edu.mssm.crover.webapps.dimlib.datamodel
Class MutationManager

java.lang.Object
  |
  +--edu.mssm.crover.webapps.dimlib.datamodel.MutationManager

public class MutationManager
extends java.lang.Object

Provides access to the persistent DimLib datamodel.

Author:
Fabien Campagne, luce

Constructor Summary
MutationManager()
          Constructs a new mutation manager.
 
Method Summary
 void abort()
          Aborts the transaction.
 void addGifXMLtoMP(MutantProtein mp, GifMap xml)
          Updates the MutantProtein to include the mapping information for the GIF image.
 void addGifXMLtoWTP(WildTypeProtein wtp, GifMap xml)
          Updates the WildTypeProtein to include the mapping information for the GIF image.
 void begin()
          Begins a transaction.
 void commit()
          Commits the transaction.
 MutantProtein createMutantProtein(WildTypeProtein wildtype)
          Creates a MutantProtein.
 WildTypeProtein createWildTypeProtein(java.lang.String name, java.lang.String family)
          Creates a WildTypeProtein.
 boolean delete(java.lang.Object object)
          Deletes a persistent object.
 boolean doesACExist(java.lang.String ac, java.lang.String org)
          Searches for this accession code in the database.
 java.util.Collection getAllArcadiaAlns()
          Queries the database for all stored ArcadiaAlignments.
 java.util.Collection getAllFamilies()
          Returns a Collection of all the families associated with WildTypeProteins in the database.
 java.util.Collection getAllMutantProteins()
          Returns all MutantProteins in the database.
 java.util.Collection getAllSNPs()
          Returns all the SNPs in the database.
 java.util.Collection getAllWTProteins()
          Returns all WildTypeProteins in the database.
 ArcadiaAlignment getArcadiaAlnByID(java.lang.String id)
          Queries the database for the ArcadiaAlignments with the specific ID.
 java.util.Collection getArcadiaAlnsByKeyword(java.lang.String keyword)
          Queries the database for ArcadiaAlignments which contain the keyword in either the name or description fields.
 java.util.Collection getArcadiaAlnsByName(java.lang.String name)
          Queries the database for ArcadiaAlignments whose short_name matches name.
 java.util.Collection getArcadiaAlnsBySeq(java.lang.String keyword)
          Queries the database for ArcadiaAlignments containing the ArcadiaAlignedSequence seq defined by this keyword.
 java.util.Collection getCorrelatedSNPs()
          Returns all the SNPs which occur at positions which already have mutations entered for them (for the same protein) in the database.
 GenericPosition getGenericPosition(Mutation mutation, MutantProtein mutant, WildTypeProtein protein)
          Returns the generic position associated for this mutation.
 MutantProtein getMutantProteinById(java.lang.String id)
          Queries the database for a MutantProtein by its ID.
 java.util.Collection getMutantProteins(java.lang.String keyword)
          Queries the database for the presence of a keyword in a MutantProtein.
 java.util.Collection getMutantProteinsByAc(java.lang.String ac)
          Queries the database for MutantProteins by the accession code of their parent WildTypeProtein.
 java.util.Collection getMutantProteinsByOrg(java.lang.String organism)
          Queries the database for MutantProteins by the organism of their parent WildTypeProtein.
 java.util.Collection getMutantProteinsByPosition(java.lang.String q)
          Queries the database for MutantProteins with a mutation at a given position.
 java.util.Collection getMutantProteinsBySubmitter(java.lang.String name)
          Queries the database for MutantProteins by submitter.
 java.util.Collection getMutantProteinsByWTP(WildTypeProtein w)
          Queries the database for MutantProteins associated with a WildTypeProtein.
 java.util.Collection getMutantProteinsCriteria()
           
 javax.jdo.PersistenceManager getPersistenceManager()
           
 java.util.Collection getProteinsCriteria()
           
 javax.jdo.Transaction getTrans()
           
 java.util.Collection getWTPByPosition(java.lang.String q)
          Queries the database for WildTypeProteins which have MutantProteins with mutations at a given position.
 java.util.Collection getWTPBySubmitter(java.lang.String name)
          Queries the database for WildTypeProteins submitted by a particular submitter.
 WildTypeProtein getWTProteinByAcOrg(java.lang.String ac, java.lang.String organism)
          Queries the database for a WildTypeProtein by accession code and organism.
 WildTypeProtein getWTProteinById(java.lang.String id)
          Queries the database for WildTypeProteins by DiMLib ID.
 WildTypeProtein getWTProteinByMID(java.lang.String id)
          Queries the database for a WildTypeProtein by mutant id.
 WildTypeProtein getWTProteinByName(java.lang.String name, java.lang.String family, java.lang.String organism)
          Queries the database for a WildTypeProtein by name and family and organism.
 java.util.Collection getWTProteins(java.lang.String keyword)
          Queries the database for the presence of a keyword in a WildTypeProtein.
 java.util.Collection getWTProteinsByAc(java.lang.String ac)
          Queries the database for WildTypeProteins by accession code.
 java.util.Collection getWTProteinsByOrg(java.lang.String organism)
          Queries the database for a WildTypeProtein by organism.
 boolean isAcInDb(java.lang.String ac, java.lang.String db)
          Searches for this accession code in the Arcadia database.
 boolean isAutoCommit()
           
static void main(java.lang.String[] args)
           
 java.lang.String mutantExists(WildTypeProtein wtp, MutantProtein mp)
          Checks if the MutantProtein is already associated with the given WildTypeProtein.
 java.util.Collection selectMutantProteinsByPosition(java.util.Collection c, java.lang.String q)
           
 void setAutoCommit(boolean autoCommit)
          Sets auto commit on this manager.
 void setPersistenceManager(javax.jdo.PersistenceManager persistenceManager)
           
 java.lang.String snpExists(WildTypeProtein wtp, SNP snp)
          Checks if the SNP is already associated with the given WildTypeProtein.
 void submitAccessionCode(AccessionCode ac)
          Submits an AccessionCode.
 void submitArcadiaAlignment(ArcadiaAlignment aln)
           
 void submitMutantProtein(MutantProtein mp)
          Submits a MutantProtein.
 void submitSNP(SNP snp)
           
 void submitWildTypeProtein(WildTypeProtein wtp)
          Submits a WildTypeProtein.
 void updateWildTypeProtein(WildTypeProtein wp, java.util.Collection mp)
          Updates the MutantProteins associated with a WildTypeProtein.
 void updateWildTypeProtein(WildTypeProtein wp, MutantProtein mp)
          Updates the MutantProteins associated with a WildTypeProtein.
 void updateWildTypeProtein(WildTypeProtein wp, SNP snp)
           
 void updateWTPRefs(WildTypeProtein wtp, java.lang.String database, java.lang.String ac)
          Updates the ExternalReferences associated with a WildTypeProtein.
 boolean wtpExists(WildTypeProtein wtp)
          Checks if the WildTypeProtein is already in the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MutationManager

public MutationManager()
Constructs a new mutation manager. Auto commit is set to true by default.

Method Detail

getGenericPosition

public GenericPosition getGenericPosition(Mutation mutation,
                                          MutantProtein mutant,
                                          WildTypeProtein protein)
Returns the generic position associated for this mutation. The mutation is part of a mutant.

Parameters:
protein - The wild type sequence.
mutant - The mutant which contains the mutation.
mutation - The mutation for which a generic position should be computed.

getAllWTProteins

public java.util.Collection getAllWTProteins()
Returns all WildTypeProteins in the database.


getWTProteins

public java.util.Collection getWTProteins(java.lang.String keyword)
Queries the database for the presence of a keyword in a WildTypeProtein. The keyword can appear in either the the protein name or the protein family.


getWTProteinsByAc

public java.util.Collection getWTProteinsByAc(java.lang.String ac)
Queries the database for WildTypeProteins by accession code.


getWTProteinById

public WildTypeProtein getWTProteinById(java.lang.String id)
Queries the database for WildTypeProteins by DiMLib ID.


getWTProteinByAcOrg

public WildTypeProtein getWTProteinByAcOrg(java.lang.String ac,
                                           java.lang.String organism)
Queries the database for a WildTypeProtein by accession code and organism.


getWTProteinsByOrg

public java.util.Collection getWTProteinsByOrg(java.lang.String organism)
Queries the database for a WildTypeProtein by organism.


getWTProteinByMID

public WildTypeProtein getWTProteinByMID(java.lang.String id)
Queries the database for a WildTypeProtein by mutant id. Searches for a mutant with that id, and returns the WildTypeProtein associated with it.


getWTProteinByName

public WildTypeProtein getWTProteinByName(java.lang.String name,
                                          java.lang.String family,
                                          java.lang.String organism)
Queries the database for a WildTypeProtein by name and family and organism.


getWTPBySubmitter

public java.util.Collection getWTPBySubmitter(java.lang.String name)
Queries the database for WildTypeProteins submitted by a particular submitter.


getWTPByPosition

public java.util.Collection getWTPByPosition(java.lang.String q)
Queries the database for WildTypeProteins which have MutantProteins with mutations at a given position.


getAllMutantProteins

public java.util.Collection getAllMutantProteins()
Returns all MutantProteins in the database.


getProteinsCriteria

public java.util.Collection getProteinsCriteria()

getMutantProteinsCriteria

public java.util.Collection getMutantProteinsCriteria()

getMutantProteins

public java.util.Collection getMutantProteins(java.lang.String keyword)
Queries the database for the presence of a keyword in a MutantProtein. The keyword can appear in the description field (mutant-specific) or in the accession code field, the protein name or the protein family of the WildTypeProtein from which this mutant originates.


getMutantProteinsByAc

public java.util.Collection getMutantProteinsByAc(java.lang.String ac)
Queries the database for MutantProteins by the accession code of their parent WildTypeProtein.


getMutantProteinsByOrg

public java.util.Collection getMutantProteinsByOrg(java.lang.String organism)
Queries the database for MutantProteins by the organism of their parent WildTypeProtein.


getMutantProteinById

public MutantProtein getMutantProteinById(java.lang.String id)
Queries the database for a MutantProtein by its ID.


getMutantProteinsBySubmitter

public java.util.Collection getMutantProteinsBySubmitter(java.lang.String name)
Queries the database for MutantProteins by submitter.


getMutantProteinsByPosition

public java.util.Collection getMutantProteinsByPosition(java.lang.String q)
Queries the database for MutantProteins with a mutation at a given position.


getMutantProteinsByWTP

public java.util.Collection getMutantProteinsByWTP(WildTypeProtein w)
Queries the database for MutantProteins associated with a WildTypeProtein.


getAllArcadiaAlns

public java.util.Collection getAllArcadiaAlns()
Queries the database for all stored ArcadiaAlignments.


getArcadiaAlnByID

public ArcadiaAlignment getArcadiaAlnByID(java.lang.String id)
Queries the database for the ArcadiaAlignments with the specific ID.


getArcadiaAlnsByName

public java.util.Collection getArcadiaAlnsByName(java.lang.String name)
Queries the database for ArcadiaAlignments whose short_name matches name.


getArcadiaAlnsByKeyword

public java.util.Collection getArcadiaAlnsByKeyword(java.lang.String keyword)
Queries the database for ArcadiaAlignments which contain the keyword in either the name or description fields.


getArcadiaAlnsBySeq

public java.util.Collection getArcadiaAlnsBySeq(java.lang.String keyword)
Queries the database for ArcadiaAlignments containing the ArcadiaAlignedSequence seq defined by this keyword. The keyword can be part of the name, family or the accession code.


getAllSNPs

public java.util.Collection getAllSNPs()
Returns all the SNPs in the database.


getCorrelatedSNPs

public java.util.Collection getCorrelatedSNPs()
Returns all the SNPs which occur at positions which already have mutations entered for them (for the same protein) in the database.


getAllFamilies

public java.util.Collection getAllFamilies()
Returns a Collection of all the families associated with WildTypeProteins in the database.


wtpExists

public boolean wtpExists(WildTypeProtein wtp)
Checks if the WildTypeProtein is already in the database. Uses the protein name, family and organism, which are the only fields that are obligatory.


mutantExists

public java.lang.String mutantExists(WildTypeProtein wtp,
                                     MutantProtein mp)
Checks if the MutantProtein is already associated with the given WildTypeProtein. If it is, returns the ID of the mutant which already exists in the database.


doesACExist

public boolean doesACExist(java.lang.String ac,
                           java.lang.String org)
Searches for this accession code in the database. Returns true if this accession code is already associated with this organism.


isAcInDb

public boolean isAcInDb(java.lang.String ac,
                        java.lang.String db)
Searches for this accession code in the Arcadia database. Returns true if this accession code is found in the given database. In this case, the organism field is irrelevant (we can have several organisms with the accession code/database information for the same protein).


snpExists

public java.lang.String snpExists(WildTypeProtein wtp,
                                  SNP snp)
Checks if the SNP is already associated with the given WildTypeProtein. If it is, returns the ID of the mutant which already exists in the database.


submitWildTypeProtein

public void submitWildTypeProtein(WildTypeProtein wtp)
Submits a WildTypeProtein.

Parameters:
wtp - is the instance of the WildTypeProtein that is to be made persistent.

createWildTypeProtein

public WildTypeProtein createWildTypeProtein(java.lang.String name,
                                             java.lang.String family)
Creates a WildTypeProtein.

Parameters:
family - Name of the family to which the new protein will belong.

updateWildTypeProtein

public void updateWildTypeProtein(WildTypeProtein wp,
                                  java.util.Collection mp)
Updates the MutantProteins associated with a WildTypeProtein.

Parameters:
wp - the WildTypeProtein to be updated.
mp - Collection of MutantProteins to be added to the WildTypeProtein.

updateWildTypeProtein

public void updateWildTypeProtein(WildTypeProtein wp,
                                  SNP snp)

updateWTPRefs

public void updateWTPRefs(WildTypeProtein wtp,
                          java.lang.String database,
                          java.lang.String ac)
Updates the ExternalReferences associated with a WildTypeProtein.

Parameters:
database - the database which the new reference refers to.
ac - the accession code which the new reference refers to.

updateWildTypeProtein

public void updateWildTypeProtein(WildTypeProtein wp,
                                  MutantProtein mp)
Updates the MutantProteins associated with a WildTypeProtein.

Parameters:
wp - the WildTypeProtein to be updated.
mp - MutantProtein to be added to the WildTypeProtein.

addGifXMLtoWTP

public void addGifXMLtoWTP(WildTypeProtein wtp,
                           GifMap xml)
Updates the WildTypeProtein to include the mapping information for the GIF image.


submitMutantProtein

public void submitMutantProtein(MutantProtein mp)
Submits a MutantProtein.

Parameters:
mp - - the instance of MutantProtein to be made persistent.

createMutantProtein

public MutantProtein createMutantProtein(WildTypeProtein wildtype)
Creates a MutantProtein.

Parameters:
wildtype - - the WildTypeProtein which is the origin of this MutantProtein.

addGifXMLtoMP

public void addGifXMLtoMP(MutantProtein mp,
                          GifMap xml)
Updates the MutantProtein to include the mapping information for the GIF image.


submitAccessionCode

public void submitAccessionCode(AccessionCode ac)
Submits an AccessionCode.

Parameters:
ac - is the instance of the AccessionCode that is to be made persistent.

submitArcadiaAlignment

public void submitArcadiaAlignment(ArcadiaAlignment aln)

submitSNP

public void submitSNP(SNP snp)

selectMutantProteinsByPosition

public java.util.Collection selectMutantProteinsByPosition(java.util.Collection c,
                                                           java.lang.String q)

delete

public boolean delete(java.lang.Object object)
Deletes a persistent object. The peristent object is no longer persistent when this method succeeds.

Returns:
true when the object has been deleted. false if the object could not be deleted.

getTrans

public javax.jdo.Transaction getTrans()

begin

public void begin()
Begins a transaction.


commit

public void commit()
Commits the transaction. See begin() to start the transaction.


abort

public void abort()
Aborts the transaction. See begin() to start the transaction.


getPersistenceManager

public javax.jdo.PersistenceManager getPersistenceManager()

setPersistenceManager

public void setPersistenceManager(javax.jdo.PersistenceManager persistenceManager)

isAutoCommit

public boolean isAutoCommit()

setAutoCommit

public void setAutoCommit(boolean autoCommit)
Sets auto commit on this manager.

Parameters:
autoCommit - When set to true, the manager will commit a change each time a method succeeds. When false, the client must manage transactions explicitly. Explicit management of transactions can be performed by using the start(), commit() and abort() methods of the manager.
See Also:
begin(), commit(), abort()

main

public static void main(java.lang.String[] args)


Copyright @ 2003 Mount Sinai School of Medicine. All Rights Reserved.