view rapsodyn/MergeSamFiles.pl @ 10:0a6c1cfe4dc8 draft

Uploaded
author mcharles
date Mon, 19 Jan 2015 04:33:21 -0500
parents 3f7b0788a1c4
children
line wrap: on
line source

#!/usr/bin/perl
#V1.0.0
use strict;
use warnings;

my $header_done = 0;
my @files = split(/,/,$ARGV[0]);
for (my $i=0;$i<=$#files;$i++){
	open(IN, $files[$i]) or die ("Can't open ",$files[$i],"\n");
	while (my $line = <IN>){
		if ($line =~ /^\@PG\s/){
			if ($header_done == 0){
				$header_done = 1;
				print $line;
			}
			else {
			}
		}
		elsif ($line =~ /^\@SQ\s/){
			if ($header_done == 0){
				print $line;
			}
			else {
			}
		}
		else{
			print $line;
		}
	}
	close (IN);
}