Bio::I...::Fastq(3pm)

πŸ“¦
version 1.7.8 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

Bio::Index::Fastq πŸ’–

okay bestie, welcome to the Bio::I...::Fastq(3pm) page β€” that's a User Contributed Perl Documentation joint, and today we're indexing fastq files like it's our whole personality. no cap. ✨


🌸 NAME 🌸

Bio::Index::Fastq β€” the interface for indexing (multiple) fastq files. it's giving "library card catalog but for your sequences" πŸ’…


✨ SYNOPSIS ✨

okay so here's the whole vibe, full code, making an index for a bunch of fastq files:

# Complete code for making an index for several
# fastq files
use Bio::Index::Fastq;
use strict;

my $Index_File_Name = shift;
my $inx = Bio::Index::Fastq->new(
    '-filename' => $Index_File_Name,
    '-write_flag' => 1);
$inx->make_index(@ARGV);

and then, print out several sequences that live in the index, in Fastq format:

# Print out several sequences present in the index
# in Fastq format
use Bio::Index::Fastq;
use strict;

my $Index_File_Name = shift;
my $inx = Bio::Index::Fastq->new('-filename' => $Index_File_Name);
my $out = Bio::SeqIO->new('-format' => 'Fastq','-fh' => \*STDOUT);

foreach my $id (@ARGV) {
    my $seq = $inx->fetch($id); # Returns Bio::Seq::Quality object
    $out->write_seq($seq);
}

or, alternatively β€” plot twist β€” this:

# or, alternatively
my $id;
my $seq = $inx->get_Seq_by_id($id); #identical to fetch

like, get_Seq_by_id is literally the same thing as fetch. iconic. 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

so this module inherits its dbm-file-managing functions from Bio::Index::Abstract.pm, and it brings the basic functionality for indexing fastq files and pulling the sequence back out of them. oh and heads up: for best results, use strict. that's the rule, periodt.

and the tea is Bio::Index::Fastq supports the Bio::DB::BioSeqI interface β€” which means it can be used as a Sequence database for other parts of bioperl. main character energy fr fr πŸ‘‘


πŸ’Œ FEED_BACK πŸ’Œ

Mailing Lists πŸ“¬

user feedback is an integral part of the evolution of this and other Bioperl modules β€” like, genuinely, your voice matters here. send your comments and suggestions preferably to one of the Bioperl mailing lists. your participation is much appreciated, no joke. πŸ₯Ή

bioperl-l@bioperl.org                  - General discussion
http://bioperl.org/wiki/Mailing_lists  - About the mailing lists

Support πŸ›Ÿ

please direct usage questions or support issues to the mailing list:

bioperl-l@bioperl.org

rather than to the module maintainer directly. the way that many experienced and responsive experts will be able to look at the problem and quickly address it… so good. if at all possible, please include a thorough description of the problem with code and data examples. give them the full context bestie, they'll eat πŸ“

Reporting Bugs πŸ›

report bugs to the Bioperl bug tracking system so we can keep track of the bugs and their resolution. bug reports can be submitted via the web:

https://github.com/bioperl/bioperl-live/issues

πŸ‘‘ AUTHOR - Tony Cox πŸ‘‘

Email β€” avc@sanger.ac.uk


πŸ“– APPENDIX πŸ“–

the rest of the documentation gives you the details on each of the object methods. internal methods are usually preceded with a _ β€” that's the lil secret handshake 🀫

_file_format

Title   : _file_format
Function: The file format for this package, which is needed
          by the SeqIO system when reading the sequence.
Returns : 'Fastq'

so it returns 'Fastq'. that's it. that's the whole function. slay. πŸ’…

_index_file

Title   : _index_file
Usage   : $index->_index_file( $file_name, $i )
Function: Specialist function to index FASTQ format files.
          Is provided with a filename and an integer
          by make_index in its SUPER class.
Example :
Returns :
Args    :

id_parser

Title   : id_parser
Usage   : $index->id_parser( CODE )
Function: Stores or returns the code used by record_id to
          parse the ID for record from a string.  Useful
          for (for instance) specifying a different
          parser for different flavours of FASTQ file.
          Returns \&default_id_parser (see below) if not
          set. If you supply your own id_parser
          subroutine, then it should expect a fastq
          description line.  An entry will be added to
          the index for each string in the list returned.
Example : $index->id_parser( \&my_id_parser )
Returns : ref to CODE if called without arguments
Args    : CODE

basically you can swap in your own parsing logic for different flavours of FASTQ file β€” very customizable, very much your call 🌈

default_id_parser

Title   : default_id_parser
Usage   : $id = default_id_parser( $header )
Function: The default Fastq ID parser for Fastq.pm
          Returns $1 from applying the regexp /^>\s*(\S+)/
          to $header.
Returns : ID string
Args    : a fastq header line string

the default one just grabs $1 from that regexp /^>\s*(\S+)/ applied to $header, and hands you back an ID string. simple, clean, does the job πŸ’œ


and that's the whole page bestie!! this one's from perl v5.32.1, dated 2021-08-15 β€” so it's a lil vintage, a classic, a collector's item πŸŽ€ go forth and index your fastq files, you've absolutely got this. periodt. βœ¨πŸ’–πŸ¦‹

πŸ“¦ where this page comes from