org.intermine.bio.dataconversion
Class BioFileConverter

java.lang.Object
  extended by org.intermine.dataconversion.DataConverter
      extended by org.intermine.dataconversion.FileConverter
          extended by org.intermine.bio.dataconversion.BioFileConverter
Direct Known Subclasses:
BioGridConverter, GoConverter, InparanoidConverter, InterProConverter, KeggPathwayConverter, PsiConverter, UniprotKeywordConverter, WormBaseIdentifiersConverter

public abstract class BioFileConverter
extends FileConverter

A FileConverter that automatically sets the dataSets collection of objects as they are stored.


Constructor Summary
BioFileConverter(ItemWriter writer, Model model)
          Create a new BioFileConverter.
BioFileConverter(ItemWriter writer, Model model, java.lang.String dataSourceName, java.lang.String dataSetTitle)
          Create a new BioFileConverter.
BioFileConverter(ItemWriter writer, Model model, java.lang.String dataSourceName, java.lang.String dataSetTitle, java.lang.String ontology)
          Create a new BioFileConverter.
 
Method Summary
 Item createCrossReference(java.lang.String subjectId, java.lang.String value, java.lang.String dataSource, boolean store)
          Create a new CrossReference.
 Item createSynonym(Item item, java.lang.String value, boolean store)
          Create a new Synonym.
 Item createSynonym(java.lang.String subjectId, java.lang.String value, boolean store)
          Create a new Synonym.
 java.lang.String getDataSet(java.lang.String title, java.lang.String dataSourceRefId)
          Return a DataSet ref with the given details.
 java.lang.String getDataSource(java.lang.String name)
          Return a DataSource item for the given title
 java.lang.String getOrganism(java.lang.String 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 sequenceFeatureId, java.lang.String startString, java.lang.String endString, java.lang.String strand, boolean store)
          Make a Location between a Feature and a Chromosome.
 
Methods inherited from class org.intermine.dataconversion.FileConverter
close, getCurrentFile, process, setCurrentFile
 
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

BioFileConverter

public BioFileConverter(ItemWriter writer,
                        Model model,
                        java.lang.String dataSourceName,
                        java.lang.String dataSetTitle)
Create a new BioFileConverter.

Parameters:
writer - the Writer used to output the resultant items
model - the data model
dataSourceName - the DataSource name
dataSetTitle - the DataSet title

BioFileConverter

public BioFileConverter(ItemWriter writer,
                        Model model,
                        java.lang.String dataSourceName,
                        java.lang.String dataSetTitle,
                        java.lang.String ontology)
Create a new BioFileConverter.

Parameters:
writer - the Writer used to output the resultant items
model - the data model
dataSourceName - the DataSource name
dataSetTitle - the DataSet title
ontology - ID of ontology object. if NULL no SO object will be stored

BioFileConverter

public BioFileConverter(ItemWriter writer,
                        Model model)
Create a new BioFileConverter.

Parameters:
writer - the Writer used to output the resultant items
model - the data model
Method Detail

getSequenceOntologyRefId

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

getDataSource

public java.lang.String getDataSource(java.lang.String name)
Return a DataSource item for the given title

Parameters:
name - the DataSource name
Returns:
the DataSource Item

getDataSet

public java.lang.String getDataSet(java.lang.String title,
                                   java.lang.String dataSourceRefId)
Return a DataSet ref with the given details.

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

createSynonym

public Item createSynonym(Item item,
                          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:
item - object
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

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

createCrossReference

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

Parameters:
subjectId - id representing the object (eg. Gene) this CrossReference describes.
value - identifier
dataSource - external database
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

getOrganism

public java.lang.String getOrganism(java.lang.String taxonId)
The Organism item created from the taxon id passed to the constructor.

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

makeLocation

protected Item makeLocation(java.lang.String chromosomeId,
                            java.lang.String sequenceFeatureId,
                            java.lang.String startString,
                            java.lang.String endString,
                            java.lang.String strand,
                            boolean store)
Make a Location between a Feature and a Chromosome.

Parameters:
chromosomeId - Chromosome Item identifier
sequenceFeatureId - the Item identifier of the feature
startString - the start position
endString - the end position
strand - the strand
store - if true the location item will be saved in the database
Returns:
the new Location object