Andrea Telatin 🔆
/
Proch-N50-0.032
/
README.md
Proch::N50

A simple Perl module to calculate N50 of a FASTA or FASTQ file
For updated documentation, please visit Meta::CPAN.
Short synopsis
use Proch::N50 qw(getStats getN50);
my $filepath = '/path/to/assembly.fasta';
# Get N50 only: getN50(file) will return an integer
print "N50 only:\t", getN50($filepath), "\n";
# Full stats
my $seq_stats = getStats($filepath);
print Data::Dumper->Dump( [ $seq_stats ], [ qw(*FASTA_stats) ] );
# Will print:
# %FASTA_stats = (
# 'N50' => 65,
# 'dirname' => 'data',
# 'size' => 130,
# 'seqs' => 6,
# 'filename' => 'small_test.fa',
# 'status' => 1
# );
# Get also a JSON object
my $seq_stats_with_JSON = getStats($filepath, 'JSON');
print $seq_stats_with_JSON->{json}, "\n";
# Will print:
# {
# "seqs" : 6,
# "status" : 1,
# "filename" : "small_test.fa",
# "N50" : "65",
# "dirname" : "data",
# "size" : 130
# }