def gen_search_result(self): """ Get the info displayed in the search result table from the set of results computed in the "search" function """ self.trait_list = [] species = webqtlDatabaseFunction.retrieve_species(self.dataset.group.name) # result_set represents the results for each search term; a search of # "shh grin2b" would have two sets of results, one for each term print("self.results is:", pf(self.results)) for result in self.results: if not result: continue #### Excel file needs to be generated #### print("foo locals are:", locals()) trait_id = result[0] this_trait = GeneralTrait(dataset=self.dataset, name=trait_id) this_trait.retrieve_info(get_qtl_info=True) self.trait_list.append(this_trait) self.dataset.get_trait_info(self.trait_list, species)
def gen_search_result(self): """ Get the info displayed in the search result table from the set of results computed in the "search" function """ self.trait_list = [] species = webqtlDatabaseFunction.retrieve_species( self.dataset.group.name) # result_set represents the results for each search term; a search of # "shh grin2b" would have two sets of results, one for each term print("self.results is:", pf(self.results)) for result in self.results: if not result: continue #### Excel file needs to be generated #### #print("foo locals are:", locals()) trait_id = result[0] this_trait = GeneralTrait(dataset=self.dataset, name=trait_id, get_qtl_info=True, get_sample_info=False) self.trait_list.append(this_trait) self.dataset.get_trait_info(self.trait_list, species)
def __init__(self, dataset): """This sets self.group and self.group_id""" print("dataset name:", dataset.name) self.name, self.id = g.db.execute(dataset.query_for_group).fetchone() if self.name == 'BXD300': self.name = "BXD" self.f1list = None self.parlist = None self.get_f1_parent_strains() #print("parents/f1s: {}:{}".format(self.parlist, self.f1list)) self.species = webqtlDatabaseFunction.retrieve_species(self.name) self.incparentsf1 = False self.allsamples = None
def __init__(self, kw): self.type = kw['type'] self.terms = kw['terms'] if self.type == "gene": sql = """ SELECT Species.`Name` AS species_name, InbredSet.`Name` AS inbredset_name, Tissue.`Name` AS tissue_name, ProbeSetFreeze.Name AS probesetfreeze_name, ProbeSet.Name AS probeset_name, ProbeSet.Symbol AS probeset_symbol, ProbeSet.`description` AS probeset_description, ProbeSet.Chr AS chr, ProbeSet.Mb AS mb, ProbeSetXRef.Mean AS mean, ProbeSetXRef.LRS AS lrs, ProbeSetXRef.`Locus` AS locus, ProbeSetXRef.`pValue` AS pvalue, ProbeSetXRef.`additive` AS additive FROM Species, InbredSet, ProbeSetXRef, ProbeSet, ProbeFreeze, ProbeSetFreeze, Tissue WHERE InbredSet.`SpeciesId`=Species.`Id` AND ProbeFreeze.InbredSetId=InbredSet.`Id` AND ProbeFreeze.`TissueId`=Tissue.`Id` AND ProbeSetFreeze.ProbeFreezeId=ProbeFreeze.Id AND ( MATCH (ProbeSet.Name,ProbeSet.description,ProbeSet.symbol,alias,GenbankId, UniGeneId, Probe_Target_Description) AGAINST ('%s' IN BOOLEAN MODE) ) AND ProbeSet.Id = ProbeSetXRef.ProbeSetId AND ProbeSetXRef.ProbeSetFreezeId=ProbeSetFreeze.Id AND ProbeSetFreeze.public > 0 ORDER BY species_name, inbredset_name, tissue_name, probesetfreeze_name, probeset_name LIMIT 5000 """ % (self.terms) re = g.db.execute(sql).fetchall() self.trait_list = [] for line in re: dataset = create_dataset(line[3], "ProbeSet") trait_id = line[4] this_trait = GeneralTrait(dataset=dataset, name=trait_id, get_qtl_info=True) self.trait_list.append(this_trait) species = webqtlDatabaseFunction.retrieve_species(dataset.group.name) dataset.get_trait_info([this_trait], species) elif self.type == "phenotype": sql = """ SELECT Species.`Name`, InbredSet.`Name`, PublishFreeze.`Name`, PublishXRef.`Id`, Phenotype.`Post_publication_description`, Publication.`Authors`, Publication.`Year`, PublishXRef.`LRS`, PublishXRef.`Locus`, PublishXRef.`additive` FROM Species,InbredSet,PublishFreeze,PublishXRef,Phenotype,Publication WHERE PublishXRef.`InbredSetId`=InbredSet.`Id` AND PublishFreeze.`InbredSetId`=InbredSet.`Id` AND InbredSet.`SpeciesId`=Species.`Id` AND PublishXRef.`PhenotypeId`=Phenotype.`Id` AND PublishXRef.`PublicationId`=Publication.`Id` AND (Phenotype.Post_publication_description REGEXP "[[:<:]]%s[[:>:]]" OR Phenotype.Pre_publication_description REGEXP "[[:<:]]%s[[:>:]]" OR Phenotype.Pre_publication_abbreviation REGEXP "[[:<:]]%s[[:>:]]" OR Phenotype.Post_publication_abbreviation REGEXP "[[:<:]]%s[[:>:]]" OR Phenotype.Lab_code REGEXP "[[:<:]]%s[[:>:]]" OR Publication.PubMed_ID REGEXP "[[:<:]]%s[[:>:]]" OR Publication.Abstract REGEXP "[[:<:]]%s[[:>:]]" OR Publication.Title REGEXP "[[:<:]]%s[[:>:]]" OR Publication.Authors REGEXP "[[:<:]]%s[[:>:]]" OR PublishXRef.Id REGEXP "[[:<:]]%s[[:>:]]") ORDER BY Species.`Name`, InbredSet.`Name`, PublishXRef.`Id` LIMIT 5000 """ % (self.terms, self.terms, self.terms, self.terms, self.terms, self.terms, self.terms, self.terms, self.terms, self.terms) re = g.db.execute(sql).fetchall() self.trait_list = [] for line in re: dataset = create_dataset(line[2], "Publish") trait_id = line[3] this_trait = GeneralTrait(dataset=dataset, name=trait_id, get_qtl_info=True) self.trait_list.append(this_trait) species = webqtlDatabaseFunction.retrieve_species(dataset.group.name) dataset.get_trait_info([this_trait], species)
def get_info(self): """For lots of traits just use get_trait_info in dataset instead...that will be way more efficient""" self.dataset.get_trait_info([self], webqtlDatabaseFunction.retrieve_species( self.dataset.group.name))
def get_info(self): """For lots of traits just use get_trait_info in dataset instead...that will be way more efficient""" self.dataset.get_trait_info([self], webqtlDatabaseFunction.retrieve_species(self.dataset.group.name))