Commit 6758aa06 authored by Carsten Kemena's avatar Carsten Kemena

Merge branch 'develop-ck' into 'master'

Develop ck

See merge request !14
parents ccb16af0 78d53f95
Pipeline #626 failed with stages
in 6 seconds
cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 3.2)
# onec cmake 3 will be used
#set(CMAKE_CXX_STANDARD 11)
#set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_compile_options(-std=c++11)
project (BioSeqDataLib_TESTS CXX)
SET(MAJOR_VERSION 1)
SET(MINOR_VERSION 0)
SET(PATCH_VERSION 0)
SET(MAJOR_VERSION 0)
SET(MINOR_VERSION 9)
SET(PATCH_VERSION 9)
SET(CMAKE_CXX_FLAGS_COVERAGE
"-g -O0 --coverage -fprofile-arcs -ftest-coverage -fno-inline -fno-inline-small-functions -fno-default-inline -pedantic -Wall -Wextra" # -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wnoexcept -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=5 -Wswitch-default -Wundef -Werror -Wno-unused"
......@@ -40,7 +40,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
endif ()
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wextra -Wunused -pedantic -Wall -Wextra")# -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wnoexcept -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wsign-conversion -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=5 -Wswitch-default -Wundef -Werror -Wno-unused")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wextra -Wunused")# -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wnoexcept -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wsign-conversion -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=5 -Wswitch-default -Wundef -Werror -Wno-unused")
endif ()
#message(${CMAKE_CXX_FLAGS})
#-Wshadow
......
This diff is collapsed.
......@@ -48,7 +48,7 @@ template <typename D>
void
insertGaps(DomainArrangementSet<D> &domSet, const std::string &editString)
{
D emptyDomain;;
D emptyDomain;
for (auto &pair : domSet)
{
auto &arrangement = pair.second;
......
......@@ -88,7 +88,7 @@ namespace BioSeqDataLib
* @param simMat The similarity matrix.
* @param matrix The dynamic programming matrix.
*/
template<typename SeqType, typename SimMat, typename DataType>
template<typename SeqType, typename SimMat, typename DataType>
void
initNwMatrix(const SeqType &seq1, const SeqType &seq2, const SimMat &simMat, LineMatrix<std::pair<DataType, char> > &matrix)
{
......
......@@ -40,8 +40,30 @@ namespace BioSeqDataLib
*
* \mainpage
*
* The BioSeqDataLib has been developed to provide an easy access to biological data. Its main focus is on domain data however it contains several classes to deal with other (mainly sequence) data.
* The BioSeqDataLib (BSDL) has been developed to provide an easy access to biological data. Its main focus is on domain data however it
* contains several classes to deal with other (mainly sequence) data.
*
* ## Modules
* The BSDL currently consists of three main modules taking care of three areas of Bioinformatics.
*
* ### Sequence module
*
* The sequence module contains mainly classes and functions that are related to reading, writing and analysing sequence data. A range of
* different Input formats are currently supported.
*
* ### Domain module
*
* The domain module contains classes and functions to reading and writing of domain data. A range of
* different Input formats are currently supported.
*
* ### Phylogeny module
*
* The phylogeny module provides a class to read a phylogenetic tree and allows to traverse it in different ways.
*/
/*
# test
*/
......
......@@ -638,7 +638,7 @@ DomainArrangementSet<DomainType>::_writeXDomFormat(std::ofstream &outFile, const
outFile << ">" << pair.first << " " << seqSet[pair.first].length() << "\n";
for (auto &dom : pair.second)
{
outFile << dom.start() << " " << dom.end() << " " << dom.accession() << " " << dom.evalue() << "\n";
outFile << dom.start()+1 << " " << dom.end()+1 << " " << dom.accession() << " " << dom.evalue() << "\n";
}
}
}
......@@ -653,7 +653,7 @@ DomainArrangementSet<DomainType>::_writeXDomFormat(std::ofstream &outFile) const
outFile << ">" << pair.first << "\n";
for (auto &dom : pair.second)
{
outFile << dom.start() << " " << dom.end() << " " << dom.accession() << " " << dom.evalue() << "\n";
outFile << dom.start()+1 << " " << dom.end()+1 << " " << dom.accession() << " " << dom.evalue() << "\n";
}
}
}
......@@ -946,7 +946,7 @@ DomainArrangementSet<DomainType>::_readXDOMFormat(AP::Input &inFile)
else
{
auto tokens = split(line, " ");
it->second.emplace_back(tokens[2], stoul(tokens[0]), stoul(tokens[1]), stod(tokens[3]));
it->second.emplace_back(tokens[2], stoul(tokens[0])-1, stoul(tokens[1])-1, stod(tokens[3]));
}
}
}
......
......@@ -37,7 +37,7 @@
#include <utility>
// BioSeqDataLib header
#include "../align/nw_gotoh.hpp"
#include "../align/AlignmentMatrix.hpp"
#ifndef SEQSETFUNCTIONS_HPP_
#define SEQSETFUNCTIONS_HPP_
......@@ -123,12 +123,13 @@ avgId(const SequenceSetType &set, const SimilarityMatrix<float> &simMat)
{
float id=0;
size_t nSeqs = set.size();
MatrixStack<3, std::pair<float, char> > dynMat(1,1);
//MatrixStack<3, std::pair<float, char> > dynMat(1,1);
std::string editString1, editString2;
std::string::size_type len;
size_t j,k;
size_t pos1, pos2;
size_t same, total;
AlignmentMatrix<float, SimilarityMatrix<float> > dynMat(-11,-1, simMat);
for (size_t i=0; i<nSeqs; ++i)
{
const typename SequenceSetType::value_type &seq1 = set[i];
......@@ -137,27 +138,31 @@ avgId(const SequenceSetType &set, const SimilarityMatrix<float> &simMat)
editString1.clear();
editString2.clear();
const typename SequenceSetType::value_type &seq2 = set[j];
initGotohMatrix(seq1, seq2, simMat, dynMat);
runGotoh(dynMat, seq1.size(), seq2.size(), -11, -1);
gotohTraceback(dynMat, seq1.size(), seq2.size(), editString1, editString2);
len=editString1.size();
pos1=seq1.size();
pos2=seq2.size();
dynMat.gotoh(seq1, seq2);
//initGotohMatrix(seq1, seq2, simMat, dynMat);
//runGotoh(dynMat, seq1.size(), seq2.size(), -11, -1);
//gotohTraceback(dynMat, seq1.size(), seq2.size(), editString1, editString2);
const auto &result = dynMat.result();
len=result.size();
//pos1=seq1.size();
//pos2=seq2.size();
same=0;
total=0;
const auto &editString1 = result.eS1;
const auto &editString2 = result.eS2;
for (k=0; k<len; ++k)
{
if ((editString1[k]=='m') && (editString2[k]=='m'))
if ((editString1[k] != -1) && (editString2[k] != -1))
{
if (std::tolower(seq1[--pos1]) == std::tolower(seq2[--pos2]))
if (std::tolower(seq1[editString1[k]]) == std::tolower(seq2[editString2[k]]))
++same;
++total;
}
else
{
if (editString1[k]=='m')
if (editString1[k] != -1)
--pos1;
if (editString2[k]=='m')
if (editString2[k] != -1)
--pos2;
}
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -29,3 +29,4 @@
#include "NwGotohTest.hpp"
#include "SwTest.hpp"
#include "msaTest.hpp"
#include "AlignmentMatrix_Test.hpp"
......@@ -42,7 +42,6 @@ BOOST_AUTO_TEST_CASE( OrthologySet_TestOrthoMCL)
BOOST_CHECK_EQUAL(value["pbar"].size(), 1);
BOOST_CHECK_EQUAL(value["sinv"][0],"SINV10854-PA");
const BioSeqDataLib::OrthologySet &set2 = set;
value = set2["2ants1001"];
BOOST_CHECK_EQUAL(value["sinv"].size(), 50 );
......
......@@ -159,8 +159,8 @@ BOOST_AUTO_TEST_CASE( DomainArrangement_readXDOM_Test )
const BioSeqDataLib::DomainExt &dom = da[1];
BOOST_CHECK_EQUAL(dom.accession(), "PF00002");
BOOST_CHECK_EQUAL(dom.start(), 20);
BOOST_CHECK_EQUAL(dom.end(), 40);
BOOST_CHECK_EQUAL(dom.start(), 19);
BOOST_CHECK_EQUAL(dom.end(), 39);
......
......@@ -108,9 +108,9 @@ BOOST_AUTO_TEST_CASE( AlignmentFunction_Test )
BOOST_CHECK_EQUAL(aln3[1].seq(), "TVL-LSPSY");
BioSeqDataLib::Alignment<BioSeqDataLib::Sequence<> > alnIdentity;
alnIdentity.push_back(new BioSeqDataLib::Sequence<>("Seq1","ACGt", "", "test sequence"));
alnIdentity.push_back(new BioSeqDataLib::Sequence<>("Seq2","AcGt", "", "test sequence"));
alnIdentity.push_back(new BioSeqDataLib::Sequence<>("Seq3","A-et", "", "test sequence"));
alnIdentity.push_back(BioSeqDataLib::Sequence<>("Seq1","ACGt", "", "test sequence"));
alnIdentity.push_back(BioSeqDataLib::Sequence<>("Seq2","AcGt", "", "test sequence"));
alnIdentity.push_back(BioSeqDataLib::Sequence<>("Seq3","A-et", "", "test sequence"));
BioSeqDataLib::TwoValues vals = BioSeqDataLib::identity(alnIdentity);
BOOST_CHECK_EQUAL(vals.first(), 8);
BOOST_CHECK_EQUAL(vals.second(), 10);
......
......@@ -157,7 +157,7 @@ BOOST_AUTO_TEST_CASE( Sequence_changing_Test)
BOOST_CHECK_EQUAL(set2.find("seq2")->name(), "seq2");
BioSeqDataLib::Sequence<> *tmpSeq = new BioSeqDataLib::Sequence<>("seq3", "ACGT", "", "");
BioSeqDataLib::Sequence<> tmpSeq("seq3", "ACGT", "", "");
set1.push_back(tmpSeq);
BOOST_CHECK_EQUAL(set1.size(), 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment