[Bio] / SeedViewer / MetagenomeAnalysis.pm Repository:
ViewVC logotype

Diff of /SeedViewer/MetagenomeAnalysis.pm

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

revision 1.3, Fri Apr 18 20:09:19 2008 UTC revision 1.4, Tue Apr 22 19:56:18 2008 UTC
# Line 454  Line 454 
454    my $where = $self->get_where_clause();    my $where = $self->get_where_clause();
455    $where = ($where) ? "and $where" : '';    $where = ($where) ? "and $where" : '';
456    
457      #print STDERR "select s.tax_group_1, s.tax_group_2, s.tax_group_3, s.tax_str, count(*) as num from ( select id1, min(rank_psc) as rank from $table where dbid=$dbid $where group by id1) as b inner join $table as s on b.id1=s.id1 and b.rank=s.rank_psc where dbid=$dbid group by s.tax_group_1, s.tax_group_2, s.tax_group_3";
458     #die;
459    my $sth = $self->dbh->prepare("select s.tax_group_1, s.tax_group_2, s.tax_group_3, s.tax_str, count(*) as num from ( select id1, min(rank_psc) as rank from $table where dbid=$dbid $where group by id1) as b inner join $table as s on b.id1=s.id1 and b.rank=s.rank_psc where dbid=$dbid group by s.tax_group_1, s.tax_group_2, s.tax_group_3");    my $sth = $self->dbh->prepare("select s.tax_group_1, s.tax_group_2, s.tax_group_3, s.tax_str, count(*) as num from ( select id1, min(rank_psc) as rank from $table where dbid=$dbid $where group by id1) as b inner join $table as s on b.id1=s.id1 and b.rank=s.rank_psc where dbid=$dbid group by s.tax_group_1, s.tax_group_2, s.tax_group_3");
460    
461    $sth->execute;    $sth->execute;
# Line 495  Line 497 
497    
498  =pod  =pod
499    
500    =item * B<get_hits_for_sequence> (I<seq_id>, I<dataset>, I<limit>)
501    
502    Given a sequence id I<seq_id> (id1) and a dataset name (db_id), this method returns
503    the first I<limit> rows of hit data for this sequence. If no I<limit> is provided, it
504    will default to 10.
505    It returns (match id, taxonomy string, log evalue, bitscore, alignment length,
506    percent identity, start1, end1) per hit.
507    
508    =cut
509    
510    sub get_hits_for_sequence {
511      my ($self, $id, $dataset, $limit) = @_;
512    
513      my $table = $self->dbtable;
514      my $dbid  = $self->get_dataset_id($dataset);
515      $limit = 10 unless ($limit);
516    
517      my $sth = $self->dbh->prepare("select id2, tax_str, logpsc, bsc, ali_ln, iden, b1, e1 from $table where id1=$id and dbid=$dbid and rank_psc<$limit;");
518      $sth->execute;
519      my $result = $sth->fetchall_arrayref();
520    
521      return $result;
522    
523    }
524    
525    
526    =pod
527    
528  =item * B<get_align_len_range> (I<dataset_name>)  =item * B<get_align_len_range> (I<dataset_name>)
529    
530  Given a dataset name (db_id), this method returns  Given a dataset name (db_id), this method returns

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3