From 47c4a18a15d5f93d4f3622615b3368448a74127d Mon Sep 17 00:00:00 2001 From: Cyriac Kandoth Date: Thu, 23 Jul 2020 11:37:10 -0700 Subject: [PATCH] Fix maf2maf by using vcf2maf with inhibit-vep arg --- maf2maf.pl | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/maf2maf.pl b/maf2maf.pl index d9fc0d5..9875c65 100644 --- a/maf2maf.pl +++ b/maf2maf.pl @@ -109,10 +109,10 @@ "--nrm-vad-col $nrm_vad_col --per-tn-vcfs"; system( $maf2vcf_cmd ) == 0 or die "\nERROR: Failed to run maf2vcf! Command: $maf2vcf_cmd\n"; -my $vcf_file = "$tmp_dir/" . substr( $input_maf, rindex( $input_maf, '/' ) + 1 ); -$vcf_file =~ s/(\.)?(maf|tsv|txt)?$/.vcf/; -my $vep_anno = $vcf_file; -$vep_anno =~ s/\.vcf$/.vep.vcf/; +my $tmp_basename = "$tmp_dir/" . substr( $input_maf, rindex( $input_maf, '/' ) + 1 ); +$tmp_basename =~ s/(\.)?(maf|tsv|txt)?$//; +my $vcf_file = $tmp_basename . ".vcf"; +my $vep_anno = $tmp_basename . ".vep.vcf"; # Skip running VEP if a VEP-annotated VCF already exists if( -s $vep_anno ) { @@ -146,8 +146,7 @@ } # Load the tumor-normal pairs from the TSV created by maf2vcf -my $tsv_file = $vcf_file; -$tsv_file =~ s/(\.vcf)?$/.pairs.tsv/; +my $tsv_file = $tmp_basename . ".pairs.tsv"; # Store the VEP annotated VCF header so we can duplicate it for per-TN VCFs my $vep_vcf_header = `grep ^## $vep_anno`; @@ -220,13 +219,13 @@ $tn_vep_fh->close; } -# For each VCF generated by maf2vcf above, contruct a vcf2maf command and run it -my @vcfs = grep{ !m/.vep.vcf$/ and !m/$vcf_file/ } glob( "$tmp_dir/*.vcf" ); # Avoid reannotating annotated VCFs +# For each annotated VCF generated above, contruct a vcf2maf command and run it +my @vcfs = grep{ !m/$tmp_basename/ } glob( "$tmp_dir/*.vep.vcf" ); foreach my $tn_vcf ( @vcfs ) { - my ( $tumor_id, $normal_id ) = $tn_vcf=~m/^.*\/(.*)_vs_(.*)\.vcf/; + my ( $tumor_id, $normal_id ) = $tn_vcf=~m/^.*\/(.*)_vs_(.*)\.vep.vcf/; my $tn_maf = $tn_vcf; - $tn_maf =~ s/.vcf$/.vep.maf/; - my $vcf2maf_cmd = "$perl_bin $vcf2maf_path --input-vcf $tn_vcf --output-maf $tn_maf" . + $tn_maf =~ s/.vep.vcf$/.vep.maf/; + my $vcf2maf_cmd = "$perl_bin $vcf2maf_path --input-vcf $tn_vcf --output-maf $tn_maf --inhibit-vep" . " --tumor-id $tumor_id --normal-id $normal_id --vep-path $vep_path --vep-data $vep_data" . " --vep-forks $vep_forks --ref-fasta $ref_fasta --ncbi-build $ncbi_build --species $species" . " --filter-vcf $filter_vcf --max-filter-ac $max_filter_ac";