Skip to content

Commit

Permalink
Patch: Sort SE data with samtools to avoid ulimit issues, resolves #28
Browse files Browse the repository at this point in the history
  • Loading branch information
skchronicles committed Jan 19, 2024
1 parent e46cda6 commit 32aee77
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions workflow/rules/single-end.smk
Original file line number Diff line number Diff line change
Expand Up @@ -341,12 +341,21 @@ if config['options']['star_2_pass_basic'] or config['options']['prokaryote']:
--sjdbGTFfile {params.gtffile} \
--limitSjdbInsertNsj {params.nbjuncs} \
--quantMode TranscriptomeSAM GeneCounts \
--outSAMtype BAM SortedByCoordinate \
--outSAMtype BAM Unsorted \
--alignEndsProtrude 10 ConcordantPair \
--peOverlapNbasesMin 10 \
--outTmpDir=${{tmp}}/STARtmp_{wildcards.name} \
--sjdbOverhang ${{readlength}}
# SAMtools sort (uses less memory than STAR SortedByCoordinate),
# also avoids ulimit related errors caused by STAR's internal sorting
samtools sort -@ {threads} \
-m 2G -T ${{tmp}}/SORTtmp_{wildcards.name} \
-O bam {params.prefix}.Aligned.out.bam \
> {output.out1}
rm {params.prefix}.Aligned.out.bam
mv {params.prefix}.Aligned.toTranscriptome.out.bam {workpath}/{bams_dir};
mv {params.prefix}.Log.final.out {workpath}/{log_dir}
"""
Expand Down Expand Up @@ -634,12 +643,20 @@ else:
--sjdbGTFfile {params.gtffile} \
--limitSjdbInsertNsj {params.nbjuncs} \
--quantMode TranscriptomeSAM GeneCounts \
--outSAMtype BAM SortedByCoordinate \
--outSAMtype BAM Unsorted \
--alignEndsProtrude 10 ConcordantPair \
--peOverlapNbasesMin 10 \
--outTmpDir=${{tmp}}/STARtmp_{wildcards.name} \
--sjdbOverhang ${{readlength}}
# SAMtools sort (uses less memory than STAR SortedByCoordinate),
# also avoids ulimit related issues caused by STAR's internal sorting
samtools sort -@ {threads} \
-m 2G -T ${{tmp}}/SORTtmp_{wildcards.name} \
-O bam {params.prefix}.Aligned.out.bam \
> {output.out1}
rm {params.prefix}.Aligned.out.bam
mv {params.prefix}.Aligned.toTranscriptome.out.bam {workpath}/{bams_dir};
mv {params.prefix}.Log.final.out {workpath}/{log_dir}
"""
Expand Down

0 comments on commit 32aee77

Please sign in to comment.