-
Notifications
You must be signed in to change notification settings - Fork 127
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
Add nf-test for local module blat_mirna
#387
Merged
+290
−2
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a80e451
add test for blat mirna
atrigila 613ba65
add small test with contamination filter
atrigila 13ab7bf
Merge branch 'dev' into nf_tests_blat
atrigila 13d77c5
update changelog
atrigila c425db9
Merge branch 'nf_tests_blat' of https://github.com/atrigila/smrnaseq …
atrigila f525be2
Merge branch 'dev' into nf_tests_blat
atrigila File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
Nextflow config file for running minimal tests | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
Defines input files and everything required to run a fast and simple pipeline test. | ||
|
||
Use as follows: | ||
nextflow run nf-core/smrnaseq -profile test_contamination,<docker/singularity> --outdir <OUTDIR> | ||
|
||
---------------------------------------------------------------------------------------- | ||
*/ | ||
|
||
params { | ||
config_profile_name = 'Test profile' | ||
config_profile_description = 'Minimal test dataset to check pipeline function with contamination filter' | ||
|
||
// Limit resources so that this can run on GitHub Actions | ||
max_cpus = 2 | ||
max_memory = '6.GB' | ||
max_time = '6.h' | ||
|
||
// Input data | ||
|
||
input = 'https://github.com/nf-core/test-datasets/raw/smrnaseq/samplesheet/v2.0/samplesheet.csv' | ||
fasta = 'https://github.com/nf-core/test-datasets/raw/smrnaseq/reference/genome.fa' | ||
|
||
mirtrace_species = 'hsa' | ||
skip_mirdeep = true | ||
save_merged = false | ||
save_aligned_mirna_quant = false | ||
|
||
|
||
filter_contamination = true | ||
cdna = "https://huggingface.co/datasets/nf-core/smrnaseq/resolve/main/GRCh37/Homo_sapiens.GRCh37.cdna.all.fa" | ||
ncrna = "https://huggingface.co/datasets/nf-core/smrnaseq/resolve/main/GRCh37/Homo_sapiens.GRCh37.ncrna.fa" | ||
trna = "https://huggingface.co/datasets/nf-core/smrnaseq/resolve/main/GRCh37/hg19-tRNAs.fa" | ||
} | ||
|
||
// Include illumina config to run test without additional profiles | ||
|
||
includeConfig 'protocol_illumina.config' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
process BLAT_MIRNA { | ||
tag "$fasta" | ||
label 'process_medium' | ||
|
||
conda 'bioconda::blat=36' | ||
container 'community.wave.seqera.io/library/ucsc-blat:445--32730933d3c2c916' | ||
|
||
input: | ||
val db_type | ||
path mirna | ||
path contaminants | ||
|
||
|
||
output: | ||
path 'filtered.fa' , emit: filtered_set | ||
path "versions.yml" , emit: versions | ||
|
||
when: | ||
task.ext.when == null || task.ext.when | ||
|
||
script: | ||
if ( db_type == "cdna" ) | ||
""" | ||
echo $db_type | ||
awk '/^>/ { x=index(\$6, "transcript_biotype:miRNA") } { if(!x) print }' $contaminants > subset.fa | ||
blat -out=blast8 $mirna subset.fa /dev/stdout | awk 'BEGIN{FS="\t"}{if(\$11 < 1e-5)print \$1;}' | uniq > mirnahit.txt | ||
awk 'BEGIN { while((getline<"mirnahit.txt")>0) l[">"\$1]=1 } /^>/ {x = l[\$1]} {if(!x) print }' subset.fa > filtered.fa | ||
|
||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
blat: \$(echo \$(blat) | grep Standalone | awk '{ if (match(\$0,/[0-9]*[0-9]/,m)) print m[0] }') | ||
END_VERSIONS | ||
""" | ||
|
||
else if ( db_type == "ncrna" ) | ||
""" | ||
echo $db_type | ||
awk '/^>/ { x=(index(\$6, "transcript_biotype:rRNA") || index(\$6, "transcript_biotype:miRNA")) } { if(!x) print }' $contaminants > subset.fa | ||
blat -out=blast8 $mirna subset.fa /dev/stdout | awk 'BEGIN{FS="\t"}{if(\$11 < 1e-5)print \$1;}' | uniq > mirnahit.txt | ||
awk 'BEGIN { while((getline<"mirnahit.txt")>0) l[">"\$1]=1 } /^>/ {x = l[\$1]} {if(!x) print }' subset.fa > filtered.fa | ||
|
||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
blat: \$(echo \$(blat) | grep Standalone | awk '{ if (match(\$0,/[0-9]*[0-9]/,m)) print m[0] }') | ||
END_VERSIONS | ||
""" | ||
|
||
else | ||
""" | ||
echo $db_type | ||
blat -out=blast8 $mirna $contaminants /dev/stdout | awk 'BEGIN{FS="\t"}{if(\$11 < 1e-5)print \$1;}' | uniq > mirnahit.txt | ||
awk 'BEGIN { while((getline<"mirnahit.txt")>0) l[">"\$1]=1 } /^>/ {x = l[\$1]} {if(!x) print }' $contaminants > filtered.fa | ||
|
||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
blat: \$(echo \$(blat) | grep Standalone | awk '{ if (match(\$0,/[0-9]*[0-9]/,m)) print m[0] }') | ||
END_VERSIONS | ||
""" | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
nextflow_process { | ||
|
||
name "Test Process BLAT_MIRNA" | ||
script "../blat_mirna.nf" | ||
process "BLAT_MIRNA" | ||
tag "modules" | ||
tag "modules_local" | ||
tag "blat_mirna" | ||
|
||
test("cDNA BLAT - Human") { | ||
|
||
when { | ||
params { | ||
outdir = "${outputDir}" | ||
} | ||
process { | ||
""" | ||
input[0] = "cdna" | ||
input[1] = [file("https://github.com/nf-core/test-datasets/raw/smrnaseq/miRBase/hairpin.fa", checkIfExists: true)] | ||
input[2] = [file("https://huggingface.co/datasets/nf-core/smrnaseq/resolve/main/GRCh37/Homo_sapiens.GRCh37.cdna.all.fa", checkIfExists: true)] | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assert process.success | ||
assert snapshot(process.out).match() | ||
|
||
with(process.out.filtered_set) { | ||
with(get(0)) { | ||
assert get(0).endsWith("filtered.fa") | ||
|
||
// Check for AWK filtering of specific biotype | ||
def lines = path(get(0)).readLines() | ||
assert !lines.any { it.contains("transcript_biotype:miRNA") } | ||
|
||
// Check for exclusion of miRNAs hits | ||
assert !lines.any { it.contains("ENST00000564740.1") } | ||
} | ||
} | ||
} | ||
|
||
} | ||
|
||
test("ncRNA BLAT - Human") { | ||
|
||
when { | ||
params { | ||
outdir = "${outputDir}" | ||
} | ||
process { | ||
""" | ||
input[0] = "ncRNA" | ||
input[1] = [file("https://github.com/nf-core/test-datasets/raw/smrnaseq/miRBase/hairpin.fa", checkIfExists: true)] | ||
input[2] = [file("https://huggingface.co/datasets/nf-core/smrnaseq/resolve/main/GRCh37/Homo_sapiens.GRCh37.ncrna.fa", checkIfExists: true)] | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assert process.success | ||
assert snapshot(process.out).match() | ||
|
||
with(process.out.filtered_set) { | ||
with(get(0)) { | ||
assert get(0).endsWith("filtered.fa") | ||
|
||
// Check for AWK filtering of specific biotype | ||
def lines = path(get(0)).readLines() | ||
// Lines contain transcript_biotype:rRNA or miRNA, so AWK assertions do not work: | ||
//assert !lines.any { it.contains("transcript_biotype:rRNA") } | ||
//assert !lines.any { it.contains("transcript_biotype:miRNA") } | ||
|
||
// Check for exclusion of miRNAs hits | ||
assert !lines.any { it.contains("ENST00000564740.1") } | ||
} | ||
} | ||
} | ||
|
||
} | ||
|
||
test("tRNA BLAT - Human") { | ||
|
||
when { | ||
params { | ||
outdir = "${outputDir}" | ||
} | ||
process { | ||
""" | ||
input[0] = "tRNA" | ||
input[1] = [file("https://github.com/nf-core/test-datasets/raw/smrnaseq/miRBase/hairpin.fa", checkIfExists: true)] | ||
input[2] = [file("https://huggingface.co/datasets/nf-core/smrnaseq/resolve/main/GRCh37/hg19-tRNAs.fa", checkIfExists: true)] | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assert process.success | ||
assert snapshot(process.out).match() | ||
|
||
with(process.out.filtered_set) { | ||
with(get(0)) { | ||
assert get(0).endsWith("filtered.fa") | ||
|
||
// Check for exclusion of miRNAs hits | ||
def lines = path(get(0)).readLines() | ||
assert !lines.any { it.contains("ENST00000564740.1") } | ||
} | ||
} | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
{ | ||
"ncRNA BLAT - Human": { | ||
"content": [ | ||
{ | ||
"0": [ | ||
"filtered.fa:md5,6bc8a430400e2e78cf7f474981230811" | ||
], | ||
"1": [ | ||
"versions.yml:md5,e2957df2cc8f0410101564c8e65d1761" | ||
], | ||
"filtered_set": [ | ||
"filtered.fa:md5,6bc8a430400e2e78cf7f474981230811" | ||
], | ||
"versions": [ | ||
"versions.yml:md5,e2957df2cc8f0410101564c8e65d1761" | ||
] | ||
} | ||
], | ||
"meta": { | ||
"nf-test": "0.8.4", | ||
"nextflow": "24.04.4" | ||
}, | ||
"timestamp": "2024-08-23T17:53:35.313580289" | ||
}, | ||
"tRNA BLAT - Human": { | ||
"content": [ | ||
{ | ||
"0": [ | ||
"filtered.fa:md5,6b54e95ca5418d7d9c4d331ca3b2c96f" | ||
], | ||
"1": [ | ||
"versions.yml:md5,e2957df2cc8f0410101564c8e65d1761" | ||
], | ||
"filtered_set": [ | ||
"filtered.fa:md5,6b54e95ca5418d7d9c4d331ca3b2c96f" | ||
], | ||
"versions": [ | ||
"versions.yml:md5,e2957df2cc8f0410101564c8e65d1761" | ||
] | ||
} | ||
], | ||
"meta": { | ||
"nf-test": "0.8.4", | ||
"nextflow": "24.04.4" | ||
}, | ||
"timestamp": "2024-08-23T17:57:58.238216453" | ||
}, | ||
"cDNA BLAT - Human": { | ||
"content": [ | ||
{ | ||
"0": [ | ||
"filtered.fa:md5,8fd42894e815999b4278b08297720aae" | ||
], | ||
"1": [ | ||
"versions.yml:md5,e2957df2cc8f0410101564c8e65d1761" | ||
], | ||
"filtered_set": [ | ||
"filtered.fa:md5,8fd42894e815999b4278b08297720aae" | ||
], | ||
"versions": [ | ||
"versions.yml:md5,e2957df2cc8f0410101564c8e65d1761" | ||
] | ||
} | ||
], | ||
"meta": { | ||
"nf-test": "0.8.4", | ||
"nextflow": "24.04.4" | ||
}, | ||
"timestamp": "2024-08-23T17:53:16.735132971" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test profile is almost identical to test_full_filter_contamination isn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! The input samplesheet is smaller, though