def protein(self, query, mode): """Return the Protein object""" o = '' p=None if mode == "GI": p = Protein.select(Protein.q.gi.contains(query)) elif mode == "Accession": p = Protein.select(Protein.q.accesion.contains(query)) if p[0].organism == 1: o = "Drosophila melanogaster" else: o = "Saccaromyces cervisiae" title = "Protein: " + mode + query return dict(title=title, protein=p[0], organism=o)
def alignment(self, p_gi, a_gi): """Return the Alignments object""" p = Protein.byGi(p_gi) a = None for i in p.hits: if i.alignment_protein.gi == (a_gi): a = i if a.query_protein.organism == 1: q_org = "Drosophila melanogaster" else: q_org = "Saccaromyces cervisiae" if a.alignment_protein.organism == 1: a_org = "Drosophila melanogaster" else: a_org = "Saccaromyces cervisiae" title = "Alignment: " + a_gi + "and" + p_gi return dict(title=title, alignment=a, alignment_organism=a_org, query_organism=q_org)
def protein_list(self): title = "Search Page" proteins = Protein.select() count = proteins.count() return dict(title=title, proteins=proteins, count=count)