Package org.bridgedb.file
Class IDMappingReaderFromDelimitedReader
- java.lang.Object
-
- org.bridgedb.file.IDMappingReaderFromDelimitedReader
-
- All Implemented Interfaces:
IDMappingReader
- Direct Known Subclasses:
IDMappingReaderFromText
public class IDMappingReaderFromDelimitedReader extends Object implements IDMappingReader
Class for reading ID mapping data from delimited reader.- Author:
- gjj
-
-
Field Summary
Fields Modifier and Type Field Description protected booleandsValidprotected booleanidMappingValidprotected StringregExDataSourceDelimiterprotected StringregExIDDelimiter
-
Constructor Summary
Constructors Constructor Description IDMappingReaderFromDelimitedReader(Reader reader, String regExDataSourceDelimiter, String regExIDDelimiter, boolean transitivity)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddIDMapping(Set<Xref> xrefs)Add matched references.Set<DataSource>getDataSources()GetDataSources from the file.Map<Xref,Set<Xref>>getIDMappings()GetXrefs from the file.booleangetTransitivity()Get transitivity support.protected voidreadData(Reader reader)Read data.protected voidreadDataSources()ReadDataSources from the reader.protected voidreadIDMappings()Read ID mappings from the reader.voidsetDataSources(List<DataSource> dataSources)SetDataSources.voidsetTransitivity(boolean transitivity)Set transitivity support.
-
-
-
Constructor Detail
-
IDMappingReaderFromDelimitedReader
public IDMappingReaderFromDelimitedReader(Reader reader, String regExDataSourceDelimiter, String regExIDDelimiter, boolean transitivity) throws IDMapperException
- Parameters:
reader- aReaderregExDataSourceDelimiter- regular expression of delimiter between data sourcesregExIDDelimiter- regular expression of delimiter between IDstransitivity- transitivity support- Throws:
IDMapperException- if failed to read
-
-
Method Detail
-
readData
protected void readData(Reader reader) throws IDMapperException
Read data.- Parameters:
reader- to read data from- Throws:
IDMapperException- when file can't be read
-
setTransitivity
public void setTransitivity(boolean transitivity)
Set transitivity support.- Parameters:
transitivity- support transitivity if true.
-
getTransitivity
public boolean getTransitivity()
Get transitivity support.- Returns:
- true if support transitivity; false otherwise.
-
setDataSources
public void setDataSources(List<DataSource> dataSources)
SetDataSources. This will override the data sources read from the delimited reader.- Parameters:
dataSources-DataSources
-
getDataSources
public Set<DataSource> getDataSources() throws IDMapperException
GetDataSources from the file.- Specified by:
getDataSourcesin interfaceIDMappingReader- Returns:
DataSources from the file- Throws:
IDMapperException- if failed to read the file
-
getIDMappings
public Map<Xref,Set<Xref>> getIDMappings() throws IDMapperException
GetXrefs from the file.- Specified by:
getIDMappingsin interfaceIDMappingReader- Returns:
- Map from a
Xrefto theSetof all its matched Xref. - Throws:
IDMapperException- if failed to read the file
-
readDataSources
protected void readDataSources() throws IOExceptionReadDataSources from the reader.- Throws:
IOException- on failing to read file
-
readIDMappings
protected void readIDMappings() throws IOExceptionRead ID mappings from the reader.- Throws:
IOException- on file read error
-
-