Skip to content

Commit

Permalink
add last question corrections for TP1
Browse files Browse the repository at this point in the history
  • Loading branch information
nalcala committed Oct 19, 2022
1 parent 8aac9c9 commit 70d4651
Show file tree
Hide file tree
Showing 4 changed files with 145 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Practical1/Correction/Q5_SalmonIndex.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
nextflow.enable.dsl=2

params.ref = "ref.fa"
refch = file(params.ref)

process buildIndex(){
input:
path ref
output:
path "transcripts_index"
publishDir "index", mode: "copy"
shell:
'''
salmon index -t !{ref} -i transcripts_index
'''
}

workflow {
buildIndex(refch)
}

38 changes: 38 additions & 0 deletions Practical1/Correction/Q6_Salmon.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
nextflow.enable.dsl=2

params.ref = "ref.fa"
params.input = "fastq/"

refch = file(params.ref)
fastqch = channel.fromFilePairs("${params.input}/*_{1,2}.fastq.gz")

process buildIndex(){
input:
path ref
output:
path "transcripts_index"
publishDir "index", mode: "copy"
shell:
'''
salmon index -t !{ref} -i transcripts_index
'''
}

process quant(){
input:
path index
tuple val(ID), path(fastq)
output:
path "${ID}"
publishDir "expression", mode: "copy"
shell:
'''
salmon quant -i !{index} -l A -1 !{fastq[0]} -2 !{fastq[1]} -o !{ID}
'''
}

workflow {
buildIndex(refch)
quant( buildIndex.out, fastqch)
}

38 changes: 38 additions & 0 deletions Practical1/Correction/Q8_Salmon_SRA.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
nextflow.enable.dsl=2

params.ref = "ref.fa"
params.input = "fastq/"

refch = file(params.ref)
fastqch = channel.fromSRA("SRP156394")

process buildIndex(){
input:
path ref
output:
path "transcripts_index"
publishDir "index", mode: "copy"
shell:
'''
salmon index -t !{ref} -i transcripts_index
'''
}

process quant(){
input:
path index
tuple val(ID), path(fastq)
output:
path "${ID}"
publishDir "expression", mode: "copy"
shell:
'''
salmon quant -i !{index} -l A -1 !{fastq[0]} -2 !{fastq[1]} -o !{ID}
'''
}

workflow {
buildIndex(refch)
quant( buildIndex.out, fastqch)
}

48 changes: 48 additions & 0 deletions Practical1/Correction/Q8_Salmon_pimped.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
nextflow.enable.dsl=2

params.index = null
params.ref = "ref.fa"
params.input = "fastq/"
params.cpus = 2
params.memory = 5

refch = file(params.ref)
fastqch = channel.fromFilePairs("${params.input}/*_{1,2}.fastq.gz")

process buildIndex(){
input:
path ref
output:
path "transcripts_index"
publishDir "index", mode: "copy"
shell:
'''
salmon index -t !{ref} -i transcripts_index
'''
}

process quant(){
cpus params.cpus
memory params.memory+"GB"

input:
path index
tuple val(ID), path(fastq)
output:
path "${ID}"
publishDir "expression", mode: "copy"
shell:
'''
salmon quant -i !{index} -l A -1 !{fastq[0]} -2 !{fastq[1]} -o !{ID}
'''
}

workflow {
if(!params.index){
ind = buildIndex(refch)
}else{
ind = channel.from(params.ref)
}
quant( ind, fastqch)
}

0 comments on commit 70d4651

Please sign in to comment.