Changeset 4334


Ignore:
Timestamp:
Mar 25, 2023, 4:32:55 AM (6 months ago)
Author:
Peter
Message:

new class NeedlemanWunsch?.

Location:
trunk
Files:
3 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/Makefile.am

    r4332 r4334  
    109109  test/ncc.test \
    110110  test/needleman_wunsch.test \
     111  test/needleman_wunsch2.test \
    111112  test/negative_binomial.test \
    112113  test/negative_binomial_mixture.test \
  • trunk/yat/utility/Aligner.cc

    r4308 r4334  
    157157
    158158
     159  double Aligner::insertion_penalty(void) const
     160  {
     161    return vertical_gap_;
     162  }
     163
     164
     165  double Aligner::open_insertion_penalty(void) const
     166  {
     167    return open_vertical_gap_;
     168  }
     169
     170
     171  double Aligner::deletion_penalty(void) const
     172  {
     173    return horizon_gap_;
     174  }
     175
     176
     177  double Aligner::open_deletion_penalty(void) const
     178  {
     179    return open_horizon_gap_;
     180  }
     181
     182
    159183  // ================ Cigar =======================
    160184
     
    315339
    316340
     341  Aligner::Cigar::const_reverse_iterator Aligner::Cigar::rbegin(void) const
     342  {
     343    return const_reverse_iterator(cigar_.rbegin());
     344  }
     345
     346
    317347  uint32_t Aligner::Cigar::reference_length(void) const
    318348  {
    319349    return length(2);
     350  }
     351
     352
     353  Aligner::Cigar::const_reverse_iterator Aligner::Cigar::rend(void) const
     354  {
     355    return const_reverse_iterator(cigar_.rend());
    320356  }
    321357
     
    337373    assert(i<cigar_.size());
    338374    return cigar_[i];
     375  }
     376
     377
     378  bool Aligner::Cigar::operator==(const Aligner::Cigar& other) const
     379  {
     380    return cigar_ == other.cigar_;
     381  }
     382
     383
     384  bool Aligner::Cigar::operator!=(const Aligner::Cigar& other) const
     385  {
     386    return cigar_ != other.cigar_;
    339387  }
    340388
  • trunk/yat/utility/Aligner.h

    r4207 r4334  
    8686       vertical_gap.
    8787
    88        \param horizon_gap Penalty for extending a horizontal gap
    89 
    90        \param open_horizon_gap Penalty for open a horizontal
     88       \param horizontal_gap Penalty for extending a horizontal gap
     89
     90       \param open_horizontal_gap Penalty for open a horizontal
    9191       gap. Total penalty for a horizontal gap is open_horizon_gap + N
    9292       * horizon_gap.
    9393     */
    9494    Aligner(double vertical_gap, double open_vertical_gap,
    95             double horizon_gap, double open_horizon_gap);
     95            double horizontal_gap, double open_horizontal_gap);
    9696
    9797    /**
     
    192192
    193193      /**
     194         \since New in yat 0.21
     195       */
     196      typedef
     197      CigarIterator<std::deque<uint32_t>::const_reverse_iterator>
     198      const_reverse_iterator;
     199
     200      /**
    194201         Default constructor
    195202       */
     
    289296
    290297      /**
     298         \return reverse iterator pointing to the beginning
     299
     300         \since New in yat 0.21
     301       */
     302      const_reverse_iterator rbegin(void) const;
     303
     304      /**
    291305         \brief Translate CIGAR to a reference length.
    292306
     
    301315
    302316      /**
     317         \return reverse iterator pointing to the end
     318
     319         \since New in yat 0.21
     320       */
     321      const_reverse_iterator rend(void) const;
     322
     323      /**
    303324        \brief reverse the CIGAR
    304325
     
    316337       */
    317338      size_t size(void) const;
     339
     340      /**
     341         \since New in yat 0.21
     342       */
     343      bool operator==(const Cigar& other) const;
     344
     345      /**
     346         \since New in yat 0.21
     347       */
     348      bool operator!=(const Cigar& other) const;
    318349    private:
    319350      std::deque<uint32_t> cigar_;
     
    337368    const Cigar cigar(size_t i, size_t j) const;
    338369
     370    /**
     371       Same as vertical_gap in Constructor
     372
     373       \since New in yat 0.21
     374     */
     375    double insertion_penalty(void) const;
     376
     377    /**
     378       Same as open_vertical_gap in Constructor
     379
     380       \since New in yat 0.21
     381     */
     382    double open_insertion_penalty(void) const;
     383
     384    /**
     385       Same as horizontal_gap in Constructor
     386
     387       \since New in yat 0.21
     388     */
     389    double deletion_penalty(void) const;
     390
     391    /**
     392       Same as open_horizontal_gap in Constructor
     393
     394       \since New in yat 0.21
     395     */
     396    double open_deletion_penalty(void) const;
    339397  private:
    340398    direction& directions(size_t i, size_t j);
  • trunk/yat/utility/Cigar.h

    r4005 r4334  
    8282// 2, (3rd column below) is 1 iff operation consumes reference
    8383// sequence.
     84//
     85// CIGAR          Type Reference Query String
     86// BAM_CMATCH      3    1         1     M
     87// BAM_CINS        1    0         1     I
     88// BAM_CDEL        2    1         0     D
     89// BAM_CREF_SKIP   2    1         0     N
     90// BAM_CSOFT_CLIP  1    0         1     S
     91// BAM_CHARD_CLIP  0    0         0     H
     92// BAM_CPAD        0    0         0     P
     93// BAM_CEQUAL      3    1         1     =
     94// BAM_CDIFF       3    1         1     X
     95// BAM_CBACK       0    0         0     B
    8496#define bam_cigar_type(o) (BAM_CIGAR_TYPE>>((o)<<1)&3)
    8597#endif // end of backport
  • trunk/yat/utility/Makefile.am

    r4280 r4334  
    5353  yat/utility/MultiMinimizer.cc \
    5454  yat/utility/MultiMinimizerDerivative.cc \
     55  yat/utility/NeedlemanWunsch.cc \
    5556  yat/utility/NelderMeadSimplex.cc \
    5657  yat/utility/NelderMeadSimplex2.cc \
     
    144145  $(srcdir)/yat/utility/MultiMinimizerDerivative.h \
    145146  $(srcdir)/yat/utility/multiprocess.h \
     147  $(srcdir)/yat/utility/NeedlemanWunsch.h \
    146148  $(srcdir)/yat/utility/NelderMeadSimplex.h \
    147149  $(srcdir)/yat/utility/NelderMeadSimplex2.h \
Note: See TracChangeset for help on using the changeset viewer.