# known biotype/status pairs and associated density type
# Note: the types starting with 'total_...' should only be used for the stats stuff and are composed of other types,
# which are in the array pointed to by the 'parts' key
my%gene_types=(
"protein_coding_KNOWN"=>{logic_name=>"knownPCodDensity",code=>"KnownPCCount",description=>"Number of Known Protein Coding"},
"protein_coding_in_progress_KNOWN"=>{logic_name=>"knownPCodDensity",code=>"KnwnPCProgCount",description=>"Number of Known Protein coding genes in progress"},
"processed_transcript_KNOWN"=>{logic_name=>"knownPTransDensity",code=>"KnownPTCount",description=>"Number of Known Processed Transcripts"},
"protein_coding_NOVEL"=>{logic_name=>"novelPCodDensity",code=>"NovelPCCount",description=>"Number of Novel Protein Coding"},
"protein_coding_in_progress_NOVEL"=>{logic_name=>"novelPCodDensity",code=>"NovPCProgCount",description=>"Number of Novel Protein coding genes in progress"},
"processed_transcript_NOVEL"=>{logic_name=>"novelPTransDensity",code=>"NovelPTCount",description=>"Number of Novel transcripts"},
"processed_transcript_PUTATIVE"=>{logic_name=>"putativePTransDensity",code=>"PutPTCount",description=>"Number of Putative processed transcripts"},
"protein_coding_PREDICTED"=>{logic_name=>"predictedPCodDensity",code=>"PredPCCount",description=>"Number of Predicted transcripts"},
"Ig_pseudogene_segment_UNKNOWN"=>{logic_name=>"IgPseudoSegDensity",code=>"IgPsSegCount",description=>"Number of Ig Pseudogene Segments"},
"processed_pseudogene_UNKNOWN"=>{logic_name=>"pseudoGeneDensity",code=>"ProcPsCount",description=>"Number of Processed pseudogenes"},
"unprocessed_pseudogene_UNKNOWN"=>{logic_name=>"pseudoGeneDensity",code=>"UnprocPsCount",description=>"Number of Unprocessed pseudogenes"},
"total_pseudogene_UNKNOWN"=>{logic_name=>"",code=>"TotPsCount",description=>"Total Number of Pseudogenes",parts=>['pseudogene_UNKNOWN','processed_pseudogene_UNKNOWN','unprocessed_pseudogene_UNKNOWN']},
"total_Ig_segment_UNKNOWN"=>{logic_name=>"",code=>"IgSegCount",description=>"Number of Ig Segments",parts=>['Ig_segment_NOVEL','Ig_segment_KNOWN']},
"processed_transcript_UNKNOWN"=>{logic_name=>"PTransDensity",code=>"PTCount",description=>"Number of Processed Transcripts"},
"processed_transcript_PREDICTED"=>{logic_name=>"PredPTransDensity",code=>"PredPTCount",description=>"Number of Predicted Processed Transcripts"}
);
if($support->param('prune')){
exitunless($support->user_proceed('About to delete all data from previous runs of this script. Proceed ?'));
# delete the results in the database from a previous run
# Note: Need to use a left-join in the multitable delete otherwise rows in e.g. analysis which have program= vega_gene_density.pl, but no corresponding rows in the density_type or density_feature table will NOT be deleted.
left join density_type on analysis.analysis_id= density_type.analysis_id
left join density_feature on density_type.density_type_id= density_feature.density_type_id
where analysis.program= 'vega_gene_density.pl'";
if(my$c=$dbh->do($query)){
$support->log("prune 1 was successfull: $c previous entries in the database generated by this script have been deleted\n");
}
else{
$support->log_error("prune 1 failed: any previous entries in the database generated by this script have NOT been deleted\n");
exit;
}
foreachmy$name(keys%gene_types){
my$href=$gene_types{$name};
my$code=$href->{'code'};
if($code){
$query="delete attrib_type, seq_region_attrib from attrib_type left join seq_region_attrib on attrib_type.attrib_type_id= seq_region_attrib.attrib_type_id where attrib_type.code= '$code'";
if(my$c=$dbh->do($query)){
$support->log("$c entries removed successfull for code $code\n");
}
else{
$support->log_error("prune 2 failed for code $code\n");
}
}
}
}
#limit to gene_stable_ids ?
my(%gene_ids,%found_genes);
if($support->param('limit_file')){
...
...
@@ -130,26 +193,6 @@ if ($support->param('limit_file')) {
}
}
# biotype/status pairs and associated density type
$support->log_warning("There are new biotype/status pairs! You might need to adapt Bio::EnsEMBL::ColourMap, EnsEMBL::Sanger_vega::Component::Chromosome and configure mapview to show them.\n\n");
@@ -104,24 +104,17 @@ my $dbh= $dba->dbc->db_handle;
# check for prune option (undo)
if($support->param('prune')){
exitunless($support->user_proceed('About to delete all data from previous runs of this script. Proceed ?'));
my$query="delete analysis, density_type, density_feature from analysis, density_type, density_feature where (analysis.program= 'percent_gc_calc.pl') and (analysis.analysis_id= density_type.analysis_id) and (density_type.density_type_id= density_feature.density_type_id)";
if($dbh->do($query)){
$support->log("prune was successfull: any previous entries in the database generated by this script have been deleted\n");
my$query="delete analysis, density_type, density_feature from analysis left join density_type on analysis.analysis_id= density_type.analysis_id left join density_feature on density_type.density_type_id= density_feature.density_type_id where analysis.program= 'percent_gc_calc.pl'";
if(my$c=$dbh->do($query)){
$support->log("prune was successfull: $c previous entries in the database generated by this script have been deleted\n");
}
else{
$support->log_error("prune failed: any previous entries in the database generated by this script have NOT been deleted\n");
@@ -107,7 +107,10 @@ my $dbh= $dba->dbc->db_handle;
# check for prune option (undo)
if($support->param('prune')){
my$query="delete analysis, density_type, density_feature from analysis, density_type, density_feature where (analysis.program= 'repeat_coverage_calc.pl') and (analysis.analysis_id= density_type.analysis_id) and (density_type.density_type_id= density_feature.density_type_id)";
#my $query= "delete analysis, density_type, density_feature from analysis, density_type, density_feature where (analysis.program= 'repeat_coverage_calc.pl') and (analysis.analysis_id= density_type.analysis_id) and (density_type.density_type_id= density_feature.density_type_id)";
my$query="delete analysis, density_type, density_feature from analysis left join density_type on analysis.analysis_id= density_type.analysis_id left join density_feature on density_type.density_type_id= density_feature.density_type_id where analysis.program= 'repeat_coverage_calc.pl'";