Changeset 3891


Ignore:
Timestamp:
Mar 26, 2020, 6:50:27 AM (2 months ago)
Author:
Peter
Message:

fixes #933

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/vcf_header.cc

    r3750 r3891  
    6060    suite.add(!(id=="DB" && d!="\"dbSNP membership, build 129\""));
    6161  }
     62
     63  // testing erase
     64  {
     65    size_t n_pre = hdr.size();
     66    std::string pre = hdr.line(4);
     67    hdr.erase(4);
     68    size_t n_post = hdr.size();
     69    if (n_post != n_pre - 1) {
     70      suite.add(false);
     71      suite.err() << "error: erase(): size did decrement\n"
     72                  << "N pre: " << n_pre << "\n"
     73                  << "N post: " << n_post << "\n";
     74    }
     75    std::string post = hdr.line(4);
     76    if (pre == post) {
     77      suite.add(false);
     78      suite.err() << "error: pre and post identical\n"
     79                  << "pre: " << pre << "\n"
     80                  << "post: " << post << "\n";
     81    }
     82  }
     83  suite.out() << hdr.line(4) << "\n";
     84
    6285  return suite.return_value();
    6386}
  • trunk/yat/omic/VcfHeader.cc

    r3762 r3891  
    22
    33/*
    4   Copyright (C) 2018 Peter Johansson
     4  Copyright (C) 2018, 2020 Peter Johansson
    55
    66  The yat library is free software; you can redistribute it and/or
     
    159159  {
    160160    add(prog + "Version", version);
     161  }
     162
     163
     164  void VcfHeader::erase(size_t i)
     165  {
     166    assert(i+1 < lines_.size());
     167    lines_.erase(lines_.begin()+i);
    161168  }
    162169
  • trunk/yat/omic/VcfHeader.h

    r3855 r3891  
    100100
    101101    /**
     102       \brief erase line \a line
     103
     104       The last line, starting with '\#CHROM', cannot be erased. Use
     105       function samples(const std::vector<std::string>&) to alter that
     106       line.
     107    */
     108    void erase(size_t line);
     109
     110    /**
    102111       \return the last line of the header
    103112     */
     
    121130    /**
    122131       Sort lines
     132
     133       Lines are sorted with respect to their categories
     134       a) \c '\#\#fileformat='
     135       b) \c '\#\#reference=' and \c '\#\#contig='
     136       c) \c '\#\#INFO='
     137       d) \c '\#\#FILTER='
     138       e) \c '\#\#FORMAT='
     139       f) other
     140       g) \c '\#CHROM'
    123141    */
    124142    void nicify(void);
Note: See TracChangeset for help on using the changeset viewer.