Skip to content

Commit

Permalink
update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
urmi-21 committed Jan 13, 2021
1 parent 8919f54 commit e4f2c81
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
2 changes: 2 additions & 0 deletions case_studies/Covid_RNA-Seq/Nextflow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ To install the reference data and build Salmon index, run [this file](https://gi

`bash prepare_data.sh`

The salmon index must be in `./human_data/salmon_index` or specify path to salmon index in the `run_quant.nf` file.

### Execute using Nextflow

`nextflow run run_quant.nf`
3 changes: 3 additions & 0 deletions case_studies/Covid_RNA-Seq/Nextflow/runids.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SRR12850397
SRR12850398
SRR12850399
39 changes: 39 additions & 0 deletions case_studies/Covid_RNA-Seq/Nextflow/scripts/merge.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import sys
import pandas as pd
import os

input=sys.argv[1].split(',')
for f in input:
print ('this f',f)

DIR=sys.argv[-1]

with open(input[0]) as f:
thisdata=f.read().splitlines()
thisdata.pop(0)

names=[]
txids=[]
geneids=[]
for l in thisdata:
thistx=l.split('\t')[0].split('|')[0]
thisgene=l.split('\t')[0].split('|')[1]
txids.append(thistx)
geneids.append(thisgene)
df=pd.DataFrame({'TranscriptID':txids,'GeneID':geneids})

#read files in memory
for qf in input:
name=qf.split('/')[-3]
names.append(name)
thisdata=pd.read_csv(qf,sep='\t',usecols=[3],skiprows=0)
df[name]=thisdata['TPM']

#transcript counts
df_tx=df[['TranscriptID']+names].copy()
#write to file
df_tx.to_csv(DIR+'/results_TPM_tx.tsv',sep='\t',index=False)
#gene counts
df_gene=df[['GeneID']+names].copy()
df_gene = df_gene.groupby(['GeneID'],as_index = False).sum()
df_gene.to_csv(DIR+'/results_TPM_gene.tsv',sep='\t',index=False)

0 comments on commit e4f2c81

Please sign in to comment.