Revision 423M

org.bridgedb.file
Class IDMappingReaderFromDelimitedReader

java.lang.Object
  extended by org.bridgedb.file.IDMappingReaderFromDelimitedReader
All Implemented Interfaces:
IDMappingReader
Direct Known Subclasses:
IDMappingReaderFromText

public class IDMappingReaderFromDelimitedReader
extends java.lang.Object
implements IDMappingReader

Class for reading ID mapping data from delimited reader.

Author:
gjj

Field Summary
protected  boolean dsValid
           
protected  boolean idMappingValid
           
protected  java.lang.String regExDataSourceDelimiter
           
protected  java.lang.String regExIDDelimiter
           
 
Constructor Summary
IDMappingReaderFromDelimitedReader(java.io.Reader reader, java.lang.String regExDataSourceDelimiter, java.lang.String regExIDDelimiter, boolean transitivity)
           
 
Method Summary
protected  void addIDMapping(java.util.Set<Xref> xrefs)
          Add matched references.
 java.util.Set<DataSource> getDataSources()
          Get DataSources from the file.
 java.util.Map<Xref,java.util.Set<Xref>> getIDMappings()
          Get Xrefs from the file.
 boolean getTransitivity()
          Get transitivity support.
protected  void readData(java.io.Reader reader)
          Read data.
protected  void readDataSources()
          Read DataSources from the reader.
protected  void readIDMappings()
          Read ID mappings from the reader.
 void setDataSources(java.util.List<DataSource> dataSources)
          Set DataSources.
 void setTransitivity(boolean transitivity)
          Set transitivity support.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

regExDataSourceDelimiter

protected java.lang.String regExDataSourceDelimiter

regExIDDelimiter

protected java.lang.String regExIDDelimiter

dsValid

protected boolean dsValid

idMappingValid

protected boolean idMappingValid
Constructor Detail

IDMappingReaderFromDelimitedReader

public IDMappingReaderFromDelimitedReader(java.io.Reader reader,
                                          java.lang.String regExDataSourceDelimiter,
                                          java.lang.String regExIDDelimiter,
                                          boolean transitivity)
                                   throws IDMapperException
Parameters:
reader - a Reader
regExDataSourceDelimiter - regular expression of delimiter between data sources
regExIDDelimiter - regular expression of delimiter between IDs
transitivity - transitivity support
Throws:
IDMapperException - if failed to read
Method Detail

readData

protected void readData(java.io.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(java.util.List<DataSource> dataSources)
Set DataSources. This will override the data sources read from the delimited reader.

Parameters:
dataSources - DataSources

getDataSources

public java.util.Set<DataSource> getDataSources()
                                         throws IDMapperException
Get DataSources from the file.

Specified by:
getDataSources in interface IDMappingReader
Returns:
DataSources from the file
Throws:
IDMapperException - if failed to read the file

getIDMappings

public java.util.Map<Xref,java.util.Set<Xref>> getIDMappings()
                                                      throws IDMapperException
Get Xrefs from the file.

Specified by:
getIDMappings in interface IDMappingReader
Returns:
Map from a Xref to the Set of all its matched Xref.
Throws:
IDMapperException - if failed to read the file

readDataSources

protected void readDataSources()
                        throws java.io.IOException
Read DataSources from the reader.

Throws:
java.io.IOException - on failing to read file

readIDMappings

protected void readIDMappings()
                       throws java.io.IOException
Read ID mappings from the reader.

Throws:
java.io.IOException - on file read error

addIDMapping

protected void addIDMapping(java.util.Set<Xref> xrefs)
Add matched references.

Parameters:
xrefs - matched references

Generated July 29 2010