本文整理汇总了C++中Gene::getId方法的典型用法代码示例。如果您正苦于以下问题:C++ Gene::getId方法的具体用法?C++ Gene::getId怎么用?C++ Gene::getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gene
的用法示例。
在下文中一共展示了Gene::getId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: simulateGenome
void FONSEModel::simulateGenome(Genome & genome)
{
unsigned codonIndex;
std::string curAA;
std::string tmpDesc = "Simulated Gene";
for (unsigned geneIndex = 0; geneIndex < genome.getGenomeSize(); geneIndex++) //loop over all genes in the genome
{
if (geneIndex % 100 == 0) my_print("Simulating Gene %\n", geneIndex);
Gene gene = genome.getGene(geneIndex);
SequenceSummary sequenceSummary = gene.geneData;
std::string tmpSeq = "ATG"; //Always will have the start amino acid
unsigned mixtureElement = getMixtureAssignment(geneIndex);
unsigned mutationCategory = getMutationCategory(mixtureElement);
unsigned selectionCategory = getSelectionCategory(mixtureElement);
unsigned synthesisRateCategory = getSynthesisRateCategory(mixtureElement);
double phi = getSynthesisRate(geneIndex, synthesisRateCategory, false);
std::string geneSeq = gene.getSequence();
for (unsigned position = 1; position < (geneSeq.size() / 3); position++)
{
std::string codon = geneSeq.substr((position * 3), 3);
curAA = SequenceSummary::codonToAA(codon);
//TODO: Throw an error here instead
if (curAA == "X") {
if (position < (geneSeq.size() / 3) - 1) my_print("Warning: Internal stop codon found in gene % at position %. Ignoring and moving on.\n", gene.getId(), position);
continue;
}
unsigned numCodons = SequenceSummary::GetNumCodonsForAA(curAA);
double* codonProb = new double[numCodons](); //size the arrays to the proper size based on # of codons.
double* mutation = new double[numCodons - 1]();
double* selection = new double[numCodons - 1]();
if (curAA == "M" || curAA == "W")
{
codonProb[0] = 1;
}
else
{
getParameterForCategory(mutationCategory, FONSEParameter::dM, curAA, false, mutation);
getParameterForCategory(selectionCategory, FONSEParameter::dOmega, curAA, false, selection);
calculateCodonProbabilityVector(numCodons, position, mutation, selection, phi, codonProb);
}
codonIndex = Parameter::randMultinom(codonProb, numCodons);
unsigned aaStart, aaEnd;
SequenceSummary::AAToCodonRange(curAA, aaStart, aaEnd, false); //need the first spot in the array where the codons for curAA are
codon = sequenceSummary.indexToCodon(aaStart + codonIndex);//get the correct codon based off codonIndex
tmpSeq += codon;
}
std::string codon = sequenceSummary.indexToCodon((unsigned)Parameter::randUnif(61.0, 64.0)); //randomly choose a stop codon, from range 61-63
tmpSeq += codon;
Gene simulatedGene(tmpSeq, tmpDesc, gene.getId());
genome.addGene(simulatedGene, true);
}
}