File: filterGenesIn.pl

package info (click to toggle)
augustus 3.5.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 777,036 kB
  • sloc: cpp: 80,063; perl: 21,491; python: 4,368; ansic: 1,244; makefile: 1,126; sh: 171; javascript: 32
file content (40 lines) | stat: -rwxr-xr-x 1,071 bytes parent folder | download | duplicates (4)
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
#!/usr/bin/perl

##############################################################
# filterGenes
# filter genes from a genbank flat file database
# usage: fileterGenes namefile dbfile
#
#
# Mario Stanke & Katharina Hoff, last modification Feb 19 2018
##############################################################

if ($#ARGV != 1) {
    print "usage: filterGenesIn.pl namefile dbfile\n";
    print "names of the loci to be kept come from\n";
    print "the first parameter. Only the the first of identical loci is kept\n";
    exit;
}
$origfilename = $ARGV[1];
$goodfilename = $ARGV[0];
open(goodfile, "<$goodfilename") || die "ERROR in file " . __FILE__ ." at line ". __LINE__ ."\nCouldn't open name file";

while(<goodfile>){
   /.*/;
   $goodlist{$&}=1;
}


open(origfile, "<$origfilename") || die "ERROR in file " . __FILE__ ." at line ". __LINE__ ."\nCouldn't open dbfile\n";


$/="\n//\n";
while(<origfile>) {
    $gendaten=$_;
    m/^LOCUS +(\S+) .*/;
    $genname=$1;
    if (exists($goodlist{$genname})) {
	print "$gendaten";
	delete($goodlist{$genname});
    }
}