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.
22 # This sub-class of XrefParser::BaseParser serves as the parent class
23 # for parsers of Xref source data that we use coordinate overlap to
24 # determine the Xrefs to.
26 package XrefParser::CoordinateParser;
32 use DBI qw( :sql_types );
37 our $add_xref_sql = q(
38 INSERT INTO coordinate_xref
39 ( source_id, species_id,
44 exonStarts, exonEnds )
45 VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
50 my ( $source_id, $species_id, $xref ) = @_;
52 if ( !defined($add_xref_sth) ) {
53 my $dbh = $self->dbi();
54 $add_xref_sth = $dbh->prepare_cached($add_xref_sql);
55 if ( !defined($add_xref_sth) ) {
56 croak( $dbh->errstr() );
60 for my $required_key (
'accession',
'chromosome',
62 'txEnd',
'exonStarts',
65 if ( !defined( $xref->{$required_key} ) ) {
67 sprintf(
"Missing required key '%s' for Xref", $required_key )
72 $add_xref_sth->bind_param( 1, $source_id, SQL_INTEGER );
73 $add_xref_sth->bind_param( 2, $species_id, SQL_INTEGER );
74 $add_xref_sth->bind_param( 3, $xref->{
'accession'}, SQL_VARCHAR );
75 $add_xref_sth->bind_param( 4, $xref->{
'chromosome'}, SQL_VARCHAR );
76 $add_xref_sth->bind_param( 5, $xref->{
'strand'}, SQL_INTEGER );
77 $add_xref_sth->bind_param( 6, $xref->{
'txStart'}, SQL_INTEGER );
78 $add_xref_sth->bind_param( 7, $xref->{
'txEnd'}, SQL_INTEGER );
79 $add_xref_sth->bind_param( 8, $xref->{
'cdsStart'}, SQL_INTEGER );
80 $add_xref_sth->bind_param( 9, $xref->{
'cdsEnd'}, SQL_INTEGER );
81 $add_xref_sth->bind_param( 10, $xref->{
'exonStarts'}, SQL_VARCHAR );
82 $add_xref_sth->bind_param( 11, $xref->{
'exonEnds'}, SQL_VARCHAR );
84 $add_xref_sth->execute() or croak( $add_xref_sth->errstr() );