-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add missense TMB calculation (#432)
Co-authored-by: giacuong171 <[email protected]>
- Loading branch information
1 parent
35b24cd
commit 4fd0c73
Showing
6 changed files
with
405 additions
and
89 deletions.
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
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 |
---|---|---|
|
@@ -7,6 +7,12 @@ | |
__author__ = "Pham Gia Cuong" | ||
__email__ = "[email protected]" | ||
|
||
missense_re = ( | ||
snakemake.params.args["missense_re"] | ||
if "args" in snakemake.params.keys() and "missense_re" in snakemake.params.args.keys() | ||
else "" | ||
) | ||
|
||
shell( | ||
r""" | ||
# ----------------------------------------------------------------------------- | ||
|
@@ -33,23 +39,53 @@ | |
number_indels=$(bcftools view -R $bed_file -v indels --threads 2 -H {snakemake.input.vcf}| wc -l) | ||
number_variants=$(bcftools view -R $bed_file --threads 2 -H {snakemake.input.vcf}| wc -l) | ||
if [[ -n "{missense_re}" ]] | ||
then | ||
number_missense_variants=$(bcftools view -R $bed_file --threads 2 -H {snakemake.input.vcf}| grep -E '{missense_re}' | wc -l) | ||
fi | ||
TMB=`echo "1000000*($number_variants/$total_exom_length)" | bc -l ` | ||
cat << EOF > {snakemake.output.json} | ||
{ | ||
"Library_name": {snakemake.wildcards.tumor_library}, | ||
"VCF_file": $name_vcf, | ||
"VCF_md5": $vcf_md5, | ||
"BED_file": $bed_file_name, | ||
"BED_md5": $bed_md5, | ||
"TMB": $TMB, | ||
"Number_variants": $number_variants, | ||
"Number_snvs": $number_snvs, | ||
"Number_indels": $number_indels, | ||
"Total_regions_length": $total_exom_length | ||
missense_TMB=`echo "1000000*($number_missense_variants/$total_exom_length)" | bc -l ` | ||
if [[ {snakemake.config[step_config][tumor_mutational_burden][has_annotation]} == "TRUE" ]] | ||
then | ||
out_file=$(cat << EOF | ||
{{ | ||
"Library_name": {snakemake.wildcards.tumor_library}, | ||
"VCF_file": $name_vcf, | ||
"VCF_md5": $vcf_md5, | ||
"BED_file": $bed_file_name, | ||
"BED_md5": $bed_md5, | ||
"TMB": $TMB, | ||
"missense_TMB": $missense_TMB, | ||
"Number_variants": $number_variants, | ||
"Number_snvs": $number_snvs, | ||
"Number_indels": $number_indels, | ||
"Total_regions_length": $total_exom_length | ||
}} | ||
EOF | ||
) | ||
echo $out_file > {snakemake.output.json} | ||
else | ||
out_file=$(cat << EOF | ||
{{ | ||
"Library_name": {snakemake.wildcards.tumor_library}, | ||
"VCF_file": $name_vcf, | ||
"VCF_md5": $vcf_md5, | ||
"BED_file": $bed_file_name, | ||
"BED_md5": $bed_md5, | ||
"TMB": $TMB, | ||
"Number_variants": $number_variants, | ||
"Number_snvs": $number_snvs, | ||
"Number_indels": $number_indels, | ||
"Total_regions_length": $total_exom_length | ||
}} | ||
EOF | ||
) | ||
echo $out_file > {snakemake.output.json} | ||
fi | ||
pushd $(dirname {snakemake.output.json}) | ||
md5sum $(basename {snakemake.output.json}) > $(basename {snakemake.output.json_md5}) | ||
} | ||
""" | ||
) | ||
|
||
|
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 |
---|---|---|
@@ -1,8 +1,5 @@ | ||
channels: | ||
- conda-forge | ||
- bioconda | ||
dependencies: | ||
- python | ||
- ensembl-vep=102 | ||
- htslib | ||
|
Oops, something went wrong.