adapdted star for mutliple output BAMs

This commit is contained in:
kevinmenden 2021-01-25 14:09:03 +01:00
parent 6444af7b36
commit 71e0de733c
2 changed files with 8 additions and 3 deletions

View file

@ -25,7 +25,7 @@ process STAR_ALIGN {
path gtf path gtf
output: output:
tuple val(meta), path('*Aligned.out.bam') , emit: bam tuple val(meta), path('*d.out.bam') , emit: bam
tuple val(meta), path('*Log.final.out') , emit: log_final tuple val(meta), path('*Log.final.out') , emit: log_final
tuple val(meta), path('*Log.out') , emit: log_out tuple val(meta), path('*Log.out') , emit: log_out
tuple val(meta), path('*Log.progress.out'), emit: log_progress tuple val(meta), path('*Log.progress.out'), emit: log_progress
@ -33,6 +33,7 @@ process STAR_ALIGN {
tuple val(meta), path('*sortedByCoord.out.bam') , optional:true, emit: bam_sorted tuple val(meta), path('*sortedByCoord.out.bam') , optional:true, emit: bam_sorted
tuple val(meta), path('*toTranscriptome.out.bam'), optional:true, emit: bam_transcript tuple val(meta), path('*toTranscriptome.out.bam'), optional:true, emit: bam_transcript
tuple val(meta), path('*Aligned.unsort.out.bam'), optional:true, emit: bam_unsorted
tuple val(meta), path('*fastq.gz') , optional:true, emit: fastq tuple val(meta), path('*fastq.gz') , optional:true, emit: fastq
tuple val(meta), path('*.tab') , optional:true, emit: tab tuple val(meta), path('*.tab') , optional:true, emit: tab
@ -41,17 +42,21 @@ process STAR_ALIGN {
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def ignore_gtf = params.star_ignore_sjdbgtf ? '' : "--sjdbGTFfile $gtf" def ignore_gtf = params.star_ignore_sjdbgtf ? '' : "--sjdbGTFfile $gtf"
def seq_center = params.seq_center ? "--outSAMattrRGline ID:$prefix 'CN:$params.seq_center' 'SM:$prefix'" : "--outSAMattrRGline ID:$prefix 'SM:$prefix'" def seq_center = params.seq_center ? "--outSAMattrRGline ID:$prefix 'CN:$params.seq_center' 'SM:$prefix'" : "--outSAMattrRGline ID:$prefix 'SM:$prefix'"
def out_sam_type = (options.args.contains('--outSAMtype')) ? '' : '--outSAMtype BAM Unsorted'
def mv_unsorted_bam = (options.args.contains('--outSAMtype BAM Unsorted SortedByCoordinate')) ? "mv ${prefix}.Aligned.out.bam ${prefix}.Aligned.unsort.out.bam" : ''
""" """
STAR \\ STAR \\
--genomeDir $index \\ --genomeDir $index \\
--readFilesIn $reads \\ --readFilesIn $reads \\
--runThreadN $task.cpus \\ --runThreadN $task.cpus \\
--outFileNamePrefix $prefix. \\ --outFileNamePrefix $prefix. \\
--outSAMtype BAM Unsorted \\ $out_sam_type \\
$ignore_gtf \\ $ignore_gtf \\
$seq_center \\ $seq_center \\
$options.args $options.args
${mv_unsorted_bam}
if [ -f ${prefix}.Unmapped.out.mate1 ]; then if [ -f ${prefix}.Unmapped.out.mate1 ]; then
mv ${prefix}.Unmapped.out.mate1 ${prefix}.unmapped_1.fastq mv ${prefix}.Unmapped.out.mate1 ${prefix}.unmapped_1.fastq
gzip ${prefix}.unmapped_1.fastq gzip ${prefix}.unmapped_1.fastq

View file

@ -1,7 +1,7 @@
#!/usr/bin/env nextflow #!/usr/bin/env nextflow
nextflow.enable.dsl = 2 nextflow.enable.dsl = 2
def options_align = [args: '--readFilesCommand zcat'] def options_align = [args: '--readFilesCommand zcat --outSAMtype BAM Unsorted SortedByCoordinate']
def options_gg = [args: '--genomeSAindexNbases 9'] def options_gg = [args: '--genomeSAindexNbases 9']
include { STAR_ALIGN } from '../../../software/star/align/main.nf' addParams( options: options_align ) include { STAR_ALIGN } from '../../../software/star/align/main.nf' addParams( options: options_align )
include { STAR_GENOMEGENERATE } from '../../../software/star/genomegenerate/main.nf' addParams( options: options_gg ) include { STAR_GENOMEGENERATE } from '../../../software/star/genomegenerate/main.nf' addParams( options: options_gg )