Skip to content
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

feat: make sample_mixup_configurable #495

Merged
merged 7 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,9 @@ report_fusions:
report_gene_fuse:
min_unique_reads: 6

sample_mixup_check:
match_cutoff: 0.7

samtools_merge_bam:
extra: "-c -p"

Expand Down
2 changes: 1 addition & 1 deletion workflow/rules/bcftools.smk
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ rule bcftools_id_snps:
"{input.bam} "
"| bcftools call "
"--skip-variants indels "
"-m -O v "
"-c -O v "
"-o {output.vcf}) "
"&> {log}"
1 change: 1 addition & 0 deletions workflow/rules/sample_mixup_check.smk
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ rule sample_mixup_check:
mixup_report="qc/sample_mixup_check/sample_mixup_check.tsv",
params:
extra=config.get("sample_mixup_check", {}).get("extra", ""),
match_cutoff=config.get("sample_mixup_check", {}).get("match_cutoff", "0.7"),
log:
"twist_solid/sample_mixup_check/sample_mixup_check.tsv.log",
benchmark:
Expand Down
3 changes: 3 additions & 0 deletions workflow/schemas/config.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,9 @@ properties:
extra:
type: string
description: parameters that should be forwarded
match_cutoff:
type: number
description: minimum fraction of matching SNP calls for an RNA and DNA matched sample

required:
- samples
Expand Down
5 changes: 3 additions & 2 deletions workflow/scripts/sample_mixup_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
vcf_dna_filenames = snakemake.input.id_snp_vcf_dna
vcf_rna_filenames = snakemake.input.id_snp_vcf_rna
report = open(snakemake.output.mixup_report, "w")
match_cutoff = snakemake.params.match_cutoff
monikaBrandt marked this conversation as resolved.
Show resolved Hide resolved

vcf_dict_dna = {}
dna_samples = {}
Expand Down Expand Up @@ -64,9 +65,9 @@ def read_vcf(vcf_filename, vcf_dict, samples):
if rna_samples[rna_sample][dna_sample] > best_gt_match:
best_dna_sample = dna_sample
best_gt_match = rna_samples[rna_sample][dna_sample]
p_match = round(best_gt_match * 100 / 42.0, 1)
p_match = round(best_gt_match / 42.0, 1)
report.write(f"{rna_sample}\t{best_dna_sample}\t{best_gt_match}\t{p_match}%\t")
if p_match > 80:
if p_match > match_cutoff:
report.write(f"yes\n")
else:
report.write(f"no\n")
Loading