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.
23 Please email comments or questions to the
public Ensembl
24 developers list at <http:
26 Questions may also be sent to the Ensembl help desk at
36 genome related information
43 -host =>
'ensembldb.ensembl.org',
50 my $version = $genome->get_version;
52 my $ref_length = $genome->get_ref_length;
54 my $coord_systems = $genome->get_coord_systems;
60 This module is responsible
for fetching and storing genome-wide information.
61 Genome is an
abstract object which contains information linking the species, the assembly and the ensembl annotation.
67 package Bio::EnsEMBL::DBSQL::GenomeContainer;
88 Returntype : Bio::EnsEMBL::GenomeContainer
99 my $self = $class->SUPER::new(@_);
101 # cache creation could go here
109 The type of statistic to store
111 The corresponding value
for the statistic
113 If more than one value exists
for the statistics, it will be distinguished by its attribute
114 Example : $genome_adaptor->store(
'coding_cnt', 20769);
115 Description: Stores a genome statistic in the database
116 Returntype : The database identifier (dbID) of the newly stored genome statistic
124 my ($self, $statistic, $value, $attribute) = @_;
126 my $stats_id = $self->fetch_by_statistic($statistic, $attribute)->dbID;
128 if (defined $stats_id) {
129 $self->update($statistic, $value, $attribute);
131 my $db = $self->db();
132 my $species_id = $db->species_id();
134 my $store_genome_sql = q{
135 INSERT INTO genome_statistics
142 if (defined $attribute) {
143 $store_genome_sql .=
", attrib_type_id = ?";
146 my $sth = $self->prepare($store_genome_sql);
147 $sth->bind_param(1, $statistic, SQL_VARCHAR);
148 $sth->bind_param(2, $value, SQL_INTEGER);
149 $sth->bind_param(3, $species_id, SQL_INTEGER);
151 if (defined $attribute) {
152 my $attribute_adaptor = $db->get_AttributeAdaptor();
154 my $attribute_type_id = $attribute_adaptor->_store_type($attribute_object);
155 $sth->bind_param(4, $attribute_type_id, SQL_VARCHAR);
161 $stats_id = $sth->{
'mysql_insertid'};
172 The type of statistic to update
174 The corresponding value
for the statistic
176 If more than one value exists
for the statistics, it will be distinguished by its attribute
177 Example : $genome_adaptor->update(
'coding_cnt', 20769);
178 Description: Updates an existing genome statistic in the database
187 my ($self, $statistic, $value, $attribute) = @_;
189 my $db = $self->db();
191 my $update_genome_sql = q{
192 UPDATE genome_statistics
197 if (defined $attribute) {
198 $update_genome_sql .=
', attrib_type_id = ?';
201 $update_genome_sql .=
' WHERE statistic = ? and species_id = ?';
203 my $sth = $self->prepare($update_genome_sql);
204 $sth->bind_param(1, $value, SQL_INTEGER);
207 if (defined $attribute) {
208 my $attribute_adaptor = $db->get_AttributeAdaptor();
210 my $attribute_type_id = $attribute_adaptor->_store_type($attribute_object);
211 $sth->bind_param($increment, $attribute_type_id, SQL_VARCHAR);
215 $sth->bind_param($increment++, $statistic, SQL_VARCHAR);
216 $sth->bind_param($increment, $db->species_id(), SQL_INTEGER);
223 =head2 _meta_container
226 Example : $meta_container = $genome->_meta_container();
227 Description: Internal method to
return a MetaContainer
object for the genome
235 sub _meta_container {
243 Arg [1] : (optional) assembly version
244 Example : $version = $genome->get_version();
245 Description: Getter/Setter
for the assembly version
255 my ($self, $version) = @_;
256 if (defined $version) {
257 $self->{
'version'} = $version;
259 if (!defined $self->{
'version'}) {
260 my $csa = $self->db()->get_adaptor(
'CoordSystem');
261 $self->{
'version'} = $csa->get_default_version;
263 return $self->{
'version'};
269 Example : $accession = $genome->get_accession();
270 Description: Getter/setter
for the
accession of the assembly currently used
280 my ($self, $accession) = @_;
281 if (defined $accession) {
282 $self->{
'accession'} = $accession;
284 if (!defined $self->{
'accession'}) {
285 $self->{
'accession'} = $self->_meta_container->single_value_by_key(
'assembly.accession');
287 return $self->{
'accession'};
291 =head2 get_assembly_name
293 Arg [1] : (optional) assembly name
294 Example : $assembly_name = $genome->get_assembly_name();
295 Description: Getter/setter
for the name of the assembly currently used
304 sub get_assembly_name {
305 my ($self, $assembly_name) = @_;
306 if (defined $assembly_name) {
307 $self->{
'assembly_name'} = $assembly_name;
309 if (!defined $self->{
'assembly_name'}) {
310 $self->{
'assembly_name'} = $self->_meta_container->single_value_by_key(
'assembly.name');
312 return $self->{
'assembly_name'};
316 =head2 get_assembly_date
318 Arg [1] : (optional) assembly date
319 Example : $assembly_date = $genome->get_assembly_date();
320 Description: Getter/setter
for the date of the assembly currently used
329 sub get_assembly_date {
330 my ($self, $assembly_date) = @_;
331 if (defined $assembly_date) {
332 $self->{
'assembly_date'} = $assembly_date;
334 if (!defined $self->{
'assembly_date'}) {
335 $self->{
'assembly_date'} = $self->_meta_container->single_value_by_key(
'assembly.date');
337 return $self->{
'assembly_date'};
341 =head2 get_genebuild_start_date
343 Arg [1] : (optional) genebuild start date
344 Example : $genebuild_start_date = $genome->get_genebuild_start_date();
345 Description: Getter/setter
for the start date of the genebuild currently used
354 sub get_genebuild_start_date {
355 my ($self, $genebuild_start_date) = @_;
356 if (defined $genebuild_start_date) {
357 $self->{
'genebuild_start_date'} = $genebuild_start_date;
359 if (!defined $self->{
'genebuild_start_date'}) {
360 $self->{
'genebuild_start_date'} = $self->_meta_container->single_value_by_key(
'genebuild.start_date');
362 return $self->{
'genebuild_start_date'};
366 =head2 get_genebuild_method
368 Arg [1] : (optional) genebuild start date
369 Example : $genebuild_method = $genome->get_genebuild_method();
370 Description: Getter/setter
for the method of the genebuild currently used
379 sub get_genebuild_method {
380 my ($self, $genebuild_method) = @_;
381 if (defined $genebuild_method) {
382 $self->{
'genebuild_method'} = $genebuild_method;
384 if (!defined $self->{
'genebuild_method'}) {
385 $self->{
'genebuild_method'} = $self->_meta_container->single_value_by_key(
'genebuild.method');
387 return $self->{
'genebuild_method'};
391 =head2 get_genebuild_initial_release_date
393 Arg [1] : (optional) genebuild initial release date
394 Example : $genebuild_initial_release_date = $genome->get_initial_release_date();
395 Description: Getter/setter
for the initial release date of the genebuild currently used
404 sub get_genebuild_initial_release_date {
405 my ($self, $genebuild_initial_release_date) = @_;
406 if (defined $genebuild_initial_release_date) {
407 $self->{
'genebuild_initial_release_date'} = $genebuild_initial_release_date;
409 if (!defined $self->{
'genebuild_initial_release_date'}) {
410 $self->{
'genebuild_initial_release_date'} = $self->_meta_container->single_value_by_key(
'genebuild.initial_release_date');
412 return $self->{
'genebuild_initial_release_date'};
416 =head2 get_genebuild_last_geneset_update
418 Arg [1] : (optional) genebuild last geneset update
419 Example : $genebuild_last_geneset_update = $genome->get_last_geneset_update();
420 Description: Getter/setter
for the last geneset update of the genebuild currently used
429 sub get_genebuild_last_geneset_update {
430 my ($self, $genebuild_last_geneset_update) = @_;
431 if (defined $genebuild_last_geneset_update) {
432 $self->{
'genebuild_last_geneset_update'} = $genebuild_last_geneset_update;
434 if (!defined $self->{
'genebuild_last_geneset_update'}) {
435 $self->{
'genebuild_last_geneset_update'} = $self->_meta_container->single_value_by_key(
'genebuild.last_geneset_update');
437 return $self->{
'genebuild_last_geneset_update'};
444 Example : $length = $genome->_get_length(
'toplevel');
445 Description: Internal method to
return the length
for a type of slices
454 my ($self, $cs_name) = @_;
455 my $slice_adaptor = $self->db->get_adaptor(
'Slice');
456 my $seqlevel = $slice_adaptor->fetch_all($cs_name);
458 foreach my $seq (@$seqlevel) {
459 $count += $seq->length();
466 =head2 get_ref_length
468 Arg [1] : (optional) golden path length
469 Example : $ref_length = $genome->get_ref_length();
470 Description: Getter/setter
for the golden path of the assembly currently used
479 my ($self, $ref_length) = @_;
480 if (defined $ref_length) {
481 $self->{
'ref_length'} = $ref_length;
483 if (!defined $self->{
'ref_length'}) {
484 $self->{
'ref_length'} = $self->fetch_by_statistic(
'ref_length')->value();
486 return $self->{
'ref_length'};
492 Example : $toplevel = $genome->get_toplevel();
493 Description: Returns the toplevel
for the assembly currently used
504 my $sa = $self->db->get_adaptor(
'Slice');
505 $self->{
'toplevel'} = $sa->fetch_all(
'toplevel', undef, undef, 1);
506 return $self->{
'toplevel'};
513 Example : $karyotype = $genome->get_karyotype();
514 Description: Returns the karyotype
for the assembly currently used
525 my $sa = $self->db->get_adaptor(
'Slice');
526 $self->{
'karyotype'} = $sa->fetch_all_karyotype;
527 return $self->{
'karyotype'};
530 =head2 get_coord_systems
533 Example : $coord_systems = $genome->get_coord_systems();
534 Description: Returns the coord_systems
for the assembly currently used
543 sub get_coord_systems {
544 my ($self, $all) = @_;
545 my $csa = $self->db->get_adaptor(
'CoordSystem');
547 my $version = $self->get_version();
548 $self->{
'coord_systems'} = $csa->fetch_all_by_version($version);
550 $self->{
'coord_systems'} = $csa->fetch_all();
552 return $self->{
'coord_systems'};
558 Example : $count = $genome->_get_count(
'coding_cnt');
559 Description: Internal method to
return a count
for a given attribute code
568 my ($self, $code, $attribute) = @_;
569 my $statistic = $self->fetch_by_statistic($code, $attribute);
570 return $statistic->value();
576 Example : $count = $genome->get_count(
'coding_cnt');
577 Description: Retrieve a count
for a given attribute code
586 my ($self, $code, $attribute) = @_;
587 my $statistic = $self->fetch_by_statistic($code, $attribute);
588 return $statistic->value();
591 =head2 fetch_all_statistics
594 Example : $list = $genome->fetch_all_statistics();
595 Description: Retrieve all entries stored in the genome_statistics table
603 sub fetch_all_statistics {
609 SELECT genome_statistics_id, statistic, value, species_id, code, name, description
610 FROM genome_statistics, attrib_type
611 WHERE genome_statistics.attrib_type_id = attrib_type.attrib_type_id
615 my $sth = $self->prepare($sql);
616 $sth->bind_param(1, $species_id, SQL_INTEGER);
618 my $results = $self->_obj_from_sth($sth);
625 =head2 fetch_by_statistic
627 Arg [1] :
string $statistic
628 Example : $results = $genome->fetch_by_statistic(
'coding_cnt');
629 Description: Returns a Genome
object for a given statistic
637 sub fetch_by_statistic {
638 my ($self, $statistic_name, $attribute) = @_;
641 SELECT genome_statistics_id, statistic, value, species_id, code, name, description
642 FROM genome_statistics, attrib_type
643 WHERE genome_statistics.attrib_type_id = attrib_type.attrib_type_id
644 AND statistic = ? AND species_id=?
646 if (defined $attribute) {
647 $fetch_sql .=
" AND code = ?";
650 my $sth = $self->prepare($fetch_sql);
651 $sth->bind_param(1, $statistic_name, SQL_VARCHAR);
652 $sth->bind_param(2, $self->db->species_id, SQL_INTEGER);
653 if (defined $attribute) {
654 $sth->bind_param(3, $attribute, SQL_VARCHAR);
657 my ($dbID, $statistic, $value, $species_id, $code, $name, $desc);
658 $sth->bind_columns(\$dbID, \$statistic, \$value, \$species_id, \$code, \$name, \$desc);
660 my @results = $sth->fetchrow_array;
664 'statistic' => $statistic,
667 'description' => $desc,
675 Example : $results = $genome->is_empty;
676 Description: Boolean to check
if there is data in the genome container
690 SELECT count(*) FROM genome_statistics
693 my $sth = $self->prepare($count_sql);
695 if ($sth->fetchrow()) {
705 Example : $results = $genome->_get_attrib(
'coding_cnt');
706 Description: Returns the attribute
object for a given statistic
707 Returntype : Bio::EnsEMBL::Attrib
715 my ($self, $statistic) = @_;
716 my $db = $self->db();
717 my $attribute_adaptor = $db->get_adaptor(
'attribute');
718 my @attribs = @{ $attribute_adaptor->fetch_by_code($statistic) };
720 -code => $attribs[1],
721 -name => $attribs[2],
722 -description => $attribs[3]
727 =head2 get_coding_count
729 Arg [1] : (optional) coding count
730 Example : $coding_count = $genome->get_coding_count();
731 Description: Getter/setter
for the number of coding genes in the current build
740 sub get_coding_count {
741 my ($self, $coding_count) = @_;
742 if (defined $coding_count) {
743 $self->{
'coding_count'} = $coding_count;
745 if (!defined $self->{
'coding_count'}) {
746 $self->{
'coding_count'} = $self->_get_count(
'coding_cnt');
748 return $self->{
'coding_count'};
751 =head2 get_rcoding_count
753 Arg [1] : (optional) readthrough coding count
754 Example : $rcoding_count = $genome->get_rcoding_count();
755 Description: Getter/setter
for the number of readthrough coding genes in the current build
764 sub get_rcoding_count {
765 my ($self, $rcoding_count) = @_;
766 if (defined $rcoding_count) {
767 $self->{
'rcoding_count'} = $rcoding_count;
769 if (!defined $self->{
'rcoding_count'}) {
770 $self->{
'rcoding_count'} = $self->_get_count(
'coding_rcnt');
772 return $self->{
'rcoding_count'};
776 =head2 get_snoncoding_count
778 Arg [1] : (optional)
short non coding count
779 Example : $snoncoding_count = $genome->get_snoncoding_count();
780 Description: Getter/setter
for the number of
short non coding genes in the current build
789 sub get_snoncoding_count {
790 my ($self, $snoncoding_count) = @_;
791 if (defined $snoncoding_count) {
792 $self->{
'snoncoding_count'} = $snoncoding_count;
794 if (!defined $self->{
'snoncoding_count'}) {
795 $self->{
'snoncoding_count'} = $self->_get_count(
'noncoding_cnt_s');
797 return $self->{
'snoncoding_count'};
800 =head2 get_rsnoncoding_count
802 Arg [1] : (optional) readthrough
short non coding count
803 Example : $rsnoncoding_count = $genome->get_rsnoncoding_count();
804 Description: Getter/setter
for the number of readthrough
short non coding genes in the current build
813 sub get_rsnoncoding_count {
814 my ($self, $rsnoncoding_count) = @_;
815 if (defined $rsnoncoding_count) {
816 $self->{
'rsnoncoding_count'} = $rsnoncoding_count;
818 if (!defined $self->{
'rsnoncoding_count'}) {
819 $self->{
'rsnoncoding_count'} = $self->_get_count(
'noncoding_rcnt_s');
821 return $self->{
'rsnoncoding_count'};
824 =head2 get_mnoncoding_count
826 Arg [1] : (optional) miscellaneous non coding count
827 Example : $mnoncoding_count = $genome->get_mnoncoding_count();
828 Description: Getter/setter
for the number of miscellaneous non coding genes in the current build
837 sub get_mnoncoding_count {
838 my ($self, $mnoncoding_count) = @_;
839 if (defined $mnoncoding_count) {
840 $self->{
'mnoncoding_count'} = $mnoncoding_count;
842 if (!defined $self->{
'mnoncoding_count'}) {
843 $self->{
'mnoncoding_count'} = $self->_get_count(
'noncoding_cnt_m');
845 return $self->{
'mnoncoding_count'};
848 =head2 get_rmnoncoding_count
850 Arg [1] : (optional) readthrough miscellaneous non coding count
851 Example : $rmnoncoding_count = $genome->get_rmnoncoding_count();
852 Description: Getter/setter
for the number of readthrough miscellaneous non coding genes in the current build
861 sub get_rmnoncoding_count {
862 my ($self, $rmnoncoding_count) = @_;
863 if (defined $rmnoncoding_count) {
864 $self->{
'rmnoncoding_count'} = $rmnoncoding_count;
866 if (!defined $self->{
'rmnoncoding_count'}) {
867 $self->{
'rmnoncoding_count'} = $self->_get_count(
'noncoding_rcnt_m');
869 return $self->{
'rmnoncoding_count'};
873 =head2 get_lnoncoding_count
875 Arg [1] : (optional)
long non coding count
876 Example : $lnoncoding_count = $genome->get_lnoncoding_count();
877 Description: Getter/setter
for the number of
long non coding genes in the current build
886 sub get_lnoncoding_count {
887 my ($self, $lnoncoding_count) = @_;
888 if (defined $lnoncoding_count) {
889 $self->{
'lnoncoding_count'} = $lnoncoding_count;
891 if (!defined $self->{
'lnoncoding_count'}) {
892 $self->{
'lnoncoding_count'} = $self->_get_count(
'noncoding_cnt_l');
894 return $self->{
'lnoncoding_count'};
897 =head2 get_rlnoncoding_count
899 Arg [1] : (optional) readthrough
long non coding count
900 Example : $rlnoncoding_count = $genome->get_rlnoncoding_count();
901 Description: Getter/setter
for the number of readthrough
long non coding genes in the current build
910 sub get_rlnoncoding_count {
911 my ($self, $rlnoncoding_count) = @_;
912 if (defined $rlnoncoding_count) {
913 $self->{
'rlnoncoding_count'} = $rlnoncoding_count;
915 if (!defined $self->{
'rlnoncoding_count'}) {
916 $self->{
'rlnoncoding_count'} = $self->_get_count(
'noncoding_rcnt_l');
918 return $self->{
'rlnoncoding_count'};
921 =head2 get_pseudogene_count
923 Arg [1] : (optional) pseudogene count
924 Example : $pseudogene_count = $genome->get_pseudogene_count();
925 Description: Getter/setter
for the number of pseudogenes in the current build
935 sub get_pseudogene_count {
936 my ($self, $pseudogene_count) = @_;
937 if (defined $pseudogene_count) {
938 $self->{
'pseudogene_count'} = $pseudogene_count;
940 if (!defined $self->{
'pseudogene_count'}) {
941 $self->{
'pseudogene_count'} = $self->_get_count(
'pseudogene_cnt');
943 return $self->{
'pseudogene_count'};
946 =head2 get_rpseudogene_count
948 Arg [1] : (optional) readthrough pseudogene count
949 Example : $rpseudogene_count = $genome->get_rpseudogene_count();
950 Description: Getter/setter
for the number of readthrough pseudogenes in the current build
960 sub get_rpseudogene_count {
961 my ($self, $rpseudogene_count) = @_;
962 if (defined $rpseudogene_count) {
963 $self->{
'rpseudogene_count'} = $rpseudogene_count;
965 if (!defined $self->{
'rpseudogene_count'}) {
966 $self->{
'rpseudogene_count'} = $self->_get_count(
'pseudogene_rcnt');
968 return $self->{
'rpseudogene_count'};
971 =head2 get_alt_coding_count
973 Arg [1] : (optional) alt coding count
974 Example : $alt_coding_count = $genome->get_alt_coding_count();
975 Description: Getter/setter
for the number of coding genes on alternate sequences
984 sub get_alt_coding_count {
985 my ($self, $alt_coding_count) = @_;
986 if (defined $alt_coding_count) {
987 $self->{
'alt_coding_count'} = $alt_coding_count;
989 if (!defined $self->{
'alt_coding_count'}) {
990 $self->{
'alt_coding_count'} = $self->_get_count(
'coding_acnt');
992 return $self->{
'alt_coding_count'};
995 =head2 get_alt_rcoding_count
997 Arg [1] : (optional) alt readthrough coding count
998 Example : $alt_rcoding_count = $genome->get_alt_rcoding_count();
999 Description: Getter/setter
for the number of readthrough coding genes on alternate sequences
1001 Returntype : integer
1008 sub get_alt_rcoding_count {
1009 my ($self, $alt_rcoding_count) = @_;
1010 if (defined $alt_rcoding_count) {
1011 $self->{
'alt_rcoding_count'} = $alt_rcoding_count;
1013 if (!defined $self->{
'alt_rcoding_count'}) {
1014 $self->{
'alt_rcoding_count'} = $self->_get_count(
'coding_racnt');
1016 return $self->{
'alt_rcoding_count'};
1020 =head2 get_alt_snoncoding_count
1022 Arg [1] : (optional) alt
short non coding count
1023 Example : $alt_snoncoding_count = $genome->get_alt_snoncoding_count();
1024 Description: Getter/setter
for the number of
short non coding genes on alternate sequences
1026 Returntype : integer
1033 sub get_alt_snoncoding_count {
1034 my ($self, $alt_snoncoding_count) = @_;
1035 if (defined $alt_snoncoding_count) {
1036 $self->{
'alt_snoncoding_count'} = $alt_snoncoding_count;
1038 if (!defined $self->{
'alt_snoncoding_count'}) {
1039 $self->{
'alt_snoncoding_count'} = $self->_get_count(
'noncoding_acnt_s');
1041 return $self->{
'alt_snoncoding_count'};
1044 =head2 get_alt_rsnoncoding_count
1046 Arg [1] : (optional) alt readthrough
short non coding count
1047 Example : $alt_rsnoncoding_count = $genome->get_alt_rsnoncoding_count();
1048 Description: Getter/setter
for the number of readthrough
short non coding genes on alternate sequences
1050 Returntype : integer
1057 sub get_alt_rsnoncoding_count {
1058 my ($self, $alt_rsnoncoding_count) = @_;
1059 if (defined $alt_rsnoncoding_count) {
1060 $self->{
'alt_rsnoncoding_count'} = $alt_rsnoncoding_count;
1062 if (!defined $self->{
'alt_rsnoncoding_count'}) {
1063 $self->{
'alt_rsnoncoding_count'} = $self->_get_count(
'noncoding_racnt_s');
1065 return $self->{
'alt_rsnoncoding_count'};
1068 =head2 get_alt_mnoncoding_count
1070 Arg [1] : (optional) alt miscellaneous non coding count
1071 Example : $alt_mnoncoding_count = $genome->get_alt_mnoncoding_count();
1072 Description: Getter/setter
for the number of miscellaneous non coding genes on alternate sequences
1074 Returntype : integer
1081 sub get_alt_mnoncoding_count {
1082 my ($self, $alt_mnoncoding_count) = @_;
1083 if (defined $alt_mnoncoding_count) {
1084 $self->{
'alt_mnoncoding_count'} = $alt_mnoncoding_count;
1086 if (!defined $self->{
'alt_mnoncoding_count'}) {
1087 $self->{
'alt_mnoncoding_count'} = $self->_get_count(
'noncoding_acnt_m');
1089 return $self->{
'alt_mnoncoding_count'};
1092 =head2 get_alt_rmnoncoding_count
1094 Arg [1] : (optional) alt readthrough miscellaneous non coding count
1095 Example : $alt_rmnoncoding_count = $genome->get_alt_rmnoncoding_count();
1096 Description: Getter/setter
for the number of readthrough miscellaneous non coding genes on alternate sequences
1098 Returntype : integer
1105 sub get_alt_rmnoncoding_count {
1106 my ($self, $alt_rmnoncoding_count) = @_;
1107 if (defined $alt_rmnoncoding_count) {
1108 $self->{
'alt_rmnoncoding_count'} = $alt_rmnoncoding_count;
1110 if (!defined $self->{
'alt_rmnoncoding_count'}) {
1111 $self->{
'alt_rmnoncoding_count'} = $self->_get_count(
'noncoding_racnt_m');
1113 return $self->{
'alt_rmnoncoding_count'};
1117 =head2 get_alt_lnoncoding_count
1119 Arg [1] : (optional) alt
long non coding count
1120 Example : $alt_lnoncoding_count = $genome->get_alt_lnoncoding_count();
1121 Description: Getter/setter
for the number of
long non coding genes on alternate sequences
1123 Returntype : integer
1130 sub get_alt_lnoncoding_count {
1131 my ($self, $alt_lnoncoding_count) = @_;
1132 if (defined $alt_lnoncoding_count) {
1133 $self->{
'alt_lnoncoding_count'} = $alt_lnoncoding_count;
1135 if (!defined $self->{
'alt_lnoncoding_count'}) {
1136 $self->{
'alt_lnoncoding_count'} = $self->_get_count(
'noncoding_acnt_l');
1138 return $self->{
'alt_lnoncoding_count'};
1141 =head2 get_alt_rlnoncoding_count
1143 Arg [1] : (optional) alt readthrough
long non coding count
1144 Example : $alt_lnoncoding_count = $genome->get_alt_lnoncoding_count();
1145 Description: Getter/setter
for the number of readthrough
long non coding genes on alternate sequences
1147 Returntype : integer
1154 sub get_alt_rlnoncoding_count {
1155 my ($self, $alt_rlnoncoding_count) = @_;
1156 if (defined $alt_rlnoncoding_count) {
1157 $self->{
'alt_rlnoncoding_count'} = $alt_rlnoncoding_count;
1159 if (!defined $self->{
'alt_rlnoncoding_count'}) {
1160 $self->{
'alt_rlnoncoding_count'} = $self->_get_count(
'noncoding_racnt_l');
1162 return $self->{
'alt_rlnoncoding_count'};
1167 =head2 get_alt_pseudogene_count
1169 Arg [1] : (optional) alt pseudogene count
1170 Example : $alt_pseudogene_count = $genome->get_alt_pseudogene_count();
1171 Description: Getter/setter
for the number of pseudogenes on alternate sequences
1173 Returntype : integer
1180 sub get_alt_pseudogene_count {
1181 my ($self, $alt_pseudogene_count) = @_;
1182 if (defined $alt_pseudogene_count) {
1183 $self->{
'alt_pseudogene_count'} = $alt_pseudogene_count;
1185 if (!defined $self->{
'alt_pseudogene_count'}) {
1186 $self->{
'alt_pseudogene_count'} = $self->_get_count(
'pseudogene_acnt');
1188 return $self->{
'alt_pseudogene_count'};
1191 =head2 get_alt_rpseudogene_count
1193 Arg [1] : (optional) alt readthrough pseudogene count
1194 Example : $alt_rpseudogene_count = $genome->get_alt_pseudogene_count();
1195 Description: Getter/setter
for the number of readthrough pseudogenes on alternate sequences
1197 Returntype : integer
1204 sub get_alt_rpseudogene_count {
1205 my ($self, $alt_rpseudogene_count) = @_;
1206 if (defined $alt_rpseudogene_count) {
1207 $self->{
'alt_rpseudogene_count'} = $alt_rpseudogene_count;
1209 if (!defined $self->{
'alt_rpseudogene_count'}) {
1210 $self->{
'alt_rpseudogene_count'} = $self->_get_count(
'pseudogene_racnt');
1212 return $self->{
'alt_rpseudogene_count'};
1215 =head2 get_short_variation_count
1217 Arg [1] : (optional)
short variation count
1218 Example : $short_variation_count = $genome->get_short_variation_count();
1219 Description: Getter/setter
for the number of
short variants in the current build
1221 Returntype : integer
1228 sub get_short_variation_count {
1229 my ($self, $short_variation_count) = @_;
1230 if (defined $short_variation_count) {
1231 $self->{
'short_variation_count'} = $short_variation_count;
1233 if (!defined $self->{
'short_variation_count'}) {
1234 $self->{
'short_variation_count'} = $self->_get_count(
'SNPCount');
1236 return $self->{
'short_variation_count'};
1240 =head2 get_prediction_count
1242 Arg [1] : (optional) logic_name
1243 Example : $prediction_count = $genome->get_prediction_count();
1244 Description: Getter
for the number of predicted genes in the current build
1245 Can be restricted to a given analysis
1247 Returntype : integer
1254 sub get_prediction_count {
1255 my ($self, $logic_name) = @_;
1256 return $self->_get_count(
'PredictionTranscript', $logic_name);
1260 =head2 get_structural_variation_count
1263 Example : $structural_variation_count = $genome->get_structural_variation_count();
1264 Description: Return the number of structural variations in the current build
1265 Returntype : integer
1272 sub get_structural_variation_count {
1273 my ($self, $structural_variation_count) = @_;
1274 if (defined $structural_variation_count) {
1275 $self->{
'structural_variation_count'} = $structural_variation_count;
1277 if (!defined $self->{
'structural_variation_count'}) {
1278 $self->{
'structural_variation_count'} = $self->_get_count(
'StructuralVariation');
1280 return $self->{
'structural_variation_count'};
1283 =head2 get_transcript_count
1286 Example : $transcript_count = $genome->get_transcript_count();
1287 Description: Getter/setter
for the number of transcripts in the current build
1288 Returntype : integer
1295 sub get_transcript_count {
1296 my ($self, $transcript_count) = @_;
1297 if (defined $transcript_count) {
1298 $self->{
'transcript_count'} = $transcript_count;
1300 if (!defined $self->{
'transcript_count'}) {
1301 $self->{
'transcript_count'} = $self->_get_count(
'transcript');
1303 return $self->{
'transcript_count'};
1306 =head2 get_alt_transcript_count
1309 Example : $alt_transcript_count = $genome->get_alt_transcript_count();
1310 Description: Getter/setter
for the number of transcripts on alternate sequences in the current build
1311 Returntype : integer
1318 sub get_alt_transcript_count {
1319 my ($self, $alt_transcript_count) = @_;
1320 if (defined $alt_transcript_count) {
1321 $self->{
'alt_transcript_count'} = $alt_transcript_count;
1323 if (!defined $self->{
'alt_transcript_count'}) {
1324 $self->{
'alt_transcript_count'} = $self->_get_count(
'alt_transcript');
1326 return $self->{
'alt_transcript_count'};
1333 Example : $has_karyotype = $genome->has_karyotype();
1334 Description: Boolean indicating whether a genome has a karyotype (ie chromosomes)
1336 Returntype : integer
1346 my $db = $self->db();
1347 my $slice_adaptor = $db->get_SliceAdaptor();
1348 my $karyotype = $slice_adaptor->fetch_all_karyotype;
1350 return 0 unless scalar(@$karyotype);
1356 =head2 is_high_coverage
1359 Example : $is_high_coverage = $genome->is_high_coverage();
1360 Description: Boolean indicating whether an assembly is high coverage
1362 Returntype : integer
1369 sub is_high_coverage {
1372 my $coverage_depth = $self->_meta_container->single_value_by_key(
'assembly.coverage_depth');
1374 return 0
if !$coverage_depth;
1375 $coverage_depth = lc($coverage_depth);
1377 if ($coverage_depth eq
'high') {
1379 } elsif (($coverage_depth eq
'low') or ($coverage_depth eq
'medium')) {
1381 } elsif ($coverage_depth =~ /^([0-9]+)x$/) {
1382 return $1<6 ? 0 : 1;
1391 Example : $is_polyploid = $genome->is_polyploid();
1392 Description: Returns whether the genome is or is not polyploid.
1393 Returntype : integer
1403 my $polyploid = $self->_meta_container->single_value_by_key(
'ploidy');
1405 # polyploid could be not defined, meta_key is optional
1406 return 0 unless defined $polyploid;
1408 return $polyploid > 2;
1411 =head2 get_genome_components
1414 Example : $components = $genome->get_genome_components();
1415 Description: Returns the list of (diploid) components,
for a
1417 Returntype : Arrayref
1424 sub get_genome_components {
1427 my $sql_helper = $self->dbc->sql_helper;
1430 "SELECT DISTINCT value
1431 FROM seq_region_attrib JOIN attrib_type
1432 USING (attrib_type_id) WHERE attrib_type.code='genome_component'";
1434 return $sql_helper->execute_simple(-SQL => $sql);
1441 my ($dbID, $statistic, $value, $species_id, $code, $name, $desc);
1442 $sth->bind_columns(\$dbID, \$statistic, \$value, \$species_id, \$code, \$name, \$desc);
1445 while ($sth->fetch()) {
1448 'statistic' => $statistic,
1451 'description' => $desc,
1452 'value' => $value});