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::RattusNorvegicus;
32 sub create_coord_systems {
35 $self->debug(
"RattusNorvegicus Specific: loading assembly data");
37 my $target = $self->target();
38 my $dbh = $self->dbh();
40 my $ass_def = $self->get_default_assembly();
43 ([
"chromosome" , $ass_def,
"default_version", 1 ],
44 [
"supercontig", undef ,
"default_version", 2 ],
45 [
"contig" , undef ,
"default_version,sequence_level", 3]);
47 my @assembly_mappings = (
"chromosome:$ass_def|contig",
48 "chromosome:$ass_def|supercontig",
49 "supercontig|chromosome:$ass_def|contig");
51 $self->debug(
"Building coord_system table");
53 my $sth = $dbh->prepare(
"INSERT INTO $target.coord_system " .
54 "(name, version, attrib, rank) VALUES (?,?,?,?)");
58 foreach my $cs (@coords) {
60 $coord_system_ids{$cs->[0]} = $sth->{
'mysql_insertid'};
64 $self->debug(
"Adding assembly.mapping entries to meta table");
66 $sth = $dbh->prepare(
"INSERT INTO $target.meta(meta_key, meta_value) " .
67 "VALUES ('assembly.mapping', ?)");
69 foreach my $mapping (@assembly_mappings) {
70 $sth->execute($mapping);
80 sub create_seq_regions {
83 $self->debug(
"RattusNorvegicus Specific: creating contig, " .
84 "chromosome and supercontig seq_regions");
86 $self->contig_to_seq_region();
87 $self->chromosome_to_seq_region();
88 $self->supercontig_to_seq_region();
94 $self->debug(
"RattusNorvegicus Specific: loading assembly data");
96 $self->assembly_contig_chromosome();
97 $self->assembly_supercontig_chromosome();
102 # override the contig_to_seqregion method so that contigs are given clone
105 sub contig_to_seq_region {
107 my $target_cs_name = shift;
109 my $target = $self->target();
110 my $source = $self->source();
111 my $dbh = $self->dbh();
113 $target_cs_name ||=
'contig';
115 $self->debug(
"RattusNorvegicus Specific: Transforming contigs " .
116 "into $target_cs_name seq_regions");
118 my $cs_id = $self->get_coord_system_id($target_cs_name);
120 my $sth = $dbh->prepare
121 (
"INSERT INTO $target.seq_region " .
122 "SELECT ctg.contig_id, cln.embl_acc, " .
123 " $cs_id, ctg.length " .
124 "FROM $source.contig ctg, $source.clone cln " .
125 "WHERE ctg.clone_id = cln.clone_id");