~ubuntu-branches/ubuntu/raring/bioperl/raring

« back to all changes in this revision

Viewing changes to Bio/Assembly/Scaffold.pm

  • Committer: Bazaar Package Importer
  • Author(s): Charles Plessy
  • Date: 2008-03-18 14:44:57 UTC
  • mfrom: (4 hardy)
  • mto: This revision was merged to the branch mainline in revision 6.
  • Revision ID: james.westby@ubuntu.com-20080318144457-1jjoztrvqwf0gruk
* debian/control:
  - Removed MIA Matt Hope (dopey) from the Uploaders field.
    Thank you for your work, Matt. I hope you are doing well.
  - Downgraded some recommended package to the 'Suggests' priority,
    according to the following discussion on Upstream's mail list.
    http://bioperl.org/pipermail/bioperl-l/2008-March/027379.html
    (Closes: #448890)
* debian/copyright converted to machine-readable format.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# $Id: Scaffold.pm,v 1.3 2003/06/04 08:36:36 heikki Exp $
 
1
# $Id: Scaffold.pm,v 1.12.4.1 2006/10/02 23:10:12 sendu Exp $
2
2
#
3
3
#  BioPerl module for Bio::Assembly::Scaffold
4
4
#
12
12
 
13
13
Bio::Assembly::Scaffold - Perl module to hold and manipulate sequence assembly data.
14
14
 
15
 
=head1 SYNOPSYS
 
15
=head1 SYNOPSIS
16
16
 
17
17
    # Module loading
18
18
    use Bio::Assembly::IO;
40
40
Bioperl modules. Send your comments and suggestions preferably to the
41
41
Bioperl mailing lists  Your participation is much appreciated.
42
42
 
43
 
  bioperl-l@bioperl.org                 - General discussion
44
 
  http://bio.perl.org/MailList.html     - About the mailing lists
 
43
  bioperl-l@bioperl.org                  - General discussion
 
44
  http://bioperl.org/wiki/Mailing_lists  - About the mailing lists
45
45
 
46
46
=head2 Reporting Bugs
47
47
 
48
48
Report bugs to the Bioperl bug tracking system to help us keep track
49
 
the bugs and their resolution.  Bug reports can be submitted via email
50
 
or the web:
 
49
the bugs and their resolution.  Bug reports can be submitted via the
 
50
web:
51
51
 
52
 
  bioperl-bugs@bio.perl.org
53
 
  http://bugzilla.bioperl.org/
 
52
  http://bugzilla.open-bio.org/
54
53
 
55
54
=head1 AUTHOR - Robson Francisco de Souza
56
55
 
66
65
package Bio::Assembly::Scaffold;
67
66
 
68
67
use strict;
69
 
use vars qw(@ISA);
70
68
 
71
 
use Bio::Root::Root;
72
 
use Bio::Assembly::ScaffoldI;
73
69
use Bio::Annotation::Collection;
74
70
 
75
 
@ISA = qw(Bio::Root::Root Bio::Assembly::ScaffoldI);
 
71
use base qw(Bio::Root::Root Bio::Assembly::ScaffoldI);
76
72
 
77
73
=head2 new ()
78
74
 
166
162
 
167
163
sub get_nof_contigs {
168
164
    my $self = shift;
169
 
 
170
165
    return scalar( $self->get_contig_ids() );
171
166
}
172
167
 
248
243
sub get_contig_ids {
249
244
    my $self = shift;
250
245
 
251
 
    return sort keys %{$self->{'_contigs'}};
 
246
    return wantarray
 
247
        ? sort keys %{$self->{'_contigs'}}
 
248
        : scalar keys %{$self->{'_contigs'}};
252
249
}
253
250
 
254
251
=head2 get_singlet_ids
265
262
sub get_singlet_ids {
266
263
    my $self = shift;
267
264
 
268
 
    return sort keys %{$self->{'_singlets'}};
 
265
    return wantarray
 
266
        ? sort keys %{$self->{'_singlets'}}
 
267
        : scalar keys %{$self->{'_singlets'}};
269
268
}
270
269
 
271
270
=head2 get_seq_by_id
289
288
    my $self = shift;
290
289
    my $seqID = shift;
291
290
 
292
 
    return undef unless (exists $self->{'_seqs'}{$seqID});
 
291
    return unless (exists $self->{'_seqs'}{$seqID});
293
292
 
294
293
    return $self->{'_seqs'}{$seqID}->get_seq_by_name($seqID);
295
294
}
308
307
    my $self = shift;
309
308
    my $contigID = shift;
310
309
 
311
 
    return undef unless (exists $self->{'_contigs'}{$contigID});
 
310
    return unless (exists $self->{'_contigs'}{$contigID});
312
311
 
313
312
    return $self->{'_contigs'}{$contigID};
314
313
}
328
327
 
329
328
    my $singletID = shift;
330
329
 
331
 
    return undef unless (exists $self->{'_singlets'}{$singletID});
 
330
    return unless (exists $self->{'_singlets'}{$singletID});
332
331
 
333
332
    return $self->{'_singlets'}{$singletID};
334
333
}
353
352
    my $contig = shift;
354
353
 
355
354
    if( !ref $contig || ! $contig->isa('Bio::Assembly::Contig') ) {
356
 
        $self->throw("Unable to process non Bio::Assembly::Contig object [", ref($contig), "]");
 
355
        $self->throw("Scaffold::add_contig is unable to process non Bio::Assembly::Contig object [", ref($contig), "]");
357
356
    }
358
357
    my $contigID  = $contig->id();
359
358
    if( !defined $contigID ) {
390
389
=cut
391
390
 
392
391
sub add_singlet {
393
 
    my $self = shift;
394
 
    my $singlet = shift;
 
392
    my ($self,$singlet) = @_;
395
393
 
396
 
    if( !ref $singlet || ! $singlet->isa('Bio::PrimarySeqI') ) {
397
 
        $self->warn("Unable to process non Bio::SeqI object [", ref($singlet), "]");
 
394
    if ( !ref $singlet || ! $singlet->isa('Bio::Assembly::Singlet') ) {
 
395
        $self->warn("Scaffold::add_singlet is unable to add a singlet ($singlet) because it was not a Bio::Assembly::Singlet object.");
398
396
        return 0;
399
397
    }
400
 
 
401
398
    my $singletID = $singlet->id();
402
399
    $self->warn("Replacing singlet $singletID wih a new sequence object")
403
400
        if (exists $self->{'_contigs'}{$singletID});