| 1 | # | ||||||||||
| 2 | # BioPerl module for Bio::Seq::LargeSeq | ||||||||||
| 3 | # | ||||||||||
| 4 | # Please direct questions and support issues to <bioperl-l@bioperl.org> | ||||||||||
| 5 | # | ||||||||||
| 6 | # Cared for by Ewan Birney, Jason Stajich | ||||||||||
| 7 | # | ||||||||||
| 8 | # Copyright Ewan Birney, 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::LargeSeq - SeqI compliant object that stores sequence as | ||||||||||
| 17 | files in /tmp | ||||||||||
| 18 | |||||||||||
| 19 | =head1 SYNOPSIS | ||||||||||
| 20 | |||||||||||
| 21 | # normal primary seq usage | ||||||||||
| 22 | |||||||||||
| 23 | =head1 DESCRIPTION | ||||||||||
| 24 | |||||||||||
| 25 | This object stores a sequence as a series of files in a temporary | ||||||||||
| 26 | directory. The aim is to allow someone the ability to store very large | ||||||||||
| 27 | sequences (eg, E<gt> 100MBases) in a file system without running out | ||||||||||
| 28 | of memory (eg, on a 64 MB real memory machine!). | ||||||||||
| 29 | |||||||||||
| 30 | Of course, to actually make use of this functionality, the programs | ||||||||||
| 31 | which use this object B<must> not call $primary_seq-E<gt>seq otherwise | ||||||||||
| 32 | the entire sequence will come out into memory and probably paste your | ||||||||||
| 33 | machine. However, calls $primary_seq-E<gt>subseq(10,100) will cause | ||||||||||
| 34 | only 90 characters to be brought into real memory. | ||||||||||
| 35 | |||||||||||
| 36 | =head1 FEEDBACK | ||||||||||
| 37 | |||||||||||
| 38 | =head2 Mailing Lists | ||||||||||
| 39 | |||||||||||
| 40 | User feedback is an integral part of the evolution of this and other | ||||||||||
| 41 | Bioperl modules. Send your comments and suggestions preferably to one | ||||||||||
| 42 | of the Bioperl mailing lists. Your participation is much appreciated. | ||||||||||
| 43 | |||||||||||
| 44 | bioperl-l@bioperl.org - General discussion | ||||||||||
| 45 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists | ||||||||||
| 46 | |||||||||||
| 47 | =head2 Support | ||||||||||
| 48 | |||||||||||
| 49 | Please direct usage questions or support issues to the mailing list: | ||||||||||
| 50 | |||||||||||
| 51 | I<bioperl-l@bioperl.org> | ||||||||||
| 52 | |||||||||||
| 53 | rather than to the module maintainer directly. Many experienced and | ||||||||||
| 54 | reponsive experts will be able look at the problem and quickly | ||||||||||
| 55 | address it. Please include a thorough description of the problem | ||||||||||
| 56 | with code and data examples if at all possible. | ||||||||||
| 57 | |||||||||||
| 58 | =head2 Reporting Bugs | ||||||||||
| 59 | |||||||||||
| 60 | Report bugs to the Bioperl bug tracking system to help us keep track | ||||||||||
| 61 | the bugs and their resolution. Bug reports can be submitted via the | ||||||||||
| 62 | web: | ||||||||||
| 63 | |||||||||||
| 64 | https://github.com/bioperl/bioperl-live/issues | ||||||||||
| 65 | |||||||||||
| 66 | =head1 AUTHOR - Ewan Birney | ||||||||||
| 67 | |||||||||||
| 68 | Email birney@ebi.ac.uk | ||||||||||
| 69 | |||||||||||
| 70 | =head1 APPENDIX | ||||||||||
| 71 | |||||||||||
| 72 | The rest of the documentation details each of the object | ||||||||||
| 73 | methods. Internal methods are usually preceded with a _ | ||||||||||
| 74 | |||||||||||
| 75 | =cut | ||||||||||
| 76 | |||||||||||
| 77 | |||||||||||
| 78 | # Let the code begin... | ||||||||||
| 79 | |||||||||||
| 80 | |||||||||||
| 81 | package Bio::Seq::LargeSeq; | ||||||||||
| 82 | 2 | $Bio::Seq::LargeSeq::VERSION = '1.7.8'; | |||||||||
| 83 | 2 | ▶ | use vars qw($AUTOLOAD); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 84 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 85 | |||||||||||
| 86 | # Object preamble | ||||||||||
| 87 | |||||||||||
| 88 | 2 | ▶ | use Bio::Seq::LargePrimarySeq; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 89 | |||||||||||
| 90 | 2 | ▶ | use base qw(Bio::Seq Bio::Seq::LargeSeqI); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 91 | |||||||||||
| 92 | |||||||||||
| 93 | 8 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 94 | 8 | my ($class, @args) = @_; | |||||||||
| 95 | 8 | my $self = $class->SUPER::new(@args); | |||||||||
| 96 | |||||||||||
| 97 | 8 | my ($pseq) = $self->_rearrange([qw(PRIMARYSEQ)], @args); | |||||||||
| 98 | |||||||||||
| 99 | 8 | ▶ | if( ! defined $pseq ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 100 | 3 | $pseq = Bio::Seq::LargePrimarySeq->new(@args); | |||||||||
| 101 | } | ||||||||||
| 102 | 8 | $self->primary_seq($pseq); | |||||||||
| 103 | |||||||||||
| 104 | 8 | return $self; | |||||||||
| 105 | } | ||||||||||
| 106 | |||||||||||
| 107 | |||||||||||
| 108 | =head2 trunc | ||||||||||
| 109 | |||||||||||
| 110 | Title : trunc | ||||||||||
| 111 | Usage : $subseq = $myseq->trunc(10,100); | ||||||||||
| 112 | Function: Provides a truncation of a sequence, | ||||||||||
| 113 | |||||||||||
| 114 | Example : | ||||||||||
| 115 | Returns : a fresh Bio::SeqI object | ||||||||||
| 116 | Args : | ||||||||||
| 117 | |||||||||||
| 118 | =cut | ||||||||||
| 119 | |||||||||||
| 120 | 4 | ▶ | sub trunc { | ||||||||
|
Subroutine
trunc: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 121 | 4 | my ($self, $s, $e) = @_; | |||||||||
| 122 | 4 | return new Bio::Seq::LargeSeq | |||||||||
| 123 | ('-display_id' => $self->display_id, | ||||||||||
| 124 | '-accession_number' => $self->accession_number, | ||||||||||
| 125 | '-desc' => $self->desc, | ||||||||||
| 126 | '-alphabet' => $self->alphabet, | ||||||||||
| 127 | -primaryseq => $self->primary_seq->trunc($s,$e)); | ||||||||||
| 128 | } | ||||||||||
| 129 | |||||||||||
| 130 | =head2 Bio::Seq::LargePrimarySeq methods | ||||||||||
| 131 | |||||||||||
| 132 | =cut | ||||||||||
| 133 | |||||||||||
| 134 | =head2 add_sequence_as_string | ||||||||||
| 135 | |||||||||||
| 136 | Title : add_sequence_as_string | ||||||||||
| 137 | Usage : $seq->add_sequence_as_string("CATGAT"); | ||||||||||
| 138 | Function: Appends additional residues to an existing LargePrimarySeq object. | ||||||||||
| 139 | This allows one to build up a large sequence without storing | ||||||||||
| 140 | entire object in memory. | ||||||||||
| 141 | Returns : Current length of sequence | ||||||||||
| 142 | Args : string to append | ||||||||||
| 143 | |||||||||||
| 144 | =cut | ||||||||||
| 145 | |||||||||||
| 146 | 0 | ▶ | sub add_sequence_as_string { | ||||||||
|
Subroutine
add_sequence_as_string: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 147 | 0 | my ($self,$str) = @_; | |||||||||
| 148 | 0 | return $self->primary_seq->add_sequence_as_string($str); | |||||||||
| 149 | } | ||||||||||
| 150 | |||||||||||
| 151 | 2 | 1; | |||||||||