Package de.isas.mztab2.cvmapping
Class CvParameterLookupService
- java.lang.Object
-
- de.isas.mztab2.cvmapping.CvParameterLookupService
-
public class CvParameterLookupService extends Object
Abstraction over OLSClient to autoconvert Terms to Parameters and to allow easy matching of Parameters against parent terms and their children.- Author:
- nilshoffmann
-
-
Constructor Summary
Constructors Constructor Description CvParameterLookupService()
Create a new instance of the lookup service with default OLS configuration.CvParameterLookupService(uk.ac.ebi.pride.utilities.ols.web.service.client.OLSClient client)
Create a new instance of the lookup service with a custom OLSClient.CvParameterLookupService(uk.ac.ebi.pride.utilities.ols.web.service.config.OLSWsConfig config)
Create a new instance of the lookup service with a custom OLSWsConfig configuration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearCaches()
Clears all query result caches (parent and child).ParameterComparisonResult
isChildOfOrSame(Parameter parent, Parameter potentialChild)
Compares two parameters for their parent to child relationship.List<Parameter>
resolveChildren(Parameter parameter)
Resolve all children of a parameter up to an arbitrary depth.List<Parameter>
resolveChildren(Parameter parameter, int levels)
Resolve all children of a parameter up to a given maximum depth (1 meaning immediate children, -1 meaning all).List<Parameter>
resolveParents(Parameter parameter)
Resolve all parents of parameter up to an arbitrary depth (actually height, since we go from bottom to top).List<Parameter>
resolveParents(Parameter parameter, int levels)
Resolve all parents of a parameter up to a given maximum depth (1 meaning the immediate parents, -1 meaning all).
-
-
-
Constructor Detail
-
CvParameterLookupService
public CvParameterLookupService()
Create a new instance of the lookup service with default OLS configuration.
-
CvParameterLookupService
public CvParameterLookupService(uk.ac.ebi.pride.utilities.ols.web.service.client.OLSClient client)
Create a new instance of the lookup service with a custom OLSClient.- Parameters:
client
- the custom OLS client
-
CvParameterLookupService
public CvParameterLookupService(uk.ac.ebi.pride.utilities.ols.web.service.config.OLSWsConfig config)
Create a new instance of the lookup service with a custom OLSWsConfig configuration.- Parameters:
config
- the custom configuration
-
-
Method Detail
-
clearCaches
public void clearCaches()
Clears all query result caches (parent and child).
-
resolveParents
public List<Parameter> resolveParents(Parameter parameter) throws org.springframework.web.client.HttpClientErrorException
Resolve all parents of parameter up to an arbitrary depth (actually height, since we go from bottom to top). Use at your own risk, the OLS service may terminate your connection if the response is too large or takes too long.- Parameters:
parameter
- the parameter to start from- Returns:
- a list of all parent parameters for the given parameter
- Throws:
org.springframework.web.client.HttpClientErrorException
- on http related errors
-
resolveParents
public List<Parameter> resolveParents(Parameter parameter, int levels) throws org.springframework.web.client.HttpClientErrorException
Resolve all parents of a parameter up to a given maximum depth (1 meaning the immediate parents, -1 meaning all).- Parameters:
parameter
- the parameter to start fromlevels
- maximum levels to query- Returns:
- a list of all parent parameters for the given parameter
- Throws:
org.springframework.web.client.HttpClientErrorException
- on http related errors
-
resolveChildren
public List<Parameter> resolveChildren(Parameter parameter, int levels) throws org.springframework.web.client.HttpClientErrorException
Resolve all children of a parameter up to a given maximum depth (1 meaning immediate children, -1 meaning all).- Parameters:
parameter
- the parameter to start fromlevels
- maximum levels to query- Returns:
- a list of all child parameters for the given parameter
- Throws:
org.springframework.web.client.HttpClientErrorException
- on http related errors
-
resolveChildren
public List<Parameter> resolveChildren(Parameter parameter) throws org.springframework.web.client.HttpClientErrorException
Resolve all children of a parameter up to an arbitrary depth. Use at your own risk, the OLS service may terminate your connection if the response is too large or takes too long.- Parameters:
parameter
- the parameter to start from- Returns:
- a list of all child parameters for the given parameter
- Throws:
org.springframework.web.client.HttpClientErrorException
- on http related errors
-
isChildOfOrSame
public ParameterComparisonResult isChildOfOrSame(Parameter parent, Parameter potentialChild) throws org.springframework.web.client.HttpClientErrorException
Compares two parameters for their parent to child relationship. The result can be one of: IDENTICAL, if parent and potential child are the same node, CHILD_OF, if potentialChild is a child of parent (at least 1 level away), or NOT_RELATED, if there is no path from child to parent.- Parameters:
parent
- the parent term to start frompotentialChild
- the potential child term to check against parent- Returns:
- the comparison result
- Throws:
org.springframework.web.client.HttpClientErrorException
- on http related errors
-
-