Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
Merge pull request #400 from jlac/activeDev
Browse files Browse the repository at this point in the history
 moved sort out of STAR and into samtools rule to deal with memory bug
  • Loading branch information
jlac committed Jan 30, 2019
2 parents dbd5052 + c3f95fd commit cb2fedc
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
8 changes: 8 additions & 0 deletions Rules/samtools_sort.rl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
rule samtools_sort:
input: "{x}.p2Aligned.out.bam",
output: temp("{x}.p2Aligned.sortedByCoord.out.bam")
params: novosort=config['bin'][pfamily]['NOVOSORT'],rname="pl:sort"
threads: 8
shell: "module load samtools/1.9; samtools sort -@ {threads} -o {output} {input};"


4 changes: 2 additions & 2 deletions Rules/star.align.2.rl
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
rule star_align_2:
input: file1="{x}.R1.trimmed.fastq.gz",file2="{x}.R2.trimmed.fastq.gz",length="QC/{x}_readlength.txt",tab=expand("{x}SJ.out.tab",x=samples)
output: out1=temp("{x}.p2Aligned.sortedByCoord.out.bam"),out4="{x}.p2SJ.out.tab",out5="{x}.p2Log.final.out"
output: out1=temp("{x}.p2Aligned.out.bam"),out4="{x}.p2SJ.out.tab",out5="{x}.p2Log.final.out"
params: rname='pl:star2p',prefix="{x}.p2",outsamunmapped=config['bin'][pfamily]['OUTSAMUNMAPPED'],wigtype=config['bin'][pfamily]['WIGTYPE'],wigstrand=config['bin'][pfamily]['WIGSTRAND'], gtffile=config['references'][pfamily]['FUSIONGTFFILE'], nbjuncs=config['bin'][pfamily]['NBJUNCS'],starref=config['references'][pfamily]['STARREF']
threads: 32
run:
import glob
rl=int(open(input.length).readlines()[0].strip())-1
dbrl=sorted(list(map(lambda x:int(re.findall("genes-(\d+)",x)[0]),glob.glob(params.starref+'*/',recursive=False))))
bestdbrl=next(x[1] for x in enumerate(dbrl) if x[1] >= rl)
cmd="module load STAR/2.5.2b; STAR --genomeDir {params.starref}"+str(bestdbrl)+" --readFilesIn {input.file1} {input.file2} --readFilesCommand zcat --runThreadN {threads} --outFileNamePrefix {params.prefix} --outSAMunmapped {params.outsamunmapped} --sjdbFileChrStartEnd {input.tab} --sjdbGTFfile {params.gtffile} --limitSjdbInsertNsj 10000000 --outSAMtype BAM SortedByCoordinate --limitBAMsortRAM 39627002904"
cmd="module load STAR/2.5.2b; STAR --genomeDir {params.starref}"+str(bestdbrl)+" --readFilesIn {input.file1} {input.file2} --readFilesCommand zcat --runThreadN {threads} --outFileNamePrefix {params.prefix} --outSAMunmapped {params.outsamunmapped} --sjdbFileChrStartEnd {input.tab} --sjdbGTFfile {params.gtffile} --limitSjdbInsertNsj 10000000 --outSAMtype BAM Unsorted"
shell(cmd)
5 changes: 5 additions & 0 deletions cluster.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
"gres": "lscratch:256",
"threads": "2"
},
"samtools_sort": {
"mem": "48g",
"gres": "lscratch:256",
"threads": "8"
},
"picard_dedup": {
"mem": "96g",
"gres": "lscratch:256",
Expand Down
1 change: 1 addition & 0 deletions rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"freec_wgs_tumoronly": ["wgs-somatic-tumoronly"],
"sequenza": ["wgs-somatic","exomeseq-somatic"],
"avia": ["wgslow","exomeseq-germline","exomeseq-germline-recal","exomeseq-germline-partial","rnaseqvargerm"],
"samtools_sort": ["rnaseqvargerm"],
"index_bams": ["wgslow","exomeseq-germline","wgs-somatic-tumoronly","exomeseq-somatic-tumoronly","wgs-somatic","exomeseq-somatic"],
"rnaseqforfusions": ["rnaseqfusion"],
"rnafusioncleanup": ["none"],
Expand Down

0 comments on commit cb2fedc

Please sign in to comment.