NAME

Mash

SYNOPSIS

A module to read `mash info` output and transform it

use strict;
use warnings;
use Mash;

# Quick example

# Sketch all fastq files into one mash file.
system("mash sketch *.fastq.gz > all.msh");
die if $?;
# Read the mash file.
my $msh = Mash->new("all.msh");
# All-vs-all distances
my $distHash = $msh->dist($msh);

DESCRIPTION

This is a module to read mash files produced by the Mash executable. For more information on Mash, see mash.readthedocs.org. This module is capable of reading mash files. Future versions will read/write mash files.

METHODS

Mash->new("filename.msh",\%options);

Create a new instance of Mash. One object per set of files.

Arguments:  Sketch filename
            Hash of options (none so far)
Returns:    Mash object
$msh->file("filename.msh")

Changes which file is used in the object and updates internal object information. This method is ordinarily used internally only.

Arguments: One mash file
Returns:   self
$msh->dist($msh2)

Returns a hash describing distances between sketches represented by this object and another object. If there are multiple sketches per object, then all sketches in this object will be compared against all sketches in the other object.

Arguments: One Mash object
Returns:   reference to a hash of hashes. Each value is a number.

Aliases: distance(), mashDist()

Mash::raw_mash_distance($array1, $array2)

Returns the number of sketches in common and the total number of sketches between two lists. The return type is an array of two elements.

Arguments: A list of integers
           A list of integers
Returns:   (countOfInCommon, totalNumber)

Example:
  
  my $R1 = [1,2,3];
  my $R2 = [1,2,4];
  my($common, $total) = Mash::raw_mash_distance($R1,$R2);
  # $common => 2
  # $total  => 3

COPYRIGHT AND LICENSE

MIT license.

AUTHOR

Author: Lee Katz <lkatz@cdc.gov>

For additional help, go to https://github.com/lskatz/perl-mash

CPAN module at http://search.cpan.org/~lskatz/perl-mash