Commit cb3f64e1 authored by Patrick Meidl's avatar Patrick Meidl
Browse files

changes from branch-vega-31-dev

parent 54f99236
......@@ -160,20 +160,32 @@ sub fetch_all_by_Slice {
my $best_ratio = undef;
my $density_type = undef;
my $best_ratio_large = undef;
my $density_type_large = undef;
foreach my $dt (@dtypes) {
my $ratio;
if($dt->block_size() < $wanted_block_size) {
$ratio = $wanted_block_size/$dt->block_size();
my $ratio = $wanted_block_size/$dt->block_size();
# we prefer to use a block size that's smaller than the required one
# (better results on interpolation). remember larger block sizes though
# in case there is no smaller one in the database
if ($ratio < 1) {
if(!defined($best_ratio_large) || $ratio > $best_ratio_large) {
$best_ratio_large = $ratio;
$density_type_large = $dt;
}
} else {
$ratio = $dt->block_size()/$wanted_block_size;
}
if(!defined($best_ratio) || $ratio < $best_ratio) {
$best_ratio = $ratio;
$density_type = $dt;
if(!defined($best_ratio) || $ratio < $best_ratio) {
$best_ratio = $ratio;
$density_type = $dt;
}
}
}
# fall back to larger block size
unless ($best_ratio) {
$best_ratio = $best_ratio_large;
$density_type = $density_type_large;
}
#the ratio was not good enough, or this logic name was not in the
#density type table, return an empty list
......
......@@ -524,6 +524,9 @@ sub type {
'Ig_pseudogene_segment.NOVEL' => 'Ig_Pseudogene_Segment',
'Ig_segment.KNOWN' => 'Ig_Segment',
'Ig_segment.NOVEL' => 'Ig_Segment',
'Known_in_progress.KNOWN' => 'Known_in_progress',
'Novel_CDS_in_progress.KNOWN' => 'Novel_CDS_in_progress',
'Novel_CDS_in_progress.NOVEL' => 'Novel_CDS_in_progress',
);
my $bio_conf = $self->biotype.".".$self->confidence;
if ($typemap{$bio_conf}) {
......
......@@ -48,7 +48,7 @@ use Data::Dumper;
Example : $conversion->Bio::EnsEMBL::Utils::SchemaConversion->new($serverroot);
Description : Constructor, including an instance of a Bio::EnsEMBL::Utils::ConversionSupport
object. Parses input file
object. Parses input file and checks input with user
Return type : Bio::EnsEMBL::Utils::SchemaConversion object
Exceptions : thrown if $Siteroot not passed over
Caller : $Siteroot/utils/vega_schema_conversion
......@@ -62,6 +62,42 @@ sub new {
bless ($self,$class);
$self->{config} = Bio::EnsEMBL::Utils::ConversionSupport->new($support);
$self->conv_support->parse_common_options;
$self->conv_support->parse_extra_options('do_vega_sc=s',
'do_ens_sc=s',
'source_db=s',
'core_sql=s',
'vega_sql=s',
'patch_sql=s',
'force=s',
'do_features=s');
#check input and show help
$self->conv_usage() if ($self->conv_support->param("help"));
$self->conv_usage("configuration file needed") unless ($self->conv_support->param("conffile"));
$self->conv_usage("password for database access needed") unless ($self->conv_support->param("pass"));
$self->conv_usage("can only do conversion to ensembl OR Vega, not both") if ($self->conv_support->param('do_vega_sc') && $self->conv_support->param('do_ens_sc'));
$self->conv_usage("You need to do vega->veg or ensembl->vega conversion") unless ($self->conv_support->param('do_vega_sc') || $self->conv_support->param('do_ens_sc'));
# ask user to confirm parameters to proceed
$self->conv_support->allowed_params('conffile',
'do_vega_sc',
'do_ens_sc',
'host',
'port',
'user',
'pass',
'source_db',
'dbname',
'force',
'do_features',
'verbose',
'logpath',
'logfile',
'core_sql',
'vega_sql',
'patch_sql');
$self->conv_support->confirm_params;
my $siteroot = $self->conv_support->serverroot;
$self->conv_support->param('vega_sql',$siteroot.$self->conv_support->param('vega_sql'));
$self->conv_support->param('core_sql',$siteroot.$self->conv_support->param('core_sql'));
......@@ -136,8 +172,9 @@ sub choose_conversion_type {
my $self = shift;
my $converter;
my $species;
$species = $self->species_alias($self->conv_support->param('source_db'));
if ($self->conv_support->param('do_vega_schema_conversion')) {
if ($self->conv_support->param('do_vega_sc')) {
$species = "vega::".$species;
eval "require SeqStoreConverter::$species";
if($@) {
......@@ -166,9 +203,9 @@ sub choose_conversion_type {
$converter = "SeqStoreConverter::$species"->new
( $self->conv_support->param('user'),
$self->conv_support->param('pass'),
$self->conv_support->param('host'),
$self->conv_support->param('host').':'.$self->conv_support->param('port'),
$self->conv_support->param('source_db'),
$self->conv_support->param('target_db'),
$self->conv_support->param('dbname'),
$self->conv_support->param('core_sql'),
$self->conv_support->param('vega_sql'),
$self->conv_support->param('force'),
......@@ -200,8 +237,8 @@ sub do_conversion {
$self->conv_obj->create_assembly();
$self->conv_obj->create_attribs();
$self->conv_obj->set_top_level();
$self->conv_obj->transfer_dna();
$self->conv_obj->reset_gene_trans_tables();
$self->conv_obj->transfer_genes();
$self->conv_obj->transfer_prediction_transcripts();
......@@ -214,7 +251,7 @@ sub do_conversion {
$self->conv_obj->copy_other_tables();
$self->conv_obj->copy_repeat_consensus();
$self->conv_obj->create_meta_coord();
if ($self->conv_support->param('do_vega_schema_conversion')) {
if ($self->conv_support->param('do_vega_sc')) {
$self->conv_obj->copy_other_vega_tables();
$self->conv_obj->update_clone_info();
$self->conv_obj->remove_supercontigs();
......@@ -235,7 +272,7 @@ sub do_conversion {
sub make_schema_up_to_date {
my $self = shift;
$self->conv_obj->debug ("\n*** Patching schema to latest version ***\n");
$self->conv_obj->debug ("\nPatching schema to latest version\n");
my $user = $self->conv_obj->user;
my $pass = $self->conv_obj->password;
my $port = $self->conv_obj->port;
......@@ -247,6 +284,7 @@ sub make_schema_up_to_date {
}
=head2 conv_usage
Example : $conversion->conv_usage("message")
......@@ -265,27 +303,30 @@ sub conv_usage {
print STDERR <<EOF;
usage: ./conversion_densities.pl <options>
** Source and target databases must be on the same mysql instance
options: -pass <password> the mysql user's password (required)
usage: ./conversion_densities.pl <options>
-conf <conf_file> configuration file (required):
options: --conf <conf_file> configuration file (uses conf/Conversion.ini by default):
fields:
do_vega_conversion (0 or 1)
do_ensembl_conversion (0 or 1)
do_vega_sc (do vega conversion: 0 or 1)
do_ens_sc (do ensembl conversion: 0 or 1)
user (a mysql db user with read/write priveleges)
host (plus port eg ecs3d:3307)
host (eg ecs3f)
port (eg 3310)
source_db (schema 19 source database)
target_db (schema 20+ trget database)
core_sql (location of ensembl schema creation script eg ensembl/sql/table.sql)
vega_sql (location of creation script for additinoal vega tables eg ensembl/sql/vega_specific_tables.sql)
patch_sql (location of schema patching script eg ensembl/sql/vega_latest_schema.sql)
force (overwrite existing target database? 0 or 1)
verbose (print out debug statements 0 or 1)
do_features (0 or 1 - transfer dna- and protein-align features, for debugging)
-help display this message
dbname (schema 20+ target database)
force (overwrite existing target database: 0 or 1)
verbose (print out debug statements: 0 or 1)
logpath (location of log file)
do_features (transfer dna- and protein-align features, for debugging: 0 or 1)
core_sql (location of ensembl schema creation script: ensembl/sql/table.sql)
vega_sql (location of creation script for additional vega tables: ensembl/sql/vega_specific_tables.sql)
patch_sql (location of schema patching script: ensembl/sql/vega_latest_schema.sql)
--log name of log_file
--help display this message
EOF
exit;
......
......@@ -21,6 +21,7 @@ ALTER TABLE transcript ADD description text;
UPDATE transcript t, xref x SET t.description = x.description WHERE t.display_xref_id = x.xref_id;
UPDATE transcript SET description=NULL WHERE description="";
# usefull settings for the new tables
# usefull settings for the new tables
UPDATE gene SET biotype='protein_coding' WHERE biotype = 'ensembl';
......@@ -29,6 +30,7 @@ UPDATE gene g, xref x, external_db ed SET g.confidence='KNOWN' WHERE g.display_x
UPDATE transcript t, xref x, external_db ed SET t.confidence='KNOWN' WHERE t.display_xref_id = x.xref_id and x.external_db_id = ed.external_db_id and t.display_xref_id != 0 and ed.status like 'KNOWN%';
# some vega specific stuff, shouldnt harm anybody else
UPDATE gene SET biotype='unclassified' WHERE biotype = 'Transcript';
UPDATE gene SET biotype='pseudogene' WHERE biotype = 'Pseudogene';
UPDATE gene SET biotype='protein_coding', confidence='NOVEL' WHERE biotype = 'Novel_CDS';
......@@ -51,7 +53,6 @@ UPDATE transcript t, gene g SET t.biotype = g.biotype WHERE g.gene_id = t.gene_i
# new tables regulatory stuff and transcript supporting features
################################################################################
#
# Table structure for table 'regulatory_feature'
......
Markdown is supported
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