public final class ModelUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
addMissingEntityReference(Model model,
SimplePhysicalEntity pe)
For a non-generic simple physical entity (memberPhysicalEntity property is empty)
that does not have entityReference property defined, this method generates and adds
a new entity reference of proper type to both this entity and the model,
and also copies names and xrefs from the source physical entity to the generated entity reference
(UnificationXrefs are converted to RelationshipXref and then also deleted from the original entity.)
|
static void |
breakPathwayComponentCycle(Model model)
Removes cyclic pathway inclusions, non-trivial infinite loops, in 'pathwayComponent' biopax property.
|
static boolean |
checkERFeatureSet(EntityReference er,
boolean fix)
Finds and adds all (missing) entity features
to given entity reference from all its owner
simple physical entities ('feature' and 'notFeature'
properties).
|
static String |
encodeBase62(String str) |
static Set<EntityFeature> |
findFeaturesAddedToSecond(PhysicalEntity first,
PhysicalEntity second,
boolean fix) |
static void |
fixDanglingInverseProperties(BioPAXElement bpe,
Model model)
Unlinks inverse properties of the BioPAX object
from values the model does not have.
|
static void |
fixDanglingObjectProperties(BioPAXElement bpe,
Model model)
Unlinks object properties of the BioPAX object
from values the model does not have.
|
static Map<Class<? extends BioPAXElement>,Integer> |
generateClassMetrics(Model model)
Generates simple counts of different elements in the model.
|
static Model |
getAllChildren(BioPAXElement bpe,
Filter<PropertyEditor>... filters)
Deprecated.
use
Fetcher.fetch(BioPAXElement, Model) instead (with Fetcher.nextStepFilter or without) |
static Set<Provenance> |
getDatasources(BioPAXElement biopaxElement)
Collects all Provenance objects
associated with this one as follows:
- if the element is Entity (has 'dataSource' property)
or is Provenence itself, get the values and quit;
- if the biopax element is PathwayStep or EntityReference,
traverse into some of its object/inverse properties to collect
dataSource values from associated entities.
|
static Model |
getDirectChildren(BioPAXElement bpe)
Gets direct children of a given BioPAX element
and adds them to a new model.
|
static Set<BioPAXElement> |
getDirectChildrenAsSet(BioPAXElement bpe)
Collects direct children of a given BioPAX element.
|
static Set<EntityFeature> |
getFeatureIntersection(PhysicalEntity first,
org.biopax.paxtools.controller.ModelUtils.FeatureType firstClass,
PhysicalEntity second,
org.biopax.paxtools.controller.ModelUtils.FeatureType secondClass) |
static Set<EntityFeature> |
getFeatureSetByType(PhysicalEntity pe,
org.biopax.paxtools.controller.ModelUtils.FeatureType type) |
static Set<String> |
getKeywords(BioPAXElement biopaxElement,
int depth,
Filter<DataPropertyEditor>... dataPropertyFilters)
Collects data type (not object) property
values (can be then used for full-text indexing).
|
static <T extends BioPAXElement> |
getObject(Model model,
String uri,
Class<T> clazz)
A more strict, type-safe way to ask for a biopax object
from the model, unlike
Model.getByID(String). |
static Set<BioSource> |
getOrganisms(BioPAXElement biopaxElement)
Collects BioSource objects from this or
related elements (where it makes sense;
though the biopax element might have no
or empty 'organism' property at all.
|
static Set<Pathway> |
getParentPathways(BioPAXElement biopaxElement)
Collects all parent Pathway objects recursively
traversing the inverse object properties of the
biopax element.
|
static <T extends BioPAXElement> |
getRootElements(Model model,
Class<T> filterClass)
Finds "root" BioPAX objects that belong to a particular class (incl.
|
static String |
md5hex(String id)
Calculates MD5 hash code (as 32-byte hex.
|
static void |
mergeEquivalentInteractions(Model model)
Merges equivalent interactions (currently - Conversions only).
|
static void |
mergeEquivalentPhysicalEntities(Model model)
Merges equivalent physical entities.
|
static void |
normalizeGenerics(Model model)
Converts generic simple physical entities,
i.e., physical entities except Complexes
that have not empty memberPhysicalEntity property,
into equivalent physical entities
with generic entity references (which have members);
this is a better and less error prone way to model
generic molecules in BioPAX L3.
|
static <T extends BioPAXElement> |
removeObjectsIfDangling(Model model,
Class<T> clazz)
Iteratively removes "dangling" elements of given type and its sub-types,
e.g.
|
static void |
replace(Model model,
Map<? extends BioPAXElement,? extends BioPAXElement> subs)
Replaces BioPAX elements in the model with ones from the map,
updates corresponding BioPAX object references.
|
static void |
replaceEquivalentFeatures(Model model)
This method iterates over the features in a model and tries to find equivalent objects and merges them.
|
static String |
shortenUri(String xmlbase,
String uri)
Creates a short URI from the URI,
given the xml:base.
|
static void |
updateUri(Model model,
BioPAXElement el,
String newUri)
Replaces the URI of a BioPAX object in the Model using java reflection.
|
static Model |
writeRead(Model model)
Cuts the BioPAX model off other models and BioPAX objects
by essentially performing write/read to/from OWL.
|
public static void replace(Model model, Map<? extends BioPAXElement,? extends BioPAXElement> subs)
fixDanglingInverseProperties(BioPAXElement, Model) after.model - biopax model where the objects are to be replacedsubs - the replacements map (many-to-one, old-to-new)IllegalBioPAXArgumentException - if there is an incompatible type replacement objectpublic static <T extends BioPAXElement> Set<T> getRootElements(Model model, Class<T> filterClass)
T - biopax typemodel - biopax model to work withfilterClass - filter class (including subclasses)public static <T extends BioPAXElement> Set<BioPAXElement> removeObjectsIfDangling(Model model, Class<T> clazz)
T - biopax typemodel - to modifyclazz - filter-class (filter by this type and sub-classes)public static Model writeRead(Model model)
model - biopax model to processpublic static Model getDirectChildren(BioPAXElement bpe)
bpe - biopax element/objectpublic static Model getAllChildren(BioPAXElement bpe, Filter<PropertyEditor>... filters)
Fetcher.fetch(BioPAXElement, Model) instead (with Fetcher.nextStepFilter or without)Fetcher) and adds them to a
new model.bpe - biopax objectfilters - property filters (e.g., for Fetcher to skip some properties). Default is to skip 'nextStep'.public static Set<BioPAXElement> getDirectChildrenAsSet(BioPAXElement bpe)
bpe - biopax object (parent)public static Map<Class<? extends BioPAXElement>,Integer> generateClassMetrics(Model model)
model - biopax model to analyzepublic static <T extends BioPAXElement> T getObject(Model model, String uri, Class<T> clazz)
Model.getByID(String).T - biopax typemodel - biopax model to queryuri - absolute URI of a biopax elementclazz - class-filter (to filter by the biopax type and its sub-types)public static String md5hex(String id)
id - some identifier, e.g., URIpublic static void fixDanglingObjectProperties(BioPAXElement bpe, Model model)
bpe - a biopax objectmodel - the model to look for objects inpublic static void fixDanglingInverseProperties(BioPAXElement bpe, Model model)
bpe - BioPAX objectmodel - where to look for other objectspublic static Set<EntityFeature> getFeatureIntersection(PhysicalEntity first, org.biopax.paxtools.controller.ModelUtils.FeatureType firstClass, PhysicalEntity second, org.biopax.paxtools.controller.ModelUtils.FeatureType secondClass)
public static Set<EntityFeature> getFeatureSetByType(PhysicalEntity pe, org.biopax.paxtools.controller.ModelUtils.FeatureType type)
public static boolean checkERFeatureSet(EntityReference er, boolean fix)
er - entity reference objectfix - flagpublic static Set<EntityFeature> findFeaturesAddedToSecond(PhysicalEntity first, PhysicalEntity second, boolean fix)
public static void normalizeGenerics(Model model)
model - biopax model to fixpublic static void addMissingEntityReference(Model model, SimplePhysicalEntity pe)
model - the BioPAX modelpe - a simple physical entity (that has neither entityReference nor memberPEs set)public static void replaceEquivalentFeatures(Model model)
model - to be fixedpublic static Set<String> getKeywords(BioPAXElement biopaxElement, int depth, Filter<DataPropertyEditor>... dataPropertyFilters)
biopaxElement - biopax objectdepth - greater or equals 0: 0 means use this object's
data properties only; 1 - add child's data properties, etc.;
(the meaning is slightly different from that of Fetcher.fetch(..) method)dataPropertyFilters - - biopax data property filters to optionally
either skip e.g. properties 'sequence', 'temperature',
or only accept 'term', 'comment', 'name', etc.public static Set<BioSource> getOrganisms(BioPAXElement biopaxElement)
biopaxElement - biopax objectpublic static Set<Provenance> getDatasources(BioPAXElement biopaxElement)
biopaxElement - a biopax objectpublic static Set<Pathway> getParentPathways(BioPAXElement biopaxElement)
biopaxElement - biopax objectpublic static void mergeEquivalentInteractions(Model model)
model - to edit/updatepublic static void mergeEquivalentPhysicalEntities(Model model)
model - to edit/updatepublic static String shortenUri(String xmlbase, String uri)
xmlbase - uri - public static void updateUri(Model model, BioPAXElement el, String newUri)
model - model (can be null; if the object in fact belongs to a model, the model will be inconsistent)el - biopax objectnewUri - URI - not null/empty URIpublic static void breakPathwayComponentCycle(Model model)
model - a model that contains Pathways; will be modified as the resultCopyright © 2017 BioPAX. All rights reserved.