Changeset 3212


Ignore:
Timestamp:
May 5, 2014, 9:00:56 AM (7 years ago)
Author:
Peter
Message:

move Cigar defines to a separate file

Location:
trunk/yat
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/omic/BamRead.h

    r3210 r3212  
    2323*/
    2424
    25 #include <yat/utility/config_public.h>
    26 
    27 // allow inclusion of config_bam.h so this file is available also without bam.h
    28 #ifdef YAT_HAVE_LIBBAM
    2925#include "config_bam.h"
    3026#include YAT_BAM_HEADER
    3127#include YAT_SAM_HEADER
    3228
    33 #else
    34 /// describe how CIGAR operation/length is packed into a 32-bit
    35 #define BAM_CIGAR_SHIFT 4
    36 /// operation is described in four lowest bits
    37 #define BAM_CIGAR_MASK  ((1 << BAM_CIGAR_SHIFT) - 1)
    38 /// \abstract CIGAR: M = match or mismatch
    39 #define BAM_CMATCH      0
    40 /// \abstract CIGAR: I = insertion to the reference
    41 #define BAM_CINS        1
    42 /// \abstract CIGAR: D = deletion from the reference
    43 #define BAM_CDEL        2
    44 /// \abstract CIGAR: N = skip on the reference (e.g. spliced alignment)
    45 #define BAM_CREF_SKIP   3
    46 /// \abstract CIGAR: S = clip on the read with clipped sequence
    47 /// present in qseq
    48 #define BAM_CSOFT_CLIP  4
    49 /// \abstract CIGAR: H = clip on the read with clipped sequence trimmed off
    50 #define BAM_CHARD_CLIP  5
    51 /// \abstract CIGAR: P = padding
    52 #define BAM_CPAD        6
    53 /// \abstract CIGAR: equals = match
    54 #define BAM_CEQUAL      7
    55 /// \abstract CIGAR: X = mismatch
    56 #define BAM_CDIFF       8
    57 #define BAM_CBACK       9
    58 #endif
     29// This file has to be included to keep compatibility with yat 0.11
     30#include <yat/utility/Cigar.h>
    5931
    6032#include <functional>
     
    6234#include <vector>
    6335
    64 // backport #defines from samtools 0.1.19
    65 #ifndef BAM_CIGAR_STR
    66 #define BAM_CIGAR_STR "MIDNSHP=XB"
    67 // lookup table used in bam_cigar_type
    68 #define BAM_CIGAR_TYPE 0x3C1A7
    69 
    70 /// index of operation in range [0, 9], see below.
    71 #define bam_cigar_op(c) ((c)&BAM_CIGAR_MASK)
    72 // length of the operation
    73 #define bam_cigar_oplen(c) ((c)>>BAM_CIGAR_SHIFT)
    74 // char describing the operation, see column 2 in table below
    75 #define bam_cigar_opchr(c) (BAM_CIGAR_STR[bam_cigar_op(c)])
    76 // Create a cigar element with length l and operation o
    77 #define bam_cigar_gen(l, o) ((l)<<BAM_CIGAR_SHIFT|(o))
    78 // Returns a two-bits number describing the type of operation. The
    79 // first bit, bam_cigar_type & 1, (4th column in table below) is 1 iff
    80 // operation consumes query sequence. The second bit, bam_cigar_type &
    81 // 2, (3rd column below) is 1 iff operation consumes reference
    82 // sequence.
    83 #define bam_cigar_type(o) (BAM_CIGAR_TYPE>>((o)<<1)&3)
    84 #endif
    85 
    86 /*
    87   CIGAR
    88 0 M 1 1 match
    89 1 I 0 1 insert
    90 2 D 1 0 deletion
    91 3 N 1 0 spliced (rna)
    92 4 S 0 1 soft clipped
    93 5 H 0 0 hard clipped
    94 6 P 0 0 padded
    95 7 = 1 1 equal
    96 8 X 1 1 mismatch
    97 9 B 0 0
    98 
    99 3rd column: consumes reference sequence
    100 4th column: consumes query sequence
    101  */
    102 
    103 #ifdef YAT_HAVE_LIBBAM
    10436namespace theplu {
    10537namespace yat {
     
    457389}}}
    458390#endif
    459 #endif
  • trunk/yat/utility/Aligner.cc

    r3210 r3212  
    2323
    2424#include "Aligner.h"
     25#include "Cigar.h"
    2526#include "Matrix.h"
    26 
    27 // to get BAM_CIGAR defines
    28 #include <yat/omic/BamRead.h>
    2927
    3028#include <cassert>
  • trunk/yat/utility/Aligner.h

    r3211 r3212  
    172172
    173173       \since new in yat 0.12
     174
     175       \see file yat/utility/Cigar.h for some useful macros
    174176     */
    175177    class Cigar
  • trunk/yat/utility/Makefile.am

    r3204 r3212  
    6161  $(srcdir)/yat/utility/Alignment.h \
    6262  $(srcdir)/yat/utility/boost_exception_ptr.h \
     63  $(srcdir)/yat/utility/Cigar.h \
    6364  $(srcdir)/yat/utility/ColumnStream.h \
    6465  $(srcdir)/yat/utility/CommandLine.h \
  • trunk/yat/utility/SmithWaterman.cc

    r3205 r3212  
    2323
    2424#include "SmithWaterman.h"
    25 #include "yat/omic/BamRead.h" // for cigar defines
     25#include "Cigar.h"
    2626
    2727#include <cassert>
Note: See TracChangeset for help on using the changeset viewer.