Bio::D...::Query(3pm)

πŸ’– NAME πŸ’–

Bio::DB::Bam::Query β€” it's the whole object representing the query portion of a BAM/SAM alignment bestie, like this manual page is Bio::D...::Query(3pm) from the User Contributed Perl Documentation, and it's lowkey iconic ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

okay so picture this: you've got an alignment you pulled out of a Bio::DB::Sam database, right? and then you do:

 my $query = $alignment->query;

 my $name   = $query->display_name;
 my $start  = $query->start;
 my $end    = $query->end;
 my $dna    = $query->dna;    # dna string
 my $seq    = $query->seq;    # Bio::PrimarySeq object
 my @scores = $query->qscore; # quality score

that's it. that's the vibe. no cap πŸ’…


🌸 DESCRIPTION 🌸

so this is a simple Bio::SeqFeatureI object and it represents the query part of a SAM alignment. that's the whole thing. she's simple, she's focused, she knows her lane πŸŽ€

🫢 Methods

  • $seqid = $query->seq_id β€” the name of the read. that's it, that's her name πŸ’–
  • $name = $query->name β€” the read name (which is the same as seq_id in this case, okurrr).
  • $name = $query->display_name β€” the read display_name, and yeah, also the same as seq_id in this case. three names, one girl πŸ‘‘
  • $tag = $query->primary_tag β€” the string "match". that's literally all it says.
  • $tag = $query->source_tag β€” the string "sam/bam". yeah, she tells you where she came from 🌈
  • $start = $query->start β€” the start of the match in read coordinates.
  • $end = $query->end β€” the end of the match in read coordinates.
  • $len = $query->length β€” the length of the read ✨
  • $seq = $query->seq β€” a Bio::PrimarySeq representing the read sequence in REFERENCE orientation. not the other orientation. the REFERENCE one. important 🚨
  • $scores = $query->qscore β€” the read quality scores πŸ’… watch the context tho, because it changes EVERYTHING:
    • in a list context: a list of integers equal in length to the read sequence length
    • in a scalar context: an array ref
    • and either way, girl, the qscores are in REFERENCE sequence orientation.
  • $dna = $query->dna β€” the DNA string, in reference sequence orientation 🧬
  • $strand = $query->strand β€” so if the query was reversed to align it, you get -1. otherwise you get +1. that's the whole tea πŸ’€
  • $seq = $query->subseq($start,$end) β€” returns a Bio::PrimarySeq object representing the requested subsequence on the read. give her a start and an end and she gives you a seq πŸŽ€

πŸ‘‘ SEE ALSO πŸ‘‘

go read these too bestie, they're the friend group: Bio::Perl, Bio::DB::Sam, Bio::DB::Bam::Alignment, Bio::DB::Bam::Constants πŸ’œ


🌟 AUTHOR 🌟

Lincoln Stein <lincoln.stein@oicr.on.ca>. <lincoln.stein@bmail.com>

Copyright (c) 2009-2015 Ontario Institute for Cancer Research.

This package and its accompanying libraries are free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0, the Apache 2.0 License, or the GNU General Public License (version 1 or higher). Refer to LICENSE for the full license text. 🫢


and that's the whole page bestie, no crumbs left πŸ“ this was perl v5.42.3, dated 2026-08-19, and it slayed fr fr πŸ’–βœ¨πŸŽ€
πŸ“¦ where this page comes from