Skip to content

Instantly share code, notes, and snippets.

@seandavi
Last active October 6, 2018 22:05
Show Gist options
  • Save seandavi/263dd2e3f8e54eff3481683e39207ba8 to your computer and use it in GitHub Desktop.
Save seandavi/263dd2e3f8e54eff3481683e39207ba8 to your computer and use it in GitHub Desktop.
nextflow test script
import groovy.json.JsonSlurper
def jsonSlurper = new JsonSlurper()
res = jsonSlurper.parse(new URL('https://api-omicidx.cancerdatasci.org/sra/1.0/search/run?q=experiment_accession:' + params.experiment + '&size=500'))
l = res.hits.hits.collect {
[ it._source.experiment_accession, it._source.accession ]
}
params.transcript_fa = "transcripts.fa"
transcript_fa = file(params.transcript_fa)
srrs = Channel.from( l )
process salmonIndex {
cpus 4
memory '12 GB'
input:
file transcript_fa
output:
file 'index' into index
"""
/home/ubuntu/salmon-0.11.3-linux_x86_64/bin/salmon index -p 4 --gencode -i index --transcripts $transcript_fa
"""
}
process produceSequences {
tag { srr }
// publishDir "s3://starbuck1/tmp/${srr}", mode: 'copy'
input:
set srx, srr from srrs
output:
set srx, file("SRR*.fastq.gz") into (records, records2)
"""
/home/ubuntu/sratoolkit.2.9.2-ubuntu64/bin/fastq-dump --split-files --gzip $srr
"""
}
collated = records2.groupTuple()
// paired = records2.filter { it.get(1) instanceof List }
// single = records3.filter { !(it.get(1) instanceof List) }
// single.subscribe { println("single: $it")}
process align {
tag { srx }
cpus 4
memory '12 GB'
publishDir "s3://starbuck1/tmp/${srx}", mode: 'copy'
input:
set srx, file(f) from collated
file index from index
output:
file('quants')
"""
/home/ubuntu/salmon-0.11.3-linux_x86_64/bin/salmon quant \
--numGibbsSamples 25 -o quants -p 4 -l A -i index -r ${f}
gzip quants/quant.sf
"""
}
/* records.subscribe { println(it.get(0)) } */
index.subscribe { println(it) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment