view 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
line wrap: on
line source

#!/usr/bin/perl -s
#Merge Softsearch results by chrom
if(!$ARGV[0]){die "Usage: <Sample.1.vcf>\n";}
my ($sample,$cmd);

#Get basename
$sample="$ARGV[0]";
$sample=~s/.[0-9(+)].out.vcf//;
$sample=~s/.[0-9(+)].pe.vcf//;

my $outfile=$sample;
$outfile.="out.vcf";
if( -e $outfile ){unlink($outfile)}
$cmd="ls $sample\*vcf";
my @samples=`$cmd`;
print "there are " .scalar(@samples)." samples\n";

open (OUT,">$outfile");
my $i=1;
my $tmp=@samples[$i];
open(TMP,"$tmp");
while (<TMP>){
	print OUT if ($_=~/^#/);
}

open (OUT,">>$outfile");
my $chr;
for (my $i=0;$i<@samples;$i++){
	my $tmp=@samples[$i];
	open(TMP,"$tmp");
	while (<TMP>){
		unless (($_=~/^chrGL/)||($_=~/^#/)){print OUT $_;}
	}
	print "Done with $tmp";
        unlink($tmp);
	system("rm $tmp");
	close TMP;
}
close OUT;