def makeFamilySynonymes(): vFamSyns = [] for family in familyDB: for (miID, miName) in family.childMIMATs: mirnas = set() for mimat in MI2MIMAT[miID]: mirnas.add(MIMAT2MIRNA[mimat]) familySyn = Synonym(family.familyID) for mirna in mirnas: allIDs = set( mirna.make_strings( miRNA.compositions()[miRNASynonymeTYPE.FAMILY])) for syn in allIDs: familySyn.addSyn(syn) vFamSyns.append(familySyn) return vFamSyns
def makeOrgSynonymes(): dOrgSyns = {} addedMirnaIDs = list() for mimat in MIMAT2MIRNA: mirna = MIMAT2MIRNA[mimat] orgmir = orgmirs.mimat2orgmir.get(mimat, None) if orgmir == None: continue synid = orgmir if synid in dOrgSyns: orgSyn = dOrgSyns[synid] else: orgSyn = Synonym(synid) allsyns = set( mirna.make_strings(miRNA.compositions()[miRNASynonymeTYPE.MIORG])) for syn in allsyns: orgSyn.addSyn(syn) dOrgSyns[synid] = orgSyn vOrgSyns = [dOrgSyns[x] for x in dOrgSyns] return vOrgSyns
def makeMIMATSynonymes(): mimatSyns = [] for mimat in MIMAT2MIRNA: mirna = MIMAT2MIRNA[mimat] mirnaSyn = Synonym(mimat) for syn in mirna.make_strings( miRNA.compositions()[miRNASynonymeTYPE.MIMAT]): mirnaSyn.addSyn(syn) mimatSyns.append(mirnaSyn) return mimatSyns
def makeMISynonymes(): vMISyns = [] for mi in MI2MIMAT: mimats = MI2MIMAT[mi] mirnas = [MIMAT2MIRNA[x] for x in mimats] orgSyn = Synonym('ORG' + mi) for mirna in mirnas: allIDs = set( mirna.make_strings(miRNA.compositions()[miRNASynonymeTYPE.MI])) for syn in allIDs: orgSyn.addSyn(syn) vMISyns.append(orgSyn) return vMISyns
ncitTerm2Sym = NcitTermSymbolDB.loadFromFolder() vAllSyns = [] for termID in ncitObo.dTerms: oboNode = ncitObo.dTerms[termID] oboID = oboNode.id oboName = oboNode.name oboSyns = oboNode.synonym oboRels = oboNode.is_a newSyn = Synonym(oboID) newSyn.addSyn(oboName) if oboSyns != None: for x in oboSyns: newSyn.addSyn(x.syn) allOrgs = [x for x in ncitTerm2Sym.org_term2symbol] for org in allOrgs: ncitID = oboID[oboID.index(":") + 1:] if ncitID in ncitTerm2Sym.org_term2symbol[org]: orgSyms = ncitTerm2Sym.org_term2symbol[org][ncitID]
bodypartsObo = GeneOntology( dataDir + "miRExplore/foundational_model_anatomy/fma_obo.obo") vAllSyns = [] for cellID in bodypartsObo.dTerms: oboNode = bodypartsObo.dTerms[cellID] oboID = oboNode.id oboName = oboNode.name oboSyns = oboNode.synonym oboRels = oboNode.is_a newSyn = Synonym(oboID) newSyn.addSyn(oboName) aName = oboName.split(' ') if len(aName) > 1 and len(aName) < 5: acro = "" if aName[-1].upper() == 'CELL': acro = "".join([x[0].upper() for x in aName]) newSyn.addSyn(acro) if oboSyns != None: for x in oboSyns: newSyn.addSyn(x.syn)
name = aline[1] altNames = StringIO() altNames.write(aline[2] + "\n") names = [] for line in csv.reader([aline[2]], dialect='phenotypes'): for elem in line: names.append(elem) names = names + [name] newSyn = Synonym( 'DISEASE' + str(len(vAllSyns)+1)) newSyn.addSyn(name) for x in names: if x.startswith('[D]') or x.startswith('[X]') or x.startswith('[M]'): x = x[3:] xsyns = [] if ' - ' in x: xsyns += x.split(' - ') else: xsyns.append(x) for xsyn in xsyns: newSyn.addSyn(xsyn.strip())
oboID = oboNode.id if not oboID.startswith("CL"): continue if oboID == 'CL:1000413': print(oboID) print(oboNode.name) oboName = oboNode.name oboSyns = oboNode.synonym oboRels = oboNode.is_a newSyn = Synonym(oboID) newSyn.addSyn(oboName) if oboSyns != None: for x in oboSyns: if x == None: continue if x.syn in allOboNames: continue newSyn.addSyn(x.syn) for x in newSyn.syns: if 'cell of' in x:
allNodes.append(oboNode) globalKeywordExcludes = loadExludeWords(common=False, cell_co=False, disease=False, generic=False) for x in globalKeywordExcludes: if 'membrane' in globalKeywordExcludes[x]: print("Membrane: " + x) synSet = set() for node in allNodes: newSyn = Synonym(node.id) newSyn.addSyn(node.name) if node.synonym != None: for x in node.synonym: if x == None: continue newSyn.addSyn(x.syn) synSet.add(newSyn) vPrintSyns = handleCommonExcludeWords(synSet, globalKeywordExcludes, mostCommonCount=66, maxCommonCount=5, minSynCount=0) printToFile(vPrintSyns, sys.argv[2])