Skip to content

Commit

Permalink
Fix maf2maf by using vcf2maf with inhibit-vep arg
Browse files Browse the repository at this point in the history
  • Loading branch information
ckandoth committed Jul 23, 2020
1 parent 550be85 commit 47c4a18
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions maf2maf.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down Expand Up @@ -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`;
Expand Down Expand Up @@ -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";
Expand Down

0 comments on commit 47c4a18

Please sign in to comment.