Skip to content

Commit

Permalink
Merge pull request #71 from genepi:mutserve_parser_2
Browse files Browse the repository at this point in the history
add parser of mutserve output
  • Loading branch information
AmstlerStephan authored Jun 20, 2024
2 parents 84c8f96 + 1cd93d0 commit 37ad152
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 7 deletions.
11 changes: 10 additions & 1 deletion lib/processes/mutserve.nf
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ process MUTSERVE {
output:
path "${type}.txt", emit: variants
path "${type}_raw.txt", emit: variants_raw
path "${type}_parsed.txt", emit: variants_parsed

script:
def min_variant_level = 0.0085
"""
java -jar /opt/mutserve_LPA_adapted.jar call \
--output ${type}.vcf \
Expand All @@ -21,9 +23,16 @@ process MUTSERVE {
--insertions \
--deletions \
--contig-name \$(awk '{ print \$1 }' ${bed}) \
${bam}
${bam} && \
echo -e "Sample\tPosition\tReference\tVariant\tVariant-level" > ${type}_parsed.txt && \
cat ${type}_raw.txt | \
tail +2 | \
awk -F'\t' 'NR==1 || (\$3 == \$4 && \$27 >= $min_variant_level) || \$3 != \$4' | \
awk -F'\t' '{print \$1, \$2, \$3, (\$3 == \$4 ? \$5 : \$4), (\$3 != \$4 ? \$25 : \$27)}' >> ${type}_parsed.txt
"""
}
// awk -F'\t' 'NR==1 || (\$3 != \$4 || \$3 == \$4 && \$27 >= $min_variant_level)' ${type}_raw.txt > ${type}_filtered.txt



28 changes: 22 additions & 6 deletions tests/lib/processes/mutserve.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,21 @@
"final_raw.txt:md5,a647c13b88e318322308fa70526a8d96",
"final_raw.txt:md5,f8da170e2122c7caffa8fb3efb311434"
],
"2": [
"final_parsed.txt:md5,6acf8a7a7f2d4481996671da99ab520d",
"final_parsed.txt:md5,f199bb8726d869d680004d35713cbdd4",
"final_parsed.txt:md5,ff76e27a92d752db87135a57951f3cc4"
],
"variants": [
"final.txt:md5,1e5554e27b3b8a0687374df975a6c9cb",
"final.txt:md5,871ecfddc44cb8b3aee5a3c482fa2900",
"final.txt:md5,bdcd9fa23bcd1e226b07988460f9b162"
],
"variants_parsed": [
"final_parsed.txt:md5,6acf8a7a7f2d4481996671da99ab520d",
"final_parsed.txt:md5,f199bb8726d869d680004d35713cbdd4",
"final_parsed.txt:md5,ff76e27a92d752db87135a57951f3cc4"
],
"variants_raw": [
"final_raw.txt:md5,94352f26d9095f38eb44ff730db75dbc",
"final_raw.txt:md5,a647c13b88e318322308fa70526a8d96",
Expand All @@ -25,10 +35,10 @@
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.0"
"nf-test": "0.9.0-rc2",
"nextflow": "24.05.0"
},
"timestamp": "2024-03-11T12:49:45.12999"
"timestamp": "2024-06-20T13:06:51.2669"
},
"Should run without failures": {
"content": [
Expand All @@ -39,18 +49,24 @@
"1": [
"final_raw.txt:md5,94352f26d9095f38eb44ff730db75dbc"
],
"2": [
"final_parsed.txt:md5,f199bb8726d869d680004d35713cbdd4"
],
"variants": [
"final.txt:md5,1e5554e27b3b8a0687374df975a6c9cb"
],
"variants_parsed": [
"final_parsed.txt:md5,f199bb8726d869d680004d35713cbdd4"
],
"variants_raw": [
"final_raw.txt:md5,94352f26d9095f38eb44ff730db75dbc"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.0"
"nf-test": "0.9.0-rc2",
"nextflow": "24.05.0"
},
"timestamp": "2024-03-11T12:49:34.341905"
"timestamp": "2024-06-20T13:06:38.306114"
}
}

0 comments on commit 37ad152

Please sign in to comment.