source: trunk/PERL_SCRIPTS/SPECIES/listMarkedSpecies.pl

Last change on this file was 19355, checked in by westram, 16 months ago
  • adds script to detect new field content in marked subset of species (compared with unmarked subset).
  • fix whitespace only in listMarkedSpecies.pl.
  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 1.6 KB
Line 
1#!/usr/bin/perl
2# =============================================================== #
3#                                                                 #
4#   File      : markedSpecies.pl                                  #
5#   Purpose   : list names of species marked in running ARB       #
6#                                                                 #
7#   Coded by Ralf Westram (coder@reallysoft.de) in October 2006   #
8#   Institute of Microbiology (Technical University Munich)       #
9#   http://www.arb-home.de/                                       #
10#                                                                 #
11# =============================================================== #
12
13use strict;
14use warnings;
15
16BEGIN {
17  if (not exists $ENV{'ARBHOME'}) { die "Environment variable \$ARBHOME has to be defined"; }
18  my $arbhome = $ENV{'ARBHOME'};
19  push @INC, "$arbhome/lib";
20  push @INC, "$arbhome/PERL_SCRIPTS/lib";
21  1;
22}
23
24use ARB;
25use tools;
26
27sub listMarkedSpecies() {
28  my $gb_main = ARB::open(":","r");
29  $gb_main || expectError('db connect (no running ARB?)');
30
31  dieOnError(ARB::begin_transaction($gb_main), 'begin_transaction');
32
33  for (my $gb_species = BIO::first_species($gb_main);
34       $gb_species;
35       $gb_species = BIO::next_species($gb_species))
36    {
37      my $marked = ARB::read_flag($gb_species);
38      if ($marked==1) {
39        my $species_name = BIO::read_string($gb_species, "name");
40        $species_name || expectError('read_string');
41        print $species_name."\n";
42      }
43    }
44
45  ARB::commit_transaction($gb_main);
46  ARB::close($gb_main);
47}
48
49listMarkedSpecies();
50
Note: See TracBrowser for help on using the repository browser.