diff 2.4/script/Extract_nSC.pl @ 18:1163c16cb3c0 draft

Uploaded
author plus91-technologies-pvt-ltd
date Mon, 02 Jun 2014 07:35:53 -0400
parents e3609c8714fb
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/2.4/script/Extract_nSC.pl	Mon Jun 02 07:35:53 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;