Mercurial > repos > plus91-technologies-pvt-ltd > softsearch
comparison 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 |
comparison
equal
deleted
inserted
replaced
17:5343ef57827f | 18:1163c16cb3c0 |
---|---|
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; |