|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectapollo.dataadapter.chado.jdbc.JdbcChadoAdapter
public abstract class JdbcChadoAdapter
Abstract superclass that encapsulates vendor-independent routines for interacting with Chado-compliant relational databases. Used by apollo.dataadapter.chado.ChadoAdapter to implement the database access layer of an Apollo/Chado adapter.
ChadoAdapter| Field Summary | |
|---|---|
protected java.lang.String |
chadoDb
Schema/database name of the Chado database instance. |
protected SchemaVersion |
chadoVersion
Chado schema version - should this be merged with chado instance? |
protected static java.util.HashMap |
fkcMap
|
protected java.lang.String |
jdbcUrl
JDBC URL of a Chado-compliant database (or of a server/DBMS that hosts such a database.) |
protected static org.apache.log4j.Logger |
logger
|
protected java.lang.String |
organismLike
Used by getAllChadoSequencesByType if not null. |
protected java.lang.String |
password
Database password |
protected static java.util.HashMap |
pkcMap
|
protected static java.lang.String |
sqlLogPath
Path to a file where all SQL statements are logged. |
protected java.sql.Connection |
transactionConnection
Used to ensure that the same JDBC Connection is used for all write operations that are part of a single transaction. |
protected static java.lang.String |
txnLogPath
Path to a file where all committed Apollo transactions are logged |
protected java.lang.String |
username
Database username. |
| Constructor Summary | |
|---|---|
JdbcChadoAdapter()
|
|
| Method Summary | |
|---|---|
protected void |
_addExonsToTranscript(Transcript t,
java.util.Vector exons)
Add a set of apollo.datamodel.Exons to an instance of apollo.datamodel.Transcript. |
protected void |
_addFeatures(FeatureSet fs,
java.util.Vector features)
An alternative to _makeFeatureSet. |
protected void |
_addFeaturesToFeatureSet(FeatureSet fs,
java.util.Vector feats)
Add a set of apollo.datamodel.SeqFeatureIs to an instance of apollo.datamodel.FeatureSet |
protected int |
_addTranscriptsToGene(AnnotatedFeature gene,
java.util.Vector transcripts)
Add a set of apollo.datamodel.Transcripts to an instance of apollo.datamodel.Gene. |
protected Exon |
_makeExon(int low,
int high,
int strand)
Factory method for Exons. |
protected FeatureSet |
_makeFeatureSet(java.util.Vector features,
java.lang.String name,
java.lang.String type,
int strand)
Helper method for addSearchHits; |
protected Transcript |
_makeNewTranscript(Transcript t,
apollo.dataadapter.chado.jdbc.ChadoCds cds)
Create a new instance of apollo.datamodel.Transcript based on an existing template. |
protected SeqFeature |
_makeSeqFeature(java.lang.Integer low,
java.lang.Integer high,
java.lang.String type,
java.lang.Integer strand)
|
protected SeqFeature |
_makeSeqFeature(int low,
int high,
java.lang.String type,
int strand)
Factory method for SeqFeatures. |
protected void |
addGenePredictionResults(java.sql.Connection c,
ChadoProgram[] programs,
StrandedFeatureSet parentFeatSet,
apollo.dataadapter.chado.jdbc.FeatureLocImplementation featLoc,
SequenceI refSeq)
Retrieve gene predictions and add them to parentFeatSet as SeqFeatures. |
protected void |
addGenePredictionResults(java.sql.Connection c,
ChadoProgram[] programs,
StrandedFeatureSet parentFeatSet,
apollo.dataadapter.chado.jdbc.FeatureLocImplementation featLoc,
SequenceI refSeq,
java.lang.String scoreColumn)
Retrieve gene predictions and add them to parentFeatSet as SeqFeatures. |
protected void |
addGenePredictionResults(java.sql.Connection c,
java.lang.String[] programStr,
StrandedFeatureSet parentFeatSet,
apollo.dataadapter.chado.jdbc.FeatureLocImplementation featLoc,
SequenceI refSeq)
Deprecated. use chadoProgram array instead of string array |
protected void |
addOneLevelAnnotations(java.sql.Connection c,
SequenceI refSeq,
StrandedFeatureSet sfs,
apollo.dataadapter.chado.jdbc.FeatureLocImplementation featLoc,
boolean getFeatProps,
boolean getSynonyms,
boolean getDbXRefs)
add annotations with only one level, like transposons (for now) and annotated tiling paths, promoters & what not. |
protected long |
addPrimaryKeyColumnValue(java.lang.String tableName,
java.util.HashMap columnValues)
|
protected void |
addProteinAlignments(java.sql.Connection c,
java.lang.String programStr,
StrandedFeatureSet sfs,
apollo.dataadapter.chado.jdbc.FeatureLocImplementation featLoc)
Retrieve a set of protein alignments from Chado and convert them into instances of apollo.datmodel.FeaturePair. |
protected void |
addSearchHits(java.sql.Connection c,
ChadoProgram[] programs,
boolean setTargetSeqs,
boolean getTargetSeqsSeparately,
boolean lazyTgtSeqs,
boolean getTargetSeqDescriptions,
boolean joinWithFeatureProp,
SequenceI refSeq,
StrandedFeatureSet sfs,
java.lang.String scoreColumn,
boolean setAlignSeqs,
apollo.dataadapter.chado.jdbc.FeatureLocImplementation featLoc)
Retrieve a set of search hits (e.g. |
boolean |
beginTransaction()
Begin a transaction using the current JDBC Connection. |
boolean |
chadoFeatureExists(java.sql.Connection conn,
java.lang.String seqType,
java.lang.String seqId)
Check whether a particular feature exists in a given Chado database. |
boolean |
chadoFeatureExists(java.sql.Connection conn,
java.lang.String seqType,
java.lang.String seqId,
java.lang.StringBuilder realSeqId)
Check whether a particular feature exists in a given Chado database. |
void |
commitChanges(CurationSet curationSet)
|
boolean |
commitTransaction()
Commit a transaction using the current JDBC Connection. |
java.lang.String |
computeMD5Checksum(java.lang.String seq)
|
protected void |
copyAnnotatedGenesIntoResultTier(StrandedFeatureSet annotations,
StrandedFeatureSet results,
java.lang.String tierType,
SequenceI refSeq)
A method that copies all the annotated protein-coding genes into a result tier. |
boolean |
decrementGeneTranscriptRanks(java.lang.Long geneFeatureId,
long newTranscriptRank)
|
boolean |
decrementTranscriptExonRanks(java.lang.Long transFeatureId,
long newExonRank)
|
boolean |
deleteFeatureDbXrefRow(long featureId,
long dbXrefId)
|
boolean |
deleteFeaturepropRow(java.lang.Long featurePropId)
|
boolean |
deleteFeatureRelationshipRow(java.lang.Long subjectId,
java.lang.Long objectId,
java.lang.Long typeId)
|
boolean |
deleteFeatureSynonymRow(java.lang.Long featureId,
java.lang.Long synonymId,
java.lang.Integer pubId)
|
protected int |
deleteReferencingRows(java.lang.String tableName,
long rowId)
|
boolean |
deleteRow(java.lang.String tableName,
long rowId)
Recursive delete of a row and all the rows that reference it via a foreign key constraint. |
boolean |
deleteSynonymRowIfNoLongerNeeded(java.lang.Long synonymId)
|
protected boolean |
deleteUnreferencedRow(java.lang.String tableName,
long rowId)
Delete a row known not to be referenced by any other (e.g., because deleteReferencingRows has already been called on the row) |
java.sql.ResultSet |
executeLoggedSelectQuery(java.lang.String method,
java.sql.Connection c,
java.lang.String sql)
Execute a single SQL query and return the corresponding ResultSet. |
protected java.sql.ResultSet |
executeLoggedSelectQuery(java.lang.String method,
java.lang.String sql)
Alternate form of executeLoggedSelectQuery that uses getConnection()
instead of an expicitly-passed Connection object. |
int |
executeLoggedUpdate(java.lang.String method,
java.sql.Connection c,
java.lang.String sql,
java.lang.String[] colNames,
java.lang.Object[] colVals,
java.util.Map unquotedColValues)
Execute an SQL update statement (update, insert, or delete) and return the number of rows affected. |
void |
getAllChadoSequencesByType(java.lang.String featType,
java.util.Vector seqUniqueNames,
java.util.Vector seqDescrs)
Retrieve the id (Chado uniquename) and description of every Chado sequence of a particular type. |
protected java.lang.String |
getAnalysisFeatureIdentityField()
The analysisfeature table has a column named 'identity' in the standard Chado release. |
protected abstract java.lang.Object |
getBooleanValue(boolean val)
|
protected java.util.Hashtable |
getCDSFeatures(java.sql.Connection c,
long srcSeqId,
SequenceI refSeq,
StrandedFeatureSet sfs,
apollo.dataadapter.chado.jdbc.FeatureLocImplementation featLocImp)
Front end to the main getCDSFeatures |
protected java.util.Hashtable |
getCDSFeatures(java.sql.Connection c,
long srcSeqId,
SequenceI refSeq,
StrandedFeatureSet sfs,
apollo.dataadapter.chado.jdbc.FeatureLocImplementation featLocImp,
ChadoProgram[] chadoPrgs)
Front end to the main getCDSFeatures |
protected java.util.Hashtable |
getCDSFeatures(java.sql.Connection c,
long srcSeqId,
SequenceI refSeq,
StrandedFeatureSet sfs,
java.lang.String sql)
Retrieve all CDS features feature-loc'ed to a Chado sequence. |
java.util.List |
getCdsPolypeptideIds(java.lang.Long cdsFeatureId)
|
ChadoInstance |
getChadoInstance()
|
java.lang.String |
getChadoProgramWhereClause(ChadoProgram[] programs,
java.lang.String analysisfeatureAlias,
java.lang.String analysisAlias)
Construct a where clause that will constrain a query on analysisfeature and/or analysis to exactly those rows in the analysis table that are specified by a list of ChadoProgram objects. |
protected SchemaVersion |
getChadoVersion()
|
protected abstract java.lang.String |
getClobLengthFunction()
|
protected java.sql.Connection |
getConnection()
Returns the current database connection, if one exists and is valid. |
java.sql.Connection |
getConnectionUsedForLastTransaction()
Retrieve the JDBC Connection used to initiate the most recent transaction. |
protected java.sql.Connection |
getConnectionWithException()
A variant of getConnection that throws an SQLException in the
case of an SQL error. |
CurationSet |
getCurationSet(ChadoAdapter adapter,
java.lang.String seqType,
java.lang.String seqId)
|
CurationSet |
getCurationSetInRange(ChadoAdapter adapter,
java.lang.String seqType,
Region region)
|
java.lang.Long |
getDbId(java.lang.String name)
|
java.lang.Long |
getDbXrefId(long dbId,
java.lang.String accession,
java.lang.String version)
|
java.lang.Long |
getExonRank(java.lang.Long exonFeatureId,
java.lang.Long transFeatureId)
|
java.util.List |
getFeatNamesByType(java.lang.String featType)
This is a stripped down version of getAllChadoSequencesByType. |
java.lang.Long |
getFeatureDbXrefId(long featureId,
long dbXrefId)
|
protected long |
getFeatureId(java.sql.Connection c,
java.lang.String featType,
java.lang.String featName)
Retrieve the Chado feature.feature_id for a specified feature. |
long |
getFeatureId(java.lang.String featName)
Retrieve the Chado feature.feature_id for a specified feature. |
protected long |
getFeatureIdBySynonym(java.sql.Connection c,
java.lang.String featType,
java.lang.String synonym,
java.lang.StringBuilder realSeqId)
Get feature.feature_id by searching against synonyms. |
java.lang.Long |
getFeatureRelationshipId(java.lang.Long subjectId,
java.lang.Long objectId,
java.lang.Long typeId)
|
protected java.lang.String |
getFeatureType(java.lang.String alignType,
java.lang.String program,
java.lang.String programversion,
java.lang.String targetSp,
java.lang.String sourcename,
java.lang.String featProp)
Tigr and fb assign feature type differently - config! |
protected TableColumn[] |
getForeignKeyConstraints(java.lang.String tableName)
Returns an array of the chado columns that reference a given table. |
protected static java.util.HashMap |
getForeignKeyReferenceMapping()
|
java.util.List |
getGeneTranscriptIds(java.lang.Long geneFeatureId)
|
protected java.sql.Connection |
getNewConnection()
Opens and return a new Connection to the database specified in the arguments to init. |
long |
getNextPrimaryKeyId(java.lang.String tableName)
Run a SELECT(MAX()) + 1 query to get the next available primary key value for a chado table. |
java.lang.Long |
getNullCVTermId(java.lang.String name)
|
protected java.lang.String |
getPrimaryKeyColumn(java.lang.String tableName)
Returns the name of the (single) primary key column for a chado table. |
protected static java.util.HashMap |
getPrimaryKeyColumnMapping()
|
protected java.util.List |
getReferencingRowIds(java.lang.String refTable,
java.lang.String refCol,
long rowId)
TODO - this is actually a generic method; all it's doing is evaluating a single equijoin (modulo quoting) and returning the row ids |
java.util.List |
getRelatedFeatureIds(java.lang.Long featureId,
boolean isSubject,
java.lang.String relTypeName,
java.lang.String relFeatType)
|
java.lang.Long |
getRelatedFeatureRank(java.lang.Long subjectId,
java.lang.Long objectId,
java.lang.String relTypeName)
|
protected java.lang.Long |
getRelationshipCVTermId(java.lang.String name)
|
protected int |
getSeqLengthForFeatureId(java.sql.Connection c,
long seqFeatId)
Retrieve the Chado feature.seqlen for a specified feature. |
protected SequenceI |
getSequence(long featureId)
Retrieve a sequence from Chado and convert it into an instance of apollo.dataadapter.Sequence. |
protected SequenceI |
getSequence(long featureId,
boolean isLazy,
java.lang.String uniquename,
int seqLength)
|
java.lang.Long |
getSynonymId(java.lang.String name,
java.lang.Long typeId)
|
java.util.List |
getTranscriptCdsIds(java.lang.Long transFeatureId)
|
java.util.List |
getTranscriptExonIds(java.lang.Long transFeatureId)
|
java.util.List |
getTranscriptPolypeptideIds(java.lang.Long transFeatureId)
|
java.lang.Long |
getTranscriptRank(java.lang.Long transFeatureId,
java.lang.Long geneFeatureId)
|
boolean |
hasOpenTransaction()
|
boolean |
incrementGeneTranscriptRanks(java.lang.Long geneFeatureId,
long newTranscriptRank)
|
boolean |
incrementTranscriptExonRanks(java.lang.Long transFeatureId,
long newExonRank)
|
void |
init(java.lang.String jdbcUrl,
java.lang.String chadoDb,
java.lang.String username,
java.lang.String password,
java.lang.String organismLike)
This method must be called before calling any of the other methods of this class (or those of its subclasses.) This will typically be done by an instance of apollo.dataadapter.chado.ChadoAdaptor. |
void |
initWithException(java.lang.String jdbcUrl,
java.lang.String chadoDb,
java.lang.String username,
java.lang.String password,
java.lang.String organismLike)
This method must be called before calling any of the other methods of this class (or those of its subclasses.) This will typically be done by an instance of apollo.dataadapter.chado.ChadoAdaptor. |
java.lang.Long |
insertDbRowIfNeeded(java.lang.String name)
|
java.lang.Long |
insertDbXrefRowIfNeeded(long dbId,
java.lang.String accession,
java.lang.String version,
java.lang.String description)
|
java.lang.Long |
insertFeatureDbXrefRow(long featureId,
long dbXrefId,
boolean isCurrent)
|
java.lang.Long |
insertFeaturelocRow(java.lang.Long featureId,
java.lang.Long srcFeatureId,
java.lang.Integer fmin,
java.lang.Integer fmax,
boolean fmin_partial,
boolean fmax_partial,
java.lang.Integer strand,
java.lang.Integer phase,
java.lang.String residueInfo,
int locgroup,
long rank)
|
java.lang.Long |
insertFeaturepropPubRow(java.lang.Long featPropId,
java.lang.Long pubId)
|
java.lang.Long |
insertFeaturepropRow(java.lang.Long featureId,
java.lang.Long typeId,
java.lang.String value,
long rank)
|
java.lang.Long |
insertFeaturepropRow(java.lang.Long featureId,
java.lang.Long typeId,
java.lang.String value,
long rank,
boolean checkNextRank)
|
java.lang.Long |
insertFeatureRelationshipRow(java.lang.Long subjectId,
java.lang.Long objectId,
java.lang.Long typeId,
java.lang.String value,
java.lang.Long rank)
|
java.lang.Long |
insertFeatureRow(java.lang.Long dbxrefId,
long organismId,
java.lang.String name,
java.lang.String uniquename,
java.lang.String residues,
java.lang.Long seqlen,
java.lang.Long typeId,
java.lang.Integer isAnalysis,
java.util.Date createDate)
|
java.lang.Long |
insertFeatureSynonymRow(java.lang.Long synId,
java.lang.Long featId,
java.lang.Integer pubId,
boolean is_current,
boolean is_internal)
|
java.lang.Long |
insertPubRowIfNeeded(java.lang.String pubUniquename,
long pubTypeId)
|
boolean |
insertRow(java.lang.String tableName,
java.util.Map colValues,
java.util.Map unquotedColValues)
Generic method to insert a single row into a named table. |
java.lang.Long |
insertSynonymRowIfNeeded(java.lang.String name,
java.lang.Long typeId,
java.lang.String synonym_sgml)
|
protected boolean |
integersTheSame(java.lang.Integer i1,
java.lang.Integer i2)
|
boolean |
isSharedExon(long exonId)
Check to see if this is a shared exon (more than one transcript has it |
protected void |
loadClass(java.lang.String jdbcDriverClass)
This method can be called by the subclass before calling getConnection,
in order to load any needed JDBC driver classes with a Class.forName(). |
protected boolean |
longsTheSame(java.lang.Long l1,
java.lang.Long l2)
|
boolean |
rollbackTransaction()
Roll back a transaction using the current JDBC Connection. |
void |
setChadoInstance(ChadoInstance instance)
|
void |
setPropertyScheme(PropertyScheme ps)
need property scheme to check if type is a synteny link |
protected boolean |
stringsTheSame(java.lang.String s1,
java.lang.String s2)
|
boolean |
updateFeatureDbXrefRow(apollo.dataadapter.chado.jdbc.ChadoFeatureDbXref dbFeatDbXref,
long featureId,
long dbXrefId,
boolean isCurrent)
|
boolean |
updateFeaturelocRow(long featurelocId,
apollo.dataadapter.chado.jdbc.ChadoFeatureLoc dbLoc,
long featureId,
java.lang.Long srcFeatureId,
java.lang.Integer fmin,
java.lang.Integer fmax,
boolean fmin_partial,
boolean fmax_partial,
java.lang.Integer strand,
java.lang.Integer phase,
java.lang.String residueInfo,
int locgroup,
int rank)
|
boolean |
updateFeaturepropRow(long featurepropId,
apollo.dataadapter.chado.jdbc.ChadoFeatureProp dbFeatprop,
long featureId,
long typeId,
java.lang.String value,
int rank)
|
boolean |
updateFeatureRelationshipRanks(java.lang.Long featureId,
boolean isSubject,
java.lang.String relTypeName,
java.lang.String relFeatType,
long newRank,
boolean increment)
|
boolean |
updateFeatureRow(long featureId,
apollo.dataadapter.chado.jdbc.ChadoFeature dbFeat,
java.lang.Long dbxrefId,
long organismId,
java.lang.String name,
java.lang.String uniquename,
java.lang.String residues,
long typeId,
boolean isAnalysis,
boolean isObsolete)
|
boolean |
updateRow(java.lang.String tableName,
long id,
java.util.Map colValues,
java.util.Map unquotedColValues)
Generic method to update a single row. |
void |
validateConnectionAndSequence(java.lang.String seqType,
java.lang.String seqId)
Check that the current connection information and the supplied sequence id are both valid. |
void |
validateConnectionAndSequence(java.lang.String seqType,
java.lang.String seqId,
java.lang.StringBuilder realSeqId)
Check that the current connection information and the supplied sequence id are both valid. |
protected java.lang.String |
zeroPad(int n,
int width)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final org.apache.log4j.Logger logger
protected static java.lang.String sqlLogPath
protected static java.lang.String txnLogPath
protected java.lang.String jdbcUrl
protected java.lang.String chadoDb
protected java.lang.String username
protected java.lang.String password
protected java.lang.String organismLike
getAllChadoSequencesByType if not null.
protected SchemaVersion chadoVersion
protected java.sql.Connection transactionConnection
protected static java.util.HashMap pkcMap
protected static java.util.HashMap fkcMap
| Constructor Detail |
|---|
public JdbcChadoAdapter()
| Method Detail |
|---|
public void init(java.lang.String jdbcUrl,
java.lang.String chadoDb,
java.lang.String username,
java.lang.String password,
java.lang.String organismLike)
apollo.dataadapter.chado.ChadoAdaptor.
jdbcUrl - JDBC URL of a Chado-compliant database (or of a server/DBMS that hosts such a database.)chadoDb - Schema/database name of the Chado database instance.username - Database username.password - Database password.organismLike - Only sequences that match this string are retrieved by getAllChadoSequencesByType.
public void initWithException(java.lang.String jdbcUrl,
java.lang.String chadoDb,
java.lang.String username,
java.lang.String password,
java.lang.String organismLike)
throws java.sql.SQLException
apollo.dataadapter.chado.ChadoAdaptor.
jdbcUrl - JDBC URL of a Chado-compliant database (or of a server/DBMS that hosts such a database.)chadoDb - Schema/database name of the Chado database instance.username - Database username.password - Database password.organismLike - Only sequences that match this string are retrieved by getAllChadoSequencesByType.
java.sql.SQLException
public java.sql.ResultSet executeLoggedSelectQuery(java.lang.String method,
java.sql.Connection c,
java.lang.String sql)
method - - name of the calling methodc - - JDBC Connectionsql - - query to run
public int executeLoggedUpdate(java.lang.String method,
java.sql.Connection c,
java.lang.String sql,
java.lang.String[] colNames,
java.lang.Object[] colVals,
java.util.Map unquotedColValues)
method - - name of the calling methodc - - JDBC Connectionsql - - query to runcolNames - - names of the affected columns (if applicable)colVals - - values corresponding to colNamesunquotedColValues - - Map whose keys list the column names that should NOT be
passed as bound parameters.
protected java.sql.ResultSet executeLoggedSelectQuery(java.lang.String method,
java.lang.String sql)
getConnection()
instead of an expicitly-passed Connection object.
public void setPropertyScheme(PropertyScheme ps)
protected SchemaVersion getChadoVersion()
protected java.lang.String zeroPad(int n,
int width)
public void setChadoInstance(ChadoInstance instance)
public ChadoInstance getChadoInstance()
public void validateConnectionAndSequence(java.lang.String seqType,
java.lang.String seqId)
throws ApolloAdapterException
seqType - Name of a sequence type found in the current chado database's cvterm.name column.seqId - A sequence identifier found in the current chado database's feature.uniquename column.
ApolloAdapterException
public void validateConnectionAndSequence(java.lang.String seqType,
java.lang.String seqId,
java.lang.StringBuilder realSeqId)
throws ApolloAdapterException
seqType - Name of a sequence type found in the current chado database's cvterm.name column.seqId - A sequence identifier found in the current chado database's feature.uniquename column.realSeqId - StringBuilder that gets updated with actual feature.uniquename (used for synonym lookups).
ApolloAdapterExceptionprotected void loadClass(java.lang.String jdbcDriverClass)
getConnection,
in order to load any needed JDBC driver classes with a Class.forName().
jdbcDriverClass - The name of the Java class for which to do a Class.forName().protected java.sql.Connection getConnection()
init.
protected java.sql.Connection getConnectionWithException()
throws java.sql.SQLException
getConnection that throws an SQLException in the
case of an SQL error.
java.sql.SQLException
protected java.sql.Connection getNewConnection()
throws java.sql.SQLException
init.
java.sql.SQLException
protected long getFeatureIdBySynonym(java.sql.Connection c,
java.lang.String featType,
java.lang.String synonym,
java.lang.StringBuilder realSeqId)
c - - Connection object to the databasefeatType - - Chado cvterm.namesynonym - - Synonym to be searchedrealSeqId - - StringBuilder that gets updated with the actual id for the feature
protected long getFeatureId(java.sql.Connection c,
java.lang.String featType,
java.lang.String featName)
featType - chado cvterm.namefeatName - chado feature.uniquename
protected int getSeqLengthForFeatureId(java.sql.Connection c,
long seqFeatId)
c - JDBC connection to useseqFeatId - chado feature.feature_id
public long getFeatureId(java.lang.String featName)
featName - chado feature.uniquename
public boolean chadoFeatureExists(java.sql.Connection conn,
java.lang.String seqType,
java.lang.String seqId)
conn - JDBC Connection to a Chado-compliant relational database.seqType - Name of a sequence type found in the current chado database's cvterm.name column.seqId - A sequence identifier found in the current chado database's feature.uniquename column.
public boolean chadoFeatureExists(java.sql.Connection conn,
java.lang.String seqType,
java.lang.String seqId,
java.lang.StringBuilder realSeqId)
conn - JDBC Connection to a Chado-compliant relational database.seqType - Name of a sequence type found in the current chado database's cvterm.name column.seqId - A sequence identifier found in the current chado database's feature.uniquename column.realSeqId - StringBuilder object that will get populated with feature.uniquename.
public void getAllChadoSequencesByType(java.lang.String featType,
java.util.Vector seqUniqueNames,
java.util.Vector seqDescrs)
throws ApolloAdapterException
featType - Name of a sequence type found in the current chado database's cvterm.name column.seqUniqueNames - Vector to be populated with the Chado uniquenames for the sequences.seqDescrs - Vector to be populated with human-readable sequence descriptions.
ApolloAdapterExceptionpublic java.util.List getFeatNamesByType(java.lang.String featType)
protected SequenceI getSequence(long featureId)
featureId and
revComp are guaranteed to return the same cached object returned by the first
call.
featureId - Chado feature.feature_id.
protected SequenceI getSequence(long featureId,
boolean isLazy,
java.lang.String uniquename,
int seqLength)
public java.lang.Long getNullCVTermId(java.lang.String name)
protected java.lang.Long getRelationshipCVTermId(java.lang.String name)
protected java.util.Hashtable getCDSFeatures(java.sql.Connection c,
long srcSeqId,
SequenceI refSeq,
StrandedFeatureSet sfs,
apollo.dataadapter.chado.jdbc.FeatureLocImplementation featLocImp,
ChadoProgram[] chadoPrgs)
throws apollo.dataadapter.chado.jdbc.RelationshipCVException
c - srcSeqId - refSeq - sfs - featLocImp - chadoPrgs -
RelationshipCVExceptiongetCDSFeatures(Connection, long, SequenceI, StrandedFeatureSet, String)
protected java.util.Hashtable getCDSFeatures(java.sql.Connection c,
long srcSeqId,
SequenceI refSeq,
StrandedFeatureSet sfs,
apollo.dataadapter.chado.jdbc.FeatureLocImplementation featLocImp)
throws apollo.dataadapter.chado.jdbc.RelationshipCVException
c - srcSeqId - refSeq - sfs - featLocImp -
RelationshipCVExceptiongetCDSFeatures(Connection, long, SequenceI, StrandedFeatureSet, String)
protected java.util.Hashtable getCDSFeatures(java.sql.Connection c,
long srcSeqId,
SequenceI refSeq,
StrandedFeatureSet sfs,
java.lang.String sql)
throws apollo.dataadapter.chado.jdbc.RelationshipCVException
c - JDBC connection to the database.srcSeqId - Chado feature_id of the sequence whose CDS features are to be returned.refSeq - Apollo Sequence that corresponds to Chado sequence srcSeqIdsfs - StrandedFeatureSet to which CDS features should be added when running in debug mode.sql - Sql string wich retrieves the cds, according to featlocimp and chadoprogram[]
apollo.dataadapter.chado.jdbc.RelationshipCVException
protected void addOneLevelAnnotations(java.sql.Connection c,
SequenceI refSeq,
StrandedFeatureSet sfs,
apollo.dataadapter.chado.jdbc.FeatureLocImplementation featLoc,
boolean getFeatProps,
boolean getSynonyms,
boolean getDbXRefs)
protected void addSearchHits(java.sql.Connection c,
ChadoProgram[] programs,
boolean setTargetSeqs,
boolean getTargetSeqsSeparately,
boolean lazyTgtSeqs,
boolean getTargetSeqDescriptions,
boolean joinWithFeatureProp,
SequenceI refSeq,
StrandedFeatureSet sfs,
java.lang.String scoreColumn,
boolean setAlignSeqs,
apollo.dataadapter.chado.jdbc.FeatureLocImplementation featLoc)
c - JDBC connection to the database.programStr - Retrieve search hits (Chado analysisfeatures) whose Chado
analysis.program matches this string.srcRank - Chado featureloc.rank of the source sequence.tgtRank - Chado featureloc.rank of the target sequence.setTargetSeqs - Whether to call setRefSequence on the target Apollo featuresgetTargetSeqsSeparately - Whether to get the the target seqs in the main query
or retrieve them with a separate query. If most or all of the
hits go to 1 or just a handful of sequences, then it makes
sense to retrieve separately (tigr is of this ilk). If most
of the hits are to separate seqs its better to retrieve in
query (flybase is of this ilk).getTargetSeqDescriptions - if true retrieve description for target
sequence. descriptions are retrieved by joining with featureprop. only
useful if retrieving target seqs to begin with, if setTargetSeqs = truejoinWithFeatureProp - Whether to join the analysis features with featureprop.refSeq - Apollo Sequence that corresponds to Chado sequence srcSeqIdsfs - StrandedFeatureSet to which the search hits should be added.scoreColumn - analysisfeature column to use for primary feature score(setScore)setAlignSeqs - If true set explicit query and hit seqs (once we have cigars
i suspect we will need a flag for cigar vs explicit alignsfeatLoc - Has srcfeature_id to use for featureloc as well as where clause
for range (needed for non-redundant featlocs) and range padding
maybe all the params here could be lumped into a SearchHitsParams object?
programs should be changed to how one level results does it - ChadoProgram[]
with programversion and sourcename and getChadoProgramWhereClause
protected void addProteinAlignments(java.sql.Connection c,
java.lang.String programStr,
StrandedFeatureSet sfs,
apollo.dataadapter.chado.jdbc.FeatureLocImplementation featLoc)
c - JDBC connection to the database.srcSeqId - Chado feature_id of the sequence whose protein alignments are to be returned.programStr - Retrieve search hits (Chado analysisfeatures) whose Chado analysis.program matches this string.sfs - StrandedFeatureSet to which the protein alignment features should be added.
protected void addGenePredictionResults(java.sql.Connection c,
java.lang.String[] programStr,
StrandedFeatureSet parentFeatSet,
apollo.dataadapter.chado.jdbc.FeatureLocImplementation featLoc,
SequenceI refSeq)
c - JDBC connection to the database.programStr - Retrieve predictions (Chado analysisfeatures) whose Chado analysis.program matches this string. (eg genscan, piecegenie) Can do
multiple programs "in ('piecegenie','genscan')" or "= 'genscan'"parentFeatSet - StrandedFeatureSet to which the gene prediction features should be added.featLoc - Has srcfeature_id to use for featureloc as well as where clause for range (needed for non-redundant featlocs) and range padding
This was made for flybase - will probably need some tweeking if tigr or some other db needs to use this.#addGenePredictionResults(Connection, ChadoProgram[], StrandedFeatureSet, FeatureLocImplementation)
protected void addGenePredictionResults(java.sql.Connection c,
ChadoProgram[] programs,
StrandedFeatureSet parentFeatSet,
apollo.dataadapter.chado.jdbc.FeatureLocImplementation featLoc,
SequenceI refSeq)
c - JDBC connection to the database.programStr - Retrieve predictions (Chado analysisfeatures) whose Chado analysis.program matches this program (chadoProgram.getName). (eg
genscan, piecegenie) Can do multiple programs "in ('piecegenie','genscan')" or "= 'genscan'"parentFeatSet - StrandedFeatureSet to which the gene prediction features should be added.featLoc - Has srcfeature_id to use for featureloc as well as where clause for range (needed for non-redundant featlocs) and range padding
This was made for flybase - will probably need some tweeking if tigr or some other db needs to use this.ChadoProgram
protected void addGenePredictionResults(java.sql.Connection c,
ChadoProgram[] programs,
StrandedFeatureSet parentFeatSet,
apollo.dataadapter.chado.jdbc.FeatureLocImplementation featLoc,
SequenceI refSeq,
java.lang.String scoreColumn)
c - JDBC connection to the database.programStr - Retrieve predictions (Chado analysisfeatures) whose Chado analysis.program matches this program (chadoProgram.getName). (eg
genscan, piecegenie) Can do multiple programs "in ('piecegenie','genscan')" or "= 'genscan'"parentFeatSet - StrandedFeatureSet to which the gene prediction features should be added.featLoc - Has srcfeature_id to use for featureloc as well as where clause for range (needed for non-redundant featlocs) and range padding
This was made for flybase - will probably need some tweeking if tigr or some other db needs to use this.scoreColumn - analysisfeature column to use for primary featureChadoProgram
protected void copyAnnotatedGenesIntoResultTier(StrandedFeatureSet annotations,
StrandedFeatureSet results,
java.lang.String tierType,
SequenceI refSeq)
public java.lang.String getChadoProgramWhereClause(ChadoProgram[] programs,
java.lang.String analysisfeatureAlias,
java.lang.String analysisAlias)
throws apollo.dataadapter.chado.jdbc.JdbcChadoAdapter.AnalysisException
programs - Array of ChadoProgram objects that specifies the analysis rows to include.analysisfeatureAlias - Alias of the analysisfeature table, if the query includes it.analysisAlias - Alias of the analysis table, if the query includes it.
AnalysisException
apollo.dataadapter.chado.jdbc.JdbcChadoAdapter.AnalysisExceptionpublic java.sql.Connection getConnectionUsedForLastTransaction()
public boolean beginTransaction()
public boolean hasOpenTransaction()
public boolean commitTransaction()
public boolean rollbackTransaction()
public boolean deleteRow(java.lang.String tableName,
long rowId)
tableName - chado table from which the row is to be deletedrowId - chado feature_id of the row to be deleted
protected int deleteReferencingRows(java.lang.String tableName,
long rowId)
protected java.util.List getReferencingRowIds(java.lang.String refTable,
java.lang.String refCol,
long rowId)
refTable - refCol - rowId -
protected boolean deleteUnreferencedRow(java.lang.String tableName,
long rowId)
tableName - chado table from which the row is to be deletedrowId - chado feature_id of the row to be deleted
protected boolean integersTheSame(java.lang.Integer i1,
java.lang.Integer i2)
protected boolean longsTheSame(java.lang.Long l1,
java.lang.Long l2)
protected boolean stringsTheSame(java.lang.String s1,
java.lang.String s2)
public boolean updateFeatureRow(long featureId,
apollo.dataadapter.chado.jdbc.ChadoFeature dbFeat,
java.lang.Long dbxrefId,
long organismId,
java.lang.String name,
java.lang.String uniquename,
java.lang.String residues,
long typeId,
boolean isAnalysis,
boolean isObsolete)
public boolean updateFeaturepropRow(long featurepropId,
apollo.dataadapter.chado.jdbc.ChadoFeatureProp dbFeatprop,
long featureId,
long typeId,
java.lang.String value,
int rank)
dbFeatprop - ChadoFeatureProp giving the *current* database contents
public boolean updateFeaturelocRow(long featurelocId,
apollo.dataadapter.chado.jdbc.ChadoFeatureLoc dbLoc,
long featureId,
java.lang.Long srcFeatureId,
java.lang.Integer fmin,
java.lang.Integer fmax,
boolean fmin_partial,
boolean fmax_partial,
java.lang.Integer strand,
java.lang.Integer phase,
java.lang.String residueInfo,
int locgroup,
int rank)
dbLoc - ChadoFeatureLoc giving the *current* database contentsprotected java.lang.String getPrimaryKeyColumn(java.lang.String tableName)
protected TableColumn[] getForeignKeyConstraints(java.lang.String tableName)
protected static java.util.HashMap getPrimaryKeyColumnMapping()
protected static java.util.HashMap getForeignKeyReferenceMapping()
public long getNextPrimaryKeyId(java.lang.String tableName)
protected long addPrimaryKeyColumnValue(java.lang.String tableName,
java.util.HashMap columnValues)
public boolean insertRow(java.lang.String tableName,
java.util.Map colValues,
java.util.Map unquotedColValues)
tableName - Name of the chado table into which to insert.colValues - Map from column name to column value. May be null.unquotedColValues - Map from column name to column value. May be null.
public boolean updateRow(java.lang.String tableName,
long id,
java.util.Map colValues,
java.util.Map unquotedColValues)
tableName - Name of the chado table to update.colValues - Map from column name to column value. May be null.unquotedColValues - Map from column name to column value. May be null.
public java.lang.String computeMD5Checksum(java.lang.String seq)
public java.lang.Long insertFeatureRow(java.lang.Long dbxrefId,
long organismId,
java.lang.String name,
java.lang.String uniquename,
java.lang.String residues,
java.lang.Long seqlen,
java.lang.Long typeId,
java.lang.Integer isAnalysis,
java.util.Date createDate)
public java.lang.Long insertFeatureRelationshipRow(java.lang.Long subjectId,
java.lang.Long objectId,
java.lang.Long typeId,
java.lang.String value,
java.lang.Long rank)
public boolean deleteFeatureRelationshipRow(java.lang.Long subjectId,
java.lang.Long objectId,
java.lang.Long typeId)
public java.lang.Long insertFeaturelocRow(java.lang.Long featureId,
java.lang.Long srcFeatureId,
java.lang.Integer fmin,
java.lang.Integer fmax,
boolean fmin_partial,
boolean fmax_partial,
java.lang.Integer strand,
java.lang.Integer phase,
java.lang.String residueInfo,
int locgroup,
long rank)
public java.lang.Long insertFeaturepropRow(java.lang.Long featureId,
java.lang.Long typeId,
java.lang.String value,
long rank,
boolean checkNextRank)
public java.lang.Long insertFeaturepropRow(java.lang.Long featureId,
java.lang.Long typeId,
java.lang.String value,
long rank)
public boolean deleteFeaturepropRow(java.lang.Long featurePropId)
public java.lang.Long insertPubRowIfNeeded(java.lang.String pubUniquename,
long pubTypeId)
public java.lang.Long insertFeaturepropPubRow(java.lang.Long featPropId,
java.lang.Long pubId)
public java.lang.Long insertSynonymRowIfNeeded(java.lang.String name,
java.lang.Long typeId,
java.lang.String synonym_sgml)
public boolean deleteSynonymRowIfNoLongerNeeded(java.lang.Long synonymId)
public java.lang.Long getSynonymId(java.lang.String name,
java.lang.Long typeId)
public java.lang.Long insertFeatureSynonymRow(java.lang.Long synId,
java.lang.Long featId,
java.lang.Integer pubId,
boolean is_current,
boolean is_internal)
public boolean deleteFeatureSynonymRow(java.lang.Long featureId,
java.lang.Long synonymId,
java.lang.Integer pubId)
public java.lang.Long getDbId(java.lang.String name)
public java.lang.Long insertDbRowIfNeeded(java.lang.String name)
public java.lang.Long getDbXrefId(long dbId,
java.lang.String accession,
java.lang.String version)
public java.lang.Long insertDbXrefRowIfNeeded(long dbId,
java.lang.String accession,
java.lang.String version,
java.lang.String description)
public java.lang.Long getFeatureDbXrefId(long featureId,
long dbXrefId)
public boolean updateFeatureDbXrefRow(apollo.dataadapter.chado.jdbc.ChadoFeatureDbXref dbFeatDbXref,
long featureId,
long dbXrefId,
boolean isCurrent)
dbFeatDbXref - ChadoFeatureDbXref giving the *current* database contentsfeatureId - New feature_iddbXrefId - New dbxref_idisCurrent - New value for is_current
public java.lang.Long insertFeatureDbXrefRow(long featureId,
long dbXrefId,
boolean isCurrent)
public boolean deleteFeatureDbXrefRow(long featureId,
long dbXrefId)
public java.util.List getRelatedFeatureIds(java.lang.Long featureId,
boolean isSubject,
java.lang.String relTypeName,
java.lang.String relFeatType)
featureId - chado feature_id of the original featureisSubject - whether featureId is the subject in the feature_relationshiprelTypeName - relationship cvterm.name
featureId
public java.lang.Long getRelatedFeatureRank(java.lang.Long subjectId,
java.lang.Long objectId,
java.lang.String relTypeName)
public boolean updateFeatureRelationshipRanks(java.lang.Long featureId,
boolean isSubject,
java.lang.String relTypeName,
java.lang.String relFeatType,
long newRank,
boolean increment)
public java.lang.Long getFeatureRelationshipId(java.lang.Long subjectId,
java.lang.Long objectId,
java.lang.Long typeId)
public boolean incrementTranscriptExonRanks(java.lang.Long transFeatureId,
long newExonRank)
public boolean decrementTranscriptExonRanks(java.lang.Long transFeatureId,
long newExonRank)
public boolean incrementGeneTranscriptRanks(java.lang.Long geneFeatureId,
long newTranscriptRank)
public boolean decrementGeneTranscriptRanks(java.lang.Long geneFeatureId,
long newTranscriptRank)
public java.util.List getGeneTranscriptIds(java.lang.Long geneFeatureId)
public java.util.List getTranscriptCdsIds(java.lang.Long transFeatureId)
public java.util.List getTranscriptExonIds(java.lang.Long transFeatureId)
public java.util.List getCdsPolypeptideIds(java.lang.Long cdsFeatureId)
public java.util.List getTranscriptPolypeptideIds(java.lang.Long transFeatureId)
public java.lang.Long getExonRank(java.lang.Long exonFeatureId,
java.lang.Long transFeatureId)
public java.lang.Long getTranscriptRank(java.lang.Long transFeatureId,
java.lang.Long geneFeatureId)
public boolean isSharedExon(long exonId)
exonId - - feature.feature_id of the exon
public CurationSet getCurationSet(ChadoAdapter adapter,
java.lang.String seqType,
java.lang.String seqId)
adapter - ChadoAdapter on whose behalf the database accesses are to be performed.seqType - cvterm type_id of the sequence identified by seqIdseqId - Chado feature_id of the sequence to be displayed/annotated in Apollo.
public CurationSet getCurationSetInRange(ChadoAdapter adapter,
java.lang.String seqType,
Region region)
public void commitChanges(CurationSet curationSet)
protected java.lang.String getFeatureType(java.lang.String alignType,
java.lang.String program,
java.lang.String programversion,
java.lang.String targetSp,
java.lang.String sourcename,
java.lang.String featProp)
protected java.lang.String getAnalysisFeatureIdentityField()
protected abstract java.lang.Object getBooleanValue(boolean val)
protected abstract java.lang.String getClobLengthFunction()
protected int _addTranscriptsToGene(AnnotatedFeature gene,
java.util.Vector transcripts)
gene - Gene to which the transcripts should be added.transcripts - A Vector of apollo.datamodel.Transcript objects. Cleared after the transcripts are added.
protected void _addExonsToTranscript(Transcript t,
java.util.Vector exons)
t - Transcript to which the exons should be added.exons - A Vector of apollo.datamodel.Exon objects. Cleared after the exons are added.
protected void _addFeaturesToFeatureSet(FeatureSet fs,
java.util.Vector feats)
t - FeatureSet to which the subfeatures should be added.exons - A Vector of apollo.datamodel.SeqFeatureI objects. Cleared after the features are added.
protected Transcript _makeNewTranscript(Transcript t,
apollo.dataadapter.chado.jdbc.ChadoCds cds)
t - A template Transcript on which to base the new object.cds - ChadoCds that specifies the coding region of the new transcript.
cds.
protected FeatureSet _makeFeatureSet(java.util.Vector features,
java.lang.String name,
java.lang.String type,
int strand)
features - name - type - strand -
protected void _addFeatures(FeatureSet fs,
java.util.Vector features)
fs - features -
protected SeqFeature _makeSeqFeature(int low,
int high,
java.lang.String type,
int strand)
low - high - type - strand -
protected SeqFeature _makeSeqFeature(java.lang.Integer low,
java.lang.Integer high,
java.lang.String type,
java.lang.Integer strand)
protected Exon _makeExon(int low,
int high,
int strand)
low - high - strand -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||