PianaInsertSQL
index
../../../../piana/code/PianaDB/PianaInsertSQL.py

 File       : PianaInsertSQL.py
 Author     : R. Aragues & D. Jaeggi
 Creation   : 2003
 Contents   : subclasses for generating insert sql statements
 Called from: PianaDBaccess
 
=======================================================================================================
 
This class is used in the same way as PianaSelectSQL
 
Each of the subclasses creates an sql query string that can be used to insert information into Piana
 
This is done this way to generalize as much as possible the interaction of users with the database pianaDB.
 
A user that needs to insert information into pianaDB will not create the SQL statement himself, but will
use one of these classes, together with method insert_db_content() of class PianaDB
 
class PianaDBaccess integrates into a single and clear interface all the access to piana databases

 
Modules
       
PianaGlobals

 
Classes
       
PianaInsertSQL
DeleteInteraction
DeleteInteractionMethod
DeleteInteractionProteinSource
DeleteInteractionScores
DeleteInteractionSourceDB
InsertCellFitness
InsertCog
InsertGo
InsertGo_term2term_distance
InsertInteraction
InsertInteractionFeatures
InsertInteractionMethod
InsertInteractionProteinSource
InsertInteractionScores
InsertInteractionSourceDB
InsertProtein
InsertProteinAttributeRelationship
InsertProteinCathRelationship
InsertProteinDBAliRelationship
InsertProteinEMBLCode
InsertProteinExternalCode
InsertProteinInterProCode
InsertProteinPIRCode
InsertProteinPdbCode
InsertProteinPianaCorrespondence
InsertProteinPianaCounter
InsertProteinScopRelationship
InsertProteinSimilarity
InsertProteinSwissAccessionCode
InsertSpecies
InsertUniprotInfo
UpdateSpeciesKingdom
UpdateTableColumn

 
class DeleteInteraction(PianaInsertSQL)
    Generates sql statement to delete an interaction entry from table interaction
 
  Static methods defined here:
get_sqlquery(interactionPiana_value)

 
class DeleteInteractionMethod(PianaInsertSQL)
    Generates sql statement to delete an interaction entry from table interactionMethod
 
It can be used to delete a particular interactionPiana or just those entries that belong to a specific source db or those with a method ID
 
  - if interactionPiana_value 'not None' --> delete entries where interactionPiana = interactionPiana_value
 
  - if sourceDBID_value 'not None' -->  delete entries where sourceDBID = sourceDBID_value
 
  - if methodID_value 'not None' -->  delete entries where methodID = methodID_value
 
Only one argument can be 'not None'
 
  Static methods defined here:
get_sqlquery(interactionPiana_value=None, sourceDBID_value=None, methodID_value=None)

 
class DeleteInteractionProteinSource(PianaInsertSQL)
    Generates sql statement to delete an interaction protein source entry from table interactionProteinSource
 
It can be used to delete a particular interactionPiana or just those entries that belong to a specific source db
 
  - if interactionPiana_value 'not None' --> delete entries where interactionPiana = interactionPiana_value
 
  - if sourceDBID_value 'not None' -->  delete entries where sourceDBID = sourceDBID_value
 
Only one argument can be 'not None'
 
  Static methods defined here:
get_sqlquery(interactionPiana_value=None, sourceDBID_value=None)

 
class DeleteInteractionScores(PianaInsertSQL)
    Generates sql statement to delete an interaction scores entry from table interactionScores
 
It can be used to delete a particular interactionPiana or just those entries that belong to a specific source db
 
  - if interactionPiana_value 'not None' --> delete entries where interactionPiana = interactionPiana_value
 
  - if sourceDBID_value 'not None' -->  delete entries where sourceDBID = sourceDBID_value
 
 
Only one argument can be 'not None'
 
  Static methods defined here:
get_sqlquery(interactionPiana_value=None, sourceDBID_value=None)

 
class DeleteInteractionSourceDB(PianaInsertSQL)
    Generates sql statement to delete an interaction entry from table interactionSourceDB
 
It can be used to delete a particular interactionPiana or just those entries that belong to a specific source db
 
   - if interactionPiana_value 'not None' --> delete entries where interactionPiana = interactionPiana_value
 
   - if sourceDBID_value 'not None' -->  delete entries where sourceDBID = sourceDBID_value
 
Only one argument can be 'not None'
 
  Static methods defined here:
get_sqlquery(interactionPiana_value=None, sourceDBID_value=None)

 
class InsertCellFitness(PianaInsertSQL)
    Generates sql statement to insert information on table cell_fitness
 
  Static methods defined here:
get_sqlquery(fitnessScore_value, reaction_value, conditions_value, cellFitnessSource_value, proteinPiana_value)

 
class InsertCog(PianaInsertSQL)
    Generates sql statement to insert information on table cog
 
  Static methods defined here:
get_sqlquery(cogID_value, cogDescription_value, cogFunction_value, cogSource_value)

 
class InsertGo(PianaInsertSQL)
    Generates sql statement to insert information on table go
 
  Static methods defined here:
get_sqlquery(goID_value, go_name_value, go_acc_value, go_term_type_value, go_distance2root_value, goSource_value)

 
class InsertGo_term2term_distance(PianaInsertSQL)
    Generates sql statement to insert distance between two terms
 
  Static methods defined here:
get_sqlquery(term1_id_value, term2_id_value, distance_value)

 
class InsertInteraction(PianaInsertSQL)
    Generates sql statement to insert information on table interaction
 
  Static methods defined here:
get_sqlquery(proteinPianaA_value, isSourceA_value, proteinPianaB_value, isSourceB_value, interactionConfidence_value)

 
class InsertInteractionFeatures(PianaInsertSQL)
    Generates sql statement to insert information on table interactionMethod
 
  Static methods defined here:
get_sqlquery(pubmedID_value, interactionPiana_value, sourceDBID_value)

 
class InsertInteractionMethod(PianaInsertSQL)
    Generates sql statement to insert information on table interactionMethod
 
  Static methods defined here:
get_sqlquery(methodID_value, interactionPiana_value, sourceDBID_value)

 
class InsertInteractionProteinSource(PianaInsertSQL)
    Generates sql statement to insert information on table interactionProteinSource
 
  Static methods defined here:
get_sqlquery(interactionPiana_value=None, proteinPianaSource_value=None, sourceDBID_value=None)

 
class InsertInteractionScores(PianaInsertSQL)
    Generates sql statement to insert information on table interactionScores
 
  Static methods defined here:
get_sqlquery(interactionPiana_value, sourceDBID_value, equiv_nscore_value, equiv_nscore_transferred_value, equiv_fscore_value, equiv_pscore_value, equiv_hscore_value, array_score_value, array_score_transferred_value, experimental_score_value, experimental_score_transferred_value, database_score_value, database_score_transferred_value, textmining_score_value, textmining_score_transferred_value, combined_score_value)

 
class InsertInteractionSourceDB(PianaInsertSQL)
    Generates sql statement to insert information on table interactionSourceDB
 
  Static methods defined here:
get_sqlquery(sourceDBID_value, confidenceAssignedSourceDB_value, interactionPiana_value)

 
class InsertProtein(PianaInsertSQL)
    Generates sql statement to insert information on table protein
 
  Static methods defined here:
get_sqlquery(proteinPiana_value, tax_id_value, proteinSequence_value, proteinMD5_value, proteinSequenceLength_value, proteinMW_value, proteinIP_value)

 
class InsertProteinAttributeRelationship(PianaInsertSQL)
    Generates sql statement to insert information on protein attributes relationship tables
 
the tables must follow the structure:
 
(currently for tables:
 
proteinCog_table
proteinGo_table
proteinEC_table 
proteinSpecies_table 
proteinDescription_table 
proteinKeyword_table 
proteinFunction_table 
proteinSubcellularLocation_table
)
 
  Static methods defined here:
get_sqlquery(attribute_relationship_table, attribute_value, proteinPiana_value, attributeSource_value)

 
class InsertProteinCathRelationship(PianaInsertSQL)
    Generates sql statement to insert information of CATH to table proteinCath
 
  Static methods defined here:
get_sqlquery(cathID_value, res_start_value, res_end_value, segmentID_value, proteinPiana_value, source_value)

 
class InsertProteinDBAliRelationship(PianaInsertSQL)
    Generates sql statement to insert information of DBAli clustering of pibase patches to table proteinDBAliCluster
 
  Static methods defined here:
get_sqlquery(dbali_cluster_id_value, proteinPiana_value, clustering_method_value, patch_residues_value, protein_dbali_cluster_source)

 
class InsertProteinEMBLCode(PianaInsertSQL)
    Generates sql statement to insert protein information on tables that follow the structure:
 
code ID (external code, for example emblPID)
proteinPiana  (internal piana protein code)
version (number of version for the external code)
codeSource  (name of origin of the data being inserted)
 
Instead of writing one class for each table, this class is designed to handle all these similar tables
 
current tables managed through this class are: emblAcc, emblPID
 
  Static methods defined here:
get_sqlquery(table_name, code_value, proteinPiana_value, version_value, codeSource_value)

 
class InsertProteinExternalCode(PianaInsertSQL)
    Generates sql statement to insert protein information on tables that follow the structure:
 
codeID  (external code, for example swissprotID) (string)
proteinPiana  (internal piana protein code)
codeSource  (name of origin of the data being inserted)
 
Instead of writing one class for each table, this class is designed to handle all these similar tables. This is somehow
dangerous, since we are hardcoding the order of the fields of the tables. If the order is changed, this class
will not work... and we would need to de-generalize it to insert information separately in each table.
 
current tables managed through this class are: swissProt,  geneName, gi, protein_id_intDB_table
 
  Static methods defined here:
get_sqlquery(table_name, code_value, proteinPiana_value, codeSource_value)

 
class InsertProteinInterProCode(PianaInsertSQL)
    Generates sql statement to insert protein information on tables that follow the structure:
 
code ID (external code, for example interProID) (string)
proteinPiana  (internal piana protein code)
description (description of codeID) (string)
codeSource  (name of origin of the data being inserted)
 
Instead of writing one class for each table, this class is designed to handle all these similar tables
 
current tables managed through this class are: interPro
 
  Static methods defined here:
get_sqlquery(table_name, code_value, proteinPiana_value, description_value, codeSource_value)

 
class InsertProteinPIRCode(PianaInsertSQL)
    Generates sql statement to insert protein information on tables that follow the structure:
 
code ID (external code, for example pirEntry) (string)
proteinPiana  (internal piana protein code)
isComplete boolean information about if the entry is either a complete protein (1) or a fragment(0). NULL when not known
codeSource  (name of origin of the data being inserted)
 
Instead of writing one class for each table, this class is designed to handle all these similar tables
 
current tables managed through this class are: pirEntry, pirAcc
 
  Static methods defined here:
get_sqlquery(table_name, code_value, proteinPiana_value, isComplete_value, codeSource_value)

 
class InsertProteinPdbCode(PianaInsertSQL)
    Generates sql statement to insert protein information on tables that follow the structure:
 
code ID (external code, for example PDB ID) (string)
proteinPiana  (internal piana protein code)
chain ID (specific to codeID) (string)
codeSource  (name of origin of the data being inserted)
 
Instead of writing one class for each table, this class is designed to handle all these similar tables
 
current tables managed through this class are: pdb
 
  Static methods defined here:
get_sqlquery(table_name, code_value, proteinPiana_value, chain_value, codeSource_value)

 
class InsertProteinPianaCorrespondence(PianaInsertSQL)
    Generates sql statement to generate the SQL statement that obtains the proteinPiana associated to a proteinMD5 in table proteinCorrespondence
 
This class is used to keep consistency of proteinPiana <--> proteinSequence between different versions of piana databases
 
Attention: not using it! Well... information is inserted, but coherence between different versions of piana databases is not maintained
 
  Static methods defined here:
get_sqlquery(proteinPiana_value, proteinMD5_value, tax_id_value)

 
class InsertProteinPianaCounter(PianaInsertSQL)
    Generates sql statement to generate the SQL statement that obtains a new proteinPiana identifier from proteinPianaCounter table
 
After getting the new proteinPiana identifier, the method calling this class must make sure that the counter in increased by 1
 
  Static methods defined here:
get_sqlquery(proteinPiana_value)

 
class InsertProteinScopRelationship(PianaInsertSQL)
    Generates sql statement to insert information of SCOP to table proteinScop
 
  Static methods defined here:
get_sqlquery(cf_value, sf_value, fa_value, proteinPiana_value, source_value)

 
class InsertProteinSimilarity(PianaInsertSQL)
    Generates sql statement to insert  protein similarity information into table proteinSimilarity
 
  Static methods defined here:
get_sqlquery(proteinPianaA_value, proteinPianaB_value)

 
class InsertProteinSwissAccessionCode(PianaInsertSQL)
    Generates sql statement to insert protein information on tables that follow the structure:
 
codeID  (external code, for example swissprotAccession) (string)
proteinPiana  (internal piana protein code)
isPrimary (boolean field 1 (primary id) or 0 (secondary id)
codeSource  (name of origin of the data being inserted)
 
Instead of writing one class for each table, this class is designed to handle all these similar tables
 
current tables managed through this class are: swissAccession
 
  Static methods defined here:
get_sqlquery(table_name, code_value, proteinPiana_value, isPrimary_value, codeSource_value)

 
class InsertSpecies(PianaInsertSQL)
    Generates sql statement to insert information on table species
 
  Static methods defined here:
get_sqlquery(speciesNCBIid_value, speciesName_value, speciesDescription_value, speciesSource_value, speciesKingdom_value=None)

 
class InsertUniprotInfo(PianaInsertSQL)
    Generates sql statement to insert information on table uniprotInfo
 
  Static methods defined here:
get_sqlquery(proteinPiana_value, swissProtID_value, swissAccessionID_value, data_class_value, description_value, geneName_value, organism_value, organelle_value, proteinSequenceLength_value, proteinMW_value)

 
class PianaInsertSQL
    General class for generating Piana SQL INSERT queries. All SQL queries inserting data into piana should be extensions of this class
 
  Static methods defined here:
get_sqlquery()
Override this with the sql query that inserts the desired values

 
class UpdateSpeciesKingdom(PianaInsertSQL)
    Generates sql statement to update the kingdom field in species table
 
  Static methods defined here:
get_sqlquery(speciesNCBIid_value, speciesKingdom_value=None)

 
class UpdateTableColumn(PianaInsertSQL)
    Generates sql statement to insert information on table protein
 
  Static methods defined here:
get_sqlquery(proteinPiana=None, table=None, column=None, new_value=None)

 
Data
        verbose = 1