BioPerl
view release on metacpan or search on metacpan
Bio/Assembly/IO/maq.pm view on Meta::CPAN
my $readobj = Bio::LocatableSeq->new(
-display_id => $$readinfo{'read_name'},
-primary_id => $$readinfo{'read_name'},
-seq => $$readinfo{'seqstr'},
-start => 1,
-strand => $$readinfo{'strand'},
-alphabet => 'dna'
);
# Add read location and sequence to contig (in 'gapped consensus' coordinates)
$$readinfo{'aln_start'} = $$readinfo{'posn'};
$$readinfo{'aln_end'} = $$readinfo{'posn'} + length($$readinfo{'seqstr'})-1;
my $alncoord = Bio::SeqFeature::Generic->new(
-primary => $readobj->id,
-start => $$readinfo{'aln_start'},
-end => $$readinfo{'aln_end'},
-strand => $$readinfo{'strand'},
-qual => join(' ', $$readinfo{seq}->qual),
# check here, need to create contigs "by hand"...
-tag => { 'contig' => $contigobj->id() }
);
$contigobj->set_seq_coord($alncoord, $readobj);
# Add other misc read information as subsequence feature
my @other = grep !/aln_(?:end|start)|seq(?:str)?|strand/, keys %$readinfo;
my %other;
@other{@other} = @$readinfo{@other};
my $readtags = Bio::SeqFeature::Generic->new(
-primary => '_main_read_feature',
-source => $readobj->id,
-start => $$readinfo{'aln_start'},
-end => $$readinfo{'aln_end'},
-strand => $$readinfo{'strand'},
# dumping ground:
-tag => \%other
);
$contigobj->get_features_collection->add_features([$readtags]);
$contigobj->get_features_collection->add_SeqFeature($alncoord, $readtags);
return $readobj;
}
#### revamp for maq
=head2 _store_singlet()
Title : _store_singlet
Usage : my $singletobj = $self->_store_read(\%readinfo, \%contiginfo);
Function: store information of a singlet belonging to a scaffold in a singlet object
Returns : Bio::Assembly::Singlet
Args : hash, hash
=cut
sub _store_singlet {
my ($self, $contiginfo, $contigobj) = @_;
my $contigid = $$contiginfo{'asmbl_id'};
my $seqref = ($contigobj->each_seq())[0];
my $singletobj = Bio::Assembly::Singlet->new( -id => $contigid,
-seqref => $seqref );
# Add other misc contig information as features of the contig
# Add other misc read information as subsequence feature
#my @other = grep !/_sfc|_assembly|_elem/, keys %$contiginfo; # remove the objects; _elem contains a code ref and can't be frozen. Just shooting blind here.
#my %other;
#@other{@other} = @$contiginfo{@other};
#my $contigtags = Bio::SeqFeature::Generic->new(
# -primary => '_main_contig_feature',
# -source => $$contiginfo{asmbl_id},
# -start => 1,
# -end => $singletobj->get_consensus_length(),
# -strand => 1,
# # dumping ground:
# -tag => \%other
#);
#$singletobj->add_features([ $contigtags ], 1);
#$$readinfo{'aln_start'} = $$readinfo{'start'};
#$$readinfo{'aln_end'} = $$readinfo{'end'};
#$$readinfo{'strand'} = ($$readinfo{strand} eq '+' ? 1 : -1);
#my $alncoord = Bio::SeqFeature::Generic->new(
# -primary => '_aligned_coord',
# -source => $$readinfo{read_name},
# -start => $$readinfo{'start'},
# -end => $$readinfo{'end'},
# -strand => $$readinfo{'strand'},
# -tag => { 'contig' => $$contiginfo{asmbl_id} }
# );
#$alncoord->attach_seq($singletobj->seqref);
#$singletobj->add_features([ $alncoord ], 0);
# Add other misc read information as subsequence feature
#my @other = grep !/seqstr|strand/, keys %$readinfo;
#my %other;
#@other{@other} = @$readinfo{@other};
#my $readtags = Bio::SeqFeature::Generic->new(
# -primary => '_main_read_feature',
# -source => $$readinfo{read_name},
# -start => $$readinfo{'aln_start'},
# -end => $$readinfo{'aln_end'},
# -strand => $$readinfo{'strand'},
# # dumping ground:
# -tag => \%other
# );
#$singletobj->get_features_collection->add_features([$readtags]);
#$singletobj->get_features_collection->add_SeqFeature($alncoord, $readtags);
return $singletobj;
}
###### writes -- need them??
=head2 write_assembly()
Title : write_assembly
Usage :
Function: not currently available for maq assemblies
Returns : throw
Args :
( run in 1.367 second using v1.01-cache-2.11-cpan-97f6503c9c8 )