public final class ModelUtils extends Object
Modifier and Type | Method and Description |
---|---|
static void |
addPathwayAnnotations(Model model,
boolean directParentsOnly,
Class<? extends BioPAXElement>... types)
Given BioPAX model, for each BioPAX object of the listed classes and their sub-classes,
such as e.g.
|
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 void |
copySimplePointers(Model model,
Named source,
Named target)
Copies names and xrefs from source to target
biopax object; it does not copy unification xrefs
but instead adds relationship xrefs using the same
db and id values as source's unification xrefs.
|
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 other 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)
Gets all the child BioPAX elements of a given BioPAX element
(using the "tuned"
Fetcher ) and adds them to a
new model. |
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.
|
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 void |
resolveFeatures(Model model)
TODO annotate or deprecate...
|
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
) 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 copySimplePointers(Model model, Named source, Named target)
model
- the biopax model where the source and target objects belongsource
- fromtarget
- topublic static void resolveFeatures(Model model)
model
- biopax model to editpublic 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 addPathwayAnnotations(Model model, boolean directParentsOnly, Class<? extends BioPAXElement>... types)
model
- BioPAX modeldirectParentsOnly
- use only direct or nearest parent (sub-)pathways of a BioPAX object in the annotationtypes
- optional list of BioPAX types to annotate); default: BioPAXElement.class (i.e., everything)public static void mergeEquivalentInteractions(Model model)
model
- to edit/updateCopyright © 2015 BioPAX. All rights reserved.