Skip to content
Snippets Groups Projects
Commit 2e6c1646 authored by Glenn Proctor's avatar Glenn Proctor
Browse files

Now delete old features before starting to avoid creating duplicates.

parent 467a70b4
No related branches found
No related tags found
No related merge requests found
......@@ -64,6 +64,10 @@ my $aa = $db->get_AnalysisAdaptor();
my $slices = $slice_adaptor->fetch_all( "toplevel" );
my @sorted_slices = sort { $b->seq_region_length() <=> $a->seq_region_length()} @$slices;
print "Deleting old PercentGC features\n";
$sth = $db->dbc->prepare("DELETE df, dt, a FROM density_feature df, density_type dt, analysis a WHERE a.analysis_id=dt.analysis_id AND dt.density_type_id=df.density_type_id AND a.logic_name='PercentGC'");
$sth->execute();
#
# Create new analysis object for density calculation.
......@@ -131,7 +135,7 @@ foreach my $slice (@sorted_slices){
-end => $current_end,
-density_type => $density_type,
-density_value => $gc);
#print join ("\t", $slice, $current_start, $current_end, $density_type, $gc, "\n");
$dfa->store($df);
}
......
......@@ -64,6 +64,13 @@ my $dfa = $db->get_DensityFeatureAdaptor();
my $dta = $db->get_DensityTypeAdaptor();
my $aa = $db->get_AnalysisAdaptor();
#
# Clean up old features first. Also remove analysis and density type entry as these are recreated.
#
print "Deleting old PercentageRepeat features\n";
$sth = $db->dbc->prepare("DELETE df, dt, a FROM density_feature df, density_type dt, analysis a WHERE a.analysis_id=dt.analysis_id AND dt.density_type_id=df.density_type_id AND a.logic_name='PercentageRepeat'");
$sth->execute();
#
# Create new analysis object for density calculation.
......@@ -144,21 +151,21 @@ foreach my $slice ( @sorted_slices ) {
}
}
#while ( $small_end + $small_blocksize <= $chunk_end ) {
# # here we can do the small sized density features
# $small_start = $small_end+1;
# $small_end += $small_blocksize;
#
# $repeat_size = $rr->overlap_size( "1", $small_start, $small_end );
# my $percentage_repeat = $repeat_size / $small_blocksize * 100;
#
# push( @dfs, Bio::EnsEMBL::DensityFeature->new
# (-seq_region => $slice,
# -start => $small_start,
# -end => $small_end,
# -density_type => $small_density_type,
# -density_value => $percentage_repeat));
#}
while ( $small_end + $small_blocksize <= $chunk_end ) {
# here we can do the small sized density features
$small_start = $small_end+1;
$small_end += $small_blocksize;
$repeat_size = $rr->overlap_size( "1", $small_start, $small_end );
my $percentage_repeat = $repeat_size / $small_blocksize * 100;
push( @dfs, Bio::EnsEMBL::DensityFeature->new
(-seq_region => $slice,
-start => $small_start,
-end => $small_end,
-density_type => $small_density_type,
-density_value => $percentage_repeat));
}
if (@dfs) {
$dfa->store(@dfs);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment