Changeset 3384


Ignore:
Timestamp:
Mar 11, 2015, 4:02:19 AM (7 years ago)
Author:
Peter
Message:

closes #826

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/bam.cc

    r3359 r3384  
    11// $Id$
    22//
    3 // Copyright (C) 2013, 2014 Peter Johansson
     3// Copyright (C) 2013, 2014, 2015 Peter Johansson
    44//
    55// This program is free software; you can redistribute it and/or modify
     
    105105  if (!suite.add(same_query_name(b, bam)))
    106106    suite.err() << "error: \n'" << b.name() << "'\n'" << bam.name() << "'\n";
     107  if (!suite.add(!less_query_name(b, bam)))
     108    suite.err() << "error: less_query_name:\n'"
     109                << b.name() << "'\n'" << bam.name() << "'\n";
     110
     111  BamLessName less_name;
     112  if (!suite.add(!less_name(b, bam)))
     113    suite.err() << "error: BamLessName:\n'"
     114                << b.name() << "'\n'" << bam.name() << "'\n";
    107115
    108116  if (!suite.add(b.sequence()==bam.sequence()))
  • trunk/yat/omic/BamRead.cc

    r3355 r3384  
    22
    33/*
    4   Copyright (C) 2012, 2013, 2014 Peter Johansson
     4  Copyright (C) 2012, 2013, 2014, 2015 Peter Johansson
    55
    66  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    441441
    442442
     443  bool less_query_name(const BamRead& lhs, const BamRead& rhs)
     444  {
     445    return std::lexicographical_compare(lhs.name(),
     446                                        lhs.name()+lhs.core().l_qname,
     447                                        rhs.name(),
     448                                        rhs.name()+rhs.core().l_qname);
     449  }
     450
     451
    443452  void swap(BamRead& lhs, BamRead& rhs)
    444453  {
    445454    lhs.swap(rhs);
    446455  }
     456
    447457
    448458  bool same_query_name(const BamRead& lhs, const BamRead& rhs)
     
    501511  }
    502512
     513
     514  bool BamLessName::operator()(const BamRead& lhs, const BamRead& rhs) const
     515  {
     516    return less_query_name(lhs, rhs);
     517  }
     518
    503519}}}
  • trunk/yat/omic/BamRead.h

    r3380 r3384  
    55
    66/*
    7   Copyright (C) 2012, 2013, 2014 Peter Johansson
     7  Copyright (C) 2012, 2013, 2014, 2015 Peter Johansson
    88
    99  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    371371
    372372  /**
     373     return \c true if lhs query name is less than rhs query name
     374
     375     \see BamRead::name()
     376
     377     \since New in yat 0.13
     378
     379     \relates BamRead
     380   */
     381  bool less_query_name(const BamRead& lhs, const BamRead& rhs);
     382
     383  /**
    373384     Functor to compare two reads with respect to their leftmost
    374385     coordinate.
     
    411422  };
    412423
     424  /**
     425     Functor to compare two reads with respect to their query names.
     426
     427     \see BamRead
     428     \see less_query_name(const BamRead&, const BamRead&)
     429
     430     \since New in yat 0.13
     431   */
     432  struct BamLessName
     433    : public std::binary_function<const BamRead&, const BamRead&, bool>
     434  {
     435    /**
     436       \return \c true if lhs query name is less than rhs query name
     437     */
     438    bool operator()(const BamRead& lhs, const BamRead& rhs) const;
     439  };
     440
    413441}}}
    414442#endif
Note: See TracChangeset for help on using the changeset viewer.