diff 2.4/script/Extract_nSC.pl @ 13:e3609c8714fb draft

Uploaded
author plus91-technologies-pvt-ltd
date Fri, 30 May 2014 03:37:55 -0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/2.4/script/Extract_nSC.pl	Fri May 30 03:37:55 2014 -0400
@@ -0,0 +1,27 @@
+#!/usr/bin/perl -w
+
+use Getopt::Long;
+
+#Initialize values
+my (@queries,@HEADER,$samples,@HEADER_OUT,$end,$samp);
+GetOptions ("query|q=s" => \$queries);
+if(!$queries){die "Usage: FORMAT_extract.pl <VCF> -query nSC 
+\n\n";}
+
+
+open (VCF,"$ARGV[0]") or die "Usage: <VCF>";
+
+while (<VCF>) {
+        if($_=~/^##/){print;next}
+    chomp;
+    @line=split(/\t/,$_);
+    if($line[0]=~/^#CH/){
+        print join ("\t",@line,$queries)."\n";
+	next}
+ @FORMAT=split(/:/,$line[8]);
+ @SAMPLE=split(/:/,$line[9]);
+	for($i=0;$i<@FORMAT;$i++){
+	if($FORMAT[$i] =~/^$queries$/){print join ("\t",@line,$SAMPLE[$i])."\n";next}
+	}
+}
+close VCF;