ensembl-hive  2.8.1
FuguRubripes.pm
Go to the documentation of this file.
1 =head1 LICENSE
2 
3 See the NOTICE file distributed with this work for additional information
4 regarding copyright ownership.
5 
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
9 
10  http://www.apache.org/licenses/LICENSE-2.0
11 
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.
17 
18 =cut
19 
20 
21 use strict;
22 use warnings;
23 
25 
26 package SeqStoreConverter::FuguRubripes;
27 
28 use vars qw(@ISA);
29 
31 
32 
33 sub create_coord_systems {
34  my $self = shift;
35 
36  $self->debug("FuguRubripes Specific: creating scaffold coord system");
37 
38  #
39  # Load the coord system table.
40  # Fugu has only one coord system : scaffold
41  #
42  my $default_assembly = $self->get_default_assembly();
43  my $target = $self->target();
44 
45  my $sth = $self->dbh()->prepare
46  ("INSERT INTO $target.coord_system (name, version, attrib, rank)" .
47  "VALUES (?,?,?,?)");
48  $sth->execute('scaffold', $default_assembly,
49  'default_version,sequence_level', 1);
50 
51  $sth->finish();
52 }
53 
54 
55 
56 sub create_seq_regions {
57  my $self = shift;
58 
59  $self->debug("FuguRubripes Specific: creating scaffolds");
60 
61  $self->contig_to_seq_region('scaffold');
62 }
63 
64 
65 sub create_assembly {
66  my $self = shift;
67 
68  $self->debug("FuguRubripes Specific: no assembly data needed");
69  #fugu has no assembly table
70 }
71 
72 
73 sub transfer_genes {
74  my $self = shift;
75 
76  my $target = $self->target();
77  my $source = $self->source();
78  my $dbh = $self->dbh();
79 
80  #
81  # This is simple in fugu since all genes are actually in contig (now
82  # renamed scaffold) coords. We don't need joins to the assembly table
83  # and we don't have to worry about stickies
84  #
85 
86  $self->debug("FuguRubripes Specific: Building gene table " .
87  "(no chromosomal conversion)");
88 
89  #
90  # Transfer the gene table
91  #
92 
93  $dbh->do
94  ("INSERT INTO $target.gene " .
95  "SELECT g.gene_id, g.type, g.analysis_id, e.contig_id, " .
96  " MIN(e.contig_start), MAX(e.contig_end), e.contig_strand, " .
97  " g.display_xref_id " .
98  "FROM $source.transcript t, $source.exon_transcript et, " .
99  " $source.exon e, $source.gene g " .
100  "WHERE t.transcript_id = et.transcript_id " .
101  "AND et.exon_id = e.exon_id " .
102  "AND g.gene_id = t.gene_id " .
103  "GROUP BY g.gene_id");
104 
105  $self->debug("FuguRubripes Specific: Building transcript table " .
106  "(no chromosomal conversion)");
107 
108  #
109  # Transfer transcript table
110  #
111 
112  $dbh->do
113  ("INSERT INTO $target.transcript " .
114  "SELECT t.transcript_id, t.gene_id, e.contig_id, " .
115  " MIN(e.contig_start), MAX(e.contig_end), e.contig_strand, " .
116  " t.display_xref_id " .
117  "FROM $source.transcript t, $source.exon_transcript et, " .
118  " $source.exon e " .
119  "WHERE t.transcript_id = et.transcript_id " .
120  "AND et.exon_id = e.exon_id " .
121  "GROUP BY t.transcript_id");
122 
123  $self->debug("FuguRubripes Specific: Building exon table " .
124  "(no chromosomal conversion)");
125 
126 
127  #
128  # Transfer exon table
129  #
130 
131  $self->debug("FuguRubripes Specific: Building transcript table " .
132  "(no chromosomal conversion)");
133 
134  $dbh->do
135  ("INSERT INTO $target.exon " .
136  "SELECT e.exon_id, e.contig_id, " .
137  " e.contig_start, e.contig_end, e.contig_strand, " .
138  " e.phase, e.end_phase " .
139  "FROM $source.exon e");
140 
141 
142  #
143  # Transfer translation table
144  #
145 
146  $self->debug("Building translation table");
147 
148  $dbh->do
149  ("INSERT INTO $target.translation " .
150  "SELECT tl.translation_id, ts.transcript_id, tl.seq_start, " .
151  " tl.start_exon_id, tl.seq_end, tl.end_exon_id " .
152  "FROM $source.transcript ts, $source.translation tl " .
153  "WHERE ts.translation_id = tl.translation_id");
154 
155  return;
156 }
157 
158 
159 1;
SeqStoreConverter::BasicConverter
Definition: BasicConverter.pm:3