3 See the NOTICE file distributed with
this work
for additional information
4 regarding copyright ownership.
6 Licensed under the Apache License, Version 2.0 (the
"License");
7 you may not use
this file except in compliance with the License.
8 You may obtain a copy of the License at
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an
"AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License
for the specific language governing permissions and
16 limitations under the License.
25 package SeqStoreConverter::CaenorhabditisElegans;
32 sub create_coord_systems {
35 $self->debug(
"Caenorhabditis Specific: creating " .
36 "clone and chromosome coord systems");
38 my $target = $self->target();
39 my $dbh = $self->dbh();
41 my $ass_def = $self->get_default_assembly();
44 ([
"chromosome" , $ass_def,
"default_version" , 1],
45 [
"clone", undef ,
"default_version,sequence_level", 2]);
47 my @assembly_mappings = (
"chromosome:$ass_def|clone");
49 $self->debug(
"Building coord_system table");
51 my $sth = $dbh->prepare(
"INSERT INTO $target.coord_system " .
52 "(name, version, attrib, rank) VALUES (?,?,?,?)");
56 foreach my $cs (@coords) {
58 $coord_system_ids{$cs->[0]} = $sth->{
'mysql_insertid'};
62 $self->debug(
"Adding assembly.mapping entries to meta table");
64 $sth = $dbh->prepare(
"INSERT INTO $target.meta(meta_key, meta_value) " .
65 "VALUES ('assembly.mapping', ?)");
67 foreach my $mapping (@assembly_mappings) {
68 $sth->execute($mapping);
78 sub create_seq_regions {
81 $self->debug(
"CaenorhabditisElegans Specific: creating clone and " .
82 "chromosome seq_regions");
84 $self->contig_to_seq_region(
'clone');
85 $self->chromosome_to_seq_region();
92 $self->debug(
"CaenorhabditisElegans Specific: loading assembly data");
94 $self->assembly_contig_chromosome();
99 # override the contig_to_seqregion method so that contigs are given clone
102 sub contig_to_seq_region {
104 my $target_cs_name = shift;
106 my $target = $self->target();
107 my $source = $self->source();
108 my $dbh = $self->dbh();
110 $target_cs_name ||=
'contig';
112 $self->debug(
"CaenorhabditisElegans Specific: Transforming contigs " .
113 "into $target_cs_name seq_regions");
115 my $cs_id = $self->get_coord_system_id($target_cs_name);
117 my $sth = $dbh->prepare
118 (
"INSERT INTO $target.seq_region " .
119 "SELECT ctg.contig_id, CONCAT(cln.embl_acc, '.', cln.embl_version), " .
120 " $cs_id, ctg.length " .
121 "FROM $source.contig ctg, $source.clone cln " .
122 "WHERE ctg.clone_id = cln.clone_id");