[Bio] / FigKernelPackages / FIG.pm Repository:
ViewVC logotype

Diff of /FigKernelPackages/FIG.pm

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

revision 1.697, Fri Jun 20 20:35:19 2008 UTC revision 1.698, Sat Jun 21 23:23:38 2008 UTC
# Line 4649  Line 4649 
4649  }  }
4650    
4651    
4652    =head3 contig_md5sum
4653    
4654        my $cksum = $fig->md5_of_peg( $peg );
4655    
4656    Return the MD5 checksum for a peg. The MD5 checksum is computed from the
4657    uppercase sequence of the protein.  This method retrieves the checksum stored
4658    in the database.
4659    
4660    =over 4
4661    
4662    =item peg
4663    
4664    FIG ID of the peg.
4665    
4666    =item RETURN
4667    
4668    Returns the checksum of the specified contig as a hex string, or C<undef> if
4669    the peg is not in the database.
4670    
4671    =back
4672    
4673    =cut
4674    
4675    #
4676    #  Return md5sum of a peg as hex string:
4677    #
4678    #    my $md5sum = $fig->md5_of_peg( $peg )
4679    #
4680    sub md5_of_peg {
4681        my( $self, $peg ) = @_;
4682        return undef if ! $peg;
4683        my $rdbH = $self->db_handle;
4684    
4685        my $relational_db_response =
4686                 $rdbH->SQL( "SELECT md5 FROM protein_sequence_MD5 WHERE id = '$peg'" );
4687    
4688         ! $relational_db_response ? undef
4689        : @$relational_db_response ? $relational_db_response->[0]->[0]
4690        :                            undef;
4691    }
4692    
4693    
4694    =head3 pegs_with_md5
4695    
4696        my @pegs = $fig->pegs_with_md5( $md5 );
4697    
4698    Return all pegs with sequence matching the check sum.  Thus,
4699    
4700        my @pegs = $fig->pegs_with_md5( $fig->md5_of_peg( $peg ) );
4701    
4702    produces all pegs with sequence identical the query peg.
4703    
4704    =over 4
4705    
4706    =item md5
4707    
4708    The md5 checksum as a hex string (32 characters).
4709    
4710    =item RETURN
4711    
4712    Returns the list of pegs matching the given md5 checksum.
4713    
4714    =back
4715    
4716    =cut
4717    
4718    #
4719    #  Return all peg ids with a given md5sum:
4720    #
4721    #    my @fids = $fig->pegs_with_md5( $md5_in_hex )
4722    #
4723    sub pegs_with_md5
4724    {
4725        my( $self, $md5 ) = @_;
4726        return () if ! $md5;
4727    
4728        $md5 = lc $md5;
4729        my $rdbH = $self->db_handle;
4730        my $relational_db_response =
4731                 $rdbH->SQL( "SELECT id FROM protein_sequence_MD5 WHERE md5 = '$md5'" );
4732    
4733        $relational_db_response ? map { $_->[0] } @$relational_db_response
4734                                : ();
4735    }
4736    
4737    
4738    
4739  =head3 genus_species  =head3 genus_species
4740    

Legend:
Removed from v.1.697  
changed lines
  Added in v.1.698

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3