The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Bio::RNA::BarMap::Mapping - Parse and query BarMap mappings.

SYNOPSIS

    use v5.12;              # for 'say()' and '//' a.k.a. logical defined-or
    use Bio::RNA::BarMap;

    # Parse a BarMap output file.
    my $barmap_file = 'N1M7_barmap_1.out';     # e.g. the test data in t/data/
    my $mapping = Bio::RNA::BarMap::Mapping->new($barmap_file);

    # Print mapped Barriers files.
    say join q{ }, $mapping->mapped_files;

    # Map a file.
    my $from_file = '8.bar';            # one of the mapped .bar files
    my $to_file = $mapping->map_file($from_file);   # last file maps to undef
    say "$from_file is mapped to ", $to_file // "nothing";
    say "The other way round: predecessor file of $to_file is ",
        $mapping->map_file_inv($to_file)

    # Map minimum 2 from file 8.bar to the next file.
    my $from_min = 2;
    my $to_min = $mapping->map_min_step($from_file, $from_min);

    # Map to an arbitrary file (only forward direction!)
    $to_file = '15.bar';
    $to_min = $mapping->map_min($from_file, $from_min, $to_file);

DESCRIPTION

This class is the main class of the Bio::RNA::BarMap distribution. It parses the mapping generated by BarMap and provides methods to easily query the mapping of individual states and files.

METHODS

Bio::RNA::BarMap::Mapping->new($barmap_file)

Construct a new mapping object from a path or a handle to a BarMap mapping file.

$mapping->first_mapped_file()

Returns the name of the first mapped Barriers file of this BarMap mapping.

$mapping->mapped_files()

Returns a list of all Barriers files of the mapping file.

$mapping->mapped_mins($barriers_file)

Returns a list of all minima from $barriers_file found in the mapping file.

$mapping->path_of_file($barriers_file)

Given a $barriers_file, return its full path. The file is assumed to reside in the same directory as the BarMap mapping file. Useful when the mapping file is not in the current working directory.

$mapping->first_mapped_path()

Returns the path to the first mapped Barriers file of this BarMap mapping.

$mapping->map_file($from_file)

Return the immediate successor file of Barriers file $from_file in the mapping, or undef if $from_file is the last one.

$mapping->map_path($barriers_file_path)

Like map_file(), but takes and returns a full path to a Barriers file.

$mapping->map_file_inv($to_file)

(Inversely) map Barriers file to_file to its immediate predecessor file in the mapping, or to undef if it is the first one.

$mapping->map_path_inv()

Like map_file_inv(), but takes and returns a full path to a Barriers file.

$mapping->map_min_step($from_file, $from_min)

Map minimum $from_min from Barriers file $from_file to its corresponding minimum in the next Barriers file.

In scalar context, only the corresponding minimum is returned. In list context, both the mapping type and the corresponding minimum are returned (in that order). The mapping type tells whether a minimum was mapped exactly (->) or approximately (~>), and is an object of class Bio::RNA::BarMap::Mapping::Type.

$mapping->map_min($from_file, $from_min, $to_file)

Map minimum $from_min from Barriers file $from_file to its corresponding minimum in the Barriers file $to_file. This is achieved by iteratively applying map_min_step() until reaching the requested target file.

In scalar context, only the corresponding minimum is returned. In list context, both the mapping type and the corresponding minimum are returned (in that order). The mapping type tells whether a minimum was mapped exactly (->) or approximately (~>), and is an object of class Bio::RNA::BarMap::Mapping::Type. A mapping is considered exact if and only if the mapping was exact in all individual mapping steps.

$mapping->get_mapping_type($from_file, $from_min, $to_file)

Convenience wrapper for map_min() that only returns the mapping type, but not the target minimum.

$mapping->get_mapping_arrow()

Convenience wrapper for map_min() that only returns the arrow representation of the mapping type, but not the target minimum. An exact mapping is converted to arrow ->, an approximate mapping to arrow ~>.

$mapping->map_min_inv_step($to_file, $to_min)

Returns all minima in the preceding Barriers file that map to minimum $to_min in file $to_file.

$mapping->map_min_inv($to_file, $to_min, $from_file)

Returns all minima in Barriers file $to_file that map to minimum $to_min in file $to_file.

AUTHOR

Felix Kuehnl, <felix at bioinf.uni-leipzig.de>

BUGS

Please report any bugs or feature requests by raising an issue at https://github.com/xileF1337/Bio-RNA-BarMap/issues.

You can also do so by mailing to bug-bio-rna-barmap at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Bio-RNA-BarMap. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Bio::RNA::BarMap

You can also look for information at the official BarMap website:

https://www.tbi.univie.ac.at/RNA/bar_map/

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2019-2021 Felix Kuehnl.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.