Example #1
0
    def get_Seq_by_ver(self, name):
        """Gets a DBSeqRecord object by version number

        Example: seq_rec = db.get_Seq_by_ver('X77802.1')

        The name of this method is misleading since it returns a DBSeqRecord
        rather than a DBSeq ojbect, and presumably was to mirror BioPerl.
        """
        seqid = self.adaptor.fetch_seqid_by_version(self.dbid, name)
        return BioSeq.DBSeqRecord(self.adaptor, seqid)
Example #2
0
    def get_Seq_by_id(self, name):
        """Gets a DBSeqRecord object by its name

        Example: seq_rec = db.get_Seq_by_id('ROA1_HUMAN')

        The name of this method is misleading since it returns a DBSeqRecord
        rather than a DBSeq ojbect, and presumably was to mirror BioPerl.
        """
        seqid = self.adaptor.fetch_seqid_by_display_id(self.dbid, name)
        return BioSeq.DBSeqRecord(self.adaptor, seqid)
Example #3
0
 def lookup(self, **kwargs):
     if len(kwargs) != 1:
         raise TypeError("single key/value parameter expected")
     k, v = kwargs.items()[0]
     if k not in _allowed_lookups:
         raise TypeError("lookup() expects one of %s, not %r" % \
                         (repr(_allowed_lookups.keys())[1:-1], repr(k)))
     lookup_name = _allowed_lookups[k]
     lookup_func = getattr(self.adaptor, lookup_name)
     seqid = lookup_func(self.dbid, v)
     return BioSeq.DBSeqRecord(self.adaptor, seqid)
Example #4
0
    def get_Seqs_by_acc(self, name):
        """Gets a list of DBSeqRecord objects by accession number

        Example: seq_recs = db.get_Seq_by_acc('X77802')

        The name of this method is misleading since it returns a list of
        DBSeqRecord objects rather than a list of DBSeq ojbects, and presumably
        was to mirror BioPerl.
        """
        seqids = self.adaptor.fetch_seqids_by_accession(self.dbid, name)
        return [BioSeq.DBSeqRecord(self.adaptor, seqid) for seqid in seqids]
Example #5
0
 def __getitem__(self, key):
     return BioSeq.DBSeqRecord(self.adaptor, key)