Skip to content

Commit

Permalink
Merge pull request #42 from tanksha/new-atomtype
Browse files Browse the repository at this point in the history
New atomtype
  • Loading branch information
tanksha authored Aug 11, 2020
2 parents b443a3c + a0d662e commit bf77f80
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions atomwrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ class CInheritanceLink(CLink):
atom_type = 'InheritanceLink'

class CRNANode(CNode):
atom_type = 'CodingRnaNode'
atom_type = 'EnstNode'

class NcRNANode(CNode):
atom_type = 'NonCodingRnaNode'
atom_type = 'RefseqNode'

class ChebiNode(CNode):
atom_type = 'ChebiNode'
Expand Down
2 changes: 1 addition & 1 deletion codingRNA.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
with open("dataset/codingRNA_{}.scm".format(str(date.today())), 'w') as f:
for i in range(len(df)):
rna = df.iloc[i]["transcript_stable_id"]
gene = df.iloc[i]['Approved symbol'].strip()
gene = df.iloc[i]['Approved symbol'].strip().upper()
prot = df.iloc[i]["xref"]
rnas.append(rna)
genes.append(gene)
Expand Down
4 changes: 2 additions & 2 deletions gene2proteinMapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@
genes.append(g)
prot.append(p)
expresion = CEvaluationLink(CPredicateNode("expresses"), CListLink(CGeneNode(g),ProteinNode(p)))
f.write(expresion.recursive_print())
f.write(expresion.recursive_print() + "\n")
except:
continue
if not math.isnan(data.iloc[i]['entrez']):
entrez_id = str(int(data.iloc[i]['entrez']))
has_entrez = CEvaluationLink(CPredicateNode("has_entrez_id"), CListLink(CGeneNode(g),CConceptNode("entrez:"+entrez_id)))
f.write(has_entrez.recursive_print())
f.write(has_entrez.recursive_print() + "\n")

metadata.update_meta("gene2proteinMapping:latest",
"entrez2uniprot.csv",script,genes=len(set(genes)),prot=len(set(prot)))
Expand Down
4 changes: 2 additions & 2 deletions noncodingRNA.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
for i in range(len(data)):
rna = data.iloc[i]["product_accession"].split(".")[0]
if rna.split("_")[0] in ["NR", "XR"]:
gene = data.iloc[i]["symbol"].strip()
gene = data.iloc[i]["symbol"].strip().upper()
name = data.iloc[i]["name"]
rnas.append(rna)
genes.append(gene)
transc = CEvaluationLink(CPredicateNode("transcribed_to"), CListLink(CGeneNode(gene),NcRNANode(rna)))
transc_name = CEvaluationLink(CPredicateNode("has_name"), CListLink(NcRNANode(rna), CConceptNode("name")))
f.write(transc.recursive_print() + "\n" + transc_name.recursive_print())
f.write(transc.recursive_print() + "\n" + transc_name.recursive_print() + "\n")

version = dataset.split(".")[1]
script = "https://github.com/MOZI-AI/knowledge-import/noncodingRNA.py"
Expand Down
16 changes: 8 additions & 8 deletions string_PPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ def import_string():
gene2 = CGeneNode(prot2.split("|")[1].split("_")[0].upper())
stv = "(stv {} {})".format(1.0, score/1000)

f.write(str(CEvaluationLink(CPredicateNode(mode), CSetLink(protein1, protein2), stv=stv)) + "\n")
f.write(str(CEvaluationLink(CPredicateNode(mode), CSetLink(gene1, gene2), stv=stv)) + "\n")
symmetric[gene1 + gene2] = mode
f.write(CEvaluationLink(CPredicateNode(mode), CSetLink(protein1, protein2), stv=stv).recursive_print() + "\n")
f.write(CEvaluationLink(CPredicateNode(mode), CSetLink(gene1, gene2), stv=stv).recursive_print() + "\n")
symmetric[gene1.name + gene2.name] = mode

except Exception as e:
print(e)
Expand Down Expand Up @@ -113,13 +113,13 @@ def import_string():
gene2 = CGeneNode(prot2.split("|")[1].split("_")[0].upper())
stv = "(stv {} {})".format(1.0, score/1000)

if not (gene1+gene2 in symmetric.keys() and symmetric[gene1+gene2] == mode):
if not (gene1.name + gene2.name in symmetric.keys() and symmetric[gene1.name + gene2.name] == mode):
if a_is_acting is "t":
f.write(str(CEvaluationLink(CPredicateNode(mode), CListLink(protein1, protein2), stv=stv)) + "\n")
g.write(str(CEvaluationLink(CPredicateNode(mode), CListLink(gene1, gene2), stv=stv)) + "\n")
f.write(CEvaluationLink(CPredicateNode(mode), CListLink(protein1, protein2), stv=stv).recursive_print() + "\n")
g.write(CEvaluationLink(CPredicateNode(mode), CListLink(gene1, gene2), stv=stv).recursive_print() + "\n")
else:
f.write(str(CEvaluationLink(CPredicateNode(mode), CListLink(protein2, protein1), stv=stv)) + "\n")
g.write(str(CEvaluationLink(CPredicateNode(mode), CListLink(gene2, gene1), stv=stv)) + "\n")
f.write(CEvaluationLink(CPredicateNode(mode), CListLink(protein2, protein1), stv=stv).recursive_print() + "\n")
g.write(CEvaluationLink(CPredicateNode(mode), CListLink(gene2, gene1), stv=stv).recursive_print() + "\n")

except Exception as e:
print(e)
Expand Down
2 changes: 1 addition & 1 deletion uniprot2GO.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
go_namespace, go_term = find_gons.find_type(i.split('\t')[4], go_namespace)
protein = ProteinNode(i.split('\t')[1])
if go_term:
f.write(CInheritanceLink(protein,go_term).recursive_print() + "\n")
f.write(CMemberLink(protein,go_term).recursive_print() + "\n")
prot.append(i.split('\t')[1])
go.append(go_term)

Expand Down

0 comments on commit bf77f80

Please sign in to comment.