Skip to content

Commit

Permalink
update examples add nextflow
Browse files Browse the repository at this point in the history
  • Loading branch information
urmi-21 committed Jan 13, 2021
1 parent db77b77 commit ea0eeca
Show file tree
Hide file tree
Showing 14 changed files with 70 additions and 0 deletions.
25 changes: 25 additions & 0 deletions case_studies/Covid_RNA-Seq/Nextflow/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

## Integrating pyrpipe scripts within a workflow management system (Nextflow)
This example shows usage of pyrpipe with Nextflow workflow management system. The example is identical to the [Snakemake example](https://github.com/urmi-21/pyrpipe/tree/master/case_studies/Covid_RNA-Seq).
This example downloads COVID-19 infected human RNA-Seq data from [Rother et. al.](https://www.medrxiv.org/content/10.1101/2020.06.08.20122143v1) published under accession [SRP287810](https://trace.ncbi.nlm.nih.gov/Traces/sra/?study=SRP287810).

Uses salmon to quantify the RNA-Seq samples and compile The transcripts TPMs for exploratory analysis with [MetaOmGraph](https://github.com/urmi-21/MetaOmGraph)
The final output file of this workflow, `results_TPM.tsv`, can be directly imported in MetaOmGraph together with the metadata file.



## Running this example

### Build the conda environment (optional)
* Please have conda installed
* Run `conda env create -f env.yaml`
* Activate the environment: `conda activate pyrpipe_human`

### Prepare reference data
To install the reference data and build Salmon index, run [this file]() as

`bash prepare_data.sh`

### Execute using Nextflow

`nextflow run run_quant.nf`
45 changes: 45 additions & 0 deletions case_studies/Covid_RNA-Seq/Nextflow/run_quant.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env nextflow

params.outdir = 'myout'
params.infile='runids.txt'
projectdir = projectDir

srrids= new File("runids.txt").collect {it}
//create a list of outfile paths
def qflist = []
srrids.each { val -> qflist.add("$projectdir/$params.outdir/$val/salmon_out/quant.sf")}
qflist.each { println it }

process rnaseq {

publishDir "$projectdir/$params.outdir"

input:
val srr from srrids
output:
file "${srr}*" into result

script:
"""
#!/usr/bin/env python3
from pyrpipe import sra,mapping,quant
salmon=quant.Salmon(index="$projectdir/human_data/salmon_index")
thisid='${srr}'
print('Processing:',thisid)
sra.SRA(thisid).quant(salmon)
"""
}

process merge {
input:
file("*") from result.collect()
output:
stdout res

"""
echo ${qflist}
python ${projectdir}/scripts/merge.py ${qflist.join(",")} ${projectdir}/${params.outdir}
"""
}

res.subscribe { println it }
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit ea0eeca

Please sign in to comment.