Changeset 2482


Ignore:
Timestamp:
Apr 25, 2011, 12:17:19 AM (12 years ago)
Author:
Peter
Message:

new class GFF. closes #647

Location:
trunk
Files:
7 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/gff.cc

    r2453 r2482  
    2222#include "Suite.h"
    2323
     24#include "yat/omic/GFF2.h"
     25#include "yat/omic/GFF3.h"
     26
     27#include <fstream>
     28
    2429using namespace theplu::yat;
     30using namespace omic;
     31
     32template<typename T>
     33void avoid_pedantic_warning(T t) {}
     34
     35void gff2(test::Suite&);
     36void gff3(test::Suite&);
     37
     38template<class T>
     39void test_gff(test::Suite&, GFF&);
    2540
    2641int main(int argc, char* argv[])
     
    2843  test::Suite suite(argc, argv);
    2944
     45  gff2(suite);
     46  gff3(suite);
     47
    3048  return suite.return_value();
    3149}
     50
     51
     52void test_gff(test::Suite& suite, GFF& gff)
     53{
     54  std::string seqid = gff.seqid();
     55  std::string source = gff.source();
     56  std::string type = gff.type();
     57  avoid_pedantic_warning<const std::string&>(gff.start());
     58  avoid_pedantic_warning<const std::string&>(gff.end());
     59  avoid_pedantic_warning<const std::string&>(gff.score());
     60  avoid_pedantic_warning<const std::string&>(gff.strand());
     61  avoid_pedantic_warning<const std::string&>(gff.phase());
     62  const std::map<std::string, std::string>& m = gff.attributes();
     63  avoid_pedantic_warning(m);
     64}
     65
     66void gff2(test::Suite& suite)
     67{
     68  suite.out() << "testing GFF2\n";
     69  std::ifstream is(test::filename("data/small.gff2").c_str());
     70  assert(is);
     71  GFF2 gff2;
     72  suite.add(getline(is, gff2));
     73  test_gff(suite, gff2);
     74  const std::string& a = gff2.attribute("genotype");
     75  if (!suite.add(a=="T or C"))
     76    suite.err() << "incorrect genotype value: `" << a << "'\n"
     77                << "expected: `T or C'\n";
     78  is.close();
     79}
     80
     81void gff3(test::Suite& suite)
     82{
     83  suite.out() << "testing GFF3\n";
     84  std::ifstream is(test::filename("data/small.gff3").c_str());
     85  assert(is);
     86  GFF3 gff3;
     87  if (!suite.add(getline(is, gff3)))
     88    suite.err() << "getline failed\n";
     89  test_gff(suite, gff3);
     90  const std::string& a = gff3.attribute("genotype");
     91  if (!suite.add(a=="T"))
     92    suite.err() << "incorrect genotype value: `" << a << "'\n"
     93                << "expected: `T'\n";
     94  is.close();
     95}
  • trunk/yat/omic/Makefile.am

    r2368 r2482  
    33## $Id$
    44
    5 # Copyright (C) 2010 Peter Johansson
     5# Copyright (C) 2010, 2011 Peter Johansson
    66#
    77# This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2525libomic_la_SOURCES += DNA.cc
    2626libomic_la_SOURCES += GenomicPosition.cc
     27libomic_la_SOURCES += GFF.cc
     28libomic_la_SOURCES += GFF2.cc
     29libomic_la_SOURCES += GFF3.cc
    2730
    2831include_omicdir = $(includedir)/yat/omic
     
    3235include_omic_HEADERS += DNA.h
    3336include_omic_HEADERS += GenomicPosition.h
     37include_omic_HEADERS += GFF.h
     38include_omic_HEADERS += GFF2.h
     39include_omic_HEADERS += GFF3.h
    3440
    3541DISTCLEANFILES = doxygen.mk
Note: See TracChangeset for help on using the changeset viewer.