-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
61 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,5 @@ dependencies: | |
- r-rmdformats=1.0.3 | ||
- r-knitr=1.37 | ||
- pandoc=2.14.2 | ||
- samtools=1.18 | ||
- csvtk=0.26.0 |
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,34 @@ | ||
process CALCULATE_STATISTICS { | ||
|
||
input: | ||
path bam_file | ||
|
||
output: | ||
path("*summary.txt"), emit: stats_ch | ||
|
||
|
||
script: | ||
def output_name = "${bam_file.baseName}.summary.txt" | ||
|
||
""" | ||
## calculate summary statistics | ||
samtools coverage ${bam_file} > samtools_coverage_${bam_file.baseName}.txt | ||
csvtk grep -t -f3 -p 16569 samtools_coverage_${bam_file.baseName}.txt -T -o mtdna.txt | ||
contig=\$(csvtk cut -t -f 1 mtdna.txt) | ||
numreads=\$(csvtk cut -t -f 4 mtdna.txt) | ||
covered_bases=\$(csvtk cut -t -f 5 mtdna.txt) | ||
covered_bases_percentage=\$(csvtk cut -t -f 6 mtdna.txt) | ||
mean_depth=\$(csvtk cut -t -f 7 mtdna.txt) | ||
mean_base_quality=\$(csvtk cut -t -f 8 mtdna.txt) | ||
mean_map_quality=\$(csvtk cut -t -f 9 mtdna.txt) | ||
echo Sample\tParameter\tValue > $output_name | ||
echo ${bam_file.baseName}\tContig\t\${contig} >> $output_name | ||
echo ${bam_file.baseName}\tNumberofReads\t\${numreads} >> $output_name | ||
echo ${bam_file.baseName}\tCoveredBases\t\${covered_bases} >> $output_name | ||
echo ${bam_file.baseName}\tCoveragePercentage\t\${covered_bases_percentage} >> $output_name | ||
echo ${bam_file.baseName}\tMeanDepth\t\${mean_depth} >> $output_name | ||
echo ${bam_file.baseName}\tMeanBaseQuality\t\${mean_base_quality} >> $output_name | ||
echo ${bam_file.baseName}\tMeanMapQuality\t\${mean_map_quality} >> $output_name | ||
""" | ||
} |
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,15 @@ | ||
process SUMMARIZE_STATISTICS { | ||
|
||
publishDir "${params.output}/statistics", mode: 'copy' | ||
|
||
input: | ||
path statistics | ||
|
||
output: | ||
path("sample_statistics.txt"), emit: stats_summarized_ch | ||
|
||
|
||
""" | ||
csvtk concat ${statistics} -T -o sample_statistics.txt | ||
""" | ||
} |
Binary file added
BIN
+20.2 MB
tests/data/bam/HG00096.mapped.ILLUMINA.bwa.GBR.low_coverage.20101123_copy.bam
Binary file not shown.
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