annotate rapsodyn/MergeSamFiles.pl @ 14:93e6f2af1ce2 draft

Uploaded
author mcharles
date Mon, 26 Jan 2015 18:10:52 -0500
parents 3f7b0788a1c4
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
1 #!/usr/bin/perl
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
2 #V1.0.0
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
3 use strict;
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
4 use warnings;
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
5
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
6 my $header_done = 0;
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
7 my @files = split(/,/,$ARGV[0]);
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
8 for (my $i=0;$i<=$#files;$i++){
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
9 open(IN, $files[$i]) or die ("Can't open ",$files[$i],"\n");
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
10 while (my $line = <IN>){
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
11 if ($line =~ /^\@PG\s/){
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
12 if ($header_done == 0){
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
13 $header_done = 1;
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
14 print $line;
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
15 }
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
16 else {
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
17 }
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
18 }
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
19 elsif ($line =~ /^\@SQ\s/){
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
20 if ($header_done == 0){
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
21 print $line;
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
22 }
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
23 else {
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
24 }
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
25 }
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
26 else{
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
27 print $line;
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
28 }
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
29 }
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
30 close (IN);
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
31 }
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
32