apollo.dataadapter.chado.jdbc
Class JdbcChadoWriter

java.lang.Object
  extended by apollo.dataadapter.chado.jdbc.PureJDBCTransactionWriter
      extended by apollo.dataadapter.chado.jdbc.JdbcChadoWriter

public class JdbcChadoWriter
extends PureJDBCTransactionWriter

This class handles writing back to a Chado instance. It primarily uses the PureJDBCTransactionWriter implementation, but instead of writing based on transactions (which have been revamped to support undo) it writes based on a diff system.


Field Summary
protected static org.apache.log4j.Logger logger
           
 
Fields inherited from class apollo.dataadapter.chado.jdbc.PureJDBCTransactionWriter
adapter, copyOnWrite, jdbcAdapter, logApolloTransactions, logSql, noCommit, useCDS
 
Constructor Summary
JdbcChadoWriter(ChadoAdapter adapter, JdbcChadoAdapter jdbcAdapter, boolean copyOnWrite, boolean noCommit, boolean useCDS, ChadoInstance chadoInstance)
          Constructor
 
Method Summary
protected  java.lang.Long addExon(SeqFeatureI exon, java.lang.String author, java.util.Date date, java.lang.Long transId, int exonNum, apollo.dataadapter.chado.jdbc.ChadoFeature srcFeature, boolean checkExons)
          Add an exon to the database.
protected  java.lang.Long addSequenceEdit(SequenceEdit seqEdit, java.lang.String author, java.util.Date date)
          Add a sequence edit to the database.
protected  java.lang.Long addTopLevelAnnot(SeqFeatureI annot, java.lang.String author, java.util.Date date, apollo.dataadapter.chado.jdbc.ChadoFeature srcFeature)
          Add a top level annotation to the database.
protected  java.lang.Long addTranscript(Transcript transcript, java.lang.String author, java.util.Date date, java.lang.Long geneId, long transcriptRank, apollo.dataadapter.chado.jdbc.ChadoFeature srcFeature, boolean checkExons)
          Add a transcript to the database.
protected  java.lang.String getChadoCdsName(ApolloNameAdapterI nameAdapter, java.lang.String name)
          The the Chado name for a CDS.
protected  java.lang.String getChadoPeptideName(ApolloNameAdapterI nameAdapter, java.lang.String name, SeqFeatureI pfeat)
          Get the Chado name for a peptide.
 java.lang.String getGFFSource()
           
 void setGFFSource(java.lang.String gffSource)
           
 void write(CurationSet cs)
          Write the data to the database
 
Methods inherited from class apollo.dataadapter.chado.jdbc.PureJDBCTransactionWriter
addComment, addComment, addComments, addDbXref, addDbXref, addDbxrefs, addGene, addSynonym, addSynonym, addSynonyms, commitAddTransaction, commitDeleteTransaction, commitTransaction, commitTransactions, commitUpdateParentTransaction, commitUpdateTransaction, deleteCDS, deleteComment, deleteDbXref, deleteExon, deleteExon, deleteGene, deletePolypeptide, deleteSynonym, deleteTranscript, deleteTranscript, fatalError, getCdsCoordinatesFromTranscript, getChadoFeatureId, getChadoIdForFeature, getChadoIsAnalysis, getChadoLocgroup, getChadoLocgroup, getChadoPrimaryDbxrefId, getChadoRelationshipCvTermId, getChadoResidues, getSeqEditRefFeature, logTransactionList, updateCdsFeatureLocation, updateFeatureLocation, updateFeatureName, updateFeatureType, updateOwner, updateStatus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final org.apache.log4j.Logger logger
Constructor Detail

JdbcChadoWriter

public JdbcChadoWriter(ChadoAdapter adapter,
                       JdbcChadoAdapter jdbcAdapter,
                       boolean copyOnWrite,
                       boolean noCommit,
                       boolean useCDS,
                       ChadoInstance chadoInstance)
Constructor

Parameters:
adapter - - ChadoAdapter to use for writing changes
jdbcAdapter - - JdbcChadoAdapter to use for writing changes
copyOnWrite - - Whether to keep a copy of the old object(s) when writing changes
noCommit - - Whether to run in 'no commit' mode
useCDS - - Whether to generate CDS features
chadoInstance - - ChadoInstance representing this Chado database`a
Method Detail

write

public void write(CurationSet cs)
Write the data to the database

Parameters:
cs - - CurationSet containing annotations to write

getGFFSource

public java.lang.String getGFFSource()

setGFFSource

public void setGFFSource(java.lang.String gffSource)

addTopLevelAnnot

protected java.lang.Long addTopLevelAnnot(SeqFeatureI annot,
                                          java.lang.String author,
                                          java.util.Date date,
                                          apollo.dataadapter.chado.jdbc.ChadoFeature srcFeature)
Add a top level annotation to the database.

Overrides:
addTopLevelAnnot in class PureJDBCTransactionWriter
Parameters:
annot - - SeqFeatureI object for the top level annotation.
author - - Owner of this annotation.
date - - Date of edit.
srcFeature - - ChadoFeature object for the source of this feature.
Returns:
Primary key for the newly added feature.

addTranscript

protected java.lang.Long addTranscript(Transcript transcript,
                                       java.lang.String author,
                                       java.util.Date date,
                                       java.lang.Long geneId,
                                       long transcriptRank,
                                       apollo.dataadapter.chado.jdbc.ChadoFeature srcFeature,
                                       boolean checkExons)
Add a transcript to the database.

Overrides:
addTranscript in class PureJDBCTransactionWriter
Parameters:
transcript - - Transcript object to be added to the database.
author - - Owner of this transcript.
date - - Date of edit.
geneId - - Primary key of the parent gene.
transcriptRank - - Rank of transcript in parent gene.
srcFeature - - ChadoFeature object for the source of the transcript.
checkExons - - Whether to check for shared exons (the convention for Chado is to have shared exons).
Returns:
Primary key of the newly added transcript.

addExon

protected java.lang.Long addExon(SeqFeatureI exon,
                                 java.lang.String author,
                                 java.util.Date date,
                                 java.lang.Long transId,
                                 int exonNum,
                                 apollo.dataadapter.chado.jdbc.ChadoFeature srcFeature,
                                 boolean checkExons)
Add an exon to the database.

Overrides:
addExon in class PureJDBCTransactionWriter
Parameters:
exon - - SeqFeatureI object for the exon to be added to the database.
author - - Owner of this exon.
date - - Date of edit.
transId - - Primary key of the parent transcript.
exonNum - - Rank of exon in parent transcript.
srcFeature - - ChadoFeature object for the source of the exon.
checkExons - - Whether to check for shared exons (the convention for Chado is to have shared exons).
Returns:
Primary key of the newly added exon.

addSequenceEdit

protected java.lang.Long addSequenceEdit(SequenceEdit seqEdit,
                                         java.lang.String author,
                                         java.util.Date date)
Add a sequence edit to the database.

Overrides:
addSequenceEdit in class PureJDBCTransactionWriter
Parameters:
seqEdit - - SequenceEdit object to be added.
author - - Owner of sequence edit.
date - - Date of edit.
Returns:
Primary key of newly added sequence edit.

getChadoPeptideName

protected java.lang.String getChadoPeptideName(ApolloNameAdapterI nameAdapter,
                                               java.lang.String name,
                                               SeqFeatureI pfeat)
Get the Chado name for a peptide.

Overrides:
getChadoPeptideName in class PureJDBCTransactionWriter
Parameters:
nameAdapter - - ApolloNameAdapterI object that defines what the name should be.
name - - Parent transcript name.
pfeat - - SeqFeatureI object for the peptide feature.
Returns:
Generated peptide name.

getChadoCdsName

protected java.lang.String getChadoCdsName(ApolloNameAdapterI nameAdapter,
                                           java.lang.String name)
The the Chado name for a CDS.

Overrides:
getChadoCdsName in class PureJDBCTransactionWriter
Parameters:
nameAdapter - - ApolloNameAdapterI object that defines what the name should be.
name - - Parent transcript name
Returns:
Generated CDS name.