BioPerl

 view release on metacpan or  search on metacpan

Bio/AlignIO/meme.pm  view on Meta::CPAN

            # Info about the flanking sequence
            # my $start_len = ($strand > 0) ? length($left_flank) :
            # length($right_flank);
            # my $end_len = ($strand > 0) ? length($right_flank) :
            # length($left_flank);

            # Make the sequence.  Meme gives the start coordinate at the left
            # hand side of the motif relative to the INPUT sequence.
            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,
            );

            # Add the sequence motif to the alignment
            $aln->add_seq($seq);
        }
        elsif ( ( $line =~ /^\-/ ) || ( $line =~ /Sequence name/ ) ) {

            # These are acceptable things to be in the site section
        }
        elsif ( $line =~ /^\s*$/ ) {

            # This ends the site section
            $in_align_sec   = 0;
            $good_align_sec = 1;
        }
        else {
            $self->warn("Unrecognized format:\n$line");
            return;
        }
    }

    # Signal an error if we didn't find a header section
    $self->throw($MEME_NO_HEADER_ERR) unless ( $self->{'seen_header'} );

    if ($good_align_sec) {
        $aln->score($evalue);
        return $aln;
    }

    return;
}

=head2 write_aln

 Title   : write_aln
 Usage   : $stream->write_aln(@aln)
 Function: Not implemented
 Returns : 1 for success and 0 for error
 Args    : Bio::SimpleAlign object

=cut

sub write_aln {
    my ( $self, @aln ) = @_;
    $self->throw_not_implemented();
}

# ----------------------------------------
# -   Private methods
# ----------------------------------------

sub _initialize {
    my ( $self, @args ) = @_;

    # Call into our base version
    $self->SUPER::_initialize(@args);

    # Then initialize our data variables
    $self->{'seen_header'} = 0;
}

1;



( run in 0.521 second using v1.01-cache-2.11-cpan-39bf76dae61 )