Bio::AlignIO
meme
Toolbar
Summary
Bio::AlignIO::meme - meme sequence input/output stream
Package variables
Privates (from "my" definitions)
$MEME_VERS_ERR = "MEME output file must be generated by version 3.0 or higher"
$MEME_NO_HEADER_ERR = "MEME output file contains no header line (ex: MEME version 3.0)"
$HTML_VERS_ERR = "MEME output file must be generated with the -text option"
Included modules
Inherit
Synopsis
Do not use this module directly. Use it via the Bio::AlignIO class.
use Bio::AlignIO;
# read in an alignment from meme
my $in = Bio::AlignIO->new(-format => 'meme',
-file => 'meme.out');
while( my $aln = $in->next_aln ) {
# do something with the alignment
}
Description
This object transforms the "sites sorted by position p-value" sections
of a meme (text) output file into a series of Bio::SimpleAlign
objects. Each SimpleAlign object contains Bio::LocatableSeq
objects which represent the individual aligned sites as defined by
the central portion of the "site" field in the meme file. The start
and end coordinates are derived from the "Start" field. See
Bio::SimpleAlign and
Bio::LocatableSeq for more information.
This module can only parse MEME version 3.0 and greater. Previous
versions have output formats that are more difficult to parse
correctly. If the meme output file is not version 3.0 or greater,
we signal an error.
Methods
Methods description
Title : next_aln Usage : $aln = $stream->next_aln() Function: returns the next alignment in the stream Returns : Bio::SimpleAlign object with the score() set to the evalue of the motif. Args : NONE |
Title : write_aln Usage : $stream->write_aln(@aln) Function: Not implemented Returns : 1 for success and 0 for error Args : Bio::SimpleAlign object |
Methods code
sub next_aln
{ my ($self) = @_;
my $aln = Bio::SimpleAlign->new(-source => 'meme');
my $line;
my $good_align_sec = 0;
my $in_align_sec = 0;
my $evalue;
while (!$good_align_sec && defined($line = $self->_readline())) {
if (!$in_align_sec) {
if ($line =~ /^\s*MEME\s+version\s+(\S+)/ ){
$self->{'meme_vers'} = $1;
my ($vers) = $self->{'meme_vers'} =~ /^(\d)/;
$self->throw($MEME_VERS_ERR) unless ($vers >= 3);
$self->{'seen_header'} = 1;
}
if ($line =~ /\<TITLE\>/i){
$self->throw($HTML_VERS_ERR);
}
if ($line =~ /MOTIF\s+\d+\s+width.+E-value = (\S+)/) {
$self->throw($MEME_NO_HEADER_ERR) unless ($self->{'seen_header'});
$evalue = $1;
}
if ($line =~ /sites sorted by position/) {
$self->throw($MEME_NO_HEADER_ERR) unless ($self->{'seen_header'});
$in_align_sec = 1;
}
} elsif ($line =~ /^(\S+)\s+([+-]?)\s+(\d+)\s+ (\S+)\s+([.ACTGNX\-]*)\s+([ACTGNX\-]+)\s+ ([.ACTGNX\-]*)/xi ) {
my $seq_name = $1;
my $strand = ($2 eq '-') ? -1 : 1;
my $start_pos = $3;
my $central = uc($6);
my $end_pos = $start_pos + length($central) - 1;
my $seq = Bio::LocatableSeq->new
('-seq' => $central,
'-display_id' => $seq_name,
'-start' => $start_pos,
'-end' => $end_pos,
'-strand' => $strand,
'-alphabet' => $self->alphabet,
);
$aln->add_seq($seq);
} elsif (($line =~ /^\-/) || ($line =~ /Sequence name/)){
} elsif ($line =~ /^\s*$/){
$in_align_sec = 0;
$good_align_sec = 1;
} else{
$self->warn("Unrecognized format:\n$line");
return 0;
}
}
$self->throw($MEME_NO_HEADER_ERR) unless ($self->{'seen_header'});
if ($good_align_sec) {
$aln->score($evalue);
return $aln;
}
return;} |
sub write_aln
{ my ($self,@aln) = @_;
$self->throw_not_implemented();
}
} |
sub _initialize
{ my($self,@args) = @_;
$self->SUPER::_initialize(@args);
$self->{'seen_header'} = 0;
}
1; } |
General documentation
Please direct usage questions or support issues to the mailing list:
bioperl-l@bioperl.org
rather than to the module maintainer directly. Many experienced and
reponsive experts will be able look at the problem and quickly
address it. Please include a thorough description of the problem
with code and data examples if at all possible.
Report bugs to the Bioperl bug tracking system to help us keep track
the bugs and their resolution. Bug reports can be submitted via the
web:
https://redmine.open-bio.org/projects/bioperl/
| AUTHORS - Benjamin Berman | Top |
The rest of the documentation details each of the object
methods. Internal methods are usually preceded with an
underscore.