def __initialize_finish(self): # Finalize the the widget's initialization (preferably after # ensuring all required databases have been downloaded. sets = geneset.list_all() taxids = set(taxonomy.common_taxids() + list(filter(None, [tid for _, tid, _ in sets]))) organisms = [(tid, name_or_none(tid)) for tid in taxids] organisms = [(tid, name) for tid, name in organisms if name is not None] organisms = [(None, "None")] + sorted(organisms) taxids = [tid for tid, _ in organisms] names = [name for _, name in organisms] self.taxid_list = taxids self.speciesComboBox.clear() self.speciesComboBox.addItems(names) self.genesets = sets if self.taxid in self.taxid_list: taxid = self.taxid else: taxid = self.taxid_list[0] self.taxid = None self.setCurrentOrganism(taxid) self.setBlocking(False) self.__state = OWSetEnrichment.Ready self.setStatusMessage("")
# read the information from the local file with open(localfile, 'rb') as f: gds_info, excluded = pickle.load(f, encoding='latin1') f.close() except FileNotFoundError as e: print('{} file on the server not found!'.format(GDS_INFO)) force_update = True # if needed to refresh the data base if force_update: gds_info, excluded = ({}, {}) # list of common organisms may have changed, rescan excluded list excluded = dict([(id, taxid) for id, taxid in excluded.items() if taxid not in taxonomy.common_taxids()]) excluded.update([(id, info["taxid"]) for id, info in gds_info.items() if info["taxid"] not in taxonomy.common_taxids()]) gds_info = dict([(id, info) for id, info in gds_info.items() if info["taxid"] in taxonomy.common_taxids()]) # get the list of GDS files from NCBI directory print("Retrieving ftp directory ...") ftp = ftplib.FTP(FTP_NCBI) ftp.login() ftp.cwd(NCBI_DIR) dirlist = [] ftp.dir(dirlist.append) m = re.compile("GDS[0-9]*") gds_names = [m.search(d).group(0) for d in dirlist if m.search(d)]
with open(localfile, 'rb') as f: gds_info, excluded = pickle.load(f, encoding='latin1') f.close() except FileNotFoundError as e: print('{} file on the server not found!'.format(GDS_INFO)) force_update = True # if needed to refresh the data base if force_update: gds_info, excluded = ({}, {}) # list of common organisms may have changed, rescan excluded list excluded = dict([(id, taxid) for id, taxid in excluded.items() if taxid not in taxonomy.common_taxids()]) excluded.update([(id, info["taxid"]) for id, info in gds_info.items() if info["taxid"] not in taxonomy.common_taxids()]) gds_info = dict([(id, info) for id, info in gds_info.items() if info["taxid"] in taxonomy.common_taxids()]) # get the list of GDS files from NCBI directory print("Retrieving ftp directory ...") ftp = ftplib.FTP(FTP_NCBI) ftp.login() ftp.cwd(NCBI_DIR) dirlist = [] ftp.dir(dirlist.append) m = re.compile("GDS[0-9]*") gds_names = [m.search(d).group(0) for d in dirlist if m.search(d)]
def setUp(self): self.common_ids = taxonomy.common_taxids() self.organisms = [(taxonomy.name(tax_id), tax_id) for tax_id in self.common_ids] self.taxon = taxonomy.Taxonomy()