-
Arne Stabenau authored5633b94e
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
variation_density.pl 4.52 KiB
#
# calculates the variation density from given core database
# It finds Variation database by itself using naming convention s/core/variation/
#
#
use strict;
use Bio::EnsEMBL::DBSQL::DBAdaptor;
use Bio::EnsEMBL::DensityType;
use Bio::EnsEMBL::DensityFeature;
use Bio::EnsEMBL::Variation::DBSQL::DBAdaptor;
use Getopt::Long;
use Data::Dumper;
$Data::Dumper::Maxdepth = 2;
my $bin_count = 150;
my $long_slice_count = 100;
my ( $host, $user, $pass, $port, $dbname );
my ( $block_count, $genome_size, $block_size );
GetOptions( "host=s", \$host,
"user=s", \$user,
"pass=s", \$pass,
"port=i", \$port,
"dbname=s", \$dbname
);
my $db = new Bio::EnsEMBL::DBSQL::DBAdaptor(-host => $host,
-user => $user,
-port => $port,
-pass => $pass,
-dbname => $dbname,
-group => 'core',
-species => 'DEFAULT'
);
if( ! variation_attach( $db )) {
die( "Couldnt attach variation to $dbname" );
}
#
# Get the adaptors needed;
#
my $dfa = $db->get_DensityFeatureAdaptor();
my $dta = $db->get_DensityTypeAdaptor();
my $aa = $db->get_AnalysisAdaptor();
my $slice_adaptor = $db->get_SliceAdaptor();
my $top_slices = $slice_adaptor->fetch_all( "toplevel" );
my @sorted_slices = sort { $b->seq_region_length() <=> $a->seq_region_length()} @$top_slices;
my $analysis = new Bio::EnsEMBL::Analysis (-program => "variation_density.pl",
-database => "ensembl",
-gff_source => "variation_density.pl",
-gff_feature => "density",
-logic_name => "snpDensity");
$aa->store( $analysis );