annotate 2.4/script/Merge_Soft.pl @ 16:8eb7d93f7e58 draft

Uploaded
author plus91-technologies-pvt-ltd
date Sat, 31 May 2014 11:23:36 -0400
parents e3609c8714fb
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 -s
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
2 #Merge Softsearch results by chrom
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
3 if(!$ARGV[0]){die "Usage: <Sample.1.vcf>\n";}
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
4 my ($sample,$cmd);
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
5
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
6 #Get basename
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
7 $sample="$ARGV[0]";
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
8 $sample=~s/.[0-9(+)].out.vcf//;
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
9 $sample=~s/.[0-9(+)].pe.vcf//;
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
10
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
11 my $outfile=$sample;
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
12 $outfile.="out.vcf";
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
13 if( -e $outfile ){unlink($outfile)}
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
14 $cmd="ls $sample\*vcf";
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
15 my @samples=`$cmd`;
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
16 print "there are " .scalar(@samples)." samples\n";
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
17
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
18 open (OUT,">$outfile");
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
19 my $i=1;
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
20 my $tmp=@samples[$i];
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
21 open(TMP,"$tmp");
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
22 while (<TMP>){
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
23 print OUT if ($_=~/^#/);
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
24 }
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
25
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
26 open (OUT,">>$outfile");
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
27 my $chr;
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
28 for (my $i=0;$i<@samples;$i++){
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
29 my $tmp=@samples[$i];
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
30 open(TMP,"$tmp");
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
31 while (<TMP>){
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
32 unless (($_=~/^chrGL/)||($_=~/^#/)){print OUT $_;}
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
33 }
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
34 print "Done with $tmp";
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
35 unlink($tmp);
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
36 system("rm $tmp");
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
37 close TMP;
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
38 }
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
39 close OUT;