Skip to content

Add filtermutectcalls to filter mtdna variant calls#820

Open
MatthieuBeukers wants to merge 1 commit intomainfrom
feat/add_filtermutectcalls
Open

Add filtermutectcalls to filter mtdna variant calls#820
MatthieuBeukers wants to merge 1 commit intomainfrom
feat/add_filtermutectcalls

Conversation

@MatthieuBeukers
Copy link
Copy Markdown
Contributor

Before submitting this PR, please make sure:

  • You have updated documentation for new/updated/removed features
  • You have added tests
  • You have manually run tests using bash test/test.sh and verified that all tests pass

Run tests:

cram/complex                             | PASSED | 7160024=completed output/cram/complex/.nxf.log
cram/multiproject                        | PASSED | 7160025=completed output/cram/multiproject/.nxf.log
cram/nanopore_duo                        | PASSED | 7160026=completed output/cram/nanopore_duo/.nxf.log
cram/nanopore                            | PASSED | 7160027=completed output/cram/nanopore/.nxf.log
cram/single                              | PASSED | 7160028=completed output/cram/single/.nxf.log
cram/trio                                | PASSED | 7160029=completed output/cram/trio/.nxf.log
fastq/mtdna_fazzini_gs                   | PASSED | 7160030=completed output/fastq/mtdna_fazzini_gs/.nxf.log
fastq/nanopore_adaptive_sampling_new     | PASSED | 7160031=completed output/fastq/nanopore_adaptive_sampling_new/.nxf.log
fastq/nanopore_adaptive_sampling_old     | PASSED | 7160032=completed output/fastq/nanopore_adaptive_sampling_old/.nxf.log
fastq/nanopore                           | PASSED | 7160033=completed output/fastq/nanopore/.nxf.log
fastq/pacbio_hifi                        | PASSED | 7160034=completed output/fastq/pacbio_hifi/.nxf.log

tmp_index
fix_vcf
index
cleanup
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in line with the cleanup PR #819, change this to:
trap 'rc=$?; cleanup; exit $rc' EXIT INT TERM
and move this line to the very top of the main function.

filtermutect_args+=("-R" "!{reference}")
filtermutect_args+=("-V" "!{vcf}")
filtermutect_args+=("-O" "!{vcfOut}")
filtermutect_args+=("-O" "!{tmpVcfName}.tmp.vcf.gz")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just add a tempfile name here instead of the nextflow variable

shell:
refSeqPath = params[meta.project.assembly].reference.fasta
reference = refSeqPath.substring(0, refSeqPath.lastIndexOf('.'))
tmpVcfName = "${meta.project.id}_${meta.sample.family_id}_${meta.sample.individual_id}_chrm_snv"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove, see previous comment on filtermutect2_mito.sh‎


# Work around for issue described here: https://github.com/broadinstitute/gatk/issues/6857
fix_vcf () {
gunzip -c "!{tmpVcfName}.tmp.vcf.gz" | sed 's|##INFO=<ID=AS_FilterStatus,Number=A,Type=String,Description="Filter status for each allele, as assessed by ApplyVQSR. Note that the VCF filter field will reflect the most lenient/sensitive status across all alleles.">|##INFO=<ID=AS_FilterStatus,Number=.,Type=String,Description="Filter status for each allele, as assessed by ApplyVQSR. Note that the VCF filter field will reflect the most lenient/sensitive status across all alleles.">|' > "!{tmpVcfName}.filtered.vcf"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these added INFO fields need to be added to the annotations in the documentation. (and any other added INFO and FORMAT if any)

ch_mtdnasnv_gatk_unfiltered
| map { meta, vcf -> [meta, vcf.data, vcf.index, vcf.stats] }
| filtermutect2_mito
| map { meta, vcfOut, vcfOutIndex, vcfOutStats -> [meta, [data: vcfOut, index: vcfOutIndex, stats: vcfOutStats]] }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the workflow diagram in the docs

mv "!{tmpVcfName}.tmp.vcf.gz.filteringStats.tsv" "!{vcfOut}.filteringStats.tsv"
rm "!{tmpVcfName}.tmp.vcf.gz"
rm "!{tmpVcfName}.tmp.vcf.gz.csi"
rm "!{tmpVcfName}.tmp.vcf.gz.tbi"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add "-f" to supress error logs for cases that these files do not exist. Might happen due to the changes in the next comment, "trap-based cleanup"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants