[Bio] / GBBergeyDB / checkGenomeNamesForAliases.pl Repository:
ViewVC logotype

Annotation of /GBBergeyDB/checkGenomeNamesForAliases.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (view) (download) (as text)

1 : bartels 1.1 #!/usr/bin/env /home/bartels/FIGdisk/env/cee/bin/perl
2 :    
3 :     use strict;
4 :     use warnings;
5 :     use lib "../PPO/";
6 :     use DBMaster;
7 :     use GenomeParser;
8 :     use GenomeMapper;
9 :    
10 :     my $dbmaster = DBMaster->new( 'GBBergeyDB' );
11 :    
12 :     print STDERR "getting all species\n";
13 :    
14 :     my $speciesArr = $dbmaster->Species->get_objects();
15 :    
16 :     print STDERR "going through species\n";
17 :    
18 :     my $counter = 0;
19 :     my $allnum = scalar @$speciesArr;
20 :    
21 :     my $counthash = { 'phylac' => 0,
22 :     'classc' => 0,
23 :     'orderc' => 0,
24 :     'familyc' => 0,
25 :     'genusc' => 0 };
26 :    
27 :     foreach my $species ( @$speciesArr ) {
28 :    
29 :     $counter++;
30 :     if( ( $counter % 100 ) == 0 ) {
31 :     print STDERR "$counter of $allnum \r";
32 :     }
33 :    
34 :     my $name = $species->name;
35 :    
36 :     my $nameArr = $dbmaster->GenomeAlias->get_objects( { 'name' => $name } );
37 :    
38 :     if ( defined( $nameArr->[0] ) && ( $nameArr->[0]->ident == 0 ) ) {
39 :     print $name ."\tshould be\t" .$nameArr->[0]->scientificName ."\t";
40 :     my $speciesArr2 = $dbmaster->Species->get_objects( { 'name' => $nameArr->[0]->scientificName } );
41 :     if ( defined( $speciesArr2->[0] ) ) {
42 :     print "ISIN: ".$speciesArr2->[0]->_id."\t";
43 :     $species->ScientificSpecies( $speciesArr2->[0] );
44 :     my $textmeet = getMeetingPoint( $species, $speciesArr2->[0], $counthash );
45 :     print $textmeet;
46 :     }
47 :     else {
48 :     print "NOTIN\n";
49 :     }
50 :     }
51 :     }
52 :    
53 :     print "\n\nSTATISTICS\n----------\n\n";
54 :    
55 :     foreach my $k ( keys %$counthash ) {
56 :     print $k."\t". $counthash->{ $k }."\n";
57 :     }
58 :    
59 :    
60 :     sub getMeetingPoint {
61 :    
62 :     my ( $genome1, $genome2, $counthash ) = @_;
63 :    
64 :     if ( $genome1->Genus->_id == $genome2->Genus->_id ) {
65 :     $counthash->{ 'genusc' } ++;
66 :     return "Genus: " . $genome1->Genus->name."\n";
67 :     }
68 :     if ( $genome1->Genus->Family->_id == $genome2->Genus->Family->_id ) {
69 :     $counthash->{ 'familyc' } ++;
70 :     return "Family: " . $genome1->Genus->Family->name."\n";
71 :     }
72 :     if ( $genome1->Genus->Family->GOrder->_id == $genome2->Genus->Family->GOrder->_id ) {
73 :     $counthash->{ 'orderc' } ++;
74 :     return "Order: " . $genome1->Genus->Family->GOrder->name."\n";
75 :     }
76 :     if ( $genome1->Genus->Family->GOrder->Class->_id == $genome2->Genus->Family->GOrder->Class->_id ) {
77 :     $counthash->{ 'classc' } ++;
78 :     return "Class: " . $genome1->Genus->Family->GOrder->Class->name."\n";
79 :     }
80 :     if ( $genome1->Genus->Family->GOrder->Class->Phyla->_id == $genome2->Genus->Family->GOrder->Class->Phyla->_id ) {
81 :     $counthash->{ 'phylac' } ++;
82 :     return "Phyla: " . $genome1->Genus->Family->GOrder->Class->Phyla->name."\n";
83 :     }
84 :    
85 :     }

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3