Mercurial > repos > plus91-technologies-pvt-ltd > softsearch
comparison 2.4/src/Extract_nSC.pl @ 13:e3609c8714fb draft
Uploaded
author | plus91-technologies-pvt-ltd |
---|---|
date | Fri, 30 May 2014 03:37:55 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
12:980fce54e60a | 13:e3609c8714fb |
---|---|
1 #!/usr/bin/perl -w | |
2 | |
3 use Getopt::Long; | |
4 | |
5 #Initialize values | |
6 my (@queries,@HEADER,$samples,@HEADER_OUT,$end,$samp); | |
7 GetOptions ("query|q=s" => \$queries); | |
8 if(!$queries){die "Usage: FORMAT_extract.pl <VCF> -query nSC | |
9 \n\n";} | |
10 | |
11 | |
12 open (VCF,"$ARGV[0]") or die "Usage: <VCF>"; | |
13 | |
14 while (<VCF>) { | |
15 if($_=~/^##/){print;next} | |
16 chomp; | |
17 @line=split(/\t/,$_); | |
18 if($line[0]=~/^#CH/){ | |
19 print join ("\t",@line,$queries)."\n"; | |
20 next} | |
21 @FORMAT=split(/:/,$line[8]); | |
22 @SAMPLE=split(/:/,$line[9]); | |
23 for($i=0;$i<@FORMAT;$i++){ | |
24 if($FORMAT[$i] =~/^$queries$/){print join ("\t",@line,$SAMPLE[$i])."\n";next} | |
25 } | |
26 } | |
27 close VCF; |