File: select_best_rbcontig.pl

package info (click to toggle)
bio-rainbow 2.0.4+dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 560 kB
  • sloc: ansic: 7,475; perl: 172; makefile: 129; sh: 49
file content (34 lines) | stat: -rwxr-xr-x 535 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/perl -w
#

use strict;
use warnings;

my $file = shift or die "Usage: $0 <rbasmed file>\n";

my $len = 0;
my $name = "";
my $seq = "";
open IN, $file or die $!;
while (<IN>) {
	if (/^E/) {
		my @e = split /\s+/, $_;
		if ($len != 0) {
			print ">$name"."_L"."$len\n";
			print $seq, "\n";
		}
		$name = $e[0].$e[1];
		$len = 0;
		$seq = "";
	} elsif (/^S/) {
		my @e = split /\s+/, $_;
		if ($len < length($e[1])){
			$seq = $e[1];
			$len = length $e[1];
		}
	}
}
close IN;

print ">$name"."_L"."$len\n";
print $seq, "\n";