File: breakpoint_to_profile.pl

package info (click to toggle)
microbiomeutil 20101212%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 49,268 kB
  • sloc: perl: 4,878; ansic: 419; makefile: 92; sh: 27
file content (38 lines) | stat: -rwxr-xr-x 609 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
#!/usr/bin/env perl

use strict;
use warnings;

my $usage = "usage: $0 breakpoint.output [CM|CS]\n\n";

my $breakpoint_file = $ARGV[0] or die $usage;
my $CM_or_CS = $ARGV[1] or die $usage;

unless ($CM_or_CS =~ /^(CM|CS)$/) { 
	
	die $usage;
}

my $index = ($CM_or_CS eq 'CS') ? 3:4;

my @pos_counter;
$#pos_counter = 1600; # set to presumed max xrange

open (my $fh, $breakpoint_file) or die $usage;
while (<$fh>) {
	chomp;
	my @x = split(/\t/);
	$pos_counter[ $x[$index] ]++;
}
close $fh;

for (my $i = 0; $i <= $#pos_counter; $i++) {
	
	my $val = $pos_counter[$i] || 0;

	print "$i\t$val\n";
}

exit(0);