view 2.4/src/Merge_Soft.pl @ 18:1163c16cb3c0 draft

Uploaded
author plus91-technologies-pvt-ltd
date Mon, 02 Jun 2014 07:35:53 -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;