File: GetContigMagnitudes.pl

package info (click to toggle)
radiant 2.7%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,048 kB
  • sloc: perl: 5,393; sh: 323; makefile: 35
file content (55 lines) | stat: -rwxr-xr-x 1,008 bytes parent folder | download | duplicates (3)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env perl

#!/usr/bin/env perl

# Copyright © 2011, Battelle National Biodefense Institute (BNBI);
# all rights reserved. Authored by: Brian Ondov, Nicholas Bergman, and
# Adam Phillippy
#
# See the LICENSE.txt file included with this software for license information.

use strict;

BEGIN
{
	use File::Basename;
	use Cwd 'abs_path';
	use lib dirname(abs_path($0)) . "/../lib";
	use KronaTools;
}

if ( @ARGV < 2 )
{
	my $scriptName = getScriptName();
	
	printHeader("KronaTools $KronaTools::version - $scriptName");
	print
'Takes an ACE assembly file and writes a magnitude file for use with import
scripts.  The magnitude of each contig will be the total number of reads
assigned to it.

';
	printHeader('Usage');
	print
"$scriptName <assembly.ace> <output>

";
	exit;
}

my ($ace, $output) = @ARGV;


open ACE, "<$ace" or die $!;
open OUT, ">$output" or die $!;

while ( my $line = <ACE> )
{
	if ( $line =~ /^CO\s+([^\s]+)\s+\d+\s+(\d+)/ )
	{
		print OUT "$1\t$2\n";
	}
}

close OUT;
close ACE;