Commit 434524d9 authored by Carsten Kemena's avatar Carsten Kemena

[SeqFunctions] moved function to cpp

parent 777a0cdb
......@@ -79,6 +79,10 @@ ADD_DEFINITIONS( "-DHAS_BOOST" )
set(annotationCPP Feature.cpp BlastHit.cpp FeatureSet.cpp OrthologySet.cpp)
PREPEND(annotationCPP "${CMAKE_CURRENT_SOURCE_DIR}/src/annotation" ${annotationCPP})
# The sequence module
set(sequenceCPP SeqFunctions.cpp)
PREPEND(sequenceCPP "${CMAKE_CURRENT_SOURCE_DIR}/src/sequence" ${sequenceCPP})
# The domain module
set(domainCPP Domain.cpp DomainExt.cpp PfamDomain.cpp SFDomain.cpp DomainArrangementSet.cpp DomainArrangement.cpp )
PREPEND(domainCPP "${CMAKE_CURRENT_SOURCE_DIR}/src/domain" ${domainCPP})
......@@ -103,7 +107,7 @@ PREPEND(externalCPP "${CMAKE_CURRENT_SOURCE_DIR}/src/external" ${externalCPP})
set(drawCPP SVG_Drawer.cpp DA_drawer.cpp)
PREPEND(drawCPP "${CMAKE_CURRENT_SOURCE_DIR}/src/draw" ${drawCPP})
set(SOURCE_FILES ${annotationCPP} ${external_interfacesCPP} ${externalCPP} ${phylogenyCPP} ${utilityCPP} ${domainCPP} ${drawCPP})
set(SOURCE_FILES ${sequenceCPP} ${annotationCPP} ${external_interfacesCPP} ${externalCPP} ${phylogenyCPP} ${utilityCPP} ${domainCPP} ${drawCPP})
IF (CURL_FOUND)
set(SOURCE_FILES ${SOURCE_FILES} ${webserviceCPP})
ENDIF(CURL_FOUND)
......
......@@ -600,39 +600,7 @@ calc_HCA_clusters(const SequenceType &seq, const std::unordered_set<char> &hydro
std::vector<float>
calc_HCA_percentages(const std::vector<short> &translated)
{
// calculate percentages
std::vector<float> percentages;
auto seq_length = translated.size();
percentages.reserve(seq_length);
int n_hydrophobic = 0;
size_t until = (seq_length > 9) ? 9 : seq_length;
int n_total = 0;
for (size_t i=0; i<until; ++i)
{
n_hydrophobic += translated[i];
++n_total;
}
until = (seq_length > 9) ? seq_length-8 : 0;
percentages.push_back(n_hydrophobic*1.0/n_total);
for (size_t i=1; i<seq_length; ++i)
{
if (i > 8)
{
n_hydrophobic -= translated[i-9];
--n_total;
}
if (i < until)
{
n_hydrophobic += translated[i+8];
++n_total;
}
percentages.push_back(n_hydrophobic*1.0/n_total);
}
return percentages;
}
calc_HCA_percentages(const std::vector<short> &translated);
template<typename SequenceType>
......
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