本文整理汇总了C++中Alphabet::lookup方法的典型用法代码示例。如果您正苦于以下问题:C++ Alphabet::lookup方法的具体用法?C++ Alphabet::lookup怎么用?C++ Alphabet::lookup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Alphabet
的用法示例。
在下文中一共展示了Alphabet::lookup方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: match
bool Application::match(const String &pattern,EmissionSequence &S,
int begin,int len)
{
int end=begin+len;
for(int i=begin ; i<end ; ++i)
if(S[i].getDiscrete(0)!=alphabet.lookup(pattern[i-begin])) return false;
return true;
}
示例2: main
int Application::main(int argc,char *argv[])
{
// Process command line
cmd=new CommandLine(argc,argv,"");
if(cmd->numArgs()!=2)
throw String("\ndelete-target-gaps <in.maf> <target-name>\n");
String mafFile=cmd->arg(0);
String targetName=cmd->arg(1);
// Setting up alphabet
alphabet=&DnaDashDotAlphabet::global();
gapSymbols.addMember(alphabet->lookup('-'));
gapSymbols.addMember(alphabet->lookup('.'));
gapSymbols.addMember(alphabet->lookup('N'));
alphabetMap=new DropGapMapping(*alphabet,PureDnaAlphabet::global());
// Load the alignments
//int rootID=phylogeny->getRoot()->getID();
alignment=NULL;
ifstream is(mafFile.c_str());
if(!is.good()) throw String("Can't open file ")+mafFile;
while(!is.eof()) {
MultiAlignment *a=new MultiAlignment;
a->loadMAF(is);
if(a->getNumTracks()>0) {
a->toupper();
MultSeqAlignment *m=new MultSeqAlignment(*a,*alphabet,gapSymbols);
int rootID=m->getTrackByName(targetName).getID();
m->deleteTargetGaps(rootID);
if(!alignment) alignment=m;
else {
alignment->append(*m);
delete m;
}
}
delete a;
}
is.close();
// Emit the processed alignment
alignment->printSlice(cout,0,alignment->getLength(),'+',60);
return 0;
}
示例3: loadIntergenic
void Application::loadIntergenic(const BOOM::String &filename)
{
Alphabet &alphabet=DnaAlphabet::global();
ContentSensor *fullModel=ContentSensor::load(filename);
char base[2];
base[1]='\0';
for(int s=0 ; s<5 ; ++s)
{
base[0]=alphabet.lookup(s);
Sequence seq(base,alphabet);
intergenicModel[s]=
fullModel->scoreSingleBase(seq,BOOM::String(base),0,seq[0],base[0]);
}
delete fullModel;
}
示例4: writeOutput
void Application::writeOutput(const BOOM::String &tataFile,
const BOOM::String &outfile)
{
// Load TATA model
SignalSensor *tata=SignalSensor::load(tataFile,GC);
// Create output file and write header
ofstream os(outfile.c_str());
os.precision(8);
os<<"TataCapModel"<<endl;
os<<minSeparation<<"\t"<<maxSeparation<<endl;
// Write out the TATA model
tata->save(os);
// Write out the intergenic model
Alphabet &alphabet=DnaAlphabet::global();
os<<"MC\nINTERGENIC\n0\t0\t1\n5"<<endl;
os<<"A\n"<<intergenicModel[alphabet.lookup('A')]<<endl;
os<<"C\n"<<intergenicModel[alphabet.lookup('C')]<<endl;
os<<"G\n"<<intergenicModel[alphabet.lookup('G')]<<endl;
os<<"N\n"<<intergenicModel[alphabet.lookup('N')]<<endl;
os<<"T\n"<<intergenicModel[alphabet.lookup('T')]<<endl;
os<<"MC\nINTERGENIC\n0\t0\t1\n5"<<endl;
os<<"A\n"<<intergenicModel[alphabet.lookup('T')]<<endl;
os<<"C\n"<<intergenicModel[alphabet.lookup('G')]<<endl;
os<<"G\n"<<intergenicModel[alphabet.lookup('C')]<<endl;
os<<"N\n"<<intergenicModel[alphabet.lookup('N')]<<endl;
os<<"T\n"<<intergenicModel[alphabet.lookup('A')]<<endl;
// Write out the CAP model
capModel->save(os);
// Write out the CAP/intergenic ratio model
capIntergenicRatioModel->save(os);
}