Module:Bio::Assembly::IO
From BioPerl
| Pdoc documentation: Bio::Assembly::IO | CPAN documentation: Bio::Assembly::IO |
|---|
The new method returns a A Bio::Assembly::IO handler initialised with the appropriate format. The next_assembly method on the handler returns a Bio::Assembly::ScaffoldI compliant object (typically just a Bio::Assembly::Scaffold).
The assembly formats currently supported are:
Example usage
The demonstration script below can be viewed in overview like this:
- The ACE file (raw assembly input data) ->
- Bio::Assembly::IO (internal representation of the assembly data) ->
- Bio::Assembly::Scaffold (a representation of a scaffold in the assembly) ->
- Bio::Assembly::Contig (a representation of a contig in the scaffold) ->
- Bio::LocatableSeq (a representation of a read in the contig)
- Bio::SeqFeature::Generic (more data associated with the read)
- Bio::Assembly::Contig (a representation of a contig in the scaffold) ->
- Bio::Assembly::Scaffold (a representation of a scaffold in the assembly) ->
- Bio::Assembly::IO (internal representation of the assembly data) ->
#!/usr/bin/perl -w use Bio::Assembly::IO; ## Get an 'Assembly IO' object my $assemIO = Bio::Assembly::IO-> new( -file => 'my.assembly.ace', -format => 'ACE'); ## Get the individual Assembly objects from the file ## (via the Assembly IO object) while(my $assem = $assemIO->next_assembly){ ## $assem is a Bio::Assembly::ScaffoldI compliant object #print "$assem\n"; print "there are ", $assem->get_nof_contigs, " contigs in this assembly\n"; foreach my $contig ($assem->all_contigs){ ## $contig is a Bio::Assembly::Contig #print "\t$contig\n"; print "\tthere are ", $contig->no_sequences, " sequences in this contig\n"; foreach my $seq ($contig->each_seq){ ## $seq is a Bio::LocatableSeq object #print "\t\t$seq\n"; ## Get the "gapped consensus" location for aligned sequence my $feature = $contig->get_seq_coord( $seq ); ## $feature is a Bio::SeqFeature::Generic ## I'd really like to print the aligned region, not the whole ## sequence region! print join("\t", $seq->id, $seq->strand, $seq->start, $seq->end, $feature->start, $feature->end, ), "\n"; } } } warn "OK\n";