From f33ce0d5a8e9505818e08380dacd2aaccf9c44a6 Mon Sep 17 00:00:00 2001
From: Brandi Cantarel <brandi.cantarel@utsouthwestern.edu>
Date: Fri, 16 Nov 2018 20:26:30 -0600
Subject: [PATCH] tumor id bug

---
 variants/filter_pindel.pl | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/variants/filter_pindel.pl b/variants/filter_pindel.pl
index f03ad0b..efc9a5c 100644
--- a/variants/filter_pindel.pl
+++ b/variants/filter_pindel.pl
@@ -6,6 +6,7 @@ use Getopt::Long qw(:config no_ignore_case no_auto_abbrev);
 my %opt = ();
 my $results = GetOptions (\%opt,'td|d=s','indel|i=s','sv|s=s','tumor|t=s');
 
+
 my @files = grep(/vcf.gz/,values %opt);
 foreach $file (@files) {
   chomp($file);
@@ -22,6 +23,14 @@ foreach $file (@files) {
 	my @header = split(/\t/,$line);
 	($chrom, $pos,$id,$ref,$alt,$score,
 	 $filter,$info,$format,@gtheader) = split(/\t/, $line);
+	unless ($opt{tumor}) {
+	    if (grep(/T_DNA/,@gtheader)) {
+		my @tsamps = grep(/T_DNA/,@gtheader);
+		$opt{tumor} = $tsamps[0];
+	    }else {
+		$opt{tumor} = $gtheader[0];
+	    }
+	}
       }
       next;
     }
-- 
GitLab