Skip to content

Commit

Permalink
Skip pthwy step if no rxn and block provides_input_for for currency c…
Browse files Browse the repository at this point in the history
…hems
  • Loading branch information
dustine32 committed Mar 14, 2024
1 parent 512a127 commit 29112f8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1296,8 +1296,6 @@ else if (entity instanceof Interaction){
Set<PhysicalEntity> inputs = null;
Set<PhysicalEntity> outputs = null;
Set<PathwayStep> previous_steps = pathway_step.getNextStepOf();
Set<String> small_mol_do_not_join_ids = new HashSet<>(Arrays.asList("CHEBI_15378", // hydron
"CHEBI_15377"));// water

if(direction==null||direction.equals(ConversionDirectionType.LEFT_TO_RIGHT)||direction.equals(ConversionDirectionType.REVERSIBLE)) {
inputs = ((Conversion) entity).getLeft();
Expand Down Expand Up @@ -1332,7 +1330,7 @@ else if (entity instanceof Interaction){
input_id = UUID.randomUUID().toString();
}
String input_location = null;
if (small_mol_do_not_join_ids.contains(entity_ref_id) || input.getCellularLocation() == null || !(input instanceof SmallMolecule)) {
if (GoCAM.small_mol_do_not_join_ids.contains(entity_ref_id) || input.getCellularLocation() == null || !(input instanceof SmallMolecule)) {
// Gotta make these locations specific to rxn ID for do_not_join classes
input_location = entity_id;
} else {
Expand All @@ -1342,10 +1340,13 @@ else if (entity instanceof Interaction){
}
input_location = String.join("_", in_location_terms);
}
if(!small_mol_do_not_join_ids.contains(entity_ref_id) && input instanceof SmallMolecule){
if(!GoCAM.small_mol_do_not_join_ids.contains(entity_ref_id) && input instanceof SmallMolecule){
// Try to reuse previous rxn's output instance
for(PathwayStep previous_step : previous_steps) {
BiochemicalReaction reaction = getBiochemicalReaction(previous_step);
if (reaction == null) {
continue;
}
ConversionDirectionType prev_step_direction = getDirection(reaction);
Set<PhysicalEntity> previous_outputs = null;
if(prev_step_direction.equals(ConversionDirectionType.RIGHT_TO_LEFT)) {
Expand Down Expand Up @@ -1381,7 +1382,7 @@ else if (entity instanceof Interaction){
output_id = UUID.randomUUID().toString();
}
String output_location = null;
if (small_mol_do_not_join_ids.contains(entity_ref_id) || output.getCellularLocation() == null) {
if (GoCAM.small_mol_do_not_join_ids.contains(entity_ref_id) || output.getCellularLocation() == null) {
// Gotta make these locations specific to rxn ID for do_not_join classes
output_location = entity_id;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.io.UnsupportedEncodingException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
Expand Down Expand Up @@ -115,6 +116,8 @@ public class GoCAM {
public static final IRI obo_iri = IRI.create("http://purl.obolibrary.org/obo/");
public static final IRI reacto_base_iri = IRI.create("http://purl.obolibrary.org/obo/go/extensions/reacto.owl#REACTO_");
public static final IRI uniprot_iri = IRI.create("http://identifiers.org/uniprot/");
public static final Set<String> small_mol_do_not_join_ids = new HashSet<>(Arrays.asList("CHEBI_15378", // hydron
"CHEBI_15377"));// water
public static IRI base_ont_iri;
public static OWLAnnotationProperty version_info, title_prop, contributor_prop, date_prop, skos_exact_match, skos_altlabel,
state_prop, evidence_prop, provided_by_prop, x_prop, y_prop, rdfs_label, rdfs_comment, rdfs_seealso, source_prop,
Expand Down Expand Up @@ -1382,8 +1385,10 @@ private RuleResults inferProvidesInput(String model_id, RuleResults r) {
//create ?reaction2 obo:RO_0002333 ?input
OWLNamedIndividual r1 = this.makeAnnotatedIndividual(ir.reaction1_uri);
OWLNamedIndividual r2 = this.makeAnnotatedIndividual(ir.reaction2_uri);
String entity_type_id = ir.entity_type_uri.substring(ir.entity_type_uri.lastIndexOf('/') + 1);
//Check if rxns are already connected via common input/output instance
if (!ir.input_instance_uri.equals(ir.output_instance_uri)) {
if (!ir.input_instance_uri.equals(ir.output_instance_uri) &&
!GoCAM.small_mol_do_not_join_ids.contains(entity_type_id)) {
OWLObjectProperty o = df.getOWLObjectProperty(IRI.create(ir.prop_uri));
String r1_label = "'"+this.getaLabel(r1)+"'";
String r2_label = "'"+this.getaLabel(r2)+"'";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -616,12 +616,13 @@ Set<InferredInputRegulator> getInferredInputProviders() {
Resource pathway = qs.getResource("pathway");
Resource r1output = qs.getResource("r1output");
Resource r2input = qs.getResource("reaction2input");
Resource r1output_type = qs.getResource("r1output_type");
//reaction1 provides_input_for reaction 2
String pathway_uri = "";
if(pathway!=null) {
pathway_uri = pathway.getURI();
}
ir.add(new InferredInputRegulator(reaction1.getURI(), GoCAM.provides_direct_input_for.getIRI().toString(), reaction2.getURI(), pathway_uri, "", "", r1output.getURI(), r2input.getURI()));
ir.add(new InferredInputRegulator(reaction1.getURI(), GoCAM.provides_direct_input_for.getIRI().toString(), reaction2.getURI(), pathway_uri, "", r1output_type.getURI(), r1output.getURI(), r2input.getURI()));
}
qe.close();
return ir;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ prefix skos: <http://www.w3.org/2004/02/skos/core#>
#and reaction1 causally_upstream_of reaction2
#then reaction1 directly_positively_regulates reaction2

select distinct ?reaction2 ?reaction1 ?reaction2inputLabel ?reaction2Label ?reaction1Label ?pathway ?r1output ?reaction2input
select distinct ?reaction2 ?reaction1 ?reaction2inputLabel ?reaction2Label ?reaction1Label ?pathway ?r1output ?reaction2input ?r1output_type
where {
# limit to relationships in the same Pathway
# promiscuous molecules make this important to avoid explosions
Expand All @@ -21,7 +21,9 @@ where {
?reaction1 obo:RO_0002234 ?r1output .
?r1output skos:exactMatch ?A .
?reaction2input skos:exactMatch ?A .
?r1output rdf:type ?r1output_type .
filter(?reaction1 != ?reaction2) .
filter(?r1output_type != <http://www.w3.org/2002/07/owl#NamedIndividual>) .
optional {
?reaction2input rdfs:label ?reaction2inputLabel .
?reaction2 rdfs:label ?reaction2Label .
Expand Down

0 comments on commit 29112f8

Please sign in to comment.