annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
1 #!/usr/bin/perl -w
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
2
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
3 use Getopt::Long;
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
4
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
5 #Initialize values
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
6 my (@queries,@HEADER,$samples,@HEADER_OUT,$end,$samp);
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
7 GetOptions ("query|q=s" => \$queries);
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
8 if(!$queries){die "Usage: FORMAT_extract.pl <VCF> -query nSC
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
9 \n\n";}
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
10
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
11
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
12 open (VCF,"$ARGV[0]") or die "Usage: <VCF>";
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
13
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
14 while (<VCF>) {
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
15 if($_=~/^##/){print;next}
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
16 chomp;
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
17 @line=split(/\t/,$_);
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
18 if($line[0]=~/^#CH/){
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
19 print join ("\t",@line,$queries)."\n";
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
20 next}
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
21 @FORMAT=split(/:/,$line[8]);
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
22 @SAMPLE=split(/:/,$line[9]);
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
23 for($i=0;$i<@FORMAT;$i++){
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
24 if($FORMAT[$i] =~/^$queries$/){print join ("\t",@line,$SAMPLE[$i])."\n";next}
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
25 }
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
26 }
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
27 close VCF;