FASTX::Reader

CPAN Version Tests Travis Build Status Kwalitee

An OOP Perl module to parse FASTA and FASTQ files

This is a package built using Heng Li's readfq() subroutine (link). For updated documentation, please visit Meta::CPAN.

The FASTX::Reader module also ships fqc (FASTQ counter), a program to quickly count the number of sequences in a set of FASTA/FASTQ files, also .gz compressed.

Installation

With CPAN minus:

cpanm FASTX::Reader

If you don't have CPAN minus, you can install it with:

cpan App::cpanminus

Using 'fqc'

fqc [options] FILE1 FILE2 ... FILEn

The output is simply filename/read counts, but can be expanded with: -t for TSV, -c for CSV, -j for JSON, -x to print in ASCII table. Type fqc --help for full manual.

Using the module

use FASTX::Reader;
my $filepath = '/path/to/assembly.fastq';
die "Input file not found: $filepath\n" unless (-e "$filepath");
my $fasta_reader = FASTX::Reader->new({ filename => "$filepath" });
 
while (my $seq = $fasta_reader->getRead() ) {
  print STEDRR "Printing ", $seq->{name}, ' (', $seq->{comment}, ")\n";
  print $seq->{name}, "\t", $seq->{seq}, "\t", $seq->{qual}, "\n";
}

Contributors