Joachim Bargsten > Bio-Gonzales-0.0544 > Bio::Gonzales::Seq::Util

Download:
Bio-Gonzales-0.0544.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.0101   Source   Latest Release: Bio-Gonzales-0.0548

NAME ^

SYNOPSIS ^

    use Bio::Gonzales::Seq::Util qw(
        pairwise_identity_l
        pairwise_identity_s
        pairwise_identity_gaps_l
        pairwise_identity_gaps_s
        pairwise_identities
        map_seqids
        seqid_mapper
        overlaps
        cluster_overlapping_ranges
    );

DESCRIPTION ^

SUBROUTINES ^

$map = map_seqids($seqs, $pattern)

Maps all sequence ids of $seqs in situ. If $pattern is not given, s%9d is taken as default.

$clustered_ranges = cluster_overlapping_ranges(\@ranges)

This function takes some ranges and clusters them by overlap.

    @ranges = (
        [ $start, $stop, $some, $custom, $elements ],
        [ ... ],
        ...
    );

    $clustered_ranges = [
        # first cluster
        [
            [ $start, $stop, $some, $custom, $elements ],
            ...
        ],
        # next cluster
        [
            [ $start, $stop, $some, $custom, $elements ],
            ...
        ],
        ...
    ];
$map = map_seqids(\@seqs!, $pattern)

Wrapper around seqid_mapper(), maps the ids of @seqs and returns the map. This function works directly on the sequences.

$mapper = seqid_mapper(\%idmap)

Create a mapper that maps given sequences to new ids generated by the argument given. A hash as argument will be used as mapping base, taking the key as old and the value as new id. In case the sequence id is non-existent in the hash, an artificial id following the pattern unknown_$i with $i running from 0 onwards will be generated..

$mapper = seqid_mapper(\&handler)

Create a mapper that maps given sequences to new ids generated by successive calls to the handler. The handler will get the existing/original id as argument and shall return a new id. A simple mapper would be:

    my $i = 1;
    my $mapper = seqid_mapper(sub { sprintf "id%d", $i++ });
    or
    my $mapper = seqid_mapper(sub { my $id = shift; $id =~ s/pep/cds/; return $id});

    my ($old_id, $new_id) = $mapper->($sequence_object);

The sequence object WILL BE ALTERED IN SITU.

$mapper = seqid_mapper($pattern)

Use pattern as basis for sequence id mapping, "%s" or "%d" must be included ONLY ONCE and will be substituted by a couter, running from 0 to INF.

$mapper = seqid_mapper()

Same as $mapper = seqid_mapper("s%9d")

overlaps([$a_begin, $a_end], [$b_begin, $b_end])

Returns true if a overlaps with b, false otherwise.

SEE ALSO ^

AUTHOR ^

jw bargsten, <joachim.bargsten at wur.nl>

syntax highlighting: