| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# |
|
2
|
|
|
|
|
|
|
# BioPerl module for Bio::Seq::SeqFactory |
|
3
|
|
|
|
|
|
|
# |
|
4
|
|
|
|
|
|
|
# Please direct questions and support issues to |
|
5
|
|
|
|
|
|
|
# |
|
6
|
|
|
|
|
|
|
# Cared for by Jason Stajich |
|
7
|
|
|
|
|
|
|
# |
|
8
|
|
|
|
|
|
|
# Copyright Jason Stajich |
|
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::Seq::SeqFactory - Instantiation of generic Bio::PrimarySeqI (or derived) objects through a factory |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
use Bio::Seq::SeqFactory; |
|
21
|
|
|
|
|
|
|
my $factory = Bio::Seq::SeqFactory->new(); |
|
22
|
|
|
|
|
|
|
my $primaryseq = $factory->create( -seq => 'WYRAVLC', |
|
23
|
|
|
|
|
|
|
-id => 'name' ); |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# Create Bio::Seq instead of Bio::PrimarySeq objects: |
|
26
|
|
|
|
|
|
|
my $factory = Bio::Seq::SeqFactory->new( -type => 'Bio::Seq' ); |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
This object will build L and L objects |
|
32
|
|
|
|
|
|
|
generically. |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 FEEDBACK |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head2 Mailing Lists |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
User feedback is an integral part of the evolution of this and other |
|
39
|
|
|
|
|
|
|
Bioperl modules. Send your comments and suggestions preferably to |
|
40
|
|
|
|
|
|
|
the Bioperl mailing list. Your participation is much appreciated. |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
bioperl-l@bioperl.org - General discussion |
|
43
|
|
|
|
|
|
|
http://bioperl.org/wiki/Mailing_lists - About the mailing lists |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head2 Support |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Please direct usage questions or support issues to the mailing list: |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
I |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
rather than to the module maintainer directly. Many experienced and |
|
52
|
|
|
|
|
|
|
reponsive experts will be able look at the problem and quickly |
|
53
|
|
|
|
|
|
|
address it. Please include a thorough description of the problem |
|
54
|
|
|
|
|
|
|
with code and data examples if at all possible. |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head2 Reporting Bugs |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Report bugs to the Bioperl bug tracking system to help us keep track |
|
59
|
|
|
|
|
|
|
of the bugs and their resolution. Bug reports can be submitted via the |
|
60
|
|
|
|
|
|
|
web: |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
https://github.com/bioperl/bioperl-live/issues |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 AUTHOR - Jason Stajich |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Email jason@bioperl.org |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 APPENDIX |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
The rest of the documentation details each of the object methods. |
|
71
|
|
|
|
|
|
|
Internal methods are usually preceded with a _ |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=cut |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
# Let the code begin... |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
package Bio::Seq::SeqFactory; |
|
80
|
165
|
|
|
165
|
|
962
|
use strict; |
|
|
165
|
|
|
|
|
186
|
|
|
|
165
|
|
|
|
|
4220
|
|
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
|
83
|
165
|
|
|
165
|
|
510
|
use base qw(Bio::Root::Root Bio::Factory::SequenceFactoryI); |
|
|
165
|
|
|
|
|
170
|
|
|
|
165
|
|
|
|
|
51121
|
|
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head2 new |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Title : new |
|
88
|
|
|
|
|
|
|
Usage : my $obj = Bio::Seq::SeqFactory->new(); |
|
89
|
|
|
|
|
|
|
Function: Builds a new Bio::Seq::SeqFactory object |
|
90
|
|
|
|
|
|
|
Returns : Bio::Seq::SeqFactory |
|
91
|
|
|
|
|
|
|
Args : -type => string, name of a PrimarySeqI derived class |
|
92
|
|
|
|
|
|
|
This is optional. Default=Bio::PrimarySeq. |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=cut |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub new { |
|
97
|
375
|
|
|
375
|
1
|
855
|
my($class,@args) = @_; |
|
98
|
375
|
|
|
|
|
1177
|
my $self = $class->SUPER::new(@args); |
|
99
|
375
|
|
|
|
|
1412
|
my ($type) = $self->_rearrange([qw(TYPE)], @args); |
|
100
|
375
|
100
|
|
|
|
1071
|
if( ! defined $type ) { |
|
101
|
15
|
|
|
|
|
19
|
$type = 'Bio::PrimarySeq'; |
|
102
|
|
|
|
|
|
|
} |
|
103
|
375
|
|
|
|
|
992
|
$self->type($type); |
|
104
|
375
|
|
|
|
|
1380
|
return $self; |
|
105
|
|
|
|
|
|
|
} |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head2 create |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Title : create |
|
111
|
|
|
|
|
|
|
Usage : my $seq = $seqbuilder->create(-seq => 'CAGT', -id => 'name'); |
|
112
|
|
|
|
|
|
|
Function: Instantiates new Bio::SeqI (or one of its child classes) |
|
113
|
|
|
|
|
|
|
This object allows us to genericize the instantiation of sequence |
|
114
|
|
|
|
|
|
|
objects. |
|
115
|
|
|
|
|
|
|
Returns : Bio::PrimarySeq object (default) |
|
116
|
|
|
|
|
|
|
The return type is configurable using new(-type =>"..."). |
|
117
|
|
|
|
|
|
|
Args : initialization parameters specific to the type of sequence |
|
118
|
|
|
|
|
|
|
object we want. Typically |
|
119
|
|
|
|
|
|
|
-seq => $str, |
|
120
|
|
|
|
|
|
|
-display_id => $name |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=cut |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub create { |
|
125
|
1042
|
|
|
1042
|
1
|
3422
|
my ($self,@args) = @_; |
|
126
|
1042
|
|
|
|
|
2094
|
return $self->type->new(-verbose => $self->verbose, @args); |
|
127
|
|
|
|
|
|
|
} |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head2 type |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Title : type |
|
132
|
|
|
|
|
|
|
Usage : $obj->type($newval) |
|
133
|
|
|
|
|
|
|
Function: |
|
134
|
|
|
|
|
|
|
Returns : value of type |
|
135
|
|
|
|
|
|
|
Args : newvalue (optional) |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=cut |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
sub type { |
|
141
|
1417
|
|
|
1417
|
1
|
1536
|
my ($self, $value) = @_; |
|
142
|
1417
|
100
|
|
|
|
2590
|
if (defined $value) { |
|
143
|
375
|
|
|
|
|
21315
|
eval "require $value"; |
|
144
|
375
|
50
|
|
|
|
1555
|
if( $@ ) { $self->throw("$@: Unrecognized Sequence type for SeqFactory '$value'");} |
|
|
0
|
|
|
|
|
0
|
|
|
145
|
|
|
|
|
|
|
|
|
146
|
375
|
|
|
|
|
838
|
my $a = bless {},$value; |
|
147
|
375
|
50
|
66
|
|
|
2451
|
unless( $a->isa('Bio::PrimarySeqI') || |
|
148
|
|
|
|
|
|
|
$a->isa('Bio::Seq::QualI' ) ) { |
|
149
|
0
|
|
|
|
|
0
|
$self->throw("Must provide a valid Bio::PrimarySeqI or Bio::Seq::QualI or child class to SeqFactory Not $value"); |
|
150
|
|
|
|
|
|
|
} |
|
151
|
375
|
|
|
|
|
1322
|
$self->{'type'} = $value; |
|
152
|
|
|
|
|
|
|
} |
|
153
|
1417
|
|
|
|
|
3993
|
return $self->{'type'}; |
|
154
|
|
|
|
|
|
|
} |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
1; |