@@ -654,7 +654,7 @@ process bwa {
654654 """
655655 bwa aln -t ${ task.cpus} $fasta $reads -n ${ params.bwaalnn} -l ${ params.bwaalnl} -k ${ params.bwaalnk} -f "${ reads.baseName} .sai"
656656 bwa samse -r "@RG\\ tID:ILLUMINA-${ prefix} \\ tSM:${ prefix} \\ tPL:illumina" $fasta "${ reads.baseName} ".sai $reads | samtools sort -@ ${ task.cpus} -O bam - > "${ prefix} ".sorted.bam
657- samtools index $ size "${ prefix} ".sorted.bam
657+ samtools index " ${ size} " "${ prefix} ".sorted.bam
658658 """
659659}
660660
@@ -712,7 +712,7 @@ process circularmapper{
712712 bwa samse -r "@RG\\ tID:ILLUMINA-${ prefix} \\ tSM:${ prefix} \\ tPL:illumina" $fasta "${ reads.baseName} ".sai $reads > tmp.out
713713 realignsamfile -e ${ params.circularextension} -i tmp.out -r $fasta $filter
714714 samtools sort -@ ${ task.cpus} -O bam tmp_realigned.bam > "${ prefix} ".sorted.bam
715- samtools index $ size "${ prefix} ".sorted.bam
715+ samtools index " ${ size} " "${ prefix} ".sorted.bam
716716 """
717717}
718718
@@ -737,7 +737,7 @@ process bwamem {
737737 size = ${params. large_ref} ? ' -c' : ' '
738738 """
739739 bwa mem -t ${ task.cpus} $fasta $reads -R "@RG\\ tID:ILLUMINA-${ prefix} \\ tSM:${ prefix} \\ tPL:illumina" | samtools sort -@ ${ task.cpus} -O bam - > "${ prefix} ".sorted.bam
740- samtools index $ size -@ ${ task.cpus} "${ prefix} ".sorted.bam
740+ samtools index " ${ size} " -@ ${ task.cpus} "${ prefix} ".sorted.bam
741741 """
742742}
743743
@@ -793,30 +793,30 @@ process samtools_filter {
793793 if (" ${ params.bam_discard_unmapped} " && " ${ params.bam_unmapped_type} " == " discard" ){
794794 """
795795 samtools view -h -b $bam -@ ${ task.cpus} -F4 -q ${ params.bam_mapping_quality_threshold} -o ${ prefix} .filtered.bam
796- samtools index $ size ${ prefix} .filtered.bam
796+ samtools index " ${ size} " ${ prefix} .filtered.bam
797797 """
798798 } else if (" ${ params.bam_discard_unmapped} " && " ${ params.bam_unmapped_type} " == " bam" ){
799799 """
800800 samtools view -h $bam | tee >(samtools view - -@ ${ task.cpus} -f4 -q ${ params.bam_mapping_quality_threshold} -o ${ prefix} .unmapped.bam) >(samtools view - -@ ${ task.cpus} -F4 -q ${ params.bam_mapping_quality_threshold} -o ${ prefix} .filtered.bam)
801- samtools index $ size ${ prefix} .filtered.bam
801+ samtools index " ${ size} " ${ prefix} .filtered.bam
802802 """
803803 } else if (" ${ params.bam_discard_unmapped} " && " ${ params.bam_unmapped_type} " == " fastq" ){
804804 """
805805 samtools view -h $bam | tee >(samtools view - -@ ${ task.cpus} -f4 -q ${ params.bam_mapping_quality_threshold} -o ${ prefix} .unmapped.bam) >(samtools view - -@ ${ task.cpus} -F4 -q ${ params.bam_mapping_quality_threshold} -o ${ prefix} .filtered.bam)
806- samtools index $ size ${ prefix} .filtered.bam
806+ samtools index " ${ size} " ${ prefix} .filtered.bam
807807 samtools fastq -tn ${ prefix} .unmapped.bam | pigz -p ${ task.cpus} > ${ prefix} .unmapped.fastq.gz
808808 rm ${ prefix} .unmapped.bam
809809 """
810810 } else if (" ${ params.bam_discard_unmapped} " && " ${ params.bam_unmapped_type} " == " both" ){
811811 """
812812 samtools view -h $bam | tee >(samtools view - -@ ${ task.cpus} -f4 -q ${ params.bam_mapping_quality_threshold} -o ${ prefix} .unmapped.bam) >(samtools view - -@ ${ task.cpus} -F4 -q ${ params.bam_mapping_quality_threshold} -o ${ prefix} .filtered.bam)
813- samtools index $ size ${ prefix} .filtered.bam
813+ samtools index " ${ size} " ${ prefix} .filtered.bam
814814 samtools fastq -tn ${ prefix} .unmapped.bam | pigz -p ${ task.cpus} > ${ prefix} .unmapped.fastq.gz
815815 """
816816 } else { // Only apply quality filtering, default
817817 """
818818 samtools view -h -b $bam -@ ${ task.cpus} -q ${ params.bam_mapping_quality_threshold} -o ${ prefix} .filtered.bam
819- samtools index $ size ${ prefix} .filtered.bam
819+ samtools index " ${ size} " ${ prefix} .filtered.bam
820820 """
821821 }
822822}
@@ -852,14 +852,14 @@ process dedup{
852852 dedup -i $bam $treat_merged -o . -u
853853 mv *.log dedup.log
854854 samtools sort -@ ${ task.cpus} "$prefix "_rmdup.bam -o "$prefix ".sorted.bam
855- samtools index $ size "$prefix ".sorted.bam
855+ samtools index " ${ size} " "$prefix ".sorted.bam
856856 """
857857 } else {
858858 """
859859 dedup -i $bam $treat_merged -o . -u
860860 mv *.log dedup.log
861861 samtools sort -@ ${ task.cpus} "$prefix "_rmdup.bam -o "$prefix ".sorted.bam
862- samtools index $ size "$prefix ".sorted.bam
862+ samtools index " ${ size} " "$prefix ".sorted.bam
863863 """
864864 }
865865}
@@ -1046,7 +1046,7 @@ process bam_trim {
10461046 """
10471047 bam trimBam $bam tmp.bam -L ${ params.bamutils_clip_left} -R ${ params.bamutils_clip_right} ${ softclip}
10481048 samtools sort -@ ${ task.cpus} tmp.bam -o ${ prefix} .trimmed.bam
1049- samtools index $ size ${ prefix} .trimmed.bam
1049+ samtools index " ${ size} " ${ prefix} .trimmed.bam
10501050 """
10511051}
10521052
0 commit comments