Skip to content

Commit

Permalink
Merge pull request #271 from geneontology/issue-264-atypical-drug-rxn…
Browse files Browse the repository at this point in the history
…-relations

Prevent emitting entities if drug
  • Loading branch information
dustine32 authored Aug 5, 2023
2 parents 1abfa76 + b1bd271 commit d94ba4a
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,11 @@ public String getEntityReferenceId(Entity bp_entity) {
String id = null;
Set<Xref> references = null;
//first check for entity reference
if((entityStrategy.equals(EntityStrategy.YeastCyc) && bp_entity instanceof SimplePhysicalEntity)
boolean is_drug = PhysicalEntityOntologyBuilder.getDrugReferenceId(bp_entity) != null;
if(is_drug) {
references = bp_entity.getXref();
}
else if((entityStrategy.equals(EntityStrategy.YeastCyc) && bp_entity instanceof SimplePhysicalEntity)
|| bp_entity instanceof SmallMolecule) {
SimplePhysicalEntity entity = (SimplePhysicalEntity) bp_entity;
EntityReference entity_ref = entity.getEntityReference();
Expand All @@ -357,16 +361,28 @@ public String getEntityReferenceId(Entity bp_entity) {
}
if(entityStrategy.equals(EntityStrategy.REACTO)) {
for(Xref ref : references) {
if(ref.getModelInterface().equals(UnificationXref.class)) {
UnificationXref r = (UnificationXref)ref;
if(r.getDb().equals("Reactome")) {
id = r.getId();
if(id.startsWith("R-")) {
if (is_drug) {
if (ref.getModelInterface().equals(RelationshipXref.class)) {
RelationshipXref r = (RelationshipXref)ref;
if(r.getDb().equalsIgnoreCase("ChEBI")) {
// "CHEBI:" not included in id for these
id = "CHEBI_" + r.getId();
break;
}
}
}
else {
if(ref.getModelInterface().equals(UnificationXref.class)) {
UnificationXref r = (UnificationXref)ref;
if(r.getDb().equals("Reactome")) {
id = r.getId();
if(id.startsWith("R-")) {
break;
}
}else if(r.getDb().equalsIgnoreCase("ChEBI") && bp_entity instanceof SmallMolecule) {
id = r.getId().replace(":", "_");
break;
}
}else if(r.getDb().equalsIgnoreCase("ChEBI") && bp_entity instanceof SmallMolecule) {
id = r.getId().replace(":", "_");
break;
}
}
}
Expand Down Expand Up @@ -401,6 +417,9 @@ public String getEntityReferenceId(Entity bp_entity) {
}
}
}
if (id!=null) {
id = id.replace(" ", "_");
}
return id;
}

Expand Down Expand Up @@ -1407,6 +1426,9 @@ else if (entity instanceof Interaction){
}
}
}
if (drop_drug_reactions && drug_process_ids.contains(entity_id)) {
continue;
}
//this is the non-recursive part.. (and we usually aren't recursing anyway)
IRI iri = null;
String controller_entity_id = getEntityReferenceId(controller_entity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public static void main(String[] args) throws ParseException, OWLOntologyCreatio
options.addOption("c", true, "Catalog file for tbox");
options.addOption("nosplit", false, "If present, do not split the input biopax file into its constituent pathways where one pathway becomes one go-cam model. Make one big model.");
options.addOption("sssom", true, "An sssom formatted mapping file (optional). Will be used to add guessed classes if none are present in the biopax");
options.addOption("include_drug_rxns", false, "If present, drug reactions will not be included in the produced model");

CommandLineParser parser = new DefaultParser();
CommandLine cmd = parser.parse( options, args);
Expand Down Expand Up @@ -180,6 +181,10 @@ public static void main(String[] args) throws ParseException, OWLOntologyCreatio
}else {
bp2g.split_by_pathway = true;
}
if(cmd.hasOption("include_drug_rxns")) {
// drop_drug_reactions is true by default
bp2g.drop_drug_reactions = false;
}
if(cmd.hasOption("sssom")) {
bp2g.sssom = new SSSOM(cmd.getOptionValue("sssom"));
}
Expand Down

0 comments on commit d94ba4a

Please sign in to comment.