本文整理汇总了C++中Scaffold类的典型用法代码示例。如果您正苦于以下问题:C++ Scaffold类的具体用法?C++ Scaffold怎么用?C++ Scaffold使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Scaffold类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
void Scaffold::extend_5(const Scaffold& other)
{
assert(Scaffold::compatible(*this, other, ref_merge_overhang_tolerance));
if (strand() == CUFF_FWD)
{
AugmentedCuffOp& my_first_op = _augmented_ops.front();
const AugmentedCuffOp& other_first_op = other.augmented_ops().front();
my_first_op.g_left(other_first_op.g_left());
}
else if (strand() == CUFF_REV)
{
AugmentedCuffOp& my_last_op = _augmented_ops.back();
const AugmentedCuffOp& other_last_op = other.augmented_ops().back();
my_last_op.g_right(other_last_op.g_right());
}
else
{
assert(false);
}
int id_length = annotated_trans_id().length();
if (id_length < 4 || _annotated_trans_id.substr(id_length-4)!="_ext")
_annotated_trans_id += "_ext";
}
示例2: computerMove
void computerMove(Scaffold& s, int color, int& winner, int N, double& score, int& depth, Timer& timer)
{
int DEPTH_MAX = 100;
// does all the same things as the opponentMove but in regards to the opposite color
//if (depth % 2 == 0)
//if (timer.elapsed() > 1900)
//DEPTH_MAX = depth-11;
for (int i = 1; i <= s.cols(); i++) {
if (!s.makeMove(i, color))
continue;
depth++;
int outcome = completed(s, winner, N, color, i);
if (outcome && winner == color){
cout << "Computer can win in " << depth << " moves!" << endl;
score += 10000 - depth;
s.undoMove(); depth--;
}
else if (outcome && winner == TIE_GAME) {
score += 1;
s.undoMove(); depth--;
}
else{
if (depth < DEPTH_MAX)
opponentMove(s, !color, winner, N, score, depth, timer);
else s.undoMove();
}
}
return;
}
示例3: chooseMove
int SmartPlayerImpl::chooseMove(const Scaffold& s, int N, int color)
{
timer.start(); // start tracking time...
if (s.numberEmpty() == (s.cols() * s.levels())) return s.cols() / 2 + 1; // If comp is the first to go, place peice nearest to the center
int m = bestMove(s, N, color, timer);
return m;
}
示例4: opponentMove
void opponentMove(Scaffold& s, int color, int& winner, int N, double& score, int& depth, Timer& timer)
{
int DEPTH_MAX = 100; // keep track of how many times we call this function
// since leaving the original for loop.
//if (depth % 2 == 0)
//if (timer.elapsed() > 1900) // checks on the elapsed time intermittently
//DEPTH_MAX = depth-1; // if the time is almost up, set a max for the depth
// if there is a move that can win the game for
for (int i = 1; i <= s.cols(); i++) { // this player in the next move, prioritize that
if (!s.makeMove(i, color))
continue;
depth++;
int outcome = completed(s, winner, N, color, i);
if (outcome && winner == color){
cout << "Opponent can win in " << depth << " moves!" << endl;
score += -10000 + depth;
s.undoMove(); depth--;
}
else if (outcome && winner == TIE_GAME) {
score += 1;
s.undoMove(); depth--;
}
else {
if (depth < DEPTH_MAX) // while the depth isn't insanely high, continue entering recursion
computerMove(s, !color, winner, N, score, depth, timer);
else s.undoMove();
}
}
return;
}
示例5: compareOriented
int ScaffoldComparer::compareOriented(const Scaffold &a, const Scaffold &b)
{
map<int, int> pos;
int aSize = a.ContigCount(), bSize = b.ContigCount(), mismatch = 0;
for (int i = 0; i < bSize; i++)
pos[b[i].Id] = i;
for (int i = 1; i < aSize; i++)
{
ScaffoldContig p = a[i - 1], q = a[i];
if (pos.find(p.Id) == pos.end() || pos.find(q.Id) == pos.end())
{
mismatch++;
continue;
}
if (pos[p.Id] > pos[q.Id])
{
mismatch++;
continue;
}
if ((b[pos[p.Id]].T ^ b[pos[q.Id]].T) != (p.T ^ q.T))
{
mismatch++;
continue;
}
}
return mismatch;
}
示例6: next_priming_site
bool UniformRandomPriming::next_priming_site(const Scaffold& molecule,
int& priming_site)
{
do {
priming_site = molecule.length() * _uniform_generator();
} while (priming_site < read_length ||
!molecule.is_in_match(priming_site - 1) ||
!molecule.is_in_match(priming_site - read_length));
return true;
}
示例7: rate
int rate(const Scaffold& s, int N, int color)
{
for (int i=1;i<=s.rows();i++)
{
for (int j=1;j<=s.cols();j++)
{
if (horizontal(s,N,i,j,color)||vertical(s,N,i,j,color)||updiag(s,N,i,j,color)||downdiag(s,N,i,j,color)) //check all the conditions of victory
return (s.rows()*s.cols() - s.numberEmpty()); //this will be useful for evaluating the depth
}
}
return 0;
}
示例8: scaff_smaller_lt_rt
bool scaff_smaller_lt_rt(const Scaffold& lhs, const Scaffold& rhs)
{
size_t lhs_len = lhs.right() - lhs.left();
size_t rhs_len = rhs.right() - rhs.left();
if (lhs_len != rhs_len)
{
return lhs_len < rhs_len;
}
else
{
return scaff_lt_rt(lhs, rhs);
}
return false;
}
示例9: compress_consitutive
void compress_consitutive(vector<Scaffold>& hits)
{
vector<bool> scaffold_mask;
verbose_msg("%s\tBuilding constitutivity mask\n", bundle_label->c_str());
scaffold_mask = vector<bool>(hits.size(), false);
add_non_constitutive_to_scaffold_mask(hits, scaffold_mask);
vector<Scaffold> constitutive;
vector<Scaffold> non_constitutive;
for (size_t i = 0; i < scaffold_mask.size(); ++i)
{
if (!scaffold_mask[i])
constitutive.push_back(hits[i]);
else
non_constitutive.push_back(hits[i]);
}
size_t pre_compress = hits.size();
hits.clear();
if (!constitutive.empty())
{
Scaffold compressed = Scaffold(constitutive);
vector<Scaffold> completes;
compressed.fill_gaps(2 * olap_radius);
compressed.get_complete_subscaffolds(completes);
hits.insert(hits.end(), completes.begin(), completes.end());
}
fill_unambiguous_unknowns(non_constitutive, hits);
hits.insert(hits.end(), non_constitutive.begin(), non_constitutive.end());
sort(hits.begin(), hits.end(), scaff_lt);
size_t post_compress = hits.size();
size_t delta = pre_compress - post_compress;
double collapse_ratio = delta / (double) pre_compress;
verbose_msg("%s\tCompressed %lu of %lu constitutive fragments (%lf percent)\n",
bundle_label->c_str(),
delta,
pre_compress,
collapse_ratio);
}
示例10: weight_of_merge
long long weight_of_merge(Scaffold& lhs,
Scaffold& rhs,
double source_psi,
double target_psi)
{
//double expected_cov_diff = max(1.0, 0.1 * (source_doc + target_doc));
//normal cov_norm(0, expected_cov_diff);
normal cov_test_norm(0, 1.0);
double score = 0.0;
// HACK: This early breakout prevents spliced reads that cross exactly one
// intron from being matched up if they both cross the same intron.
// Otherwise, we get phasing problems, as introns aren't matched up long
// distance. Ugh..
if (Scaffold::overlap_in_genome(lhs, rhs, 0))
{
bool lh_intron = lhs.has_intron();
bool rh_intron = rhs.has_intron();
if (lh_intron && rh_intron)
{
vector<pair<int, int> > lh_gaps = lhs.gaps();
vector<pair<int, int> > rh_gaps = rhs.gaps();
if (lh_gaps.size() == 1 && lh_gaps == rh_gaps)
return 999999999;
}
}
if (source_psi > 0 && target_psi > 0 )
{
double test_stat = log(1.0 - abs(source_psi - target_psi));
score = test_stat;
assert (score <= 0.0);
}
else
{
return 999999999;
}
assert (score <= 0.0);
if (score >= -1e-6)
score = -1e-6;
int weight = (int)(score * -1e6);
return weight;
}
示例11: graph
vector<Scaffold> ScaffoldExtractor::Extract(const DataStore &store, const GASolver &solver)
{
vector<Scaffold> ans;
vector< vector<int> > components;
DPGraph graph(store, solver.T);
graph.FindConnectedComponents(components);
for (int i = 0; i < (int)components.size(); i++)
{
int size = components[i].size();
Scaffold scaffold;
for (int j = 0; j < size; j++)
scaffold.AddContig(components[i][j], solver.T[components[i][j]], solver.X[components[i][j]], store[components[i][j]].Sequence.Nucleotides.length());
scaffold.Sort();
ans.push_back(scaffold);
}
return ans;
}
示例12: preProcessTranscript
void BiasLearner::preProcessTranscript(const Scaffold& transcript)
{
if (transcript.strand()==CUFF_STRAND_UNKNOWN || transcript.fpkm() < 1 || transcript.seq()=="")
return;
vector<double> startHist(transcript.length()+1, 0.0); // +1 catches overhangs
vector<double> endHist(transcript.length()+1, 0.0);
foreach (const MateHit* hit_p, transcript.mate_hits())
{
const MateHit& hit = *hit_p;
if (!hit.left_alignment() && !hit.right_alignment())
continue;
double mass = hit.mass();
int start;
int end;
int frag_len;
transcript.map_frag(hit, start, end, frag_len);
startHist[start] += mass;
endHist[end] += mass;
}
processTranscript(startHist, endHist, transcript);
}
示例13: downdiag
bool downdiag(const Scaffold& s, int N, int r, int c, int color)
{
for (int i=r,j=c;i<r+N,j<c+N;i++,j++)
{
if (s.checker(j,i)!=color)
return false;
}
return true;
}
示例14: OrientationDistance
int ScaffoldComparer::OrientationDistance(const Scaffold &a, const Scaffold &b)
{
map<int, bool> orientation;
int aSize = a.ContigCount(), bSize = b.ContigCount(), mismatchForward = 0, mismatchReverse = 0;
for (int i = 0; i < bSize; i++)
orientation[b[i].Id] = b[i].T;
for (int i = 1; i < aSize; i++)
{
int id = a[i].Id;
if (orientation.find(id) == orientation.end())
mismatchForward++, mismatchReverse++;
else if (a[i].T == orientation[id])
mismatchReverse++;
else
mismatchForward++;
}
return min(mismatchForward, mismatchReverse);
}
示例15: updiag
bool updiag(const Scaffold& s, int N, int r, int c, int color)
{
for (int i=r,j=c;i>r-N,j<c+N;i--,j++)
{
if (s.checker(j,i)!=color)
return false;
}
return true;
}