File: merge_CM_CS_outputs.pl

package info (click to toggle)
microbiomeutil 20101212%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 49,268 kB
  • ctags: 353
  • sloc: perl: 4,878; ansic: 419; makefile: 94; sh: 27
file content (42 lines) | stat: -rwxr-xr-x 690 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env perl

use strict;
use warnings;

my $usage = "usage: $0 CM.CS.parsed(file)  .CM(file)\n\n\n";

my $CMCS_parsed = $ARGV[0] or die $usage;
my $CM_file = $ARGV[1] or die $usage;


my %CS;
{
	open (my $fh, "$CMCS_parsed") or die $!;
	while (<$fh>) {
		chomp;
		my ($acc, $rest) = split (/\t/, $_, 2);
		
		$CS{$acc} = $rest;
		
	}
	close $fh;
}

open (my $fh, $CM_file) or die $!;
while (<$fh>) {
	chomp;
	if (/^ChimeraMaligner/) {
		my ($token, $acc, $flag, $perID, $ranges) = split (/\t/, $_, 5);
		$ranges =~ s/\t/ /g;

		my $CS_text = $CS{$acc} or die "Error, no CS text for $acc ";
		
		print "$token\t$acc\t$flag\t$perID\t$ranges\t$CS_text\n";

	}
}
close $fh;

exit(0);