[Bio] / Babel / bin / load_md5rna2db.pl Repository:
ViewVC logotype

Diff of /Babel/bin/load_md5rna2db.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1, Wed Dec 1 15:43:35 2010 UTC revision 1.2, Thu Mar 24 21:05:43 2011 UTC
# Line 72  Line 72 
72    my ($id, $tax) = split(/\t/, $line);    my ($id, $tax) = split(/\t/, $line);
73    unless ($id && $tax) { next; }    unless ($id && $tax) { next; }
74    my @tax_set  = map { &clean_wsp($_) } split(/;/, $tax);    my @tax_set  = map { &clean_wsp($_) } split(/;/, $tax);
75      my $tax_rank = &rank_taxonomy($tax, join(" ", @tax_set[0,1]));
76      if ($tax_rank == 1) {
77    $taxa->{$id} = [ reverse @tax_set ];    $taxa->{$id} = [ reverse @tax_set ];
78  }  }
79    }
80  close TFILE;  close TFILE;
81    
82  &drop_table_indexes($dbh, $tbls->{tbl}{func}, $verbose);  &drop_table_indexes($dbh, $tbls->{tbl}{func}, $verbose);
# Line 93  Line 96 
96  while (my $line = <DFILE>) {  while (my $line = <DFILE>) {
97    chomp $line;    chomp $line;
98    my ($md5, $id, $func, $org, $source) = split(/\t/, $line);    my ($md5, $id, $func, $org, $source) = split(/\t/, $line);
99    unless ($md5 && $id) { next; }    unless ($md5 && $id && exists($taxa->{$id})) { next; }
100    
101    $funcID = ($func   && exists($func_ids->{$func}))  ? $func_ids->{$func}  : '\\N';    $funcID = ($func   && exists($func_ids->{$func}))  ? $func_ids->{$func}  : '\\N';
102    $srcID  = ($source && exists($src_ids->{$source})) ? $src_ids->{$source} : '\\N';    $srcID  = ($source && exists($src_ids->{$source})) ? $src_ids->{$source} : '\\N';
103    $orgID  = '\\N';    $orgID  = '\\N';
104    
105    if ($org && exists($org_ids->{$org})) {    if ($org && exists($org_ids->{$org})) {
106      $orgID = $org_ids->{$org};      $orgID = $org_ids->{$org};
107    }    }
# Line 245  Line 249 
249    return $clean;    return $clean;
250  }  }
251    
252    sub rank_taxonomy {
253      my ($tax, $top) = @_;
254      my $rank;
255    
256      ## enviromental
257      if ($tax =~ /(environmental samples|uncultured)/i) {
258        $rank = 3;
259      }
260      ## unknown
261      elsif ($top =~ /(artificial sequences|other sequences|unclassified|unidentified|unknown)/i) {
262        $rank = 2;
263      }
264      ## known
265      else {
266        $rank = 1;
267      }
268      return $rank;
269    }
270    
271  sub run_cmd {  sub run_cmd {
272    my ($cmd, $v) = @_;    my ($cmd, $v) = @_;
273    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3