---
name: "Bio::DB::Bam::Query"
section: "3pm"
platform: "linux"
package: "libbio-samtools-perl"
version: "1.43-5+b1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Bio::DB::Bam::Query"
---

# Bio::DB::Bam::Query(3pm)

## NAME

Bio::DB::Bam::Query -- Object representing the query portion of a BAM/SAM alignment

## SYNOPSIS

Given an alignment retrieved from a Bio::DB::Sam database,

```
 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
```

## DESCRIPTION

This is a simple Bio::SeqFeatureI object that represents the query part of a SAM alignment.

### Methods

- $seqid = $query-\>seq\_id

  The name of the read.

- $name = $query-\>name

  The read name (same as seq\_id in this case).

- $name = $query-\>display\_name

  The read display\_name (same as seq\_id in this case).

- $tag = $query-\>primary\_tag

  The string "match".

- $tag = $query-\>source\_tag

  The string "sam/bam".

- $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.

- $scores = $query-\>qscore

  The read quality scores. In a list context, a list of integers equal in length to the read sequence length. In a scalar context, an array ref. The qscores are in REFERENCE sequence orientation.

- $dna = $query-\>dna

  The DNA string in reference sequence orientation.

- $strand = $query-\>strand

  If the query was reversed to align it, -1. Otherwise +1.

- $seq = $query-\>subseq($start,$end)

  Return a Bio::PrimarySeq object representing the requested subsequence on the read.

## SEE ALSO

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.
