From a911d9f57c524ea43540d551b6316d4e1342c955 Mon Sep 17 00:00:00 2001
From: Brandi Cantarel <brandi.cantarel@utsouthwestern.edu>
Date: Fri, 26 Jan 2018 08:49:21 -0600
Subject: [PATCH] updating cnv and union code for umi

---
 variants/cnvkit.sh   | 2 +-
 variants/union.sh    | 2 +-
 variants/unionvcf.pl | 8 +++-----
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/variants/cnvkit.sh b/variants/cnvkit.sh
index 0cc9bb7..3be8a88 100644
--- a/variants/cnvkit.sh
+++ b/variants/cnvkit.sh
@@ -29,7 +29,7 @@ if [[ -z $SLURM_CPUS_ON_NODE ]]
 then
     SLURM_CPUS_ON_NODE=1
 fi
-
+baseDir="`dirname \"$0\"`"
 module load cnvkit/0.9.0
 cnvkit.py coverage ${sbam} /project/shared/bicf_workflow_ref/GRCh38/UTSWV2.cnvkit_targets.bed -o ${pair_id}.targetcoverage.cnn
 cnvkit.py coverage ${sbam} /project/shared/bicf_workflow_ref/GRCh38/UTSWV2.cnvkit_antitargets.bed -o ${pair_id}.antitargetcoverage.cnn
diff --git a/variants/union.sh b/variants/union.sh
index 7e6beba..391259b 100644
--- a/variants/union.sh
+++ b/variants/union.sh
@@ -35,7 +35,7 @@ for i in *.vcf.gz; do
 	list2="$list2 nooverlap.hotspot.vcf.gz"
     fi
 done 
-
+#echo "$baseDir/unionvcf.pl ${index_path}/union.header.vcf $list2"
 perl $baseDir/unionvcf.pl ${index_path}/union.header.vcf $list2
 perl $baseDir/vcfsorter.pl ${index_path}/genome.dict int.vcf |bgzip > ${pair_id}.union.vcf.gz
 
diff --git a/variants/unionvcf.pl b/variants/unionvcf.pl
index da35d2c..c44815b 100755
--- a/variants/unionvcf.pl
+++ b/variants/unionvcf.pl
@@ -25,11 +25,12 @@ foreach $vcf (@vcffiles) {
 	($chromhd, $posd,$idhd,$refhd,$althd,$scorehd,
 	 $filterhd,$annothd,$formathd,@sampleids) = split(/\t/, $line);
 	foreach $j (0..$#sampleids) {
-	  $sampleids[$j] =~ s/\.final//g;
+	    $sampleids[$j] = (split(/\./,$sampleids[$j]))[0];
 	}
 	unless (@sampleorder) {
 	  @sampleorder = @sampleids;
-	  print OUT $line,"\n";
+	  print OUT join("\t",$chromhd, $posd,$idhd,$refhd,$althd,$scorehd,
+			 $filterhd,$annothd,$formathd,@sampleids),"\n";
 	}
 	next;
       }
@@ -37,9 +38,6 @@ foreach $vcf (@vcffiles) {
     }
     my ($chrom, $pos,$id,$ref,$alt,$score,
 	$filter,$annot,$format,@gts) = split(/\t/, $line);
-    if ($pos == 48303944) {
-      warn "Debugging\n";
-    }
     my %hash = ();
     foreach $a (split(/;/,$annot)) {
       my ($key,$val) = split(/=/,$a);
-- 
GitLab