本文整理汇总了C++中Seq类的典型用法代码示例。如果您正苦于以下问题:C++ Seq类的具体用法?C++ Seq怎么用?C++ Seq使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Seq类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: EqIgnoreCase
bool Seq::EqIgnoreCase(const Seq &s) const
{
const unsigned n = Length();
if (n != s.Length())
{
return false;
}
for (unsigned i = 0; i < n; ++i)
{
const char c1 = at(i);
const char c2 = s.at(i);
if (IsGap(c1))
{
if (!IsGap(c2))
return false;
}
else
{
if (toupper(c1) != toupper(c2))
{
return false;
}
}
}
return true;
}
开发者ID:ggrekhov,项目名称:ugene,代码行数:26,代码来源:qscore_seq.cpp
示例2: read_test_data
void CWSInput1WithFeatureModelHandler<RNNDerived, I1Model>::predict(std::istream &is, std::ostream &os)
{
std::vector<Seq> raw_instances;
std::vector<IndexSeq> sents ;
std::vector<CWSFeatureDataSeq> cws_feature_seqs;
read_test_data(is, raw_instances, sents, cws_feature_seqs );
BOOST_LOG_TRIVIAL(info) << "do prediction on " << raw_instances.size() << " instances .";
BasicStat stat(true);
stat.start_time_stat();
for (unsigned int i = 0; i < raw_instances.size(); ++i)
{
Seq &raw_sent = raw_instances.at(i);
if (0 == raw_sent.size())
{
os << "\n";
continue;
}
IndexSeq &sent = sents.at(i) ;
CWSFeatureDataSeq &cws_feature_seq = cws_feature_seqs.at(i);
IndexSeq pred_tag_seq;
dynet::ComputationGraph cg;
i1m->predict(cg, sent, cws_feature_seq, pred_tag_seq);
Seq words ;
CWSTaggingSystem::static_parse_chars_indextag2word_seq(raw_sent, pred_tag_seq, words) ;
os << words[0] ;
for( size_t i = 1 ; i < words.size() ; ++i ) os << OutputDelimiter << words[i] ;
os << "\n";
stat.total_tags += pred_tag_seq.size() ;
}
stat.end_time_stat() ;
BOOST_LOG_TRIVIAL(info) << stat.get_stat_str("predict done.") ;
}
开发者ID:memeda,项目名称:sequence-labeling-by-nn,代码行数:33,代码来源:input1_with_feature_modelhandler_0628.hpp
示例3: empty
operator Seq<U,CA,A>() const
{
Seq<U,CA,A> result;
result.transfer( result.end(), values_ );
BOOST_ASSERT( empty() );
return result;
}
开发者ID:Mesagoppinmypants,项目名称:NGELinux,代码行数:7,代码来源:ptr_list_of.hpp
示例4: size
std::size_t size(const Seq& seq)
{
std::size_t d = 0;
for (typename Seq::const_iterator it=seq.begin(); it!=seq.end(); ++it)
d += boost::asio::buffer_size(*it);
return d;
}
开发者ID:alexeimoisseev,项目名称:NwSMTP,代码行数:7,代码来源:buffers.cpp
示例5: emit_sep
void emit_sep(
Seq const &s, std::size_t step, Printer &&p
)
{
auto iter(s.begin());
std::size_t c(0);
auto lc(std::min(s.size(), c + step));
if (lc) {
auto xc(c);
printf("\t\t");
p(*iter++);
for (++xc; xc < lc; ++xc) {
printf(", ");
p(*iter++);
}
}
c += lc;
for (; c < s.size(); c += step) {
printf(",\n");
lc = std::min(s.size(), c + step);
if (!lc)
break;
auto xc(c);
printf("\t\t");
p(*iter++);
for (++xc; xc < lc; ++xc) {
printf(", ");
p(*iter++);
}
}
}
开发者ID:oakad,项目名称:ucpf,代码行数:35,代码来源:gen_sbs_0.cpp
示例6: EstringOp
unsigned EstringOp(const short es[], const Seq &sIn, MSA &a)
{
unsigned uSymbols;
unsigned uIndels;
EstringCounts(es, &uSymbols, &uIndels);
assert(sIn.Length() == uSymbols);
unsigned uColCount = uSymbols + uIndels;
a.Clear();
a.SetSize(1, uColCount);
a.SetSeqName(0, sIn.GetName());
a.SetSeqId(0, sIn.GetId());
unsigned p = 0;
unsigned uColIndex = 0;
for (;;)
{
int n = *es++;
if (0 == n)
break;
if (n > 0)
for (int i = 0; i < n; ++i)
{
char c = sIn[p++];
a.SetChar(0, uColIndex++, c);
}
else
for (int i = 0; i < -n; ++i)
a.SetChar(0, uColIndex++, '-');
}
assert(uColIndex == uColCount);
return uColCount;
}
开发者ID:Unode,项目名称:ext_apps,代码行数:35,代码来源:estring.cpp
示例7: variance_pf
double variance_pf(Seq &sq) {
double av=0;
double var=0;
int h=0;
typename Seq::iterator it = sq.begin();
while(it != sq.end()) {
av+=*(it) * h;
var+=(*(it)) * h * h ;
it++;
h++;
}
var-=av*av;
if(var<1e-7)
return 0;
return var;
}
开发者ID:Aleyasen,项目名称:Alaki,代码行数:25,代码来源:combinatorics.cpp
示例8: Clear
void SeqVect::FromFASTAFile(TextFile &File)
{
Clear();
FILE *f = File.GetStdioFile();
for (;;)
{
char *Label;
unsigned uLength;
char *SeqData = GetFastaSeq(f, &uLength, &Label);
if (0 == SeqData)
return;
Seq *ptrSeq = new Seq;
for (unsigned i = 0; i < uLength; ++i)
{
char c = SeqData[i];
ptrSeq->push_back(c);
}
ptrSeq->SetName(Label);
push_back(ptrSeq);
delete[] SeqData;
delete[] Label;
}
}
开发者ID:cran,项目名称:muscle,代码行数:27,代码来源:seqvect.cpp
示例9: extract
static void extract(const jsonpack::value &v, char* json_ptr, Seq &value)
{
array_t arr = *v._arr;
value.clear();
for(const auto &it : arr)
{
#ifndef _MSC_VER
// Initialize before use
type_t val = {};
#else
type_t val;
#endif
if( json_traits<type_t&>::match_token_type(it) )
{
json_traits<type_t&>::extract(it, json_ptr, val);
value.insert(value.end(), val); //faster way in each container
}
else
{
throw type_error( "Array item type mismatch" );
}
}
}
开发者ID:kylemanna,项目名称:jsonpack,代码行数:25,代码来源:sequences.hpp
示例10: variance_func
double variance_func(Seq &sq) {
if (sq.empty())
return 0;
double av=0;
double var=0;
typename Seq::iterator it = sq.begin();
while(it != sq.end()) {
av+=*(it);
var+=(*(it))*(*(it));
it++;
}
av=av/sq.size();
var=var/sq.size();
var-=av*av;
if(var<1e-7)
return 0;
return var;
}
开发者ID:Aleyasen,项目名称:Alaki,代码行数:29,代码来源:combinatorics.cpp
示例11: purge
template<class Seq> void purge(Seq& c)
{
typename Seq::iterator i;
for(i = c.begin(); i != c.end(); ++i) {
delete *i;
*i = 0;
}
}
开发者ID:johnmichaloski,项目名称:CMSD,代码行数:8,代码来源:MTCAgentCmd.cpp
示例12: strings
inline Seq
strings (std::initializer_list<X> const& con)
{
Seq collected;
for (auto elm : con)
collected.push_back(elm);
return collected;
}
开发者ID:Ichthyostega,项目名称:Lumiera,代码行数:8,代码来源:generic-record-representation-test.cpp
示例13: Length
void SeqVect::ToFASTAFile(TextFile &File) const
{
unsigned uSeqCount = Length();
for (unsigned uSeqIndex = 0; uSeqIndex < uSeqCount; ++uSeqIndex)
{
Seq *ptrSeq = at(uSeqIndex);
ptrSeq->ToFASTAFile(File);
}
}
开发者ID:cran,项目名称:muscle,代码行数:9,代码来源:seqvect.cpp
示例14: Subst
static SCORE Subst(const Seq &seqA, const Seq &seqB, unsigned i, unsigned j)
{
assert(i < seqA.Length());
assert(j < seqB.Length());
unsigned uLetterA = seqA.GetLetter(i);
unsigned uLetterB = seqB.GetLetter(j);
return VTML_SP[uLetterA][uLetterB] + g_scoreCenter;
}
开发者ID:yathit,项目名称:molecular-biology-software,代码行数:9,代码来源:glbalignss.cpp
示例15: string_compare
inline int string_compare(const Seq& s, const C* p)
{
std::size_t i = 0;
while((i < s.size()) && (p[i] == s[i]))
{
++i;
}
return (i == s.size()) ? -p[i] : s[i] - p[i];
}
开发者ID:3309622938,项目名称:soundcloud-win-sharing,代码行数:9,代码来源:perl_matcher.hpp
示例16: checkPredecessorInSeqOneToFive
void checkPredecessorInSeqOneToFive(Seq& seq)
{
for (int i = 0; i < 4; ++i) {
seq.next();
EXPECT_EQ(i+1, seq.cpred());
}
for (int i = 1; i < 5; ++i) {
EXPECT_EQ(5-i, seq.cpred(i));
}
}
开发者ID:schickin,项目名称:Funcy,代码行数:10,代码来源:IteratorSeqTest.cpp
示例17: purge
/** to purge a STL container of pointers; only pointers owned by the container, ie for which second arg
corresponding value is true, are deleted.
\param a STL sequence container
\param a std::vector<bool>
*/
template<class Seq> void purge(Seq& c, const std::vector<bool>& isAllocatedIn)
{
typename Seq::iterator i;
std::vector<bool>::const_iterator it = isAllocatedIn.begin();
for (i = c.begin(); i != c.end(); ++i)
{
if (*it ++) delete *i;
*i = NULL;
}
}
开发者ID:bremond,项目名称:siconos,代码行数:15,代码来源:Tools.hpp
示例18: x_PredictAGSites
void x_PredictAGSites(const Seq& seq, CAntigenic::TLocVec& results,
int min_len)
{
// First build vector giving local average of Pa (over 7 residues).
// Along the way, calculate the average for the whole protein.
vector<double> Pa(seq.size());
double local_sum = 0, global_sum = 0;
for (int i = 0; i < 7; i++) {
local_sum += CAntigenic::sm_Pa_table[static_cast<unsigned>(seq[i])];
global_sum += CAntigenic::sm_Pa_table[static_cast<unsigned>(seq[i])];
}
Pa[3] = local_sum / 7;
for (unsigned int i = 4; i < seq.size() - 3; i++) {
local_sum -= CAntigenic::sm_Pa_table[static_cast<unsigned>(seq[i-4])];
local_sum += CAntigenic::sm_Pa_table[static_cast<unsigned>(seq[i+3])];
global_sum += CAntigenic::sm_Pa_table[static_cast<unsigned>(seq[i+3])];
Pa[i] = local_sum / 7;
}
double global_mean = global_sum / seq.size();
double thresh = min(global_mean, 1.0);
// now look for runs of Pa >= thresh of length >= min_len
int count = 0;
int begin = 0; // initialize to avoid compiler warning
// NOTE: we go one extra residue, in the knowledge that
// its Pa entry will be zero, so it will end any run
for (unsigned int i = 3; i < seq.size() - 2; i++) {
if (Pa[i] >= thresh) {
if (count == 0) {
begin = i; // the beginning of a run
}
count++;
} else {
// the end of a (possibly empty) run
if (count >= min_len) {
// an antigenic site
int end = i - 1;
CRef<objects::CSeq_loc> loc(new objects::CSeq_loc());
loc->SetInt().SetFrom(begin);
loc->SetInt().SetTo(end);
results.push_back(loc);
}
count = 0;
}
}
}
开发者ID:jackgopack4,项目名称:pico-blast,代码行数:55,代码来源:antigenic.cpp
示例19: ClearInvalidLetterWarning
void SeqVect::FixAlpha()
{
ClearInvalidLetterWarning();
unsigned uSeqCount = Length();
for (unsigned uSeqIndex = 0; uSeqIndex < uSeqCount; ++uSeqIndex)
{
Seq *ptrSeq = at(uSeqIndex);
ptrSeq->FixAlpha();
}
ReportInvalidLetters();
}
开发者ID:cran,项目名称:muscle,代码行数:11,代码来源:seqvect.cpp
示例20: Copy
void Seq::Copy(const Seq &rhs)
{
clear();
const unsigned uLength = rhs.Length();
for (unsigned uColIndex = 0; uColIndex < uLength; ++uColIndex)
push_back(rhs.at(uColIndex));
const char *ptrName = rhs.GetName();
size_t n = strlen(ptrName) + 1;
m_ptrName = new char[n];
strcpy(m_ptrName, ptrName);
}
开发者ID:ggrekhov,项目名称:ugene,代码行数:11,代码来源:qscore_seq.cpp
注:本文中的Seq类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论