apollo.dataadapter.gamexml
Class GAMEAdapter

java.lang.Object
  extended by org.bdgp.io.AbstractDataAdapter
      extended by apollo.dataadapter.AbstractApolloAdapter
          extended by apollo.dataadapter.gamexml.GAMEAdapter
All Implemented Interfaces:
ApolloDataAdapterI, org.bdgp.io.DataAdapter, org.bdgp.io.VisualDataAdapter
Direct Known Subclasses:
FlyGAMEAdapter

public class GAMEAdapter
extends AbstractApolloAdapter

Reader for GAME XML files. WARNING -- AElfred (and other SAX drivers) _may_ break large stretches of unmarked content into smaller chunks and call characters() for each smaller chunk CURRENT IMPLEMENTATION DOES NOT DEAL WITH THIS COULD CAUSE PROBLEM WHEN READING IN SEQUENCE RESIDUES haven't seen a problem yet though -- GAH 6-15-98 GAMEAdapter is presently not a singleton. There is separate instances for synteny and non-synteny/one-species. This may change in future.


Field Summary
protected static org.apache.log4j.Logger logger
           
protected  boolean NO_GUI
           
 
Fields inherited from class apollo.dataadapter.AbstractApolloAdapter
curation_set, 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
GAMEAdapter()
           
GAMEAdapter(DataInputType inputType, java.lang.String input)
           
GAMEAdapter(DataInputType inputType, java.lang.String input, boolean noGUI)
           
 
Method Summary
 java.lang.Boolean addToCurationSet()
          Called if user is layering additional GAME data on top of whatever's already been loaded
 void commitChanges(CurationSet curation)
          writes the changes from a featureChangeLog to a writeable datasource.
 void commitChanges(CurationSet curation, boolean saveAnnots, boolean saveResults)
          Writes XML If the input type is not FILE, prompts user for a file to save to.
 java.lang.String fillInDatabase(java.lang.String urlString)
          Replace %DATABASE% field with selected database.
 java.lang.String fillInPadding(java.lang.String urlString)
          Replace %PadLeft/Right% with pad ints
 CurationSet getCurationSet()
          from ApolloDataAdapterI interface.
 java.lang.String getDatabase()
           
 DataInput getDataInput()
          if file starts with http: then its really an url so correct the type bug fix for being able to load urls from file adapter and with -x
 java.util.Properties getStateInformation()
          State info Properties carries all the info needed for the adapter to do its query This is an alternative to setDataInput.
 org.bdgp.io.IOOperation[] getSupportedOperations()
          Returns a list of all operations supported by this data adapter
 java.lang.String getType()
          org.bdgp.io.DataAdapter method
 org.bdgp.io.DataAdapterUI getUI(org.bdgp.io.IOOperation op)
          Returns a user interface for the requested IOOperation.
 boolean hasLinkData()
          Returns true as game data contains link data that can be used by synteny
 void init()
          From org.bdgp.io.DataAdapter interface.
static void main(java.lang.String[] args)
          Tests all the input types - can enter filename as arg
 java.net.URL makeUrlFromString(java.lang.String urlString)
          make URL from urlString, replace %DATABASE% with selected database
 void setName(java.lang.String nameForReading)
           
 void setOriginalFilename(java.lang.String file)
          Save original file name so that if we save the data we can access the header info from the original file; and also so we can save the file name as a comment.
 void setPadLeft(int padLeft)
          Request to "pad" the input padLeft basepairs to the left(5' forward strand) - Could do this in AbstractApolloAdapter but only game adapter needs this now
 void setPadRight(int padRight)
          Request to "pad" the input padRight basepairs to the right(3' forward strand)
 void setRegion(SequenceI seq)
           
static void setSeqDescription(SequenceI seq, java.lang.String description, java.lang.String seq_id)
          Given a FASTA-style header line, set the sequence's description and extract the date.
 void setStateInformation(java.util.Properties props)
          DataLoader calls this.
 
Methods inherited from class apollo.dataadapter.AbstractApolloAdapter
cacheUI, canWriteData, clearOldData, clearStateInformation, commitChanges, commitChanges, commitChanges, commitChanges, getAdapters, getCachedUI, getChildAdapter, getChildAdapter, getCurationState, getDefaultStyle, getFilename, getInput, getInputType, getName, getNameAdapter, getNumberOfChildAdapters, getRawAnalysisResults, getSequence, getSequence, getSequence, getSequences, getSequences, getSpecies, getStyle, isComposite, loadNewSpeciesFromLink, operationIsSupported, rollbackAnnotations, rollbackAnnotations, setCuration, setCurationNumber, setCurationState, setDatabase, setDataInput, setDataLoadListener, setInput, setInputType, setLocation, setRegion, 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
 

Field Detail

logger

protected static final org.apache.log4j.Logger logger

NO_GUI

protected boolean NO_GUI
Constructor Detail

GAMEAdapter

public GAMEAdapter()

GAMEAdapter

public GAMEAdapter(DataInputType inputType,
                   java.lang.String input)

GAMEAdapter

public GAMEAdapter(DataInputType inputType,
                   java.lang.String input,
                   boolean noGUI)
Method Detail

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

getType

public java.lang.String getType()
org.bdgp.io.DataAdapter method

Specified by:
getType in interface org.bdgp.io.DataAdapter
Overrides:
getType 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


setName

public void setName(java.lang.String nameForReading)
Overrides:
setName in class AbstractApolloAdapter

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.


setPadLeft

public void setPadLeft(int padLeft)
Request to "pad" the input padLeft basepairs to the left(5' forward strand) - Could do this in AbstractApolloAdapter but only game adapter needs this now

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

setPadRight

public void setPadRight(int padRight)
Request to "pad" the input padRight basepairs to the right(3' forward strand)

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

getStateInformation

public java.util.Properties getStateInformation()
Description copied from interface: ApolloDataAdapterI
State info Properties carries all the info needed for the adapter to do its query This is an alternative to setDataInput. For most cases setDataInput should be sufficient. This should return StateInformation

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

setStateInformation

public void setStateInformation(java.util.Properties props)
DataLoader calls this. input, inputType and optionally database set here. MovementPanel(nav bar) sets db to default db (it has no db chooser)

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

setRegion

public void setRegion(SequenceI seq)
               throws ApolloAdapterException
Throws:
ApolloAdapterException

hasLinkData

public boolean hasLinkData()
Returns true as game data contains link data that can be used by synteny

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

setOriginalFilename

public void setOriginalFilename(java.lang.String file)
Save original file name so that if we save the data we can access the header info from the original file; and also so we can save the file name as a comment.


main

public static void main(java.lang.String[] args)
                 throws ApolloAdapterException
Tests all the input types - can enter filename as arg

Throws:
ApolloAdapterException

commitChanges

public void commitChanges(CurationSet curation)
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

commitChanges

public void commitChanges(CurationSet curation,
                          boolean saveAnnots,
                          boolean saveResults)
Writes XML If the input type is not FILE, prompts user for a file to save to.

Overrides:
commitChanges in class AbstractApolloAdapter

getDataInput

public DataInput getDataInput()
if file starts with http: then its really an url so correct the type bug fix for being able to load urls from file adapter and with -x

Overrides:
getDataInput in class AbstractApolloAdapter

getCurationSet

public CurationSet getCurationSet()
                           throws ApolloAdapterException
from ApolloDataAdapterI interface. dataInput should be set previous to this

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

addToCurationSet

public java.lang.Boolean addToCurationSet()
                                   throws ApolloAdapterException
Called if user is layering additional GAME data on top of whatever's already been loaded

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

makeUrlFromString

public java.net.URL makeUrlFromString(java.lang.String urlString)
make URL from urlString, replace %DATABASE% with selected database


fillInDatabase

public java.lang.String fillInDatabase(java.lang.String urlString)
Replace %DATABASE% field with selected database. Note: some of this is FlyBase-specific!


getDatabase

public java.lang.String getDatabase()
Overrides:
getDatabase in class AbstractApolloAdapter

fillInPadding

public java.lang.String fillInPadding(java.lang.String urlString)
Replace %PadLeft/Right% with pad ints


setSeqDescription

public static void setSeqDescription(SequenceI seq,
                                     java.lang.String description,
                                     java.lang.String seq_id)
Given a FASTA-style header line, set the sequence's description and extract the date. For fly sequences, the expected format of the header line is >gi||gb|AB003910|AB003910 Fruitfly DNA for 88F actin, complete cds. (08-JUN-1999) Date is that thing at the end, obviously. Another format we see sometimes is RE70410.5prime BI486922 [similar by BLASTN (3.2e-110) to l(3)82Fd "FBan0010199 GO:[] located on: 3R 82F8-82F10;" 05/17/2001] Using the expected dateFormat (defined in DateUtil) parse the date string and return it as a Date object.