|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.biopax.paxtools.controller.ModelUtils
public class ModelUtils
An advanced BioPAX utility class that implements several useful algorithms to extract root or child BioPAX elements, remove dangling, replace elements or identifiers, etc.
| Nested Class Summary | |
|---|---|
static class |
ModelUtils.RelationshipType
Controlled vocabulary terms for the RelationshipType CV to be added with auto-generated/inferred comments and/or relationship xrefs. |
| Field Summary | |
|---|---|
static java.lang.String |
BIOPAX_URI_PREFIX
|
static java.lang.String |
COMMENT_FOR_GENERATED
A comment (at least - prefix) to add to all generated objects |
| Constructor Summary | |
|---|---|
ModelUtils(Model model)
Constructor. |
|
| Method Summary | ||
|---|---|---|
java.util.Map<java.lang.Class<? extends BioPAXElement>,java.lang.Integer> |
generateClassMetrics()
|
|
void |
generateEntityOrganismXrefs()
Auto-generates organism relationship xrefs - for BioPAX entities that do not have such property (but their children do), such as of Interaction, Protein, Complex, DNA, Protein, etc. |
|
|
generateEntityProcessXrefs(java.lang.Class<T> processClass)
Creates "process" (membership) relationship xrefs for each child Entity if possible. |
|
static java.lang.String |
generateURIForXref(java.lang.String db,
java.lang.String id,
java.lang.Class<? extends Xref> type)
Builds a "normalized" RelationshipXref URI. |
|
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. |
|
java.util.Set<BioPAXElement> |
getAllChildrenAllowClones(BioPAXElement bpe,
Filter<PropertyEditor>... filters)
Collects all child BioPAX elements of a given BioPAX element (using the "tuned" Fetcher), although some of them
might have the same ID (are "clones" - for a purpose of due to a mistake) |
|
java.util.Set<java.lang.String> |
getByXref(java.util.Set<? extends Xref> xrefs,
java.lang.Class<? extends XReferrable> clazz)
This is a special (not always applicable) utility method. |
|
Model |
getDirectChildren(BioPAXElement bpe)
Gets direct children of a given BioPAX element and adds them to a new model. |
|
java.util.Set<BioPAXElement> |
getDirectChildrenAllowClones(BioPAXElement bpe)
Collects direct children of a given BioPAX element, although some of them might have the same ID (are "clones" - for a purpose of due to a mistake) |
|
Model |
getModel()
|
|
|
getObject(java.lang.String urn,
java.lang.Class<T> clazz)
|
|
|
getRootElements(java.lang.Class<T> filterClass)
Finds a subset of "root" BioPAX objects of specific class (incl. |
|
void |
inferPropertyFromParent(java.lang.String property,
java.lang.Class<? extends BioPAXElement>... forClasses)
For the current (internal) model, this method iteratively copies given property values from parent BioPAX elements to children. |
|
static java.lang.String |
relationshipTypeVocabularyUri(java.lang.String relationshipType)
Gets a URI for a special (internal, not standard, but useful) RelationshipTypeVocabulary, which can be used for such objects auto-generated by this class methods (also by any BioPAX reasoner/tool) |
|
void |
removeDependentsIfDangling(BioPAXElement parent)
Deletes (recursively from the current model) only those child elements that would become "dangling" (not a property value of anything) if the parent element were (or already was) removed from the model. |
|
|
removeObjectsIfDangling(java.lang.Class<T> clazz)
Iteratively removes dangling elements of given type, e.g., utility class, from current model. |
|
void |
replace(BioPAXElement existing,
BioPAXElement replacement)
Replaces an existing BioPAX element with another one, of the same or possibly equivalent type (or null), recursively updates all the references to it (parents' object properties). |
|
|
replace(java.util.Map<E,E> subs)
Replaces existing BioPAX elements with ones from the map, and recursively updates all the object references (parents' object properties) in a single pass. |
|
void |
replaceID(java.lang.String oldId,
java.lang.String newId)
Replaces the RDFId of the BioPAX element and in the current model. |
|
static java.lang.String |
uriPrefixForGeneratedXref(java.lang.Class<? extends Xref> clazz)
This is to consistently create URI prefixes for auto-generated/inferred Xref objects (except for PublicationXref, where creating of something like, e.g., 'urn:miriam:pubmed:' is recommended). |
|
Model |
writeRead()
Cuts the BioPAX model off other models and BioPAX objects by essentially performing write/read to/from OWL. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String COMMENT_FOR_GENERATED
public static final java.lang.String BIOPAX_URI_PREFIX
| Constructor Detail |
|---|
public ModelUtils(Model model)
model - | Method Detail |
|---|
public static java.lang.String uriPrefixForGeneratedXref(java.lang.Class<? extends Xref> clazz)
clazz -
public static java.lang.String relationshipTypeVocabularyUri(java.lang.String relationshipType)
relationshipType -
public void replace(BioPAXElement existing,
BioPAXElement replacement)
replace(Map) method
instead.
existing - replacement - public <E extends BioPAXElement> void replace(java.util.Map<E,E> subs)
Model.repair()
and removeObjectsIfDangling(Class) methods after all.
subs - public void removeDependentsIfDangling(BioPAXElement parent)
parent -
public void replaceID(java.lang.String oldId,
java.lang.String newId)
Model.repair() to fix.
The method replace(BioPAXElement, BioPAXElement)
is much safer but less efficient in special cases, such as when
one just needs to create/import one model, quickly update several or all
IDs, and save it to a file.
oldId - newId - public Model getModel()
public <T extends BioPAXElement> java.util.Set<T> getRootElements(java.lang.Class<T> filterClass)
filterClass -
public <T extends BioPAXElement> void removeObjectsIfDangling(java.lang.Class<T> clazz)
public void inferPropertyFromParent(java.lang.String property,
java.lang.Class<? extends BioPAXElement>... forClasses)
property - property nameforClasses - (optional) infer/set the property for these types onlyPropertyReasonerpublic Model writeRead()
java.io.IOException
public Model getAllChildren(BioPAXElement bpe,
Filter<PropertyEditor>... filters)
Fetcher) and adds them to a
new model.
bpe - filters - property filters (e.g., for Fetcher to skip some properties). Default is to skip 'nextStep'.
public Model getDirectChildren(BioPAXElement bpe)
bpe -
public java.util.Set<BioPAXElement> getAllChildrenAllowClones(BioPAXElement bpe,
Filter<PropertyEditor>... filters)
Fetcher), although some of them
might have the same ID (are "clones" - for a purpose of due to a mistake)
bpe - filters - property filters (e.g., for Fetcher to skip some properties). Default is to skip 'nextStep'.
public java.util.Set<BioPAXElement> getDirectChildrenAllowClones(BioPAXElement bpe)
bpe -
public <T extends Process> void generateEntityProcessXrefs(java.lang.Class<T> processClass)
Entity if possible.
This is Level3 specific.
For each child Entity of every process
(of the type given by the second argument), creates a
relationship xref with the following properties:
- db = provider (a name given by the second parameter)
- id = the rdfId (URI) of the parent process
- relationshipType = controlled vocabulary: "process" (MI:0359), urn:miriam:obo.mi:MI%3A0359
- comment = "Auto-generated by Paxtools" (also added to the CV and its unification xref)
T - processClass - to relate entities with an interaction/pathway of this typepublic void generateEntityOrganismXrefs()
SimplePhysicalEntity objects (from EntityReference objects),
except for smallmolecules.
2. infer organism information recursively via all children,
but only when children are also Entity objects (not utility classes)
(equivalently, this can be achieved by collecting all the children first,
though not visiting properties who's range is a sub-class of UtilityClass)
public static java.lang.String generateURIForXref(java.lang.String db,
java.lang.String id,
java.lang.Class<? extends Xref> type)
db - id - type - TODO
public java.util.Map<java.lang.Class<? extends BioPAXElement>,java.lang.Integer> generateClassMetrics()
public <T extends BioPAXElement> T getObject(java.lang.String urn,
java.lang.Class<T> clazz)
public java.util.Set<java.lang.String> getByXref(java.util.Set<? extends Xref> xrefs,
java.lang.Class<? extends XReferrable> clazz)
xrefs - clazz -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||