File: filter-ppx.pl

package info (click to toggle)
augustus 3.4.0%2Bdfsg2-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 758,480 kB
  • sloc: cpp: 65,451; perl: 21,436; python: 3,927; ansic: 1,240; makefile: 1,032; sh: 189; javascript: 32
file content (34 lines) | stat: -rwxr-xr-x 446 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
#!/usr/bin/perl

use strict;
use warnings;
my $mode = 0;
my $pending = "";

while (<>) {
    if (/^# start gene /) {
	$mode=1;
    } elsif ($mode==3) {
	$mode=0;
	next if /^###/;
    }
    if ($mode > 0) {
	$pending .= $_;
	if ($mode == 1 && /\tprotein_match\t/) {
	    $mode=2;
	}
	if (/^# end gene /) {
	    if ($mode == 2) {
		print $pending;
		$mode=0;
	    } else {
		$mode=3;
	    }
	    $pending="";
	}
    } else {
	print;
    }
}