| 1 | # | ||||||||||||||||||||||||||||
| 2 | # bioperl module for Bio::SeqFeature::Tools::TypeMapper | ||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||
| 4 | # Please direct questions and support issues to <bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||
| 5 | # | ||||||||||||||||||||||||||||
| 6 | # Cared for by Chris Mungall <cjm@fruitfly.org> | ||||||||||||||||||||||||||||
| 7 | # | ||||||||||||||||||||||||||||
| 8 | # Copyright Chris Mungall | ||||||||||||||||||||||||||||
| 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::SeqFeature::Tools::TypeMapper - maps $seq_feature-E<gt>primary_tag | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | use Bio::SeqIO; | ||||||||||||||||||||||||||||
| 21 | use Bio::SeqFeature::Tools::TypeMapper; | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | # first fetch a genbank SeqI object | ||||||||||||||||||||||||||||
| 24 | $seqio = | ||||||||||||||||||||||||||||
| 25 | Bio::SeqIO->new(-file=>'AE003644.gbk', | ||||||||||||||||||||||||||||
| 26 | -format=>'GenBank'); | ||||||||||||||||||||||||||||
| 27 | $seq = $seqio->next_seq(); | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | $tm = Bio::SeqFeature::Tools::TypeMapper->new; | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | # map all the types in the sequence | ||||||||||||||||||||||||||||
| 32 | $tm->map_types(-seq=>$seq, | ||||||||||||||||||||||||||||
| 33 | {CDS=>'ORF', | ||||||||||||||||||||||||||||
| 34 | variation=>sub { | ||||||||||||||||||||||||||||
| 35 | my $f = shift; | ||||||||||||||||||||||||||||
| 36 | $f->length > 1 ? | ||||||||||||||||||||||||||||
| 37 | 'variation' : 'SNP' | ||||||||||||||||||||||||||||
| 38 | }, | ||||||||||||||||||||||||||||
| 39 | }); | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | # alternatively, use the hardcoded SO mapping | ||||||||||||||||||||||||||||
| 42 | $tm->map_types_to_SO(-seq=>$seq); | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | This class implements an object for mapping between types; for | ||||||||||||||||||||||||||||
| 47 | example, the types in a genbank feature table, and the types specified | ||||||||||||||||||||||||||||
| 48 | in the Sequence Ontology. | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | You can specify your own mapping, either as a simple hash index, or by | ||||||||||||||||||||||||||||
| 51 | providing your own subroutines. | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | =head1 FEEDBACK | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | =head2 Mailing Lists | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | User feedback is an integral part of the evolution of this and other | ||||||||||||||||||||||||||||
| 58 | Bioperl modules. Send your comments and suggestions preferably to the | ||||||||||||||||||||||||||||
| 59 | Bioperl mailing lists Your participation is much appreciated. | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | bioperl-l@bioperl.org - General discussion | ||||||||||||||||||||||||||||
| 62 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | =head2 Support | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | Please direct usage questions or support issues to the mailing list: | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | I<bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | rather than to the module maintainer directly. Many experienced and | ||||||||||||||||||||||||||||
| 71 | reponsive experts will be able look at the problem and quickly | ||||||||||||||||||||||||||||
| 72 | address it. Please include a thorough description of the problem | ||||||||||||||||||||||||||||
| 73 | with code and data examples if at all possible. | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | =head2 Reporting Bugs | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | report bugs to the Bioperl bug tracking system to help us keep track | ||||||||||||||||||||||||||||
| 78 | the bugs and their resolution. Bug reports can be submitted via the | ||||||||||||||||||||||||||||
| 79 | web: | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | https://github.com/bioperl/bioperl-live/issues | ||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | =head1 AUTHOR - Chris Mungall | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | Email: cjm@fruitfly.org | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | =head1 APPENDIX | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | The rest of the documentation details each of the object | ||||||||||||||||||||||||||||
| 90 | methods. Internal methods are usually preceded with a _ | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | =cut | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | # Let the code begin... | ||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | package Bio::SeqFeature::Tools::TypeMapper; | ||||||||||||||||||||||||||||
| 98 | 1 | $Bio::SeqFeature::Tools::TypeMapper::VERSION = '1.7.8'; | |||||||||||||||||||||||||||
| 99 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | # Object preamble - inherits from Bio::Root::Root | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | 1 | ▶ | use base qw(Bio::Root::Root); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | =head2 new | ||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | Title : new | ||||||||||||||||||||||||||||
| 108 | Usage : $unflattener = Bio::SeqFeature::Tools::TypeMapper->new(); | ||||||||||||||||||||||||||||
| 109 | Function: constructor | ||||||||||||||||||||||||||||
| 110 | Example : | ||||||||||||||||||||||||||||
| 111 | Returns : a new Bio::SeqFeature::Tools::TypeMapper | ||||||||||||||||||||||||||||
| 112 | Args : see below | ||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | =cut | ||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 118 | 0 | my($class,@args) = @_; | |||||||||||||||||||||||||||
| 119 | 0 | my $self = $class->SUPER::new(@args); | |||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | 0 | my($typemap) = | |||||||||||||||||||||||||||
| 122 | $self->_rearrange([qw(TYPEMAP | ||||||||||||||||||||||||||||
| 123 | )], | ||||||||||||||||||||||||||||
| 124 | @args); | ||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | 0 | ▶ | $typemap && $self->typemap($typemap); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 127 | 0 | return $self; # success - we hope! | |||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | =head2 typemap | ||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | Title : typemap | ||||||||||||||||||||||||||||
| 133 | Usage : $obj->typemap($newval) | ||||||||||||||||||||||||||||
| 134 | Function: | ||||||||||||||||||||||||||||
| 135 | Example : | ||||||||||||||||||||||||||||
| 136 | Returns : value of typemap (a scalar) | ||||||||||||||||||||||||||||
| 137 | Args : on set, new value (a scalar or undef, optional) | ||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||
| 140 | =cut | ||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | 0 | ▶ | sub typemap{ | ||||||||||||||||||||||||||
|
Subroutine
typemap: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 143 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | 0 | ▶ | return $self->{'typemap'} = shift if @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 146 | 0 | return $self->{'typemap'}; | |||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | =head2 map_types | ||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | Title : map_types | ||||||||||||||||||||||||||||
| 152 | Usage : | ||||||||||||||||||||||||||||
| 153 | Function: | ||||||||||||||||||||||||||||
| 154 | Example : | ||||||||||||||||||||||||||||
| 155 | Returns : | ||||||||||||||||||||||||||||
| 156 | Args : | ||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | dgg: added -undefined => "region" option to produce all valid SO mappings. | ||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | =cut | ||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||
| 162 | 0 | ▶ | sub map_types{ | ||||||||||||||||||||||||||
|
Subroutine
map_types: not called CC=14 SCAR=53.5
Pod
documented
| |||||||||||||||||||||||||||||
| 163 | 0 | my ($self,@args) = @_; | |||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||
| 165 | 0 | my($sf, $seq, $type_map, $undefmap) = | |||||||||||||||||||||||||||
| 166 | $self->_rearrange([qw(FEATURE | ||||||||||||||||||||||||||||
| 167 | SEQ | ||||||||||||||||||||||||||||
| 168 | TYPE_MAP | ||||||||||||||||||||||||||||
| 169 | UNDEFINED | ||||||||||||||||||||||||||||
| 170 | )], | ||||||||||||||||||||||||||||
| 171 | @args); | ||||||||||||||||||||||||||||
| 172 | 0 | ▶ | if (!$sf && !$seq) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$sf or $seq
MC/DC0%0/2
$sf or $seq
$sf
$seq
Truth table0%0/3
A or B
A= $sfB= $seq
| |||||||||||||||||||||||||||||
| 173 | 0 | $self->throw("you need to pass in either -feature or -seq"); | |||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | 0 | my @sfs = ($sf); | |||||||||||||||||||||||||||
| 177 | 0 | ▶ | if ($seq) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 178 | 0 | ▶ | $seq->isa("Bio::SeqI") || $self->throw("$seq NOT A SeqI"); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 179 | 0 | @sfs = $seq->get_all_SeqFeatures; | |||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||
| 181 | 0 | ▶ | $type_map = $type_map || $self->typemap; # dgg: was type_map; | ||||||||||||||||||||||||||
|
Condition0%0/3
$type_map || $self->typemap
MC/DC0%0/2
$type_map || $self->typemap
$type_map
$self->typemap
Truth table0%0/3
A || B
A= $type_mapB= $self->typemap
| |||||||||||||||||||||||||||||
| 182 | 0 | foreach my $sf (@sfs) { | |||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | 0 | ▶ | $sf->isa("Bio::SeqFeatureI") || $self->throw("$sf NOT A SeqFeatureI"); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 185 | 0 | ▶ | $sf->isa("Bio::FeatureHolderI") || $self->throw("$sf NOT A FeatureHolderI"); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||
| 187 | 0 | my $type = $sf->primary_tag; | |||||||||||||||||||||||||||
| 188 | 0 | my $mtype = $type_map->{$type}; | |||||||||||||||||||||||||||
| 189 | 0 | ▶ | if ($mtype) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 190 | 0 | ▶ | if (ref($mtype)) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 191 | 0 | ▶ | if (ref($mtype) eq 'CODE') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 192 | 0 | $mtype = $mtype->($sf); | |||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||
| 194 | else { | ||||||||||||||||||||||||||||
| 195 | 0 | $self->throw('type_map values must be scalar or CODE ref. You said: '.$mtype.' for type: '.$type); | |||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||
| 198 | ▶ | elsif ($undefmap && $mtype eq 'undefined') { # dgg | |||||||||||||||||||||||||||
|
Condition0%0/3
$undefmap and $mtype eq "undefined"
MC/DC0%0/2
$undefmap and $mtype eq "undefined"
$undefmap
$mtype eq "undefined"
Truth table0%0/3
A and B
A= $undefmapB= $mtype eq "undefined"
| |||||||||||||||||||||||||||||
| 199 | 0 | $mtype= $undefmap; | |||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||
| 201 | 0 | $sf->primary_tag($mtype); | |||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||
| 204 | 0 | return; | |||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||
| 207 | =head2 map_types_to_SO | ||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||
| 209 | Title : map_types_to_SO | ||||||||||||||||||||||||||||
| 210 | Usage : | ||||||||||||||||||||||||||||
| 211 | Function: | ||||||||||||||||||||||||||||
| 212 | Example : | ||||||||||||||||||||||||||||
| 213 | Returns : | ||||||||||||||||||||||||||||
| 214 | Args : | ||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||
| 216 | hardcodes the genbank to SO mapping | ||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||
| 218 | Based on revision 1.22 of SO | ||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||
| 220 | Please see the actual code for the mappings | ||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||
| 222 | Taken from | ||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||
| 224 | L<http://sequenceontology.org/resources/mapping/FT_SO.txt> | ||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||
| 226 | dgg: separated out FT_SO_map for caller changes. Update with: | ||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | open(FTSO,"curl -s http://sequenceontology.org/resources/mapping/FT_SO.txt|"); | ||||||||||||||||||||||||||||
| 229 | while(<FTSO>){ | ||||||||||||||||||||||||||||
| 230 | chomp; ($ft,$so,$sid,$ftdef,$sodef)= split"\t"; | ||||||||||||||||||||||||||||
| 231 | print " '$ft' => '$so',\n" if($ft && $so && $ftdef); | ||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||
| 234 | =cut | ||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||
| 236 | 0 | ▶ | sub FT_SO_map { | ||||||||||||||||||||||||||
|
Subroutine
FT_SO_map: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 237 | # $self= shift; | ||||||||||||||||||||||||||||
| 238 | # note : some of the ft_so mappings are commented out and overriden... | ||||||||||||||||||||||||||||
| 239 | return { | ||||||||||||||||||||||||||||
| 240 | 0 | "-" => ["located_sequence_feature", "so:0000110"], | |||||||||||||||||||||||||||
| 241 | "-10_signal" => ["minus_10_signal", "so:0000175"], | ||||||||||||||||||||||||||||
| 242 | "-35_signal" => ["minus_35_signal", "so:0000176"], | ||||||||||||||||||||||||||||
| 243 | "3'utr" => ["three_prime_utr", "so:0000205"], | ||||||||||||||||||||||||||||
| 244 | "3'clip" => ["three_prime_clip", "so:0000557"], | ||||||||||||||||||||||||||||
| 245 | "5'utr" => ["five_prime_utr", "so:0000204"], | ||||||||||||||||||||||||||||
| 246 | "5'clip" => ["five_prime_clip", "so:0000555"], | ||||||||||||||||||||||||||||
| 247 | "caat_signal" => ["caat_signal", "so:0000172"], | ||||||||||||||||||||||||||||
| 248 | "cds" => ["cds", "so:0000316"], | ||||||||||||||||||||||||||||
| 249 | "c_region" => ["undefined", ""], | ||||||||||||||||||||||||||||
| 250 | "d-loop" => ["d_loop", "so:0000297"], | ||||||||||||||||||||||||||||
| 251 | "d_segment" => ["d_gene", "so:0000458"], | ||||||||||||||||||||||||||||
| 252 | "gc_signal" => ["gc_rich_region", "so:0000173"], | ||||||||||||||||||||||||||||
| 253 | "j_segment" => ["undefined", ""], | ||||||||||||||||||||||||||||
| 254 | "ltr" => ["long_terminal_repeat", "so:0000286"], | ||||||||||||||||||||||||||||
| 255 | "n_region" => ["undefined", ""], | ||||||||||||||||||||||||||||
| 256 | "rbs" => ["ribosome_entry_site", "so:0000139"], | ||||||||||||||||||||||||||||
| 257 | "sts" => ["sts", "so:0000331"], | ||||||||||||||||||||||||||||
| 258 | "s_region" => ["undefined", ""], | ||||||||||||||||||||||||||||
| 259 | "tata_signal" => ["tata_box", "so:0000174"], | ||||||||||||||||||||||||||||
| 260 | "v_region" => ["undefined", ""], | ||||||||||||||||||||||||||||
| 261 | "v_segment" => ["undefined", ""], | ||||||||||||||||||||||||||||
| 262 | "attenuator" => ["attenuator", "so:0000140"], | ||||||||||||||||||||||||||||
| 263 | "conflict" => ["undefined", ""], | ||||||||||||||||||||||||||||
| 264 | "enhancer" => ["enhancer", "so:0000165"], | ||||||||||||||||||||||||||||
| 265 | "exon" => ["exon", "so:0000147"], | ||||||||||||||||||||||||||||
| 266 | "gap" => ["gap", "so:0000730"], | ||||||||||||||||||||||||||||
| 267 | "gene" => ["gene", "so:0000704"], | ||||||||||||||||||||||||||||
| 268 | "idna" => ["idna", "so:0000723"], | ||||||||||||||||||||||||||||
| 269 | "intron" => ["intron", "so:0000188"], | ||||||||||||||||||||||||||||
| 270 | "mRNA" => ["mRNA", "so:0000234"], | ||||||||||||||||||||||||||||
| 271 | "mat_peptide" => ["mature_protein_region", "so:0000419"], | ||||||||||||||||||||||||||||
| 272 | "mature_peptide" => ["mature_protein_region", "so:0000419"], | ||||||||||||||||||||||||||||
| 273 | #"misc_RNA" => ["transcript", "so:0000673"], | ||||||||||||||||||||||||||||
| 274 | "misc_binding" => ["binding_site", "so:0000409"], | ||||||||||||||||||||||||||||
| 275 | "misc_difference" => ["sequence_difference", "so:0000413"], | ||||||||||||||||||||||||||||
| 276 | "misc_feature" => ["region", undef], | ||||||||||||||||||||||||||||
| 277 | "misc_recomb" => ["recombination_feature", "so:0000298"], | ||||||||||||||||||||||||||||
| 278 | "misc_signal" => ["regulatory_region", "so:0005836"], | ||||||||||||||||||||||||||||
| 279 | "misc_structure" => ["sequence_secondary_structure", "so:0000002"], | ||||||||||||||||||||||||||||
| 280 | "modified_base" => ["modified_base_site", "so:0000305"], | ||||||||||||||||||||||||||||
| 281 | "old_sequence" => ["undefined", ""], | ||||||||||||||||||||||||||||
| 282 | "operon" => ["operon", "so:0000178"], | ||||||||||||||||||||||||||||
| 283 | "oriT" => ["origin_of_transfer", "so:0000724"], | ||||||||||||||||||||||||||||
| 284 | "polya_signal" => ["polyA_signal_sequence", "so:0000551"], | ||||||||||||||||||||||||||||
| 285 | "polya_site" => ["polyA_site", "so:0000553"], | ||||||||||||||||||||||||||||
| 286 | "precursor_RNA" => ["primary_transcript", "so:0000185"], | ||||||||||||||||||||||||||||
| 287 | "prim_transcript" => ["primary_transcript", "so:0000185"], | ||||||||||||||||||||||||||||
| 288 | "primer_bind" => ["primer_binding_site", "so:0005850"], | ||||||||||||||||||||||||||||
| 289 | "promoter" => ["promoter", "so:0000167"], | ||||||||||||||||||||||||||||
| 290 | "protein_bind" => ["protein_binding_site", "so:0000410"], | ||||||||||||||||||||||||||||
| 291 | "rRNA" => ["rRNA", "so:0000252"], | ||||||||||||||||||||||||||||
| 292 | "repeat_region" => ["repeat_region", "so:0000657"], | ||||||||||||||||||||||||||||
| 293 | "repeat_unit" => ["repeat_unit", "so:0000726"], | ||||||||||||||||||||||||||||
| 294 | "satellite" => ["satellite_dna", "so:0000005"], | ||||||||||||||||||||||||||||
| 295 | "scRNA" => ["scRNA", "so:0000013"], | ||||||||||||||||||||||||||||
| 296 | "sig_peptide" => ["signal_peptide", "so:0000418"], | ||||||||||||||||||||||||||||
| 297 | "snRNA" => ["snRNA", "so:0000274"], | ||||||||||||||||||||||||||||
| 298 | "snoRNA" => ["snoRNA", "so:0000275"], | ||||||||||||||||||||||||||||
| 299 | #"source" => ["databank_entry", "so:2000061"], | ||||||||||||||||||||||||||||
| 300 | "stem_loop" => ["stem_loop", "so:0000313"], | ||||||||||||||||||||||||||||
| 301 | "tRNA" => ["tRNA", "so:0000253"], | ||||||||||||||||||||||||||||
| 302 | "terminator" => ["terminator", "so:0000141"], | ||||||||||||||||||||||||||||
| 303 | "transit_peptide" => ["transit_peptide", "so:0000725"], | ||||||||||||||||||||||||||||
| 304 | "unsure" => "undefined", | ||||||||||||||||||||||||||||
| 305 | "variation" => ["sequence_variant", "so:0000109"], | ||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||
| 307 | # manually added | ||||||||||||||||||||||||||||
| 308 | ## has parent = pseudogene ; dgg | ||||||||||||||||||||||||||||
| 309 | "pseudomRNA" => ["pseudogenic_transcript", "so:0000516"], | ||||||||||||||||||||||||||||
| 310 | ## from unflattener misc_rna ; dgg | ||||||||||||||||||||||||||||
| 311 | "pseudotranscript" => ["pseudogenic_transcript", "so:0000516"], | ||||||||||||||||||||||||||||
| 312 | "pseudoexon" => ["pseudogenic_exon", "so:0000507"], | ||||||||||||||||||||||||||||
| 313 | "pseudoCDS" => ["pseudogenic_exon", "so:0000507"], | ||||||||||||||||||||||||||||
| 314 | "pseudomisc_feature" => ["pseudogenic_region", "so:0000462"], | ||||||||||||||||||||||||||||
| 315 | "pseudointron" => ["pseudogenic_region", "so:0000462"], | ||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||
| 318 | ## "undefined" => "region", | ||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||
| 320 | # this is the most generic form for rnas; | ||||||||||||||||||||||||||||
| 321 | # we always represent the processed form of | ||||||||||||||||||||||||||||
| 322 | # the transcript | ||||||||||||||||||||||||||||
| 323 | misc_RNA => ['mature_transcript',"so:0000233"], | ||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||
| 325 | # not sure about this one... | ||||||||||||||||||||||||||||
| 326 | source=>['contig', "SO:0000149"], | ||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||
| 328 | rep_origin=>['origin_of_replication',"SO:0000296"], | ||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||
| 330 | Protein=>['polypeptide',"SO:0000104"], | ||||||||||||||||||||||||||||
| 331 | }; | ||||||||||||||||||||||||||||
| 332 | # return { | ||||||||||||||||||||||||||||
| 333 | #"FT term" => "SO term", | ||||||||||||||||||||||||||||
| 334 | #"-" => "located_sequence_feature", | ||||||||||||||||||||||||||||
| 335 | #"-10_signal" => "minus_10_signal", | ||||||||||||||||||||||||||||
| 336 | #"-35_signal" => "minus_35_signal", | ||||||||||||||||||||||||||||
| 337 | #"3'UTR" => "three_prime_UTR", | ||||||||||||||||||||||||||||
| 338 | #"3'clip" => "three_prime_clip", | ||||||||||||||||||||||||||||
| 339 | #"5'UTR" => "five_prime_UTR", | ||||||||||||||||||||||||||||
| 340 | #"5'clip" => "five_prime_clip", | ||||||||||||||||||||||||||||
| 341 | #"CAAT_signal" => "CAAT_signal", | ||||||||||||||||||||||||||||
| 342 | #"CDS" => "CDS", | ||||||||||||||||||||||||||||
| 343 | #"C_region" => "undefined", | ||||||||||||||||||||||||||||
| 344 | #"D-loop" => "D_loop", | ||||||||||||||||||||||||||||
| 345 | #"D_segment" => "D_gene", | ||||||||||||||||||||||||||||
| 346 | #"GC_signal" => "GC_rich_region", | ||||||||||||||||||||||||||||
| 347 | #"J_segment" => "undefined", | ||||||||||||||||||||||||||||
| 348 | #"LTR" => "long_terminal_repeat", | ||||||||||||||||||||||||||||
| 349 | #"N_region" => "undefined", | ||||||||||||||||||||||||||||
| 350 | #"RBS" => "ribosome_entry_site", | ||||||||||||||||||||||||||||
| 351 | #"STS" => "STS", | ||||||||||||||||||||||||||||
| 352 | #"S_region" => "undefined", | ||||||||||||||||||||||||||||
| 353 | #"TATA_signal" => "TATA_box", | ||||||||||||||||||||||||||||
| 354 | #"V_region" => "undefined", | ||||||||||||||||||||||||||||
| 355 | #"V_segment" => "undefined", | ||||||||||||||||||||||||||||
| 356 | #"attenuator" => "attenuator", | ||||||||||||||||||||||||||||
| 357 | #"conflict" => "undefined", | ||||||||||||||||||||||||||||
| 358 | #"enhancer" => "enhancer", | ||||||||||||||||||||||||||||
| 359 | #"exon" => "exon", | ||||||||||||||||||||||||||||
| 360 | #"gap" => "gap", | ||||||||||||||||||||||||||||
| 361 | #"gene" => "gene", | ||||||||||||||||||||||||||||
| 362 | #"iDNA" => "iDNA", | ||||||||||||||||||||||||||||
| 363 | #"intron" => "intron", | ||||||||||||||||||||||||||||
| 364 | #"mRNA" => "mRNA", | ||||||||||||||||||||||||||||
| 365 | #"mat_peptide" => "mature_protein_region", | ||||||||||||||||||||||||||||
| 366 | #"mature_peptide" => "mature_protein_region", | ||||||||||||||||||||||||||||
| 367 | ## "misc_RNA" => "transcript", | ||||||||||||||||||||||||||||
| 368 | #"misc_binding" => "binding_site", | ||||||||||||||||||||||||||||
| 369 | #"misc_difference" => "sequence_difference", | ||||||||||||||||||||||||||||
| 370 | #"misc_feature" => "region", | ||||||||||||||||||||||||||||
| 371 | #"misc_recomb" => "recombination_feature", | ||||||||||||||||||||||||||||
| 372 | #"misc_signal" => "regulatory_region", | ||||||||||||||||||||||||||||
| 373 | #"misc_structure" => "sequence_secondary_structure", | ||||||||||||||||||||||||||||
| 374 | #"modified_base" => "modified_base_site", | ||||||||||||||||||||||||||||
| 375 | #"old_sequence" => "undefined", | ||||||||||||||||||||||||||||
| 376 | #"operon" => "operon", | ||||||||||||||||||||||||||||
| 377 | #"oriT" => "origin_of_transfer", | ||||||||||||||||||||||||||||
| 378 | #"polyA_signal" => "polyA_signal_sequence", | ||||||||||||||||||||||||||||
| 379 | #"polyA_site" => "polyA_site", | ||||||||||||||||||||||||||||
| 380 | #"precursor_RNA" => "primary_transcript", | ||||||||||||||||||||||||||||
| 381 | #"prim_transcript" => "primary_transcript", | ||||||||||||||||||||||||||||
| 382 | #"primer_bind" => "primer_binding_site", | ||||||||||||||||||||||||||||
| 383 | #"promoter" => "promoter", | ||||||||||||||||||||||||||||
| 384 | #"protein_bind" => "protein_binding_site", | ||||||||||||||||||||||||||||
| 385 | #"rRNA" => "rRNA", | ||||||||||||||||||||||||||||
| 386 | #"repeat_region" => "repeat_region", | ||||||||||||||||||||||||||||
| 387 | #"repeat_unit" => "repeat_unit", | ||||||||||||||||||||||||||||
| 388 | #"satellite" => "satellite_DNA", | ||||||||||||||||||||||||||||
| 389 | #"scRNA" => "scRNA", | ||||||||||||||||||||||||||||
| 390 | #"sig_peptide" => "signal_peptide", | ||||||||||||||||||||||||||||
| 391 | #"snRNA" => "snRNA", | ||||||||||||||||||||||||||||
| 392 | #"snoRNA" => "snoRNA", | ||||||||||||||||||||||||||||
| 393 | ## "source" => "databank_entry", | ||||||||||||||||||||||||||||
| 394 | #"stem_loop" => "stem_loop", | ||||||||||||||||||||||||||||
| 395 | #"tRNA" => "tRNA", | ||||||||||||||||||||||||||||
| 396 | #"terminator" => "terminator", | ||||||||||||||||||||||||||||
| 397 | #"transit_peptide" => "transit_peptide", | ||||||||||||||||||||||||||||
| 398 | #"unsure" => "undefined", | ||||||||||||||||||||||||||||
| 399 | #"variation" => "sequence_variant", | ||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||
| 401 | #"pseudomRNA" => "pseudogenic_transcript", ## has parent = pseudogene ; dgg | ||||||||||||||||||||||||||||
| 402 | #"pseudotranscript" => "pseudogenic_transcript", ## from Unflattener misc_RNA ; dgg | ||||||||||||||||||||||||||||
| 403 | #"pseudoexon" => "pseudogenic_exon", | ||||||||||||||||||||||||||||
| 404 | #"pseudoCDS" => "pseudogenic_exon", | ||||||||||||||||||||||||||||
| 405 | #"pseudomisc_feature" => "pseudogenic_region", | ||||||||||||||||||||||||||||
| 406 | #"pseudointron" => "pseudogenic_region", | ||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||
| 408 | ### "undefined" => "region", | ||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||
| 410 | ## this is the most generic form for RNAs; | ||||||||||||||||||||||||||||
| 411 | ## we always represent the processed form of | ||||||||||||||||||||||||||||
| 412 | ## the transcript | ||||||||||||||||||||||||||||
| 413 | #misc_RNA=>'processed_transcript', | ||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||
| 415 | ## not sure about this one... | ||||||||||||||||||||||||||||
| 416 | #source=>'contig', | ||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||
| 418 | #rep_origin=>'origin_of_replication', | ||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||
| 420 | #Protein=>'protein', | ||||||||||||||||||||||||||||
| 421 | #}; | ||||||||||||||||||||||||||||
| 422 | } | ||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||
| 424 | 0 | ▶ | sub map_types_to_SO{ | ||||||||||||||||||||||||||
|
Subroutine
map_types_to_SO: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 425 | 0 | my ($self,@args) = @_; | |||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||
| 427 | 0 | push(@args, (-type_map=> $self->FT_SO_map() ) ); | |||||||||||||||||||||||||||
| 428 | 0 | return $self->map_types(@args); | |||||||||||||||||||||||||||
| 429 | } | ||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||
| 431 | =head2 get_relationship_type_by_parent_child | ||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||
| 433 | Title : get_relationship_type_by_parent_child | ||||||||||||||||||||||||||||
| 434 | Usage : $type = $tm->get_relationship_type_by_parent_child($parent_sf, $child_sf); | ||||||||||||||||||||||||||||
| 435 | Usage : $type = $tm->get_relationship_type_by_parent_child('mRNA', 'protein'); | ||||||||||||||||||||||||||||
| 436 | Function: given two features where the parent contains the child, | ||||||||||||||||||||||||||||
| 437 | will determine what the relationship between them in | ||||||||||||||||||||||||||||
| 438 | Example : | ||||||||||||||||||||||||||||
| 439 | Returns : | ||||||||||||||||||||||||||||
| 440 | Args : parent SeqFeature, child SeqFeature OR | ||||||||||||||||||||||||||||
| 441 | parent type string, child type string OR | ||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||
| 443 | bioperl Seq::FeatureHolderI hierarchies are equivalent to unlabeled | ||||||||||||||||||||||||||||
| 444 | graphs (where parent nodes are the containers, and child nodes are the | ||||||||||||||||||||||||||||
| 445 | features being contained). For example, a feature of type mRNA can | ||||||||||||||||||||||||||||
| 446 | contain features of type exon. | ||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||
| 448 | Some external representations (eg chadoxml or chaosxml) require that | ||||||||||||||||||||||||||||
| 449 | the edges in the feature relationship graph are labeled. For example, | ||||||||||||||||||||||||||||
| 450 | the type between mRNA and exon would be B<part_of>. Although it | ||||||||||||||||||||||||||||
| 451 | stretches the bioperl notion of containment, we could have a CDS | ||||||||||||||||||||||||||||
| 452 | contained by an mRNA (for example, the | ||||||||||||||||||||||||||||
| 453 | L<Bio::SeqFeature::Tools::Unflattener> module takes genbank records | ||||||||||||||||||||||||||||
| 454 | and makes these kind of links. The relationship here would be | ||||||||||||||||||||||||||||
| 455 | B<produced_by> | ||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||
| 457 | In chado speak, the child is the B<subject> feature and the parent is | ||||||||||||||||||||||||||||
| 458 | the B<object> feature | ||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||
| 460 | =cut | ||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||
| 462 | 0 | ▶ | sub get_relationship_type_by_parent_child { | ||||||||||||||||||||||||||
|
Subroutine
get_relationship_type_by_parent_child: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||
| 463 | 0 | my ($self,$parent,$child) = @_; | |||||||||||||||||||||||||||
| 464 | 0 | ▶ | $parent = ref($parent) ? $parent->primary_tag : $parent; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 465 | 0 | ▶ | $child = ref($child) ? $child->primary_tag : $child; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||
| 467 | 0 | my $type = 'part_of'; # default | |||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||
| 469 | # TODO - do this with metadata, or infer via SO itself | ||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||
| 471 | 0 | ▶ | if (lc($child) eq 'protein') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 472 | 0 | $type = 'derives_from'; | |||||||||||||||||||||||||||
| 473 | } | ||||||||||||||||||||||||||||
| 474 | 0 | ▶ | if (lc($child) eq 'polypeptide') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 475 | 0 | $type = 'derives_from'; | |||||||||||||||||||||||||||
| 476 | } | ||||||||||||||||||||||||||||
| 477 | 0 | return $type; | |||||||||||||||||||||||||||
| 478 | } | ||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||
| 481 | 1 | 1; | |||||||||||||||||||||||||||