[Bio] / FigKernelScripts / update_lineage.pl Repository:
ViewVC logotype

View of /FigKernelScripts/update_lineage.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (as text) (annotate)
Thu Dec 6 15:47:39 2007 UTC (12 years, 6 months ago) by wilke
Branch: MAIN
Updating the content of the TAXONOMY file in the organism dir and  in the  database

use FIG;
use strict;
use warnings;

use vars qw( $opt_d $opt_n $opt_h );
use Getopt::Std;


getopts('n:d:');



my $fig = new FIG;

my $counter = 0;

foreach my $genome ($fig->genomes) {

  my ( $tax_id ) = $genome =~ /(\d+)\.\d+/ ;
  unless ( $tax_id ){
    print STDERR "No taxonomy id for $genome\n";
  }

  my ( $overview ) = $fig->get_organism_info_from_ncbi($tax_id);

  print $overview->{lineage} , "\n";
  $counter ++;
  exit if ($counter > 10);
  sleep 10 ;
}

sub update_organism_dir{
  my ( $fig , $dir , $org , $overview) = @_;
  
  return 0 unless (-d "$dir/$org");

  #update TAXONOMY file
  open(TMP,">$dir/$org/TAXONOMY") || die "could not open $dir/$org/TAXONOMY";
  #print TMP $overview->{lineage}."\n";
  close(TMP);

  open(TMP,">$dir/$org/TAXONOMY_ID") || die "could not open $dir/$org/TAXONOMY";
  print TMP $overview->{taxonomy_id}."\n";
  close(TMP);

  chmod(0777,"$dir/$org/TAXONOMY_ID");

  #update database entry

  my $old_lineage = $fig->taxonomy_of($org);
  
  return 1;
}

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3