Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create index option and tests #1

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ workflow {
fastp_done = fastp(seqtk_done)

// Alignment
bowtie2_index_done = params.bowtie2_index == null ? bowtie2_create_index() : channel.fromPath(params.bowtie2_index)
genome_channel = channel.fromPath(params.genome_fasta)
bowtie2_index_done = params.bowtie2_index == null ? bowtie2_create_index(genome_channel) : channel.fromPath(params.bowtie2_index)

bowtie2_input_channel = fastp_done.combine(bowtie2_index_done)
bowtie2_done = bowtie2_align(bowtie2_input_channel)
bowtie2_done = bowtie2_align(fastp_done, bowtie2_index_done)
markduplicates_done = picard_MarkDuplicates(bowtie2_done)

// bedfile
Expand Down
20 changes: 12 additions & 8 deletions modules/aligners.nf
Original file line number Diff line number Diff line change
@@ -1,40 +1,44 @@
process bowtie2_create_index {
tag {"creating index"}
conda "bioconda:bowtie2=2.5.3"
publishDir "${bt2_index}/"
publishDir "reference_bowtie2_index/"
cpus 4

input:
path(genome_fasta)
path(genome_fasta)

output:
// nf-core use the name of the path as index though...
path("*.bt2")

shell:
'''
index_name=$(basename !{params.genome_fasta} | cut -f 1 -d '.')
bowtie2-build !{params.genome_fasta} ${index_name}
index_name=$(basename !{genome_fasta} | awk -F"/" '{print $NF}'| cut -f 1 -d '.')
bowtie2-build --threads !{task.cpus} !{genome_fasta} ${index_name}
# touch testing.1.bt2 testing.2.bt2 testing.3.bt2
'''
}

process bowtie2_align {
cpus 8
cpus 4
tag {library}
conda "bioconda:bowtie2=2.5.3 bioconda:samtools=1.19.2"
publishDir "${library}/"

input:
tuple val(library),
path(read1),
path(read2),
path(index)
path(read2)
path(index)

output:
tuple val(library),
path("*bam")

shell:
'''
echo !{index}

INDEX=$(find -L !{index} -name "*.1.bt2" | sed 's/\\.1.bt2\$//' | grep -v "rev")

bowtie2 -p !{task.cpus} -x $INDEX -1 !{read1} -2 !{read2} \
Expand All @@ -44,7 +48,7 @@ process bowtie2_align {
}

process picard_MarkDuplicates{
cpus 8
cpus 4
tag {library}
conda "bioconda::picard=3.1.1"
publishDir "${library}/"
Expand Down
4 changes: 2 additions & 2 deletions modules/preprocessing.nf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
process seqtk_sample {
cpus 8
cpus 4
tag {library}
conda "bioconda::seqtk=1.4"
publishDir "${library}/"
Expand All @@ -23,7 +23,7 @@ process seqtk_sample {
}

process fastp {
cpus 8
cpus 4
tag {library}
conda "bioconda::fastp=0.23.2"
publishDir "${library}/"
Expand Down
18 changes: 9 additions & 9 deletions modules/qc.nf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
process samtools_flagstat{
cpus 8
cpus 4
tag {library}
conda "bioconda::samtools=1.15.1"
publishDir "${library}/"
Expand All @@ -20,7 +20,7 @@ process samtools_flagstat{


process picard_CollectGcBiasMetrics{
cpus 8
cpus 4
tag {library}
conda "bioconda::picard=3.1.1"
publishDir "${library}/"
Expand All @@ -46,7 +46,7 @@ process picard_CollectGcBiasMetrics{
}

process picard_CollectAlignmentSummaryMetrics{
cpus 8
cpus 4
tag {library}
conda "bioconda::picard=3.1.1"
publishDir "${library}/"
Expand All @@ -71,7 +71,7 @@ process picard_CollectAlignmentSummaryMetrics{
}

process picard_EstimateLibraryComplexity {
cpus 8
cpus 4
tag {library}
conda "bioconda::picard=3.1.1"
publishDir "${library}/"
Expand All @@ -96,7 +96,7 @@ process picard_EstimateLibraryComplexity {
}

process picard_CollectInsertSizeMetrics {
cpus 8
cpus 4
tag {library}
conda "bioconda::picard=3.1.1"
publishDir "${library}/"
Expand Down Expand Up @@ -125,7 +125,7 @@ process picard_CollectInsertSizeMetrics {
}

process fastqc {
cpus 8
cpus 4
tag {library}
conda "bioconda::fastqc=0.12.1"
publishDir "${library}/"
Expand All @@ -150,7 +150,7 @@ process fastqc {
}

process bedtools_genome_coverage {
cpus 8
cpus 4
tag {library}
conda "bioconda::bedtools=2.30"
publishDir "${library}/"
Expand All @@ -172,7 +172,7 @@ process bedtools_genome_coverage {
}

process multiqc {
cpus 8
cpus 4
tag {library}
conda "bioconda::multiqc=1.11"
publishDir "${library}/"
Expand All @@ -197,7 +197,7 @@ process multiqc {
}

process tasmanian {
cpus 8
cpus 1
tag {library}
conda "bioconda::tasmanian-mismatch=1.0.7 bioconda::samtools=1.13"
publishDir "${library}/"
Expand Down
Binary file added test/r1.fastq.gz
Binary file not shown.
Binary file added test/r2.fastq.gz
Binary file not shown.
11 changes: 11 additions & 0 deletions test/run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
gunzip small_ref.fa

# run tests and report
echo " test WITHOUT alignmnet index" > test_out.log
nextflow run ../main.nf --genome_fasta /mnt/home/aerijman/seqhimem02/FFPE_nextflow_workflow/test/small_ref.fa -with-conda -resume >> test_out.log 2>> test_out.log

echo "test WITH alignment index" >> test_out.log
nextflow run ../main.nf --genome_fasta /mnt/home/aerijman/seqhimem02/FFPE_nextflow_workflow/test/small_ref.fa \
--bowtie2_index /mnt/home/aerijman/seqhimem02/FFPE_nextflow_workflow/test/reference_bowtie2_index/ -with-conda -resume >> test_out.log 2>> test_out.log

rm -r reference_bowtie2_index/ r/ test_read/ work/
Binary file added test/small_ref.fa.gz
Binary file not shown.
Loading