++ed by:

2 PAUSE users

Author image Alessandro Vullo
and 1 contributors


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


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.


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


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


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


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


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


Bio::Perl, Bio::DB::HTS, Bio::DB::HTS::Alignment, Bio::DB::HTS::Constants