-
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.
Adding variant_calling step part to compute BAF (#209)
- Loading branch information
Showing
5 changed files
with
210 additions
and
0 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
7 changes: 7 additions & 0 deletions
7
snappy_wrappers/wrappers/baf_file_generation/environment.yaml
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,7 @@ | ||
channels: | ||
- conda-forge | ||
- bioconda | ||
dependencies: | ||
- bcftools ==1.15.1 | ||
- htslib ==1.15.1 | ||
- ucsc-wigtobigwig |
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,43 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from snakemake.shell import shell | ||
|
||
shell( | ||
r""" | ||
# ----------------------------------------------------------------------------- | ||
# Redirect stderr to log file by default and enable printing executed commands | ||
exec 2> >(tee -a "{snakemake.log.log}") | ||
set -x | ||
# ----------------------------------------------------------------------------- | ||
export TMPDIR=$(mktemp -d) | ||
trap "rm -rf $TMPDIR" ERR EXIT | ||
bcftools query \ | ||
-s {snakemake.wildcards.donor_ngs_library} \ | ||
-f '%CHROM\t%POS[\t%DP\t%AD]\n' \ | ||
{snakemake.input.vcf} \ | ||
| awk -F $'\t' 'BEGIN {{ OFS=FS; prev=0; }} | ||
{{ if (prev != $1) {{ | ||
printf("variableStep chrom=%s\n", $1, span); | ||
}} else {{ | ||
split($4, a, ","); | ||
dp = $3; | ||
rd = a[1]; | ||
printf("%s\t%f\n", old2, (dp - rd) / dp); | ||
}} | ||
old2=$2; | ||
old3=$3; | ||
old4=$4; | ||
prev=$1; | ||
}}' \ | ||
> $TMPDIR/tmp.wig | ||
cut -f 1-2 {snakemake.config[static_data_config][reference][path]}.fai \ | ||
> $TMPDIR/chrom.sizes | ||
wigToBigWig $TMPDIR/tmp.wig $TMPDIR/chrom.sizes {snakemake.output.bw} | ||
pushd $(dirname {snakemake.output.bw}) | ||
md5sum $(basename {snakemake.output.bw}) >$(basename {snakemake.output.bw_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