This package was developed to load the phrap.out files from the
(phred/phrap/consed) package by Phill Green. This files contain just
the messages printed to standard out by phrap when building an
assembly. This output is redirected by phredPhrap perl-script to a
file in the project's directory and hold some bit of information
regarding assembly quality, connections between contigs and clone's
position inside contigs. It should be noted that such files have no
data about the sequence. neither for contig consensus nor for any
aligned sequence. Anyway, such information may be loaded from Fasta
files in the projects directory and added to the assembly object
later.
Note that, because no sequence is loaded for the contig consensus and
locations for aligned sequences are only given in "ungapped consensus"
coordinates in a phrap.out file, you can't make coordinate changes in
assemblies loaded by pharp.pm, unless you add an aligned
coordinates for each sequence to each contig's features collection
yourself. See
Bio::Assembly::Contig::Coordinate_Systems and
Bio::Assembly::Contig::Feature_collection..
This driver also loads singlets into the assembly contigs as Bio::Seq
objects, altough without their sequence strings. It also adds a
feature for the entire sequence, thus storing the singlet length in
its end position, and adds a tag '_nof_trimmed_nonX' to the feature,
which stores the number of non-vector bases in the singlet.
Assemblies are loaded into Bio::Assembly::Scaffold objects composed by
Bio::Assembly::Contig objects. No features are added to Bio::Assembly::Contig
"_aligned_coord:$seqID" feature class, therefore you can't make
coordinate changes in contigs loaded by this module. Contig objects
created by this module will have the following special feature
classes, identified by their primary tags, in their features
collection:
"_main_contig_feature:$ID" : main feature for contig $ID. This
feature is used to store information
about the entire consensus
sequence. This feature always start at
base 1 and its end position is the
consensus sequence length. A tag,
'trimmed_length' holds the length of the
trimmed good quality region inside the
consensus sequence.
"_covered_region:$index" : coordinates for valid clones inside the
contig. $index is the covered region
number, starting at 1 for the covered
region closest to the consensus sequence
first base.
"_unalign_coord:$seqID" : location of a sequence in "ungapped
consensus" coordinates (consensus
sequence without gaps). Primary and
secondary scores, indel and
substitutions statistics are stored as
feature tags.
"_internal_clones:$cloneID" : clones inside contigs $cloneID should be
used as the unique id for each
clone. These features have six tags:
'_1st_name', which is the id of the
upstream (5') aligned sequence
delimiting the clone; '_1st_strand', the
upstream sequence strand in the
alignment; '_2nd_name', downstream (3')
sequence id; '_2nd_strand', the
downstream sequence strand in the
alignment; '_length', unaligned clone
length; '_rejected', a boolean flag,
which is false if the clone is valid and
true if it was rejected.
All coordinates for the features above are expressed as "ungapped
consensus" coordinates (See
Bio::Assembly::Contig::Coordinate_Systems..
#
sub next_assembly
{ my $self = shift;
my $Assembly = Bio::Assembly::Scaffold->new(-source=>'phrap');
my ($contigOBJ);
while ($_ = $self->_readline) {
chomp;
/^(\d+) isolated singletons/ && do {
while ($_ = $self->_readline) {
chomp;
last if (/^$/);
if (/^\s+(\S+)\s+(\d+)\s+\((\d+)\)/) {
my $seqID = $1; my $length = $2;
my $nof_trimmed_nonX = $3;
my $seq = new Bio::Seq(-strand=>1,
-primary_id=>$seqID);
my $f = Bio::SeqFeature::Generic->new
(-start=>1, -end=>$seq->length(),
-primary=>$seq->primary_id(),
-tag=>{ '_nof_trimmed_nonX' => $nof_trimmed_nonX }
);
$seq->add_SeqFeature($f);
$Assembly->add_singlet($seq);
}
}
};
/^Contig (\d+)\.\s+(\d+) reads?; (\d+) bp \(untrimmed\), (\d+) \(trimmed\)\./ && do {
my $nof_reads = $2; my $length = $3; my $trimmed_length = $4;
$contigOBJ = Bio::Assembly::Contig->new(-id=>$1, -source=>'phrap');
my $feat = Bio::SeqFeature::Generic->new(-start=>1,
-end=>$length,
-primary=>"_main_contig_feature:".$contigOBJ->id(),
-tag=>{ '_trimmed_length' => $trimmed_length }
);
$contigOBJ->add_features([ $feat ],1);
$Assembly->add_contig($contigOBJ);
};
/^(C?)\s+(-?\d+)\s+(\d+)\s+(\S+)\s+(\d+)\s+\(\s*(\d+)\)\s+(\d+\.\d*)\s+(\d+\.\d*)\s+(\d+\.\d*)/ && do {
my $strand = ($1 eq 'C' ? -1 : 1);
my $readID = $4; my $start = $2; my $end = $3;
my $primary_score = $5; my $secondary_score = $6;
my $substitutions = $7; my $deletions = $8; my $insertions = $9;
my $seq = Bio::LocatableSeq->new(-start=>$start,
-end=>$end,
-strand=>$strand,
-id=>$readID,
-primary_id=>$readID,
-alphabet=>'dna');
my $unalign_coord = Bio::SeqFeature::Generic->new(-start=>$start,
-end=>$end,
-primary=>"_unalign_coord:$readID",
-tag=>{'_primary_score'=>$primary_score,
'_secondary_score'=>$secondary_score,
'_substitutions'=>$substitutions,
'_insertions'=>,$insertions,
'_deletions'=>$deletions }
);
$unalign_coord->attach_seq($seq);
$contigOBJ->add_seq($seq); $contigOBJ->add_features([ $unalign_coord ]);
};
/INTERNAL\s+Contig\s+(\d+)\s+opp\s+sense/ && do {
my $contigID = $1;
my $contig = $Assembly->get_contig_by_id($contigID);
while ($_ = $self->_readline) {
my (@data,$rejected,$c1_strand,$c2_strand);
(@data = /\s+(\*?)\s+(C?)\s+(\S+)\s+(C?)\s+(\S+)\s+(-?\d+)\s+(-?\d+)\s+(-?\d+)/) && do {
if ($data[0] eq '*') { $rejected = 1 } else { $rejected = 0 }
$c1_strand = ($data[1] eq 'C' ? -1 : 1);
$c2_strand = ($data[3] eq 'C' ? -1 : 1);
(my $clone_name = $data[2]) =~ s/^(\S+)\.\w.*/$1/;
my $clone = Bio::SeqFeature::Generic->new(-start=>$data[6],
-end=>$data[7],
-strand=>0,
-primary=>"_internal_clone:$clone_name",
-tag=>{'_1st_strand'=>,$c1_strand,
'_2nd_strand'=>,$c2_strand,
'_1st_name'=>$data[2],
'_2nd_name'=>$data[4],
'_length'=>$data[5],
'_rejected'=>$rejected
}
);
$contig->add_features([ $clone ]);
};
/Covered regions:/ && do {
my %coord = /(\d+)/g; my $i = 0;
foreach my $start (sort { $a <=> $b } keys %coord) {
my $cov = Bio::SeqFeature::Generic->new(-start=>$start,
-end=>$coord{$start},
-primary=>'_covered_region:'.++$i
);
$contig->add_features([ $cov ],1);
}
last; };
} };
} return $Assembly; } |