[bug 3148] switch default to "expasy" until we can work out REST service interface
[bioperl-live.git] / Bio / Seq / LargeSeq.pm
bloba244a673c41055992a15bd91e1671b27c5a045dc
2 # BioPerl module for Bio::Seq::LargeSeq
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
6 # Cared for by Ewan Birney, Jason Stajich
8 # Copyright Ewan Birney, Jason Stajich
10 # You may distribute this module under the same terms as perl itself
12 # POD documentation - main docs before the code
14 =head1 NAME
16 Bio::Seq::LargeSeq - SeqI compliant object that stores sequence as
17 files in /tmp
19 =head1 SYNOPSIS
21 # normal primary seq usage
23 =head1 DESCRIPTION
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!).
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.
36 =head1 FEEDBACK
38 =head2 Mailing Lists
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.
44 bioperl-l@bioperl.org - General discussion
45 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
47 =head2 Support
49 Please direct usage questions or support issues to the mailing list:
51 I<bioperl-l@bioperl.org>
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.
58 =head2 Reporting Bugs
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:
64 http://bugzilla.open-bio.org/
66 =head1 AUTHOR - Ewan Birney
68 Email birney@ebi.ac.uk
70 =head1 APPENDIX
72 The rest of the documentation details each of the object
73 methods. Internal methods are usually preceded with a _
75 =cut
78 # Let the code begin...
81 package Bio::Seq::LargeSeq;
82 use vars qw($AUTOLOAD);
83 use strict;
85 # Object preamble
87 use Bio::Seq::LargePrimarySeq;
89 use base qw(Bio::Seq Bio::Seq::LargeSeqI);
92 sub new {
93 my ($class, @args) = @_;
94 my $self = $class->SUPER::new(@args);
96 my ($pseq) = $self->_rearrange([qw(PRIMARYSEQ)], @args);
98 if( ! defined $pseq ) {
99 $pseq = Bio::Seq::LargePrimarySeq->new(@args);
101 $self->primary_seq($pseq);
103 return $self;
107 =head2 trunc
109 Title : trunc
110 Usage : $subseq = $myseq->trunc(10,100);
111 Function: Provides a truncation of a sequence,
113 Example :
114 Returns : a fresh Bio::SeqI object
115 Args :
117 =cut
119 sub trunc {
120 my ($self, $s, $e) = @_;
121 return new Bio::Seq::LargeSeq
122 ('-display_id' => $self->display_id,
123 '-accession_number' => $self->accession_number,
124 '-desc' => $self->desc,
125 '-alphabet' => $self->alphabet,
126 -primaryseq => $self->primary_seq->trunc($s,$e));
129 =head2 Bio::Seq::LargePrimarySeq methods
131 =cut
133 =head2 add_sequence_as_string
135 Title : add_sequence_as_string
136 Usage : $seq->add_sequence_as_string("CATGAT");
137 Function: Appends additional residues to an existing LargePrimarySeq object.
138 This allows one to build up a large sequence without storing
139 entire object in memory.
140 Returns : Current length of sequence
141 Args : string to append
143 =cut
145 sub add_sequence_as_string {
146 my ($self,$str) = @_;
147 return $self->primary_seq->add_sequence_as_string($str);