1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
|
=head1 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.
=head1 NAME
Bio::DB::HTS::Constants -- Constants for use with SAM/BAM
=head1 SYNOPSIS
use Bio::DB::HTS::Constants;
my $pad_flag = BAM_CPAD;
=head1 DESCRIPTION
This module exports several constants for use with the SAM/BAM
module. See the SAM documentation for their interpretation.
=over 4
=item Cigar operations
BAM_CIGAR_SHIFT
BAM_CIGAR_MASK
BAM_CMATCH
BAM_CINS
BAM_CDEL
BAM_CREF_SKIP
BAM_CSOFT_CLIP
BAM_CHARD_CLIP
BAM_CPAD
=item FLAGS
A hashref that maps flag values to human-readable names. For example:
FLAGS->{0x0008} == 'M_UNMAPPED'
=item RFLAGS
The reverse of FLAGS:
RFLAGS->{M_UNMAPPED} == 0x0008
=back
=head1 AUTHOR
Rishi Nag E<lt>rishi@ebi.ac.uk<gt>
=head1 SEE ALSO
L<Bio::Perl>, L<Bio::DB::HTS>, L<Bio::DB::Bam::Alignment>
=cut
package Bio::DB::HTS::Constants;
$Bio::DB::HTS::Constants::VERSION = '3.01';
use strict;
use warnings;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(CIGAR_SYMBOLS BAM_CIGAR_SHIFT BAM_CIGAR_MASK
BAM_CMATCH BAM_CINS BAM_CDEL BAM_CREF_SKIP
BAM_CSOFT_CLIP BAM_CHARD_CLIP BAM_CPAD FLAGS RFLAGS);
our @EXPORT_OK = @EXPORT;
use constant CIGAR_SYMBOLS => [qw(M I D N S H P = X)];
use constant BAM_CIGAR_SHIFT => 4;
use constant BAM_CIGAR_MASK => ( 1 << BAM_CIGAR_SHIFT ) - 1;
use constant BAM_CMATCH => 0;
use constant BAM_CINS => 1;
use constant BAM_CDEL => 2;
use constant BAM_CREF_SKIP => 3;
use constant BAM_CSOFT_CLIP => 4;
use constant BAM_CHARD_CLIP => 5;
use constant BAM_CPAD => 6;
use constant FLAGS => { 0x0001 => 'PAIRED',
0x0002 => 'MAP_PAIR',
0x0004 => 'UNMAPPED',
0x0008 => 'M_UNMAPPED',
0x0010 => 'REVERSED',
0x0020 => 'M_REVERSED',
0x0040 => 'FIRST_MATE',
0x0080 => 'SECOND_MATE',
0x0100 => 'NOT_PRIMARY',
0x0200 => 'QC_FAILED',
0x0400 => 'DUPLICATE',
0x0800 => 'SUPPLEMENTARY', };
use constant RFLAGS => { reverse %{ FLAGS() } };
1;
|