---
name: "Bio::DB::HTS::Query"
section: "3pm"
platform: "linux"
package: "libbio-db-hts-perl"
version: "3.01-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Bio::DB::HTS::Query"
---

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

## LICENSE

Copyright \[2015-2018\] EMBL-European Bioinformatics Institute

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

```
     http://www.apache.org/licenses/LICENSE-2.0
```

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

## AUTHOR

Rishi Nag \<rishi@ebi.ac.uk\<gt\>

## NAME

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

## SYNOPSIS

Given an alignment retrieved from a Bio::DB::HTS 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::HTS, Bio::DB::HTS::Alignment, Bio::DB::HTS::Constants
