| 1 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # BioPerl module for Bio::SeqIO::Handler::GenericRichSeqHandler | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # Please direct questions and support issues to <bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # Cared for by Chris Fields | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | # Copyright Chris Fields | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | # You may distribute this module under the same terms as perl itself | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | # POD documentation - main docs before the code | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | Bio::SeqIO::Handler::GenericRichSeqHandler - Bio::HandlerI-based | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | data handler for GenBank/EMBL/UniProt (and other) sequence data | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | # MyHandler is a GenericRichSeqHandler object. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | # inside a parser (driver) constructor.... | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | $self->seq_handler($handler || MyHandler->new(-format => 'genbank')); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | # in next_seq() in driver... | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | $hobj = $self->seqhandler(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | # roll data up into hashref chunks, pass off into Handler for processing... | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | $hobj->data_handler($data); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | # or retrieve Handler methods and pass data directly to Handler methods... | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | my $hmeth = $hobj->handler_methods; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | if ($hmeth->{ $data->{NAME} }) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | my $mth = $hmeth->{ $data->{NAME} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | $hobj->$mth($data); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | This is an experimental implementation of a sequence-based HandlerBaseI parser | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | and may change over time. It is possible (nay, likely) that the way handler | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | methods are set up will change over development to allow more flexibility. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | Release pumpkins, please do not add this to a release until the API has settled. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | It is also likely that write_seq() will not work properly for some data. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | Standard Developer caveats: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | Do not use for production purposes. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | Not responsible for destroying (your data|computer|world). | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | Do not stare directly at GenericRichSeqHandler. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | If GenericRichSeqHandler glows, back slowly away and call for help. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | Consider yourself warned! | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | This class acts as a demonstration on how to handle similar data chunks derived | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | from Bio::SeqIO::gbdriver, Bio::SeqIO::embldriver, and Bio::SeqIO::swissdriver | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | using similar (or the same) handler methods. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | The modules currently pass all previous tests in t/genbank.t, t/embl.t, and | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | t/swiss.t yet all use the same handler methods (the collected tests for handlers | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | can be found in t/Handler.t). Some tweaking of the methods themselves is | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | probably in order over the long run to ensure that data is consistently handled | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | for each parser. Round-trip tests are probably in order here... | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | Though a Bio::Seq::SeqBuilder is employed for building sequence objects no | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | bypassing of data based on builder slots has been implemented (yet); this is | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | planned in the near future. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | As a reminder: this is the current Annotation data chunk (via Data::Dumper): | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | $VAR1 = { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 'NAME' => 'REFERENCE', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 'DATA' => '1 (bases 1 to 10001)' | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 'AUTHORS' => 'International Human Genome Sequencing Consortium.' | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 'TITLE' => 'The DNA sequence of Homo sapiens' | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 'JOURNAL' => 'Unpublished (2003)' | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | ... | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | This is the current SeqFeature data chunk (again via Data::Dumper): | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | $VAR1 = { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 'mol_type' => 'genomic DNA', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 'LOCATION' => '<1..>10001', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 'NAME' => 'FEATURES', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 'FEATURE_KEY' => 'source', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 'note' => 'Accession AL451081 sequenced by The Sanger Centre', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 'db_xref' => 'taxon:9606', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 'clone' => 'RP11-302I18', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 'organism' => 'Homo sapiens' | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | =head1 FEEDBACK | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | =head2 Mailing Lists | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | User feedback is an integral part of the evolution of this and other | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | Bioperl modules. Send your comments and suggestions preferably to one | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | of the Bioperl mailing lists. Your participation is much appreciated. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | bioperl-l@bioperl.org - General discussion | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | =head2 Support | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | Please direct usage questions or support issues to the mailing list: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | I<bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | rather than to the module maintainer directly. Many experienced and | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | reponsive experts will be able look at the problem and quickly | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | address it. Please include a thorough description of the problem | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | with code and data examples if at all possible. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | =head2 Reporting Bugs | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | Report bugs to the Bioperl bug tracking system to help us keep track | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | the bugs and their resolution. Bug reports can be submitted via the | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | web: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | https://github.com/bioperl/bioperl-live/issues | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | =head1 AUTHOR - Chris Fields | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | Email cjfields at bioperl dot org | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | =head1 APPENDIX | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | The rest of the documentation details each of the object methods. Internal | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | methods are usually preceded with a _ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | # Let the code begin... | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | package Bio::SeqIO::Handler::GenericRichSeqHandler; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 5 | $Bio::SeqIO::Handler::GenericRichSeqHandler::VERSION = '1.7.8'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 5 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 5 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 5 | ▶ | use Bio::SeqIO::FTHelper; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 5 | ▶ | use Bio::Annotation::Collection; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 5 | ▶ | use Bio::Annotation::DBLink; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 5 | ▶ | use Bio::Annotation::Comment; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 5 | ▶ | use Bio::Annotation::Reference; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 5 | ▶ | use Bio::Annotation::Collection; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 5 | ▶ | use Bio::Annotation::SimpleValue; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 5 | ▶ | use Bio::Annotation::TagTree; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 5 | ▶ | use Bio::SeqFeature::Generic; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 5 | ▶ | use Bio::Species; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 5 | ▶ | use Bio::Taxon; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 5 | ▶ | use Bio::DB::Taxonomy; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 5 | ▶ | use Bio::Factory::FTLocationFactory; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 5 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 5 | ▶ | use base qw(Bio::Root::Root Bio::HandlerBaseI); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 5 | my %HANDLERS = ( | |||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 'genbank' => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 'LOCUS' => \&_genbank_locus, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 'DEFINITION' => \&_generic_description, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 'ACCESSION' => \&_generic_accession, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 'VERSION' => \&_generic_version, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 'KEYWORDS' => \&_generic_keywords, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 'DBSOURCE' => \&_genbank_dbsource, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 'DBLINK' => \&_genbank_dbsource, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 'SOURCE' => \&_generic_species, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 'REFERENCE' => \&_generic_reference, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 'COMMENT' => \&_generic_comment, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 'FEATURES' => \&_generic_seqfeatures, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 'BASE' => \&noop, # this is generated from scratch | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 'ORIGIN' => \&_generic_seq, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | # handles anything else (WGS, WGS_SCAFLD, CONTIG, PROJECT) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | '_DEFAULT_' => \&_generic_simplevalue, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 'embl' => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 'ID' => \&_embl_id, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 'DT' => \&_embl_date, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 'DR' => \&_generic_dbsource, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 'SV' => \&_generic_version, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 'RN' => \&_generic_reference, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 'KW' => \&_generic_keywords, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 'DE' => \&_generic_description, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 'AC' => \&_generic_accession, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | #'AH' => \&noop, # TPA data not dealt with yet... | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | #'AS' => \&noop, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 'SQ' => \&_generic_seq, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 'OS' => \&_generic_species, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 'CC' => \&_generic_comment, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 'FT' => \&_generic_seqfeatures, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | # handles anything else (WGS, TPA, ANN...) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | '_DEFAULT_' => \&_generic_simplevalue, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 'swiss' => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 'ID' => \&_swiss_id, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 'DT' => \&_swiss_date, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 'GN' => \&_swiss_genename, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 'DR' => \&_generic_dbsource, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 'RN' => \&_generic_reference, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 'KW' => \&_generic_keywords, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 'DE' => \&_generic_description, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 'AC' => \&_generic_accession, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 'SQ' => \&_generic_seq, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 'OS' => \&_generic_species, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 'CC' => \&_generic_comment, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 'FT' => \&_generic_seqfeatures, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | # handles anything else, though I don't know what... | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | '_DEFAULT_' => \&_generic_simplevalue, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | # can we do this generically? Seems like a lot of trouble... | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 5 | my %DBSOURCE = map {$_ => 1} qw( | |||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | EchoBASE IntAct SWISS-2DPAGE ECO2DBASE ECOGENE TIGRFAMs | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | TIGR GO InterPro Pfam PROSITE SGD GermOnline | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | HSSP PhosSite Ensembl RGD AGD ArrayExpress KEGG | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | H-InvDB HGNC LinkHub PANTHER PRINTS SMART SMR | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | MGI MIM RZPD-ProtExp ProDom MEROPS TRANSFAC Reactome | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | UniGene GlycoSuiteDB PIRSF HSC-2DPAGE PHCI-2DPAGE | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | PMMA-2DPAGE Siena-2DPAGE Rat-heart-2DPAGE Aarhus/Ghent-2DPAGE | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | Biocyc MetaCyc Biocyc:Metacyc GenomeReviews FlyBase | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | TMHOBP COMPLUYEAST-2DPAGE OGP DictyBase HAMAP | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | PhotoList Gramene WormBase WormPep Genew ZFIN | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | PeroxiBase MaizeDB TAIR DrugBank REBASE HPA | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | swissprot GenBank GenPept REFSEQ embl PDB UniProtKB); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 5 | my %NOPROCESS = map {$_ => 1} qw(DBSOURCE ORGANISM FEATURES); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 5 | our %VALID_ALPHABET = ( | |||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 'bp' => 'dna', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 'aa' => 'protein', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 'rc' => '' # rc = release candidate; file has no sequences | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | =head2 new | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | Title : new | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | Usage : | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | Function: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | Returns : | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | Args : -format Sequence format to be mapped for handler methods | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | -builder Bio::Seq::SeqBuilder object (normally defined in | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | SequenceStreamI object implementation constructor) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | Throws : On undefined '-format' sequence format parameter | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | Note : Still under heavy development | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 42 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 42 | my ($class, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 42 | my $self = $class->SUPER::new(@args); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 42 | $self = {@args}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 42 | bless $self,$class; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 42 | my ($format, $builder) = $self->_rearrange([qw(FORMAT BUILDER)], @args); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 42 | ▶ | $self->throw("Must define sequence record format") if !$format; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 42 | $self->format($format); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 42 | $self->handler_methods(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 42 | ▶ | $builder && $self->seqbuilder($builder); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 42 | $self->location_factory(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 42 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | =head1 L<Bio::HandlerBaseI> implementing methods | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | =head2 handler_methods | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | Title : handler_methods | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | Usage : $handler->handler_methods('GenBank') | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | %handlers = $handler->handler_methods(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | Function: Retrieve the handler methods used for the current format() in | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | the handler. This assumes the handler methods are already | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | described in the HandlerI-implementing class. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | Returns : a hash reference with the data type handled and the code ref | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | associated with it. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | Args : [optional] String representing the sequence format. If set here | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | this will also set sequence_format() | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | Throws : On unimplemented sequence format in %HANDLERS | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 75 | ▶ | sub handler_methods { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
handler_methods: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 75 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 75 | ▶ | if (!($self->{'handlers'})) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | $self->throw("No handlers defined for seqformat ",$self->format) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 42 | ▶ | unless exists $HANDLERS{$self->format}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 42 | $self->{'handlers'} = $HANDLERS{$self->format}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 75 | return ($self->{'handlers'}); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | =head2 data_handler | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | Title : data_handler | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | Usage : $handler->data_handler($data) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | Function: Centralized method which accepts all data chunks, then distributes | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | to the appropriate methods for processing based on the chunk name | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | from within the HandlerBaseI object. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | One can also use | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | Returns : None | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | Args : an hash ref containing a data chunk. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 1646 | ▶ | sub data_handler { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
data_handler: called CC=5 SCAR=18.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 1646 | my ($self, $data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 1646 | ▶ | my $nm = $data->{NAME} || $self->throw("No name tag defined!"); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$data->{'NAME'} || $self->throw('No name tag defined!')
MC/DC0%0/2
$data->{'NAME'} || $self->throw('No name tag defined!')
$data->{'NAME'}
$self->throw('No name tag defined!')
Truth table33%1/3
A || B
A= $data->{'NAME'}B= $self->throw('No name tag defined!')
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | # this should handle data on the fly w/o caching; any caching should be | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | # done in the driver! | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | my $method = (exists $self->{'handlers'}->{$nm}) ? ($self->{'handlers'}->{$nm}) : | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 1646 | ▶ | (exists $self->{'handlers'}->{'_DEFAULT_'}) ? ($self->{'handlers'}->{'_DEFAULT_'}) : | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 1646 | ▶ | if (!$method) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | $self->debug("No handler defined for $nm\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 1646 | $self->$method($data); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | =head2 reset_parameters | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | Title : reset_parameters | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | Usage : $handler->reset_parameters() | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | Function: Resets the internal cache of data (normally object parameters for | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | a builder or factory) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | Returns : None | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | Args : None | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 58 | ▶ | sub reset_parameters { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reset_parameters: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 58 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 58 | $self->{'_params'} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | =head2 format | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | Title : format | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | Usage : $handler->format('GenBank') | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | Function: Get/Set the format for the report/record being parsed. This can be | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | used to set handlers in classes which are capable of processing | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | similar data chunks from multiple driver modules. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | Returns : String with the sequence format | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | Args : [optional] String with the sequence format | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | Note : The format may be used to set the handlers (as in the | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | current GenericRichSeqHandler implementation) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 1301 | ▶ | sub format { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
format: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 1301 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 1301 | ▶ | return $self->{'_seqformat'} = lc shift if @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 1259 | return $self->{'_seqformat'}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | =head2 get_params | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | Title : get_params | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | Usage : $handler->get_params('-species') | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | Function: Convenience method used to retrieve the specified | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | parameters from the internal parameter cache | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | Returns : Hash ref containing parameters requested and data as | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | key-value pairs. Note that some parameter values may be | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | objects, arrays, etc. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | Args : List (array) representing the parameters requested | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 818 | ▶ | sub get_params { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_params: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 818 | my ($self, @ids) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 818 | my %data; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 818 | for my $id (@ids) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 818 | ▶ | if (!index($id, '-')==0) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 818 | $id = '-'.$id ; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 818 | ▶ | $data{$id} = $self->{'_params'}->{$id} if (exists $self->{'_params'}->{$id}); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 818 | return \%data; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | =head2 set_params | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | Title : set_params | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | Usage : $handler->set_param({'-species') | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | Function: Convenience method used to set specific parameters | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | Returns : None | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | Args : Hash ref containing the data to be passed as key-value pairs | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | ▶ | sub set_params { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_params: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | shift->throw('Not implemented yet!'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | =head1 Methods unique to this implementation | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | =head2 seqbuilder | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | Title : seqbuilder | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | Usage : | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | Function: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | Returns : | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | Args : | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | Throws : | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | Note : | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 104 | ▶ | sub seqbuilder { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
seqbuilder: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 104 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 104 | ▶ | return $self->{'_seqbuilder'} = shift if @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 62 | return $self->{'_seqbuilder'}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | =head2 build_sequence | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | Title : build_sequence | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | Usage : | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | Function: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | Returns : | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | Args : | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | Throws : | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | Note : | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 62 | ▶ | sub build_sequence { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build_sequence: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 62 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 62 | my $builder = $self->seqbuilder(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 62 | my $seq; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 62 | ▶ | if (defined($self->{'_params'})) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 58 | $builder->add_slot_value(%{ $self->{'_params'} }); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 58 | $seq = $builder->make_object(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 58 | $self->reset_parameters; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 62 | ▶ | return $seq if $seq; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 4 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | =head2 location_factory | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | Title : location_factory | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | Usage : | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | Function: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | Returns : | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | Args : | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | Throws : | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | Note : | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 42 | ▶ | sub location_factory { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
location_factory: called CC=5 SCAR=23.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 42 | my ($self, $factory) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 42 | ▶ | if ($factory) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 0 | ▶ | $self->throw("Must have a Bio::Factory::LocationFactoryI when ". | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $factory and $factory->isa("Bio::Factory::LocationFactoryI")
MC/DC0%0/2
ref $factory and $factory->isa("Bio::Factory::LocationFactoryI")
ref $factory
$factory->isa("Bio::Factory::LocationFactoryI")
Truth table0%0/3
A and B
A= ref $factoryB= $factory->isa("Bio::Factory::LocationFactoryI")
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | "explicitly setting factory()") unless | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | (ref($factory) && $factory->isa('Bio::Factory::LocationFactoryI')); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 0 | $self->{'_locfactory'} = $factory; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | } elsif (!defined($self->{'_locfactory'})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 42 | $self->{'_locfactory'} = Bio::Factory::FTLocationFactory->new() | |||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 42 | return $self->{'_locfactory'}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | =head2 annotation_collection | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | Title : annotation_collection | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | Usage : | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | Function: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | Returns : | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | Args : | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | Throws : | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | Note : | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 746 | ▶ | sub annotation_collection { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
annotation_collection: called CC=5 SCAR=21.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 746 | my ($self, $coll) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 746 | ▶ | if ($coll) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | ▶ | $self->throw("Must have Bio::AnnotationCollectionI ". | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $coll and $coll->isa("Bio::AnnotationCollectionI")
MC/DC0%0/2
ref $coll and $coll->isa("Bio::AnnotationCollectionI")
ref $coll
$coll->isa("Bio::AnnotationCollectionI")
Truth table0%0/3
A and B
A= ref $collB= $coll->isa("Bio::AnnotationCollectionI")
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | "when explicitly setting collection()") | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | unless (ref($coll) && $coll->isa('Bio::AnnotationCollectionI')); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 0 | $self->{'_params'}->{'-annotation'} = $coll; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | } elsif (!exists($self->{'_params'}->{'-annotation'})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 57 | $self->{'_params'}->{'-annotation'} = Bio::Annotation::Collection->new() | |||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 746 | return $self->{'_params'}->{'-annotation'}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | ####################### SEQUENCE HANDLERS ####################### | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | # any sequence data | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 53 | ▶ | sub _generic_seq { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_generic_seq: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 53 | my ($self, $data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 53 | $self->{'_params'}->{'-seq'} = $data->{DATA}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | ####################### RAW DATA HANDLERS ####################### | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | # GenBank LOCUS line | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 31 | ▶ | sub _genbank_locus { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_genbank_locus: called CC=14 SCAR=35.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 31 | my ($self, $data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 31 | my (@tokens) = split m{\s+}, $data->{DATA}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 31 | my $display_id = shift @tokens; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 31 | $self->{'_params'}->{'-display_id'} = $display_id; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 31 | my $seqlength = shift @tokens; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 31 | ▶ | if (exists $VALID_ALPHABET{$seqlength}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | # moved one token too far. No locus name? | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | $self->warn("Bad LOCUS name? Changing [".$self->{'_params'}->{'-display_id'}. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 0 | "] to 'unknown' and length to ".$self->{'_params'}->{'-display_id'}); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 0 | $self->{'_params'}->{'-length'} = $self->{'_params'}->{'-display_id'}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 0 | $self->{'_params'}->{'-display_id'} = 'unknown'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | # add token back... | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 0 | unshift @tokens, $seqlength; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 31 | $self->{'_params'}->{'-length'} = $seqlength; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 31 | my $alphabet = lc(shift @tokens); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | $self->{'_params'}->{'-alphabet'} = | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 31 | ▶ | (exists $VALID_ALPHABET{$alphabet}) ? $VALID_ALPHABET{$alphabet} : | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | $self->warn("Unknown alphabet: $alphabet"); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 31 | ▶ | if (($self->{'_params'}->{'-alphabet'} eq 'dna') || (@tokens > 2)) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"_params"}{"-alphabet"} eq "dna" or @tokens > 2
MC/DC0%0/2
$self->{"_params"}{"-alphabet"} eq "dna" or @tokens > 2
$self->{"_params"}{"-alphabet"} eq "dna"
@tokens > 2
Truth table66%2/3
A or B
A= $self->{"_params"}{"-alphabet"} eq "dna"B= @tokens > 2
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 31 | $self->{'_params'}->{'-molecule'} = shift(@tokens); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 31 | my $circ = shift(@tokens); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 31 | ▶ | if ($circ eq 'circular') { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 2 | $self->{'_params'}->{'-is_circular'} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 2 | $self->{'_params'}->{'-division'} = shift(@tokens); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | # 'linear' or 'circular' may actually be omitted altogether | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 29 | ▶ | $self->{'_params'}->{'-division'} = | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | (CORE::length($circ) == 3 ) ? $circ : shift(@tokens); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 0 | ▶ | $self->{'_params'}->{'-molecule'} = 'PRT' if($self->{'_params'}->{'-alphabet'} eq 'aa'); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 0 | $self->{'_params'}->{'-division'} = shift(@tokens); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 31 | my $date = join(' ', @tokens); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | # maybe use Date::Time for dates? | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 31 | ▶ | if($date && $date =~ s{\s*((\d{1,2})-(\w{3})-(\d{2,4})).*}{$1}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$date and $date =~ s/\s*((\d{1,2})-(\w{3})-(\d{2,4})).*/$1/
MC/DC50%1/2
$date and $date =~ s/\s*((\d{1,2})-(\w{3})-(\d{2,4})).*/$1/
$date
$date =~ s/\s*((\d{1,2})-(\w{3})-(\d{2,4})).*/$1/
Truth table66%2/3
A and B
A= $dateB= $date =~ s/\s*((\d{1,2})-(\w{3})-(\d{2,4})).*/$1/
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 30 | ▶ | if( length($date) < 11 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | # improperly formatted date | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | # But we'll be nice and fix it for them | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 0 | my ($d,$m,$y) = ($2,$3,$4); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 0 | ▶ | if( length($d) == 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | $d = "0$d"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | # guess the century here | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 0 | ▶ | if( length($y) == 2 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 0 | ▶ | if( $y > 60 ) { # arbitrarily guess that '60' means 1960 | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 0 | $y = "19$y"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 0 | $y = "20$y"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 0 | $self->warn("Date was malformed, guessing the century for $date to be $y\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 0 | $self->{'_params'}->{'-dates'} = [join('-',$d,$m,$y)]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 30 | $self->{'_params'}->{'-dates'} = [$date]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | # EMBL ID line | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 10 | ▶ | sub _embl_id { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_embl_id: called CC=21 SCAR=36.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 10 | my ($self, $data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 10 | my $alphabet; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 10 | my ($name, $sv, $topology, $mol, $div); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 10 | my $line = $data->{DATA}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | #$self->debug("$line\n"); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 10 | my ($idtype) = $line =~ tr/;/;/; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 10 | ▶ | if ( $idtype == 6) { # New style headers contain exactly six semicolons. | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | # New style header (EMBL Release >= 87, after June 2006) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 1 | my $topology; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | my $sv; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | # ID DQ299383; SV 1; linear; mRNA; STD; MAM; 431 BP. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | # This regexp comes from the new2old.pl conversion script, from EBI | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 1 | ▶ | if ($line =~ m/^(\w+);\s+SV (\d+); (\w+); ([^;]+); (\w{3}); (\w{3}); (\d+) \w{2}\./) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 1 | ($name, $sv, $topology, $mol, $div) = ($1, $2, $3, $4, $6); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 0 | $self->throw("Unrecognized EMBL ID line:[$line]"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 1 | ▶ | if (defined($sv)) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 1 | $self->{'_params'}->{'-seq_version'} = $sv; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 1 | $self->{'_params'}->{'-version'} = $sv; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 1 | ▶ | if ($topology eq "circular") { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 0 | $self->{'_params'}->{'-is_circular'} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 1 | ▶ | if (defined $mol ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 1 | ▶ | if ($mol =~ /DNA/) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 0 | $alphabet='dna'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | elsif ($mol =~ /RNA/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 1 | $alphabet='rna'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | elsif ($mol =~ /AA/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 0 | $alphabet='protein'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | } elsif ($idtype) { # has internal ';' | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | # Old style header (EMBL Release < 87, before June 2006) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 8 | ▶ | if ($line =~ m{^(\S+)[^;]*;\s+(\S+)[^;]*;\s+(\S+)[^;]*;}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | 8 | ($name, $mol, $div) = ($1, $2, $3); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | #$self->debug("[$name][$mol][$div]"); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 8 | ▶ | if($mol) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 8 | ▶ | if ( $mol =~ m{circular} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 0 | $self->{'_params'}->{'-is_circular'} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 0 | $mol =~ s{circular }{}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | 8 | ▶ | if (defined $mol ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | 8 | ▶ | if ($mol =~ /DNA/) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 7 | $alphabet='dna'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | elsif ($mol =~ /RNA/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | 1 | $alphabet='rna'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | elsif ($mol =~ /AA/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 0 | $alphabet='protein'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | 1 | $name = $data->{DATA}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 10 | ▶ | unless( defined $name && length($name) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $name and length $name
MC/DC0%0/2
defined $name and length $name
defined $name
length $name
Truth table33%1/3
A and B
A= defined $nameB= length $name
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 0 | $name = "unknown_id"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | 10 | $self->{'_params'}->{'-display_id'} = $name; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 10 | $self->{'_params'}->{'-alphabet'} = $alphabet; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | 10 | ▶ | $self->{'_params'}->{'-division'} = $div if $div; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | 10 | ▶ | $self->{'_params'}->{'-molecule'} = $mol if $mol; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | # UniProt/SwissProt ID line | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | 17 | ▶ | sub _swiss_id { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_swiss_id: called CC=6 SCAR=18.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | 17 | my ($self, $data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 17 | my ($name, $seq_div); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | 17 | ▶ | if($data->{DATA} =~ m{^ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | (\S+) \s+ # $1 entryname | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | ([^\s;]+); \s+ # $2 DataClass | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | (?:PRT;)? \s+ # Molecule Type (optional) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | [0-9]+[ ]AA \. # Sequencelength (capture?) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | $ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | }ox ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | 17 | ($name, $seq_div) = ($1, $2); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | 17 | ▶ | $self->{'_params'}->{'-namespace'} = | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition83%5/6
$seq_div eq "Reviewed" or $seq_div eq "STANDARD"
$seq_div eq "Unreviewed" or $seq_div eq "PRELIMINARY"
MC/DC100%2/2
$seq_div eq "Reviewed" or $seq_div eq "STANDARD"
$seq_div eq "Reviewed"
$seq_div eq "STANDARD"
MC/DC0%0/2
$seq_div eq "Unreviewed" or $seq_div eq "PRELIMINARY"
$seq_div eq "Unreviewed"
$seq_div eq "PRELIMINARY"
Truth table100%3/3
A or B
A= $seq_div eq "Reviewed"B= $seq_div eq "STANDARD"
Truth table66%2/3
A or B
A= $seq_div eq "Unreviewed"B= $seq_div eq "PRELIMINARY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | ($seq_div eq 'Reviewed' || $seq_div eq 'STANDARD') ? 'Swiss-Prot' : | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | ($seq_div eq 'Unreviewed' || $seq_div eq 'PRELIMINARY') ? 'TrEMBL' : | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | $seq_div; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | # we shouldn't be setting the division, but for now... | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 17 | my ($junk, $division) = split q(_), $name; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | 17 | $self->{'_params'}->{'-division'} = $division; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 17 | $self->{'_params'}->{'-alphabet'} = 'protein'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | # this is important to have the id for display in e.g. FTHelper, otherwise | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | # you won't know which entry caused an error | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | 17 | $self->{'_params'}->{'-display_id'} = $name; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | 0 | $self->throw("Unrecognized UniProt/SwissProt ID line:[".$data->{DATA}."]"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | # UniProt/SwissProt GN line | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | 17 | ▶ | sub _swiss_genename { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_swiss_genename: called CC=8 SCAR=20.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 17 | my ($self, $data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | #$self->debug(Dumper($data)); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | 17 | my $genename = $data->{DATA}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 17 | my $gn; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | 17 | ▶ | if ($genename) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 17 | my @stags; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | 17 | ▶ | if ($genename =~ /\w=\w/) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | # new format (e.g., Name=RCHY1; Synonyms=ZNF363, CHIMP) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 10 | for my $n (split(m{\s+and\s+},$genename)) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | 12 | my @genenames; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | 12 | for my $section (split(m{\s*;\s*},$n)) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | 15 | my ($tag, $rest) = split("=",$section); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | 15 | ▶ | $rest ||= ''; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$rest ||= ""
MC/DC0%0/1
$rest ||= ""
$rest
Truth table50%1/2
A
A= $rest
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | 15 | for my $val (split(m{\s*,\s*},$rest)) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | 19 | push @genenames, [$tag => $val]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | 12 | push @stags, ['gene_name' => \@genenames]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | # old format | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 7 | for my $section (split(/ AND /, $genename)) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | 9 | my @genenames; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | 9 | $section =~ s/[\(\)\.]//g; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | 9 | my @names = split(m{\s+OR\s+}, $section); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 9 | push @genenames, ['Name' => shift @names]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 9 | push @genenames, map {['Synonyms' => $_]} @names; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | 9 | push @stags, ['gene_name' => \@genenames] | |||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | } #use Data::Dumper; print Dumper $gn, $genename;# exit; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | 17 | my $gn = Bio::Annotation::TagTree->new(-tagname => 'gene_name', | |||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | -value => ['gene_names' => \@stags]); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | 17 | $self->annotation_collection->add_Annotation('gene_name', $gn); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | # GenBank VERSION line | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | # old EMBL SV line (now obsolete) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | # UniProt/SwissProt? | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 28 | ▶ | sub _generic_version { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_generic_version: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | 28 | my ($self, $data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | 28 | my ($acc,$gi) = split(' ',$data->{DATA}); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | 28 | ▶ | if($acc =~ m{^\w+\.(\d+)}xmso) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | 27 | $self->{'_params'}->{'-version'} = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | 27 | $self->{'_params'}->{'-seq_version'} = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | 28 | ▶ | if($gi && (index($gi,"GI:") == 0)) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$gi and index($gi, "GI:") == 0
MC/DC50%1/2
$gi and index($gi, "GI:") == 0
$gi
index($gi, "GI:") == 0
Truth table66%2/3
A and B
A= $giB= index($gi, "GI:") == 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | 24 | $self->{'_params'}->{'-primary_id'} = substr($gi,3); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | # EMBL DT lines | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | 5 | ▶ | sub _embl_date { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_embl_date: called CC=4 SCAR=16.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 5 | my ($self, $data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | 5 | ▶ | while ($data->{DATA} =~ m{(\S+)\s\((.*?)\)}g) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | 10 | my ($date, $version) = ($1, $2); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | 10 | $date =~ tr{,}{}d; # remove comma if new version | |||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 10 | ▶ | if ($version =~ m{\(Rel\.\s(\d+),\sCreated\)}xmso ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | 0 | my $release = Bio::Annotation::SimpleValue->new( | |||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | -tagname => 'creation_release', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | -value => $1 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | 0 | $self->annotation_collection->add_Annotation($release); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | } elsif ($version =~ m{\(Rel\.\s(\d+),\sLast\supdated,\sVersion\s(\d+)\)}xmso ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | 0 | my $release = Bio::Annotation::SimpleValue->new( | |||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | -tagname => 'update_release', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | -value => $1 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | 0 | $self->annotation_collection->add_Annotation($release); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | 0 | my $update = Bio::Annotation::SimpleValue->new( | |||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | -tagname => 'update_version', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | -value => $2 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | 0 | $self->annotation_collection->add_Annotation($update); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | 10 | push @{ $self->{'_params'}->{'-dates'} }, $date; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | # UniProt/SwissProt DT lines | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | 17 | ▶ | sub _swiss_date { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_swiss_date: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | 17 | my ($self, $data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | # swissprot | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | 17 | my @dls = split m{\n}, $data->{DATA}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | 17 | for my $dl (@dls) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | 51 | my ($date, $version) = split(' ', $dl, 2); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | 51 | $date =~ tr{,}{}d; # remove comma if new version | |||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | 51 | ▶ | if ($version =~ m{\(Rel\. (\d+), Last sequence update\)} || # old | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%3/3
$version =~ /\(Rel\. (\d+), Last sequence update\)/ or $version =~ /sequence version (\d+)\./
MC/DC100%2/2
$version =~ /\(Rel\. (\d+), Last sequence update\)/ or $version =~ /sequence version (\d+)\./
$version =~ /\(Rel\. (\d+), Last sequence update\)/
$version =~ /sequence version (\d+)\./
Truth table100%3/3
A or B
A= $version =~ /\(Rel\. (\d+), Last sequence update\)/B= $version =~ /sequence version (\d+)\./
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | $version =~ m{sequence version (\d+)\.}) { #new | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | 17 | my $update = Bio::Annotation::SimpleValue->new( | |||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | -tagname => 'seq_update', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | -value => $1 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | 17 | $self->annotation_collection->add_Annotation($update); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | ▶ | } elsif ($version =~ m{\(Rel\. (\d+), Last annotation update\)} || #old | |||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$version =~ /\(Rel\. (\d+), Last annotation update\)/ or $version =~ /entry version (\d+)\./
MC/DC100%2/2
$version =~ /\(Rel\. (\d+), Last annotation update\)/ or $version =~ /entry version (\d+)\./
$version =~ /\(Rel\. (\d+), Last annotation update\)/
$version =~ /entry version (\d+)\./
Truth table100%3/3
A or B
A= $version =~ /\(Rel\. (\d+), Last annotation update\)/B= $version =~ /entry version (\d+)\./
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | $version =~ m{entry version (\d+)\.}) { #new | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | 17 | $self->{'_params'}->{'-version'} = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | 17 | $self->{'_params'}->{'-seq_version'} = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | 51 | push @{ $self->{'_params'}->{'-dates'} }, $date; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | # GenBank KEYWORDS line | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | # EMBL KW line | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | # UniProt/SwissProt KW line | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | 55 | ▶ | sub _generic_keywords { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_generic_keywords: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | 55 | my ($self, $data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | 55 | $data->{DATA} =~ s{\.$}{}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | 55 | my @kw = split m{\s*\;\s*}xo ,$data->{DATA}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | 55 | $self->{'_params'}->{'-keywords'} = \@kw; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | # GenBank DEFINITION line | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | # EMBL DE line | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | # UniProt/SwissProt DE line | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | 57 | ▶ | sub _generic_description { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_generic_description: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | 57 | my ($self, $data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | 57 | $self->{'_params'}->{'-desc'} = $data->{DATA}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | # GenBank ACCESSION line | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | # EMBL AC line | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | # UniProt/SwissProt AC line | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | 56 | ▶ | sub _generic_accession { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_generic_accession: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | 56 | my ($self, $data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | 56 | my @accs = split m{[\s;]+}, $data->{DATA}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | 56 | $self->{'_params'}->{'-accession_number'} = shift @accs; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | 56 | ▶ | $self->{'_params'}->{'-secondary_accessions'} = \@accs if @accs; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | ####################### SPECIES HANDLERS ####################### | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | # uses Bio::Species | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | # GenBank SOURCE, ORGANISM lines | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | # EMBL O* lines | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | # UniProt/SwissProt O* lines | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | 56 | ▶ | sub _generic_species { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_generic_species: called CC=18 SCAR=29.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | 56 | my ($self, $data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | 56 | my $seqformat = $self->format; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | # if data is coming in from GenBank parser... | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | 56 | ▶ | if ($seqformat eq 'genbank' && | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$seqformat eq "genbank" and $data->{"ORGANISM"} =~ /(.+?)\s(\S+;[^\n\.]+)/ox
MC/DC50%1/2
$seqformat eq "genbank" and $data->{"ORGANISM"} =~ /(.+?)\s(\S+;[^\n\.]+)/ox
$seqformat eq "genbank"
$data->{"ORGANISM"} =~ /(.+?)\s(\S+;[^\n\.]+)/ox
Truth table66%2/3
A and B
A= $seqformat eq "genbank"B= $data->{"ORGANISM"} =~ /(.+?)\s(\S+;[^\n\.]+)/ox
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | $data->{ORGANISM} =~ m{(.+?)\s(\S+;[^\n\.]+)}ox) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | 30 | ($data->{ORGANISM}, $data->{CLASSIFICATION}) = ($1, $2); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | # SwissProt stuff... | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | # hybrid names in swissprot files are no longer valid per intergration into | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | # UniProt. Files containing these have been split into separate entries, so | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | # it is probably a good idea to update if one has these lingering around... | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | 56 | my $taxid; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | 56 | ▶ | if ($seqformat eq 'swiss') { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | 17 | ▶ | if ($data->{DATA} =~ m{^([^,]+)}ox) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | 17 | $data->{DATA} = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | 17 | ▶ | if ($data->{CROSSREF} && $data->{CROSSREF} =~ m{NCBI_TaxID=(\d+)}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$data->{"CROSSREF"} and $data->{"CROSSREF"} =~ /NCBI_TaxID=(\d+)/
MC/DC50%1/2
$data->{"CROSSREF"} and $data->{"CROSSREF"} =~ /NCBI_TaxID=(\d+)/
$data->{"CROSSREF"}
$data->{"CROSSREF"} =~ /NCBI_TaxID=(\d+)/
Truth table66%2/3
A and B
A= $data->{"CROSSREF"}B= $data->{"CROSSREF"} =~ /NCBI_TaxID=(\d+)/
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | 16 | $taxid = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | my ($sl, $class, $sci_name) = ($data->{DATA}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | $data->{CLASSIFICATION}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | 56 | ▶ | $data->{ORGANISM} || ''); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$data->{'ORGANISM'} || ''
MC/DC100%1/1
$data->{'ORGANISM'} || ''
$data->{'ORGANISM'}
Truth table100%2/2
A
A= $data->{'ORGANISM'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | 56 | my ($organelle,$abbr_name, $common); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | 56 | my @class = reverse split m{\s*;\s*}, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | # have to treat swiss different from everything else... | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | 56 | ▶ | if ($sl =~ m{^(mitochondrion|chloroplast|plastid)? # GenBank format | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | \s*(.*?) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | \s*(?: \( (.*?) \) )?\.?$ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | }xmso ){ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | 56 | ($organelle, $abbr_name, $common) = ($1, $2, $3); # optional | |||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | 0 | $abbr_name = $sl; # nothing caught; this is a backup! | |||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | # there is no 'abbreviated name' for EMBL | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | 56 | ▶ | $sci_name = $abbr_name if $seqformat ne 'genbank'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | 56 | ▶ | $organelle ||= ''; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$organelle ||= ""
MC/DC100%1/1
$organelle ||= ""
$organelle
Truth table100%2/2
A
A= $organelle
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | 56 | ▶ | $common ||= ''; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$common ||= ""
MC/DC100%1/1
$common ||= ""
$common
Truth table100%2/2
A
A= $common
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | 56 | ▶ | $sci_name || return; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | 56 | unshift @class, $sci_name; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | # no genus/species parsing here; moving to Bio::Taxon-based taxonomy | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | 56 | my $make = Bio::Species->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | 56 | $make->scientific_name($sci_name); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | 56 | ▶ | $make->classification(@class) if @class > 0; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | 56 | ▶ | $common && $make->common_name( $common ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | 56 | ▶ | $abbr_name && $make->name('abbreviated', $abbr_name); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | 56 | ▶ | $organelle && $make->organelle($organelle); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | 56 | ▶ | $taxid && $make->ncbi_taxid($taxid); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | 56 | $self->{'_params'}->{'-species'} = $make; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | ####################### ANNOTATION HANDLERS ####################### | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | # GenBank DBSOURCE line | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | 1 | ▶ | sub _genbank_dbsource { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_genbank_dbsource: called CC=23 SCAR=59.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | 1 | my ($self, $data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | 1 | my $dbsource = $data->{DATA}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | 1 | my $annotation = $self->annotation_collection; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | # deal with swissprot dbsources | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | # we could possibly parcel these out to subhandlers... | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | 1 | ▶ | if( $dbsource =~ s/(UniProt(?:KB)|swissprot):\s+locus\s+(\S+)\,.+\n// ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | 0 | $annotation->add_Annotation | |||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | ('dblink', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | Bio::Annotation::DBLink->new | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | (-primary_id => $2, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | -database => $1, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | -tagname => 'dblink')); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | 0 | ▶ | if( $dbsource =~ s/\s*created:\s+([^\.]+)\.\n// ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | 0 | $annotation->add_Annotation | |||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | ('swissprot_dates', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | Bio::Annotation::SimpleValue->new | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | (-tagname => 'date_created', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | -value => $1)); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | 0 | ▶ | while( $dbsource =~ s/\s*(sequence|annotation)\s+updated:\s+([^\.]+)\.\n//g ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | 0 | $annotation->add_Annotation | |||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | ('swissprot_dates', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | Bio::Annotation::SimpleValue->new | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | (-tagname => 'date_updated', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | -value => $1)); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | 0 | $dbsource =~ s/\n/ /g; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | 0 | ▶ | if( $dbsource =~ s/\s*xrefs:\s+((?:\S+,\s+)+\S+)\s+xrefs/xrefs/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | # will use $i to determine even or odd | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | # for swissprot the accessions are paired | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | 0 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | 0 | for my $dbsrc ( split(/,\s+/,$1) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | 0 | ▶ | if( $dbsrc =~ /(\S+)\.(\d+)/ || $dbsrc =~ /(\S+)/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$dbsrc =~ /(\S+)\.(\d+)/ or $dbsrc =~ /(\S+)/
MC/DC0%0/2
$dbsrc =~ /(\S+)\.(\d+)/ or $dbsrc =~ /(\S+)/
$dbsrc =~ /(\S+)\.(\d+)/
$dbsrc =~ /(\S+)/
Truth table0%0/3
A or B
A= $dbsrc =~ /(\S+)\.(\d+)/B= $dbsrc =~ /(\S+)/
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | 0 | my ($id,$version) = ($1,$2); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | 0 | ▶ | $version ='' unless defined $version; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | 0 | my $db; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | 0 | ▶ | if( $id =~ /^\d\S{3}/) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | 0 | $db = 'PDB'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | 0 | ▶ | $db = ($i++ % 2 ) ? 'GenPept' : 'GenBank'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | 0 | $annotation->add_Annotation | |||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | ('dblink', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | Bio::Annotation::DBLink->new | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | (-primary_id => $id, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | -version => $version, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | -database => $db, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | -tagname => 'dblink')); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | } elsif( $dbsource =~ s/\s*xrefs:\s+(.+)\s+xrefs/xrefs/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | # download screwed up and ncbi didn't put acc in for gi numbers | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | 0 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | 0 | for my $id ( split(/\,\s+/,$1) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | 0 | my ($acc,$db); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | 0 | ▶ | if( $id =~ /gi:\s+(\d+)/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | 0 | $acc= $1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | 0 | ▶ | $db = ($i++ % 2 ) ? 'GenPept' : 'GenBank'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | } elsif( $id =~ /pdb\s+accession\s+(\S+)/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | 0 | $acc= $1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | 0 | $db = 'PDB'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | 0 | $acc= $id; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | 0 | $db = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | 0 | $annotation->add_Annotation | |||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | ('dblink', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | Bio::Annotation::DBLink->new | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | (-primary_id => $acc, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | -database => $db, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | -tagname => 'dblink')); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | 0 | $self->warn("Cannot match $dbsource\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | 0 | ▶ | if( $dbsource =~ s/xrefs\s+\(non\-sequence\s+databases\):\s+ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | ((?:\S+,\s+)+\S+)//x ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | 0 | for my $id ( split(/\,\s+/,$1) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | 0 | my $db; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | # this is because GenBank dropped the spaces!!! | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | # I'm sure we're not going to get this right | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | ##if( $id =~ s/^://i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | ## $db = $1; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | ##} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | 0 | $db = substr($id,0,index($id,':')); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | 0 | ▶ | if (! exists $DBSOURCE{ $db }) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | 0 | $db = ''; # do we want 'GenBank' here? | |||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | 0 | $id = substr($id,index($id,':')+1); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | 0 | $annotation->add_Annotation | |||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | ('dblink',Bio::Annotation::DBLink->new | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | (-primary_id => $id, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | -database => $db, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | -tagname => 'dblink')); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | 1 | ▶ | if( $dbsource =~ /^(\S*?):?\s*accession\s+(\S+)\.(\d+)/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | 1 | my ($db,$id,$version) = ($1,$2,$3); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | 1 | ▶ | $annotation->add_Annotation | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$db || 'GenBank'
MC/DC0%0/1
$db || 'GenBank'
$db
Truth table50%1/2
A
A= $db
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | ('dblink', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | Bio::Annotation::DBLink->new | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | (-primary_id => $id, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | -version => $version, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | -database => $db || 'GenBank', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | -tagname => 'dblink')); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | } elsif ( $dbsource =~ /(\S+)([\.:])(\d+)/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | 0 | my ($id, $db, $version); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | 0 | ▶ | if ($2 eq ':') { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | 0 | ($db, $id) = ($1, $3); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | 0 | ($db, $id, $version) = ('GenBank', $1, $3); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | 0 | $annotation->add_Annotation('dblink', | |||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | Bio::Annotation::DBLink->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | -primary_id => $id, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | -version => $version, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | -database => $db, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | -tagname => 'dblink') | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | 0 | $self->warn("Unrecognized DBSOURCE data: $dbsource\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | # EMBL DR lines | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | # UniProt/SwissProt DR lines | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | 20 | ▶ | sub _generic_dbsource { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_generic_dbsource: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | 20 | my ($self, $data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | #$self->debug(Dumper($data)); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | 20 | ▶ | while ($data->{DATA} =~ m{([^\n]+)}og) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | 351 | my $dblink = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | 351 | $dblink =~ s{\.$}{}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | 351 | my $link; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | 351 | my @linkdata = split '; ',$dblink; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | 351 | ▶ | if ( $dblink =~ m{([^\s;]+);\s*([^\s;]+);?\s*([^\s;]+)?}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | #if ( $dblink =~ m{([^\s;]+);\s*([^\s;]+);?\s*([^\s;]+)?}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | 351 | my ($databse, $prim_id, $sec_id) = ($1,$2,$3); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | 351 | $link = Bio::Annotation::DBLink->new(-database => $databse, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | -primary_id => $prim_id, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | -optional_id => $sec_id); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | 0 | $self->warn("No match for $dblink"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | 351 | $self->annotation_collection->add_Annotation('dblink', $link); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | # GenBank REFERENCE and related lines | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | # EMBL R* lines | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | # UniProt/SwissProt R* lines | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | 301 | ▶ | sub _generic_reference { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_generic_reference: called CC=10 SCAR=23.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | 301 | my ($self, $data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | 301 | my $seqformat = $self->format; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | 301 | my ($start, $end); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | # get these in EMBL/Swiss | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | 301 | ▶ | if ($data->{CROSSREF}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | 128 | ▶ | while ($data->{CROSSREF} =~ m{(pubmed|doi|medline)(?:=|;\s+)(\S+)}oig) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | 199 | my ($db, $ref) = (uc $1, $2); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | 199 | $ref =~ s{[;.]+$}{}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | 199 | $data->{$db} = $ref; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | # run some cleanup for swissprot | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | 301 | ▶ | if ($seqformat eq 'swiss') { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | 109 | for my $val (values %{ $data }) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | 959 | $val =~ s{;$}{}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | 959 | $val =~ s{(\w-)\s}{$1}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | 301 | ▶ | if ( $data->{POSITION} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | 127 | ▶ | if ($seqformat eq 'embl') { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | 18 | ($start, $end) = split '-', $data->{POSITION},2; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | } elsif ($data->{POSITION} =~ m{.+? OF (\d+)-(\d+).*}) { #swiss | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | 23 | ($start, $end) = ($1, $2); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | 301 | ▶ | if ($data->{DATA} =~ m{^\d+\s+\([a-z]+\s+(\d+)\s+to\s+(\d+)\)}xmso) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | 59 | ($start, $end) = ($1, $2); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | my $ref = Bio::Annotation::Reference->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | -comment => $data->{REMARK}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | -location => $data->{JOURNAL}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | -pubmed => $data->{PUBMED}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1059 | -consortium => $data->{CONSRTM}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1060 | -title => $data->{TITLE}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | -authors => $data->{AUTHORS}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | -medline => $data->{MEDLINE}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1063 | -doi => $data->{DOI}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | -rp => $data->{POSITION}, # JIC... | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | 301 | -start => $start, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1066 | -end => $end, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1067 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | 301 | ▶ | if ($data->{DATA} =~ m{^\d+\s+\((.*)\)}xmso) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1069 | 59 | $ref->gb_reference($1); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1070 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1071 | 301 | $self->annotation_collection->add_Annotation('reference', $ref); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1072 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1073 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1074 | # GenBank COMMENT lines | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1075 | # EMBL CC lines | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1076 | # UniProt/SwissProt CC lines | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1077 | 43 | ▶ | sub _generic_comment { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_generic_comment: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | 43 | my ($self, $data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1079 | $self->annotation_collection->add_Annotation('comment', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | 43 | Bio::Annotation::Comment->new( -text => $data->{DATA} )); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1081 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1082 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1083 | ####################### SEQFEATURE HANDLER ####################### | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1084 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1085 | # GenBank Feature Table | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1086 | 848 | ▶ | sub _generic_seqfeatures { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_generic_seqfeatures: called CC=9 SCAR=22.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1087 | 848 | my ($self, $data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1088 | 848 | ▶ | return if $data->{FEATURE_KEY} eq 'FEATURES'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1089 | 818 | my $primary_tag = $data->{FEATURE_KEY}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1090 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1091 | # grab the NCBI taxon ID from the source SF | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1092 | 818 | ▶ | if ($primary_tag eq 'source' && exists $data->{'db_xref'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$primary_tag eq "source" and exists $data->{"db_xref"}
MC/DC100%2/2
$primary_tag eq "source" and exists $data->{"db_xref"}
$primary_tag eq "source"
exists $data->{"db_xref"}
Truth table100%3/3
A and B
A= $primary_tag eq "source"B= exists $data->{"db_xref"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1093 | 36 | ▶ | if ( $self->{'_params'}->{'-species'} && | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"_params"}{"-species"} and $data->{"db_xref"} =~ /taxon:(\d+)/mosx
MC/DC50%1/2
$self->{"_params"}{"-species"} and $data->{"db_xref"} =~ /taxon:(\d+)/mosx
$self->{"_params"}{"-species"}
$data->{"db_xref"} =~ /taxon:(\d+)/mosx
Truth table66%2/3
A and B
A= $self->{"_params"}{"-species"}B= $data->{"db_xref"} =~ /taxon:(\d+)/mosx
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1094 | $data->{'db_xref'} =~ m{taxon:(\d+)}xmso ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1095 | 35 | $self->{'_params'}->{'-species'}->ncbi_taxid($1); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1096 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1097 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1098 | 818 | my $source = $self->format; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1099 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1100 | 818 | my $seqid = ${ $self->get_params('accession_number') }{'accession_number'}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1101 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1102 | 818 | my $loc; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1103 | 818 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1104 | 818 | $loc = $self->{'_locfactory'}->from_string($data->{'LOCATION'}); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1105 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1106 | 818 | ▶ | if(! $loc) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1107 | $self->warn("exception while parsing location line [" . | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1108 | $data->{'LOCATION'} . | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1109 | "] in reading $source, ignoring feature " . | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1110 | 0 | $data->{'primary_tag'}. | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1111 | " (seqid=" . $seqid . "): " . $@); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1112 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1113 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1114 | 818 | ▶ | if($seqid && (! $loc->is_remote())) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$seqid and not $loc->is_remote
MC/DC0%0/2
$seqid and not $loc->is_remote
$seqid
not $loc->is_remote
Truth table33%1/3
A and not(B)
A= $seqidB= not $loc->is_remote
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1115 | 0 | $loc->seq_id($seqid); # propagates if it is a split location | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1116 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1117 | 818 | my $sf = Bio::SeqFeature::Generic->direct_new(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1118 | 818 | $sf->location($loc); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1119 | 818 | $sf->primary_tag($primary_tag); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1120 | 818 | $sf->seq_id($seqid); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1121 | 818 | $sf->source_tag($source); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1122 | 818 | delete $data->{'FEATURE_KEY'}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1123 | 818 | delete $data->{'LOCATION'}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1124 | 818 | delete $data->{'NAME'}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1125 | 818 | delete $data->{'DATA'}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1126 | 818 | $sf->set_attributes(-tag => $data); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1127 | 818 | push @{ $self->{'_params'}->{'-features'} }, $sf; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1128 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1129 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1130 | ####################### ODDS AND ENDS ####################### | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1131 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1132 | # Those things that don't fit anywhere else. If a specific name | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1133 | # maps to the below table, that class and method are used, otherwise | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1134 | # it goes into a SimpleValue (I think this is a good argument for why | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1135 | # we need a generic mechanism for storing annotation) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1136 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1137 | 16 | ▶ | sub _generic_simplevalue { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_generic_simplevalue: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1138 | 16 | my ($self, $data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1139 | $self->annotation_collection->add_Annotation( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1140 | Bio::Annotation::SimpleValue->new(-tagname => lc($data->{NAME}), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1141 | -value => $data->{DATA}) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1142 | 16 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1143 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1144 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1145 | 15 | ▶ | sub noop {} | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
noop: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1146 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1147 | 0 | ▶ | sub _debug { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_debug: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1148 | 0 | my ($self, $data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1149 | 0 | $self->debug(Dumper($data)); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1150 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1151 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1152 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1153 | 5 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||