John A. Crow > Bio-SeqReader > Bio::SeqReader::Fastq

Download:
Bio-SeqReader-0.1.3.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

Bio::SeqReader::Fastq - Class providing a reader for files in FASTQ format.

SYNOPSIS ^

  use Bio::SeqReader::Fastq;
  my $in1 = new Bio::SeqReader::Fastq();             # from stdin
  my $fh = ...
  my $in2 = new Bio::SeqReader::Fastq( fh => $fh );  # from filehandle

DESCRIPTION ^

Bio::SeqReader::Fastq provides a method for reading a file or stream in FASTQ format.

This format is described in P. J. A. Cock, C. J. Fields, N. Goto, M. L. Heuer, P. M. Rice. (2010) The Sanger FASTQ file format for sequences with quality scores, and the Solexa/Illumina FASTQ variants, Nucleic Acids Research 38. It specifically allows for multiline sequence and quality score information, which are handled correctly by this class.

CLASS METHODS ^

Bio::SeqReader::Fastq provides no class methods.

INSTANCE METHODS ^

Bio::SeqReader::Fastq provides the following instance methods.

new()

Constructor. Returns a new Bio::SeqReader::Fastq object associated with stdin (by default) or with a filehandle. Understands optional specification of an IO::File-compatible filehandle via fh => $fh.

  # From an IO::File filehandle
  my $fh1 = new IO::File( 'in.fq' );
  my $in1 = new Bio::SeqReader::Fastq( fh => $fh1);

  # From an IO::Uncompress::AnyUncompress filehandle
  my $fh2 = new IO::File( 'in.fq.gz' );
  my $in2 = new Bio::SeqReader::Fastq( fh => $fh2);

  # From stdin
  my $in3 = new Bio::SeqReader::Fastq();

A specified filehandle must be compatible with those produced by IO::File filehandle; for example,

  $fh1 = new IO::File( 'in.fastq' )
  $fh2 = new IO::Uncompress::AnyUncompress( 'in.fastq.gz' )
  $fh3 = new IO::Uncompress::AnyUncompress( 'in.fastq' ).
next()

Returns the next sequence as a Bio::SeqReader::FastqRecord object.

  while ( my $so = $in->next() ) {
      ... work with $so here ...
  }

EXTERNAL DEPENDENCIES ^

Perl core.

EXAMPLES ^

  # Open and read a file in FASTQ format
  my $fh = new IO::File( 'foo.fastq' );
  my $in = new Bio::SeqReader( fh => $fh );
  while ( my $so = $in->next() ) {
      my $s = $so->seq();   # $so is a Bio::SeqReader::FastqRecord
      . . .
  }

  # Open and read a gzipped file in FASTQ format
  my $fh = new IO::Uncompress::AnyUncompress( 'foo.fastq.gz' );
  my $in = new Bio::SeqReader( fh => $fh );
  while ( my $so = $in->next() ) {
      my $s = $so->seq();   # $so is a Bio::SeqReader::FastqRecord
      . . .
  }

BUGS ^

None reported yet, but let me know.

SEE ALSO ^

Bio::SeqReader::FastqRecord, Bio::SeqReader.

AUTHOR ^

John A. Crow <jac_at_cpan_dot_org>

COPYRIGHT AND LICENSE ^

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.

  Copyright (C) 2012 by John A. Crow
  Copyright (C) 2012 by National Center for Genome Resources
syntax highlighting: