apollo.dataadapter.das.simple
Class SimpleDASAdapter

java.lang.Object
  extended by org.bdgp.io.AbstractDataAdapter
      extended by apollo.dataadapter.AbstractApolloAdapter
          extended by apollo.dataadapter.das.simple.SimpleDASAdapter
All Implemented Interfaces:
ApolloDataAdapterI, org.bdgp.io.DataAdapter, org.bdgp.io.VisualDataAdapter

public class SimpleDASAdapter
extends AbstractApolloAdapter

I implement a AbstractDataAdapter, allowing Apollo to get information from DAS datasources, using 'simple' implementions of DASServerI, DASDsn etc.

My whole reason-for-being is to have a das-reading adapter which doesn't rely on a big external codebase (e.g. omnigene or biojava).


Field Summary
 
Fields inherited from class apollo.dataadapter.AbstractApolloAdapter
curation_set, logger, region, style
 
Fields inherited from class org.bdgp.io.AbstractDataAdapter
listeners
 
Fields inherited from interface apollo.dataadapter.ApolloDataAdapterI
OP_APPEND_DATA, OP_READ_DATA, OP_READ_RAW_ANALYSIS, OP_READ_SEQUENCE, OP_WRITE_DATA
 
Constructor Summary
SimpleDASAdapter()
           
 
Method Summary
 void clearStateInformation()
          This SHOULD reset all the contents of the stateInformation being held by an adapter: with setStateInformation, this is not guaranteed.
 void commitChanges(CurationSet curationSet)
          writes the changes from a featureChangeLog to a writeable datasource.
 StrandedFeatureSetI getAnalysisRegion(CurationSet curation)
           Make a call to the chosen DSN, passing in the chosen segment/range into a das "features" command.
 FeatureSetI getAnnotatedRegion()
           
 CurationSet getCurationSet()
          returns a saved CurationSet.
 DASServerI getDASServer()
           
 DASDsn getDSN()
           
 java.lang.String getInput()
          Returns the input String passed to the DataAdapter, the input is of course associated with the input type Should this go into org.bdgp.io.DataAdapter?
 DataInputType getInputType()
          Returns the type of input data (gene,file,band...)
 java.lang.String getName()
          Name label for use in Data Adapter Chooser.
 java.lang.String getRawAnalysisResults(java.lang.String id)
           
 SequenceI getSequence(DbXref dbxref)
          The dbxref passed into this argument is only checked to make sure that the the IdValue it contains is the same as the Id for the DASSegment that this adapter is poised on.
 SequenceI getSequence(DbXref dbxref, int start, int end)
           
 SequenceI getSequence(java.lang.String id)
          Strings for input types
 java.util.Vector getSequences(DbXref[] dbxref)
           
 java.util.Vector getSequences(DbXref[] dbxref, int[] start, int[] end)
           
 java.util.Properties getStateInformation()
          The adapter is characterised by dsn (e.g.
 org.bdgp.io.IOOperation[] getSupportedOperations()
          Returns a list of all operations supported by this data adapter
 java.lang.String getType()
          From org.bdgp.io.DataAdapter.
 org.bdgp.io.DataAdapterUI getUI(org.bdgp.io.IOOperation op)
          Returns a user interface for the requested IOOperation.
 void init()
          From org.bdgp.io.DataAdapter interface.
 void setDASServer(DASServerI newValue)
           
 void setRegion(java.lang.String region)
          This string is used when the user navigates around the genome - it should contain both the new segment and high/low information.
 void setStateInformation(java.util.Properties newProperties)
          With the following keys in the adapter properties, we can re-create a our internal state and start a new das-call.
 void validateStateInformation()
           
 
Methods inherited from class apollo.dataadapter.AbstractApolloAdapter
addToCurationSet, cacheUI, canWriteData, clearOldData, commitChanges, commitChanges, commitChanges, commitChanges, commitChanges, getAdapters, getCachedUI, getChildAdapter, getChildAdapter, getCurationState, getDatabase, getDataInput, getDefaultStyle, getFilename, getNameAdapter, getNumberOfChildAdapters, getSpecies, getStyle, hasLinkData, isComposite, loadNewSpeciesFromLink, operationIsSupported, rollbackAnnotations, rollbackAnnotations, setCuration, setCurationNumber, setCurationState, setDatabase, setDataInput, setDataLoadListener, setInput, setInputType, setLocation, setName, setPadLeft, setPadRight, setSpecies, setStyle
 
Methods inherited from class org.bdgp.io.AbstractDataAdapter
addProgressListener, fireProgressEvent, removeProgressListener, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.bdgp.io.VisualDataAdapter
addProgressListener, fireProgressEvent, removeProgressListener
 

Constructor Detail

SimpleDASAdapter

public SimpleDASAdapter()
Method Detail

getDASServer

public DASServerI getDASServer()

setDASServer

public void setDASServer(DASServerI newValue)

init

public void init()
Description copied from class: AbstractApolloAdapter
From org.bdgp.io.DataAdapter interface. no-op default implementation. A data adapter should override this if it needs to do some initialization.

Specified by:
init in interface org.bdgp.io.DataAdapter
Overrides:
init in class AbstractApolloAdapter

getDSN

public DASDsn getDSN()

getName

public java.lang.String getName()
Description copied from class: AbstractApolloAdapter
Name label for use in Data Adapter Chooser. Don't override this method--call setName from your constructor.

Specified by:
getName in interface org.bdgp.io.DataAdapter
Overrides:
getName in class AbstractApolloAdapter

getType

public java.lang.String getType()
Description copied from class: AbstractApolloAdapter
From org.bdgp.io.DataAdapter. Default implementation returns "". Override this to return a string describing the data adapter. The reason for the default implementation is that as far as I can tell getType is not used by apollo nor org.bdgp, so seems silly to require it. Am i missing something?

Specified by:
getType in interface org.bdgp.io.DataAdapter
Overrides:
getType in class AbstractApolloAdapter

getInputType

public DataInputType getInputType()
Description copied from class: AbstractApolloAdapter
Returns the type of input data (gene,file,band...)

Specified by:
getInputType in interface ApolloDataAdapterI
Overrides:
getInputType in class AbstractApolloAdapter
See Also:
Should this go into org.bdgp.io.DataAdapter?

getInput

public java.lang.String getInput()
Description copied from class: AbstractApolloAdapter
Returns the input String passed to the DataAdapter, the input is of course associated with the input type Should this go into org.bdgp.io.DataAdapter?

Specified by:
getInput in interface ApolloDataAdapterI
Overrides:
getInput in class AbstractApolloAdapter

getSupportedOperations

public org.bdgp.io.IOOperation[] getSupportedOperations()
Description copied from interface: org.bdgp.io.DataAdapter
Returns a list of all operations supported by this data adapter


getUI

public org.bdgp.io.DataAdapterUI getUI(org.bdgp.io.IOOperation op)
Description copied from interface: org.bdgp.io.VisualDataAdapter
Returns a user interface for the requested IOOperation. Most VisualDataAdapters will return a different user interface for each supported IOOperation.


setRegion

public void setRegion(java.lang.String region)
               throws ApolloAdapterException
This string is used when the user navigates around the genome - it should contain both the new segment and high/low information. Armed with this, we can set the DASSegment in this data adapter. The new data is set into the adapter with two calls: setStateInformation (copying in the "old" state of the adapter and then setRegion (copying in the new choices of region into the adapter).

Specified by:
setRegion in interface ApolloDataAdapterI
Overrides:
setRegion in class AbstractApolloAdapter
Throws:
ApolloAdapterException

getStateInformation

public java.util.Properties getStateInformation()
The adapter is characterised by dsn (e.g. http://url/.../entry_point) and segment (e.g. chr=1, start=... stop=....) With this information we can make a das-call. So we write this information out in entirety.

Specified by:
getStateInformation in interface ApolloDataAdapterI
Overrides:
getStateInformation in class AbstractApolloAdapter

setStateInformation

public void setStateInformation(java.util.Properties newProperties)

With the following keys in the adapter properties, we can re-create a our internal state and start a new das-call.

Specified by:
setStateInformation in interface ApolloDataAdapterI
Overrides:
setStateInformation in class AbstractApolloAdapter

getCurationSet

public CurationSet getCurationSet()
                           throws ApolloAdapterException
Description copied from interface: ApolloDataAdapterI
returns a saved CurationSet.

Specified by:
getCurationSet in interface ApolloDataAdapterI
Overrides:
getCurationSet in class AbstractApolloAdapter
Throws:
ApolloAdapterException

getAnalysisRegion

public StrandedFeatureSetI getAnalysisRegion(CurationSet curation)
                                      throws ApolloAdapterException

Make a call to the chosen DSN, passing in the chosen segment/range into a das "features" command. Parse the result into a nested heirarchy of FeatureSets.

Level 1 - StrandedFeatureSet. Common parent to all lower level sets

Level 2 - FeatureSets keyed by Method Name and Feature Type

Level 3 - FeatureSets for the parent Method and Type, keyed by GroupId, containing max score within group, and having handles to aligned sequences

Level 4 - FeaturePairs for the parent Group, containing start, end, target start, target end.

Throws:
ApolloAdapterException

getAnnotatedRegion

public FeatureSetI getAnnotatedRegion()
                               throws ApolloAdapterException
Throws:
ApolloAdapterException

getSequence

public SequenceI getSequence(java.lang.String id)
                      throws ApolloAdapterException
Description copied from interface: ApolloDataAdapterI
Strings for input types

Specified by:
getSequence in interface ApolloDataAdapterI
Overrides:
getSequence in class AbstractApolloAdapter
Throws:
ApolloAdapterException

getSequence

public SequenceI getSequence(DbXref dbxref)
                      throws ApolloAdapterException

The dbxref passed into this argument is only checked to make sure that the the IdValue it contains is the same as the Id for the DASSegment that this adapter is poised on. The range etc passed into the lazy sequence are determined by the Segment that this adapter already has stored on it.

Note carefully: the sequence should NOT be fetched from the DASServer and DASDSN set on this adapter: that Server/DSN may not be a reference server. Instead, we must to go to the server and DSN referenced by the 'MapMaster' - this points to the URL of the reference server, which will have the raw sequence.

Specified by:
getSequence in interface ApolloDataAdapterI
Overrides:
getSequence in class AbstractApolloAdapter
Throws:
ApolloAdapterException

getSequence

public SequenceI getSequence(DbXref dbxref,
                             int start,
                             int end)
                      throws ApolloAdapterException
Specified by:
getSequence in interface ApolloDataAdapterI
Overrides:
getSequence in class AbstractApolloAdapter
Throws:
ApolloAdapterException

getSequences

public java.util.Vector getSequences(DbXref[] dbxref)
                              throws ApolloAdapterException
Specified by:
getSequences in interface ApolloDataAdapterI
Overrides:
getSequences in class AbstractApolloAdapter
Throws:
ApolloAdapterException

getSequences

public java.util.Vector getSequences(DbXref[] dbxref,
                                     int[] start,
                                     int[] end)
                              throws ApolloAdapterException
Specified by:
getSequences in interface ApolloDataAdapterI
Overrides:
getSequences in class AbstractApolloAdapter
Throws:
ApolloAdapterException

commitChanges

public void commitChanges(CurationSet curationSet)
                   throws ApolloAdapterException
Description copied from interface: ApolloDataAdapterI
writes the changes from a featureChangeLog to a writeable datasource. Not just a featureChangeLog - this writes out the whole curationSet

Specified by:
commitChanges in interface ApolloDataAdapterI
Overrides:
commitChanges in class AbstractApolloAdapter
Throws:
ApolloAdapterException

getRawAnalysisResults

public java.lang.String getRawAnalysisResults(java.lang.String id)
                                       throws ApolloAdapterException
Specified by:
getRawAnalysisResults in interface ApolloDataAdapterI
Overrides:
getRawAnalysisResults in class AbstractApolloAdapter
Throws:
ApolloAdapterException

clearStateInformation

public void clearStateInformation()
Description copied from class: AbstractApolloAdapter
This SHOULD reset all the contents of the stateInformation being held by an adapter: with setStateInformation, this is not guaranteed.

Overrides:
clearStateInformation in class AbstractApolloAdapter

validateStateInformation

public void validateStateInformation()