This adaptor implements a specific mysql database schema that is
compatible with Bio::DB::GFF. It inherits from
Bio::DB::GFF::Adaptor::dbi, which itself inherits from Bio::DB::GFF.
The schema uses several tables:
fdata
This is the feature data table. Its columns are:
-
fid feature ID (integer)
fref reference sequence name (string)
fstart start position relative to reference (integer)
fstop stop postion relative to reference (integer)
ftypeid feature type ID (integer)
fscore feature score (float); may be null
fstrand strand; one of "+" or "-"; may be null
fphase phase; one of 0, 1 or 2; may be null
feature_id group ID used to be 'gid' (integer)
ftarget_start for similarity features, the target start position (integer)
ftarget_stop for similarity features, the target stop position (integer)
Note that it would be desirable to normalize the reference sequence
name, since there are usually many features that share the same
reference feature. However, in the current schema, query performance
suffers dramatically when this additional join is added.
cmap_feature (replaces fgroup)
This is the group table. There is one row for each group. This is the
shared table between CMap and GBrowse. There are many CMap related
columns but only a few that GBrowse uses.
GBrowse Columns:
feature_id the group ID (integer)
gclass the class of the group (string)
feature_name the name of the group (string)
The group table serves multiple purposes. As you might expect, it is
used to cluster features that logically belong together, such as the
multiple exons of the same transcript. It is also used to assign a
name and class to a singleton feature. Finally, the group table is
used to identify the target of a similarity hit. This is consistent
with the way in which the group field is used in the GFF version 2
format.
The cmap_feature.feature_id field joins with the fdata.feature_id field.
Examples:
mysql> select * from cmap_feature where feature_name='sjj_2L52.1';
+--------------+-------------+--------------+
| feature_id | gclass | feature_name |
+--------------+-------------+--------------+
| 69736 | PCR_product | sjj_2L52.1 |
+--------------+-------------+--------------+
1 row in set (0.70 sec)
mysql> select fref,fstart,fstop from fdata,cmap_feature
where gclass='PCR_product' and feature_name = 'sjj_2L52.1'
and fdata.feature_id=cmap_feature.feature_id;
+---------------+--------+-------+
| fref | fstart | fstop |
+---------------+--------+-------+
| CHROMOSOME_II | 1586 | 2355 |
+---------------+--------+-------+
1 row in set (0.03 sec)
ftype
This table contains the feature types, one per row. Columns are:
ftypeid the feature type ID (integer)
fmethod the feature type method name (string)
fsource the feature type source name (string)
The ftype.ftypeid field joins with the fdata.ftypeid field. Example:
mysql> select fref,fstart,fstop,fmethod,fsource from fdata,cmap_feature,ftype
where gclass='PCR_product'
and feature_name = 'sjj_2L52.1'
and fdata.feature_id=cmap_feature.feature_id
and fdata.ftypeid=ftype.ftypeid;
+---------------+--------+-------+-------------+-----------+
| fref | fstart | fstop | fmethod | fsource |
+---------------+--------+-------+-------------+-----------+
| CHROMOSOME_II | 1586 | 2355 | PCR_product | GenePairs |
+---------------+--------+-------+-------------+-----------+
1 row in set (0.08 sec)
fdna
This table holds the raw DNA of the reference sequences. It has three
columns:
fref reference sequence name (string)
foffset offset of this sequence
fdna the DNA sequence (longblob)
To overcome problems loading large blobs, DNA is automatically
fragmented into multiple segments when loading, and the position of
each segment is stored in foffset. The fragment size is controlled by
the -clump_size argument during initialization.
fattribute_to_feature
This table holds "attributes", which are tag/value pairs stuffed into
the GFF line. The first tag/value pair is treated as the group, and
anything else is treated as an attribute (weird, huh?).
CHR_I assembly_tag Finished 2032 2036 . + . Note "Right: cTel33B"
CHR_I assembly_tag Polymorphism 668 668 . + . Note "A->C in cTel33B"
The columns of this table are:
fid feature ID (integer)
fattribute_id ID of the attribute (integer)
fattribute_value text of the attribute (text)
The fdata.fid column joins with fattribute_to_feature.fid.
fattribute
This table holds the normalized names of the attributes. Fields are:
fattribute_id ID of the attribute (integer)
fattribute_name Name of the attribute (varchar)
In addition to implementing the abstract SQL-generating methods of
Bio::DB::GFF::Adaptor::dbi, this module also implements the data
loading functionality of Bio::DB::GFF.
Title : new
Usage : $db = Bio::DB::GFF->new(@args)
Function: create a new adaptor
Returns : a Bio::DB::GFF object
Args : see below
Status : Public
The new constructor is identical to the "dbi" adaptor's new() method,
except that the prefix "dbi:mysql" is added to the database DSN identifier
automatically if it is not there already.
Argument Description
-------- -----------
-dsn the DBI data source, e.g. 'dbi:mysql:ens0040' or "ens0040"
-user username for authentication
-pass the password for authentication
sub schema
{ my %schema = (
fdata =>{
table=> q{ #create table fdata ( # fid int not null auto_increment, # fref varchar(100) not null, # fstart int unsigned not null, # fstop int unsigned not null, # ftypeid int not null, # fscore float, # fstrand enum('+','-'), # fphase enum('0','1','2'), # feature_id int not null, # ftarget_start int unsigned, # ftarget_stop int unsigned, # primary key(fid), # unique index(fref,fstart,fstop,ftypeid,feature_id), # index(ftypeid), # index(feature_id) #) type=MyISAM
create table fdata ( fid int not null auto_increment, fref varchar(100) not null, fstart int unsigned not null, fstop int unsigned not null, fbin double(20,6) not null, ftypeid int not null, fscore float, fstrand enum('+','-'), fphase enum('0','1','2'), feature_id int not null, ftarget_start int unsigned, ftarget_stop int unsigned, primary key(fid), unique index(fref,fbin,fstart,fstop,ftypeid,feature_id), index(ftypeid), index(feature_id) ) type=MyISAM } },
ftype => {
table=> q{ create table ftype ( ftypeid int not null auto_increment, fmethod varchar(100) not null, fsource varchar(100), primary key(ftypeid), index(fmethod), index(fsource), unique ftype (fmethod,fsource) )type=MyISAM } },
fdna => {
table=> q{ create table fdna ( fref varchar(100) not null, foffset int(10) unsigned not null, fdna longblob, primary key(fref,foffset) )type=MyISAM } },
fmeta => {
table=> q{ create table fmeta ( fname varchar(255) not null, fvalue varchar(255) not null, primary key(fname) )type=MyISAM } },
fattribute => {
table=> q{ create table fattribute ( fattribute_id int(10) unsigned not null auto_increment, fattribute_name varchar(255) not null, primary key(fattribute_id) )type=MyISAM } },
fattribute_to_feature => {
table=> q{ create table fattribute_to_feature ( fid int(10) not null, fattribute_id int(10) not null, fattribute_value text, key(fid,fattribute_id), key(fattribute_value(48)), fulltext(fattribute_value) )type=MyISAM } },
cmap_attribute => {
table=>q{
create table cmap_attribute (
attribute_id int(11) NOT NULL default '0',
table_name varchar(30) NOT NULL default '',
object_id int(11) NOT NULL default '0',
display_order int(11) NOT NULL default '1',
is_public tinyint(4) NOT NULL default '1',
attribute_name varchar(200) NOT NULL default '',
attribute_value text NOT NULL,
PRIMARY KEY (attribute_id),
KEY table_name (table_name,object_id,display_order,attribute_name)
) TYPE=MyISAM;
} },
cmap_correspondence_evidence => {
table=>q{
create table cmap_correspondence_evidence (
correspondence_evidence_id int(11) NOT NULL default '0',
accession_id varchar(20) NOT NULL default '',
feature_correspondence_id int(11) NOT NULL default '0',
evidence_type_accession varchar(20) NOT NULL default '0',
score double(8,2) default NULL,
rank int(11) NOT NULL default '0',
PRIMARY KEY (correspondence_evidence_id),
UNIQUE KEY accession_id (accession_id),
KEY feature_correspondence_id (feature_correspondence_id)
) TYPE=MyISAM;
} },
cmap_correspondence_lookup => {
table=>q{
create table cmap_correspondence_lookup (
feature_id1 int(11) default NULL,
feature_id2 int(11) default NULL,
feature_correspondence_id int(11) default NULL,
start_position1 double(11,2) default NULL,
start_position2 double(11,2) default NULL,
stop_position1 double(11,2) default NULL,
stop_position2 double(11,2) default NULL,
map_id1 int(11) default NULL,
map_id2 int(11) default NULL,
feature_type_accession1 varchar(20) default NULL,
feature_type_accession2 varchar(20) default NULL,
KEY feature_id1 (feature_id1),
KEY corr_id (feature_correspondence_id),
KEY cl_map_id1 (map_id1),
KEY cl_map_id2 (map_id2),
KEY cl_map_id1_map_id2 (map_id1,map_id2),
KEY cl_map_id2_map_id1 (map_id2,map_id1)
) TYPE=MyISAM;
} },
cmap_correspondence_matrix => {
table=>q{
create table cmap_correspondence_matrix (
reference_map_aid varchar(20) NOT NULL default '0',
reference_map_name varchar(32) NOT NULL default '',
reference_map_set_aid varchar(20) NOT NULL default '0',
reference_species_aid varchar(20) NOT NULL default '0',
link_map_aid varchar(20) default NULL,
link_map_name varchar(32) default NULL,
link_map_set_aid varchar(20) NOT NULL default '0',
link_species_aid varchar(20) NOT NULL default '0',
no_correspondences int(11) NOT NULL default '0'
) TYPE=MyISAM;
} },
cmap_feature => {
table=>q{
create table cmap_feature (
feature_id int(11) NOT NULL default '0',
accession_id varchar(20) NOT NULL default '',
map_id int(11) default NULL,
feature_type_accession varchar(20) NOT NULL default '0',
feature_name varchar(32) NOT NULL default '',
is_landmark tinyint(4) NOT NULL default '0',
start_position double(11,2) NOT NULL default '0.00',
stop_position double(11,2) default NULL,
default_rank int(11) NOT NULL default '1',
direction tinyint(4) NOT NULL default '1',
gclass varchar(100) default NULL,
PRIMARY KEY (feature_id),
UNIQUE KEY gclass (gclass,feature_name),
UNIQUE KEY accession_id (accession_id),
KEY feature_name (feature_name),
KEY feature_id_map_id (feature_id,map_id),
KEY feature_id_map_id_start (feature_id,map_id,start_position),
KEY map_id (map_id),
KEY map_id_feature_id (map_id,feature_id)
) TYPE=MyISAM;
} },
cmap_feature_alias => {
table=>q{
create table cmap_feature_alias (
feature_alias_id int(11) NOT NULL default '0',
feature_id int(11) NOT NULL default '0',
alias varchar(255) default NULL,
PRIMARY KEY (feature_alias_id),
UNIQUE KEY feature_id_2 (feature_id,alias),
KEY feature_id (feature_id),
KEY alias (alias)
) TYPE=MyISAM;
} },
cmap_feature_correspondence => {
table=>q{
create table cmap_feature_correspondence (
feature_correspondence_id int(11) NOT NULL default '0',
accession_id varchar(20) NOT NULL default '',
feature_id1 int(11) NOT NULL default '0',
feature_id2 int(11) NOT NULL default '0',
is_enabled tinyint(4) NOT NULL default '1',
PRIMARY KEY (feature_correspondence_id),
UNIQUE KEY accession_id (accession_id),
KEY feature_id1 (feature_id1),
KEY cmap_feature_corresp_idx (is_enabled,feature_correspondence_id)
) TYPE=MyISAM;
} },
cmap_map => {
table=>q{
create table cmap_map (
map_id int(11) NOT NULL default '0',
accession_id varchar(20) NOT NULL default '',
map_set_id int(11) NOT NULL default '0',
map_name varchar(32) NOT NULL default '',
display_order int(11) NOT NULL default '1',
start_position double(11,2) default NULL,
stop_position double(11,2) default NULL,
PRIMARY KEY (map_id),
UNIQUE KEY accession_id (accession_id),
UNIQUE KEY map_id (map_id,map_set_id,map_name,accession_id),
KEY map_set_id_index (map_set_id)
) TYPE=MyISAM;
} },
cmap_map_set => {
table=>q{
create table cmap_map_set (
map_set_id int(11) NOT NULL default '0',
accession_id varchar(20) NOT NULL default '',
map_set_name varchar(64) NOT NULL default '',
short_name varchar(30) NOT NULL default '',
map_type_accession varchar(20) NOT NULL default '0',
species_id int(11) NOT NULL default '0',
published_on date default NULL,
can_be_reference_map tinyint(4) NOT NULL default '1',
display_order int(11) NOT NULL default '1',
is_enabled tinyint(4) NOT NULL default '1',
shape varchar(12) default NULL,
color varchar(20) default NULL,
width int(11) default NULL,
map_units varchar(12) NOT NULL default '',
is_relational_map tinyint(11) NOT NULL default '0',
PRIMARY KEY (map_set_id),
UNIQUE KEY accession_id (accession_id),
UNIQUE KEY map_set_id (map_set_id,species_id,short_name,accession_id),
KEY cmap_map_set_idx (can_be_reference_map,is_enabled,species_id,display_order,published_on,short_name)
) TYPE=MyISAM;
} },
cmap_next_number => {
table=>q{
create table cmap_next_number (
table_name varchar(40) NOT NULL default '',
next_number int(11) NOT NULL default '0',
PRIMARY KEY (table_name)
) TYPE=MyISAM;
}, insert=>{next_num=>q[ insert into cmap_next_number (table_name,next_number) VALUES ('cmap_feature',82);]}
},
cmap_species => {
table=>q{
create table cmap_species (
species_id int(11) NOT NULL default '0',
accession_id varchar(20) NOT NULL default '',
common_name varchar(64) NOT NULL default '',
full_name varchar(64) NOT NULL default '',
display_order int(11) NOT NULL default '1',
PRIMARY KEY (species_id),
KEY acc_id_species_id (accession_id,species_id)
) TYPE=MyISAM;
} },
cmap_xref => {
table=>q{
create table cmap_xref (
xref_id int(11) NOT NULL default '0',
table_name varchar(30) NOT NULL default '',
object_id int(11) default NULL,
display_order int(11) NOT NULL default '1',
xref_name varchar(200) NOT NULL default '',
xref_url text NOT NULL,
PRIMARY KEY (xref_id),
KEY table_name (table_name,object_id,display_order)
) TYPE=MyISAM;
} },
);
return\% schema;} |
Ben Faga <faga@cshl.org>.
Modified from mysql.pm by:
Lincoln Stein <lstein@cshl.org>.
Copyright (c) 2002 Cold Spring Harbor Laboratory.
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.