Name

chado_analysis_delete — undo the loading of an analysis into the database

Synopsis

INT chado_analysis_delete ( analysis_id);  
INT analysis_id ;
 
INT chado_analysis_delete ( name);  
VARCHAR(255) name ;
 

Description

chado_analysis_delete() deletes analysis and related data. It undoes an analysis load. It may be called either with an ANALYSIS.Analysis_Id or with an ANALYSIS.Name to identify the analysis to be deleted. See the examples below.

Caution

In order to ensure that all information related to an analysis is deleted it is almost always necessary to use chado_analysis_delete() to delete ANALYSIS rows. Deleting rows from ANALYSIS with an SQL DELETE statement or similar method will not delete the FEATURE related information put into the database by chado-vcf-load, nor will a DELETE statement remove the ND_EXPERIMENT related information put into the database by chado-funcgen-load.

Note

chado_analysis_delete() never deletes STOCK information.

chado_analysis_delete() takes either one of the following two arguments:

analysis_id

An ANALYSIS.Analysis_Id value identifying the analysis to be deleted.

name

An ANALYSIS.Name value identifying the analysis to be deleted.

chado_analysis_delete() is designed to delete all the rows added to the database by chado-vcf-load and chado-funcgen-load. Hence, it deletes all rows in the following tables which are related to the deleted analysis row:

It is assumed that none of the above tables are related to an ANALYSIS row unless the relationship was established by one of the upload programs.

Deleting uploaded FEATURE rows is not as straightforward. FEATURE rows can be shared between analysis and can exist independently of analysis so a test is required to determine whether a FEATURE row exists solely to support the analysis being deleted. FEATURE rows related to the deleted analysis are deleted if they meet all of the following properties:

  • The feature is not related to another analysis.

  • The feature entered the db as the result of an analysis -- FEATURE.Is_Analysis is TRUE.

  • The feature is related to one of the genotypes that the analysis analyzed or is related to the reference genome.

    To see of the feature is related to one of the genotypes analyzed the FEATURE.DBXref_Id is compared against the database accession value stored in the analysis' ANALYSISPROP.Value, for that ANALYSISPROP row related to the analysis that has a ANALYSISPROP.Type_Id value matching the CVTERM row with a CVTERM.Name of vcf_column_source related to the CV having a CV.Name of babase_chado_terms. The ANALYSISPROP.Value identifies an external database accession in the format of DB.Name value, colon (:), DBXREF.Accession value. It is this that is dereferenced and so translated to an actual DBXREF.DBXref_Id value to be compared against the FEATURE.DBXref_Id value.

    To see if the feature is detail added to the reference baboon sequence by chado-vcf-load the FEATURE.DBXref_Id is compared against the DBXREF row having a DBXREF.Accession value of reference_baboon and a related DB row with a DB.Name of unique_baboons.

  • The information about the bases which make up the feature must be appropriate for a feature created by chado-vcf-load.

    If the feature is related to one of the genotypes analyzed then the FEATURE.Residues value must be NULL. If the feature represents information about the reference baboon sequence then the value of FEATURE.Residues must be non-NULL.

When deleting rows from the FEATURE table related rows from the following tables are also always deleted:

EXAMPLES

Example 4.3. Deleting an Analysis by Analysis Id


babase=> select chado_analysis_delete(123);
 chado_analysis_delete
-------------------
                123
(1 row)


Example 4.4. Deleting an Analysis by Analysis Id


babase=> select chado_analysis_delete('My_Bad_Analysis');
 chado_analysis_delete
-------------------
                123
(1 row)


Example 4.5. Deleting an Analysis by Query


babase=> select chado_analysis_delete(analysis.analysis_id)
  from analysis
  where analysis.timeexecuted >= '2015-01-01';

 chado_analysis_delete
-------------------
                123
                124
                125
(3 rows)


RESULT

chado_analysis_delete() returns the ANALYSIS.Analysis_Id of the deleted analysis, or NULL if no ANALYSIS was deleted.


Page generated: 2021-09-17T11:17:07-04:00.