org.intermine.bio.dataconversion
Class BioDBConverter

java.lang.Object
  extended by org.intermine.dataconversion.DataConverter
      extended by org.intermine.dataconversion.DBConverter
          extended by org.intermine.bio.dataconversion.BioDBConverter
Direct Known Subclasses:
ChadoDBConverter

public abstract class BioDBConverter
extends DBConverter

A DBConverter with helper methods for bio sources.


Constructor Summary
BioDBConverter(Database database, Model tgtModel, ItemWriter writer)
          Create a new BioDBConverter object.
BioDBConverter(Database database, Model tgtModel, ItemWriter writer, java.lang.String dataSourceName, java.lang.String dataSetTitle)
          Create a new BioDBConverter object.
 
Method Summary
 Item createSynonym(java.lang.String subjectId, java.lang.String value, boolean store)
          Create a new Synonym.
protected  Item getChromosome(java.lang.String identifier, int taxonId)
          Make a Chromosome Item, then store and return it.
 Item getDataSetItem(int taxonId)
          Return the DataSet Item created from the dataSetTitle.
 Item getDataSetItem(java.lang.String title, Item dataSourceItem)
          Return a DataSource item for the given name
 Item getDataSetItem(java.lang.String title, java.lang.String url, java.lang.String description, Item dataSourceItem)
          Return a DataSource item with the given details.
abstract  java.lang.String getDataSetTitle(int taxonId)
          Return the DataSet title for a given taxon id.
 Item getDataSourceItem()
          Return the DataSource Item created from the dataSourceName.
 Item getDataSourceItem(java.lang.String name)
          Return a DataSet item for the given title
 java.lang.String getDataSourceName()
          Return the data source name set by setDataSourceName().
 Item getOrganismItem(int taxonId)
          The Organism item created from the taxon id passed to the constructor.
 java.lang.String getSequenceOntologyRefId()
           
protected  Item makeLocation(java.lang.String chromosomeId, java.lang.String locatedSequenceFeatureId, int start, int end, int strand, int taxonId)
          Make a Location Relation between a LocatedSequenceFeature and a Chromosome.
 void setDataSourceName(java.lang.String name)
          Set the name of the DataSource Item to create for this converter.
 
Methods inherited from class org.intermine.dataconversion.DBConverter
getDatabase, process
 
Methods inherited from class org.intermine.dataconversion.DataConverter
addUniqueItemId, alias, createItem, getItemWriter, getModel, getUniqueItemId, newId, setStoreHook, store, store, store, store, store
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BioDBConverter

public BioDBConverter(Database database,
                      Model tgtModel,
                      ItemWriter writer,
                      java.lang.String dataSourceName,
                      java.lang.String dataSetTitle)
Create a new BioDBConverter object. The constructor will automatically create a DataConverterStoreHook for this converter that sets DataSet references and collections.

Parameters:
database - the database to read from
tgtModel - the Model used by the object store we will write to with the ItemWriter
writer - an ItemWriter used to handle the resultant Items
dataSourceName - the DataSource name
dataSetTitle - the DataSet title

BioDBConverter

public BioDBConverter(Database database,
                      Model tgtModel,
                      ItemWriter writer)
Create a new BioDBConverter object. The constructor will automatically create a DataConverterStoreHook for this converter that sets DataSet references and collections.

Parameters:
database - the database to read from
tgtModel - the Model used by the object store we will write to with the ItemWriter
writer - an ItemWriter used to handle the resultant Items
Method Detail

setDataSourceName

public void setDataSourceName(java.lang.String name)
Set the name of the DataSource Item to create for this converter.

Parameters:
name - the name

getDataSourceName

public java.lang.String getDataSourceName()
Return the data source name set by setDataSourceName().

Returns:
the data source name

getDataSetItem

public Item getDataSetItem(int taxonId)
Return the DataSet Item created from the dataSetTitle.

Parameters:
taxonId - the taxon id of the to use when creating the DataSet
Returns:
the DataSet Item

getDataSourceItem

public Item getDataSourceItem()
Return the DataSource Item created from the dataSourceName.

Returns:
the DataSource Item

makeLocation

protected Item makeLocation(java.lang.String chromosomeId,
                            java.lang.String locatedSequenceFeatureId,
                            int start,
                            int end,
                            int strand,
                            int taxonId)
Make a Location Relation between a LocatedSequenceFeature and a Chromosome.

Parameters:
chromosomeId - Chromosome Item identifier
locatedSequenceFeatureId - the Item identifier of the feature
start - the start position
end - the end position
strand - the strand
taxonId - the taxon id to use when finding the Chromosome for the Location
Returns:
the new Location object

getOrganismItem

public Item getOrganismItem(int taxonId)
The Organism item created from the taxon id passed to the constructor.

Parameters:
taxonId - NCBI taxonomy id of organism to create
Returns:
the Organism Item

getDataSourceItem

public Item getDataSourceItem(java.lang.String name)
Return a DataSet item for the given title

Parameters:
name - the DataSet name
Returns:
the DataSet Item

getDataSetItem

public Item getDataSetItem(java.lang.String title,
                           Item dataSourceItem)
Return a DataSource item for the given name

Parameters:
title - the DataSet title
dataSourceItem - the DataSource referenced by the the DataSet
Returns:
the DataSet Item

getDataSetTitle

public abstract java.lang.String getDataSetTitle(int taxonId)
Return the DataSet title for a given taxon id.

Parameters:
taxonId - the taxon id
Returns:
the title

getDataSetItem

public Item getDataSetItem(java.lang.String title,
                           java.lang.String url,
                           java.lang.String description,
                           Item dataSourceItem)
Return a DataSource item with the given details.

Parameters:
title - the DataSet title
url - the new url field, or null if the url shouldn't be set
description - the new description field, or null if the field shouldn't be set
dataSourceItem - the DataSource referenced by the the DataSet
Returns:
the DataSet Item

getChromosome

protected Item getChromosome(java.lang.String identifier,
                             int taxonId)
                      throws ObjectStoreException
Make a Chromosome Item, then store and return it. The Item is held in a Map so this method can be called multiple times.

Parameters:
identifier - the chromsome identifier
taxonId - the id of the organism
Returns:
the Chromsome Item
Throws:
ObjectStoreException - if an Item can't be stored

createSynonym

public Item createSynonym(java.lang.String subjectId,
                          java.lang.String value,
                          boolean store)
                   throws org.xml.sax.SAXException,
                          ObjectStoreException
Create a new Synonym. Keeps a map of already processed synonyms, ignores duplicates. The "store" param should be true only if the subject has already been stored. Storing a synonym first can signficantly slow down the build process.

Parameters:
subjectId - id representing the object (eg. Gene) this synonym describes.
value - the Synonym value
store - if true, will store item
Returns:
the synonym item or null if this is a duplicate
Throws:
ObjectStoreException - if the synonym can't be stored
org.xml.sax.SAXException - if the synonym can't be stored

getSequenceOntologyRefId

public java.lang.String getSequenceOntologyRefId()
Returns:
ID represening the Ontology object