Mercurial > repos > mahtabm > ensembl
comparison variant_effect_predictor/Bio/Seq/LargeSeq.pm @ 0:1f6dce3d34e0
Uploaded
| author | mahtabm |
|---|---|
| date | Thu, 11 Apr 2013 02:01:53 -0400 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:1f6dce3d34e0 |
|---|---|
| 1 # $Id: LargeSeq.pm,v 1.11 2002/10/22 07:38:40 lapp Exp $ | |
| 2 # | |
| 3 # BioPerl module for Bio::Seq::LargeSeq | |
| 4 # | |
| 5 # Cared for by Ewan Birney, Jason Stajich | |
| 6 # | |
| 7 # Copyright Ewan Birney, Jason Stajich | |
| 8 # | |
| 9 # You may distribute this module under the same terms as perl itself | |
| 10 | |
| 11 # POD documentation - main docs before the code | |
| 12 | |
| 13 =head1 NAME | |
| 14 | |
| 15 Bio::Seq::LargeSeq - SeqI compliant object that stores sequence as files in /tmp | |
| 16 | |
| 17 =head1 SYNOPSIS | |
| 18 | |
| 19 # normal primary seq usage | |
| 20 | |
| 21 =head1 DESCRIPTION | |
| 22 | |
| 23 This object stores a sequence as a series of files in a temporary | |
| 24 directory. The aim is to allow someone the ability to store very large | |
| 25 sequences (eg, E<gt> 100MBases) in a file system without running out of memory | |
| 26 (eg, on a 64 MB real memory machine!). | |
| 27 | |
| 28 Of course, to actually make use of this functionality, the programs | |
| 29 which use this object B<must> not call $primary_seq-E<gt>seq otherwise the | |
| 30 entire sequence will come out into memory and probably paste your | |
| 31 machine. However, calls $primary_seq-E<gt>subseq(10,100) will cause only | |
| 32 90 characters to be brought into real memory. | |
| 33 | |
| 34 =head1 FEEDBACK | |
| 35 | |
| 36 =head2 Mailing Lists | |
| 37 | |
| 38 User feedback is an integral part of the evolution of this | |
| 39 and other Bioperl modules. Send your comments and suggestions preferably | |
| 40 to one of the Bioperl mailing lists. | |
| 41 Your participation is much appreciated. | |
| 42 | |
| 43 bioperl-l@bioperl.org - General discussion | |
| 44 http://www.bioperl.org/MailList.html - About the mailing lists | |
| 45 | |
| 46 =head2 Reporting Bugs | |
| 47 | |
| 48 Report bugs to the Bioperl bug tracking system to help us keep track | |
| 49 the bugs and their resolution. | |
| 50 Bug reports can be submitted via email or the web: | |
| 51 | |
| 52 bioperl-bugs@bio.perl.org | |
| 53 http://bugzilla.bioperl.org/ | |
| 54 | |
| 55 =head1 AUTHOR - Ewan Birney | |
| 56 | |
| 57 Email birney@ebi.ac.uk | |
| 58 | |
| 59 =head1 APPENDIX | |
| 60 | |
| 61 The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _ | |
| 62 | |
| 63 =cut | |
| 64 | |
| 65 | |
| 66 # Let the code begin... | |
| 67 | |
| 68 | |
| 69 package Bio::Seq::LargeSeq; | |
| 70 use vars qw($AUTOLOAD @ISA); | |
| 71 use strict; | |
| 72 | |
| 73 # Object preamble - inherits from Bio::Root::Objecttest 8, | |
| 74 | |
| 75 use Bio::Seq::LargePrimarySeq; | |
| 76 use Bio::Seq; | |
| 77 | |
| 78 @ISA = qw(Bio::Seq); | |
| 79 | |
| 80 | |
| 81 sub new { | |
| 82 my ($class, @args) = @_; | |
| 83 my $self = $class->SUPER::new(@args); | |
| 84 | |
| 85 my ($pseq) = $self->_rearrange([qw(PRIMARYSEQ)], @args); | |
| 86 | |
| 87 if( ! defined $pseq ) { | |
| 88 $pseq = new Bio::Seq::LargePrimarySeq(@args); | |
| 89 } | |
| 90 $self->primary_seq($pseq); | |
| 91 | |
| 92 return $self; | |
| 93 } | |
| 94 | |
| 95 | |
| 96 =head2 trunc | |
| 97 | |
| 98 Title : trunc | |
| 99 Usage : $subseq = $myseq->trunc(10,100); | |
| 100 Function: Provides a truncation of a sequence, | |
| 101 | |
| 102 Example : | |
| 103 Returns : a fresh Bio::SeqI object | |
| 104 Args : | |
| 105 | |
| 106 =cut | |
| 107 | |
| 108 sub trunc { | |
| 109 my ($self, $s, $e) = @_; | |
| 110 return new Bio::Seq::LargeSeq( | |
| 111 '-display_id' => $self->display_id, | |
| 112 '-accession_number' => $self->accession_number, | |
| 113 '-desc' => $self->desc, | |
| 114 '-alphabet' => $self->alphabet, | |
| 115 -primaryseq => | |
| 116 $self->primary_seq->trunc($s,$e)); | |
| 117 | |
| 118 } | |
| 119 | |
| 120 =head2 Bio::Seq::LargePrimarySeq methods | |
| 121 | |
| 122 =cut | |
| 123 | |
| 124 =head2 add_sequence_as_string | |
| 125 | |
| 126 Title : add_sequence_as_string | |
| 127 Usage : $seq->add_sequence_as_string("CATGAT"); | |
| 128 Function: Appends additional residues to an existing LargePrimarySeq object. | |
| 129 This allows one to build up a large sequence without storing | |
| 130 entire object in memory. | |
| 131 Returns : Current length of sequence | |
| 132 Args : string to append | |
| 133 | |
| 134 =cut | |
| 135 | |
| 136 sub add_sequence_as_string { | |
| 137 my ($self,$str) = @_; | |
| 138 return $self->primary_seq->add_sequence_as_string($str); | |
| 139 } | |
| 140 | |
| 141 1; |
