apollo.config
Class DefaultNameAdapter

java.lang.Object
  extended by apollo.config.DefaultNameAdapter
All Implemented Interfaces:
ApolloNameAdapterI
Direct Known Subclasses:
GmodNameAdapter, SimpleNameAdapter, TigrSybilNameAdapter

public class DefaultNameAdapter
extends java.lang.Object
implements ApolloNameAdapterI

If no name adapter is specified, and no or human gene def, then DefaultNameAdapter is used. Also superclass for FlyNameAdapter.


Constructor Summary
protected DefaultNameAdapter()
           
 
Method Summary
protected  AddTransaction addSynonym(AnnotatedFeatureI annFeat, java.lang.String synString)
          returns an add transaction for adding synonym to annot.
 boolean checkFormat(SeqFeatureI feat, java.lang.String idOrName)
          Returns true if seq feature's ID format is ok.
 boolean checkName(java.lang.String name, java.lang.Class featureClass)
           
 java.lang.String generateAnnotSplitName(SeqFeatureI annot, StrandedFeatureSetI annotParent, java.lang.String curationName)
          Generate a name for a gene split
 java.lang.String generateChadoCdsIdFromTranscriptId(java.lang.String transcriptId)
           
 java.lang.String generateChadoCdsNameFromTranscriptName(java.lang.String transcriptName)
          Generate a CDS name given a transcript name.
 java.lang.String generateExonId(StrandedFeatureSetI annots, java.lang.String curation_name, SeqFeatureI exon, java.lang.String geneId)
           
 java.lang.String generateId(StrandedFeatureSetI annots, java.lang.String curation_name, SeqFeatureI feature)
           
 java.lang.String generateName(StrandedFeatureSetI annots, java.lang.String curation_name, SeqFeatureI feature)
           
 java.lang.String generateName(StrandedFeatureSetI annots, java.lang.String curation_name, SeqFeatureI feature, java.util.Vector exonResults)
          Generates name for a given feature.
 java.lang.String generateNewExonId(StrandedFeatureSetI annots, java.lang.String curation_name, SeqFeatureI exon, java.lang.String geneId)
           
 java.lang.String generateNewId(StrandedFeatureSetI annots, java.lang.String curation_name, SeqFeatureI feature)
           
 java.lang.String generatePeptideIdFromTranscriptId(java.lang.String transcriptId)
           
 java.lang.String generatePeptideNameFromTranscriptName(java.lang.String transcriptName)
          Generate a peptide name given a transcript name.
 java.lang.String getNewIdFromTypeChange(java.lang.String oldId, java.lang.String oldType, java.lang.String newType)
           
 java.lang.String getSuffixDelimiter()
           
protected  TransactionManager getTransactionManager()
           
 java.lang.String getTranscriptNamePattern()
          Returns expected pattern (if any) for transcript names
 boolean idAndNameHaveSameFormat(SeqFeatureI feat, java.lang.String id, java.lang.String name)
          Returns true if name and id of feat are in the same format.
protected  boolean isTemp(SeqFeatureI feat)
           
 boolean isTemp(java.lang.String idOrName)
          Returns true if id/name String is a temp id/name.
protected  boolean match(SeqFeatureI sf, java.lang.String matchString)
          Returns true if matchString matches pattern specified for this type of SeqFeature.
 boolean nameIsId(SeqFeatureI feature)
           
protected  int nextAnnotNumber(StrandedFeatureSetI annots, java.lang.Class featClass)
          Generate the next number for use in temporary annotation id
 CompoundTransaction setAnnotId(AnnotatedFeatureI annot, java.lang.String id)
          currently only used by fly which overrides this - returns CompoundTransaction of all id changes - this is used by GeneEditPanel for explicit id changes(fly) and UpdateTransaction/TransactionUtil for id changes caused by type changes (fly) which should eventually use compound trans Merge & split dont use this (should they?)
 CompoundTransaction setAnnotName(AnnotatedFeatureI annot, java.lang.String newName)
          Set name for top level annot.
 void setDataAdapter(ApolloDataAdapterI dataAdapter)
           
protected  UpdateTransaction setId(SeqFeatureI annot, java.lang.String newId)
           
protected  UpdateTransaction setName(AnnotatedFeatureI annFeat, java.lang.String newName)
          Makes name update transaction, edits model w it, & returns it
 void setTransactionManager(TransactionManager tm)
          A name adapter needs a TransactionManager.
 CompoundTransaction setTranscriptId(SeqFeatureI trans, java.lang.String id)
          Sets transcript id, may also set peptide id
 CompoundTransaction setTranscriptName(AnnotatedFeatureI trans, java.lang.String name)
          sets transcript name to name and adds synonym of old trans name, returns compound transaction with update name and add syn transactions
 CompoundTransaction setTranscriptNameFromAnnot(AnnotatedFeatureI trans, AnnotatedFeatureI gene)
          Sets the name of a transcript based upon its annot parent.
protected  int skipUsedTempNum(java.lang.String id, int num)
          helper function to create new temp ids - gets the next temp number.
 boolean suffixInUse(java.util.Vector transcripts, java.lang.String suffix, int t_index)
           
 boolean typeChangeCausesIdChange(java.lang.String oldType, java.lang.String newType)
          Returns true if changing type from oldType to newType will cause a change in feature ID, i.e.
 void updateExonId(ExonI exon)
          This method is used by some adapters/databases to update the exon's id to reflect its new coordinates any time the exon's location is updated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultNameAdapter

protected DefaultNameAdapter()
Method Detail

setTransactionManager

public void setTransactionManager(TransactionManager tm)
Description copied from interface: ApolloNameAdapterI
A name adapter needs a TransactionManager. Has to make sure new temp id isnt in log.

Specified by:
setTransactionManager in interface ApolloNameAdapterI

getTransactionManager

protected TransactionManager getTransactionManager()

generateName

public java.lang.String generateName(StrandedFeatureSetI annots,
                                     java.lang.String curation_name,
                                     SeqFeatureI feature,
                                     java.util.Vector exonResults)
Description copied from interface: ApolloNameAdapterI
Generates name for a given feature. May or may not use associated vector of exon results used to make the annot

Specified by:
generateName in interface ApolloNameAdapterI

getSuffixDelimiter

public java.lang.String getSuffixDelimiter()
Specified by:
getSuffixDelimiter in interface ApolloNameAdapterI

checkName

public boolean checkName(java.lang.String name,
                         java.lang.Class featureClass)
Specified by:
checkName in interface ApolloNameAdapterI

generateName

public java.lang.String generateName(StrandedFeatureSetI annots,
                                     java.lang.String curation_name,
                                     SeqFeatureI feature)
Specified by:
generateName in interface ApolloNameAdapterI

generateAnnotSplitName

public java.lang.String generateAnnotSplitName(SeqFeatureI annot,
                                               StrandedFeatureSetI annotParent,
                                               java.lang.String curationName)
Description copied from interface: ApolloNameAdapterI
Generate a name for a gene split

Specified by:
generateAnnotSplitName in interface ApolloNameAdapterI

generateId

public java.lang.String generateId(StrandedFeatureSetI annots,
                                   java.lang.String curation_name,
                                   SeqFeatureI feature)
Specified by:
generateId in interface ApolloNameAdapterI

generateNewId

public java.lang.String generateNewId(StrandedFeatureSetI annots,
                                      java.lang.String curation_name,
                                      SeqFeatureI feature)
Specified by:
generateNewId in interface ApolloNameAdapterI

generateExonId

public java.lang.String generateExonId(StrandedFeatureSetI annots,
                                       java.lang.String curation_name,
                                       SeqFeatureI exon,
                                       java.lang.String geneId)
Specified by:
generateExonId in interface ApolloNameAdapterI

generateNewExonId

public java.lang.String generateNewExonId(StrandedFeatureSetI annots,
                                          java.lang.String curation_name,
                                          SeqFeatureI exon,
                                          java.lang.String geneId)
Specified by:
generateNewExonId in interface ApolloNameAdapterI

updateExonId

public void updateExonId(ExonI exon)
Description copied from interface: ApolloNameAdapterI
This method is used by some adapters/databases to update the exon's id to reflect its new coordinates any time the exon's location is updated.

Specified by:
updateExonId in interface ApolloNameAdapterI

setName

protected UpdateTransaction setName(AnnotatedFeatureI annFeat,
                                    java.lang.String newName)
Makes name update transaction, edits model w it, & returns it


setAnnotName

public CompoundTransaction setAnnotName(AnnotatedFeatureI annot,
                                        java.lang.String newName)
Description copied from interface: ApolloNameAdapterI
Set name for top level annot. may set synonym and transcript names as well depending on subclass

Specified by:
setAnnotName in interface ApolloNameAdapterI

setTranscriptName

public CompoundTransaction setTranscriptName(AnnotatedFeatureI trans,
                                             java.lang.String name)
sets transcript name to name and adds synonym of old trans name, returns compound transaction with update name and add syn transactions

Specified by:
setTranscriptName in interface ApolloNameAdapterI

setTranscriptId

public CompoundTransaction setTranscriptId(SeqFeatureI trans,
                                           java.lang.String id)
Description copied from interface: ApolloNameAdapterI
Sets transcript id, may also set peptide id

Specified by:
setTranscriptId in interface ApolloNameAdapterI

setTranscriptNameFromAnnot

public CompoundTransaction setTranscriptNameFromAnnot(AnnotatedFeatureI trans,
                                                      AnnotatedFeatureI gene)
Description copied from interface: ApolloNameAdapterI
Sets the name of a transcript based upon its annot parent. May also set exon names. May also set peptide accession

Specified by:
setTranscriptNameFromAnnot in interface ApolloNameAdapterI

addSynonym

protected AddTransaction addSynonym(AnnotatedFeatureI annFeat,
                                    java.lang.String synString)
returns an add transaction for adding synonym to annot. return null if syn is null,no_name, or temp - should probably also check if synonym exists already


isTemp

public boolean isTemp(java.lang.String idOrName)
Returns true if id/name String is a temp id/name. Default is to look for "temp" in id or name.

Specified by:
isTemp in interface ApolloNameAdapterI

isTemp

protected boolean isTemp(SeqFeatureI feat)

nameIsId

public boolean nameIsId(SeqFeatureI feature)
Specified by:
nameIsId in interface ApolloNameAdapterI

suffixInUse

public boolean suffixInUse(java.util.Vector transcripts,
                           java.lang.String suffix,
                           int t_index)
Specified by:
suffixInUse in interface ApolloNameAdapterI

checkFormat

public boolean checkFormat(SeqFeatureI feat,
                           java.lang.String idOrName)
Returns true if seq feature's ID format is ok. The format checked is the regex from tiers/feature property. If no regex provided returns true. idOrName could be the features ID or it could be its name to check if the name is mirroring the IDs format

Specified by:
checkFormat in interface ApolloNameAdapterI

idAndNameHaveSameFormat

public boolean idAndNameHaveSameFormat(SeqFeatureI feat,
                                       java.lang.String id,
                                       java.lang.String name)
Returns true if name and id of feat are in the same format. The format checked is the regex from tiers/feature property. If no regex provided returns true. Rename idAndNameHaveIdFormat? HaveConfiggedFormat? The first checks whether the ID format is legal the second checks whether the name also matches the ID format If there is no format specified then there needs to be a third check to see there is a format at all. If none is specified then this will return false always Currently the only place this is called is in FeatureEditorDialog

Specified by:
idAndNameHaveSameFormat in interface ApolloNameAdapterI

match

protected boolean match(SeqFeatureI sf,
                        java.lang.String matchString)
Returns true if matchString matches pattern specified for this type of SeqFeature. should temp ids be able to pass? currently they cant i think they should?? this came up with a bug in gene edit panel


getTranscriptNamePattern

public java.lang.String getTranscriptNamePattern()
Description copied from interface: ApolloNameAdapterI
Returns expected pattern (if any) for transcript names

Specified by:
getTranscriptNamePattern in interface ApolloNameAdapterI

typeChangeCausesIdChange

public boolean typeChangeCausesIdChange(java.lang.String oldType,
                                        java.lang.String newType)
Returns true if changing type from oldType to newType will cause a change in feature ID, i.e. the ID prefix will change to reflect the new type. By default returns false.

Specified by:
typeChangeCausesIdChange in interface ApolloNameAdapterI

getNewIdFromTypeChange

public java.lang.String getNewIdFromTypeChange(java.lang.String oldId,
                                               java.lang.String oldType,
                                               java.lang.String newType)
Specified by:
getNewIdFromTypeChange in interface ApolloNameAdapterI

nextAnnotNumber

protected int nextAnnotNumber(StrandedFeatureSetI annots,
                              java.lang.Class featClass)
Generate the next number for use in temporary annotation id


skipUsedTempNum

protected int skipUsedTempNum(java.lang.String id,
                              int num)
helper function to create new temp ids - gets the next temp number. if id is a temp id, parses out number used in temp id and return that number plus one if greater then num. This assumes temping is done with ":temp#". If curation_name is non null it uses it to strip it off the end (fly temp names have :curation_name at the end - this should probably just go in the fly adapter)


setAnnotId

public CompoundTransaction setAnnotId(AnnotatedFeatureI annot,
                                      java.lang.String id)
currently only used by fly which overrides this - returns CompoundTransaction of all id changes - this is used by GeneEditPanel for explicit id changes(fly) and UpdateTransaction/TransactionUtil for id changes caused by type changes (fly) which should eventually use compound trans Merge & split dont use this (should they?)

Specified by:
setAnnotId in interface ApolloNameAdapterI

setId

protected UpdateTransaction setId(SeqFeatureI annot,
                                  java.lang.String newId)

generatePeptideNameFromTranscriptName

public java.lang.String generatePeptideNameFromTranscriptName(java.lang.String transcriptName)
Description copied from interface: ApolloNameAdapterI
Generate a peptide name given a transcript name.

Specified by:
generatePeptideNameFromTranscriptName in interface ApolloNameAdapterI

generatePeptideIdFromTranscriptId

public java.lang.String generatePeptideIdFromTranscriptId(java.lang.String transcriptId)
Specified by:
generatePeptideIdFromTranscriptId in interface ApolloNameAdapterI

generateChadoCdsNameFromTranscriptName

public java.lang.String generateChadoCdsNameFromTranscriptName(java.lang.String transcriptName)
Description copied from interface: ApolloNameAdapterI
Generate a CDS name given a transcript name. Used only by the chado adapter.

Specified by:
generateChadoCdsNameFromTranscriptName in interface ApolloNameAdapterI

generateChadoCdsIdFromTranscriptId

public java.lang.String generateChadoCdsIdFromTranscriptId(java.lang.String transcriptId)
Specified by:
generateChadoCdsIdFromTranscriptId in interface ApolloNameAdapterI

setDataAdapter

public void setDataAdapter(ApolloDataAdapterI dataAdapter)
Specified by:
setDataAdapter in interface ApolloNameAdapterI