本文整理汇总了C++中DNASequence::PrintSeq方法的典型用法代码示例。如果您正苦于以下问题:C++ DNASequence::PrintSeq方法的具体用法?C++ DNASequence::PrintSeq怎么用?C++ DNASequence::PrintSeq使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DNASequence
的用法示例。
在下文中一共展示了DNASequence::PrintSeq方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char* argv[]) {
string refFileName, queryFileName;
int maxHammingDistance;
if (argc < 4) {
cout << "usage: hammer ref query maxHam " << endl;
exit(1);
}
refFileName = argv[1];
queryFileName = argv[2];
maxHammingDistance = atoi(argv[3]);
FASTAReader reader;
reader.Initialize(refFileName);
FASTASequence ref, refRC;
reader.GetNext(ref);
ref.MakeRC(refRC);
FASTAReader queryReader;
queryReader.Initialize(queryFileName);
FASTASequence query;
queryReader.GetNext(query);
DNALength p;
for(p=0; p < ref.length-query.length-1; p++ ){
DNASequence subseq;
subseq.seq = &ref.seq[p];
subseq.length = query.length;
// cout << "t "; subseq.PrintSeq(cout);
// cout << "q "; ((DNASequence*)&query)->PrintSeq(cout);
if (HammingDistance(&subseq.seq[0], &query.seq[0], query.length) < maxHammingDistance) {
cout << ">" << p << endl;
subseq.PrintSeq(cout);
}
int i;
for (i =0; i < query.length; i++) {
subseq.seq[i] = toupper(subseq.seq[i]);
}
}
for(p=0; p < ref.length-query.length-1; p++ ){
DNASequence subseq;
subseq.seq = &refRC.seq[p];
subseq.length = query.length;
if (HammingDistance(&subseq.seq[0], &query.seq[0], query.length) < maxHammingDistance) {
cout << ">" << p << "rc" << endl;
subseq.PrintSeq(cout);
}
int i;
for (i =0; i < query.length; i++) {
subseq.seq[i] = toupper(subseq.seq[i]);
}
}
}
示例2: main
//.........这里部分代码省略.........
string sangerFastqFileName = readsFileName + ".fastq";
CrucialOpen(sangerFastqFileName, sangerFastqFile, std::ios::out);
}
DNALength refLength = 0;
int i;
for (i = 0; i < reference.size(); i++) {
refLength += reference[i].length;
}
if (numReads == -1 and coverage == 0 and stratify == 0) {
cout << "Error, you must specify either coverage, nReads, or stratify." << endl;
exit(1);
}
else if (numReads == -1) {
numReads = (refLength / readLength) * coverage;
}
if (stratify) {
if (!readLength) {
cout << "ERROR. If you are using stratification, a read length must be specified." << endl;
exit(1);
}
}
DNASequence sampleSeq;
sampleSeq.length = readLength;
int maxRetry = 10000000;
int retryNumber = 0;
DNALength seqIndex, seqPos;
if (stratify) {
seqIndex = 0;
seqPos = 0;
}
DNALength origReadLength = readLength;
for (i = 0; stratify or i < numReads; i++) {
if (stratify == 0) {
FindRandomPos(reference, seqIndex, seqPos, readLength );
}
else {
//
// find the next start pos, or bail if done
//
if (seqPos >= reference[seqIndex].length) {
if (seqIndex == reference.size() - 1) {
break;
}
else {
seqIndex = seqIndex + 1;
seqPos = 0;
continue;
}
}
readLength = min(reference[seqIndex].length - seqPos, origReadLength);
}
sampleSeq.seq = &reference[seqIndex].seq[seqPos];
int j;
int gappedRead = 0;
string title;
stringstream titleStrm;
if (titleType == "pacbio") {
titleStrm << i << "|"<< reference[seqIndex].GetName() << "|" << seqPos << "|" << seqPos + readLength;
}
else if (titleType == "illumina") {
titleStrm << "SE_" << i << "[email protected]" << seqPos << "-"<<seqPos+readLength <<"/1";
}
else {
cout << "ERROR. Bad title type " << titleType << endl;
exit(0);
}
title = titleStrm.str();
sampleSeq.length = readLength;
if (!printFastq) {
readsFile << ">" << title << endl;
sampleSeq.PrintSeq(readsFile);
}
else {
FASTQSequence fastqSampleSeq;
fastqSampleSeq.CopyTitle(title);
fastqSampleSeq.seq = sampleSeq.seq;
fastqSampleSeq.length = sampleSeq.length;
fastqSampleSeq.qual.data = new unsigned char[sampleSeq.length];
fill(fastqSampleSeq.qual.data, fastqSampleSeq.qual.data + sampleSeq.length, qualityValue);
if (fastqType == "illumina") {
fastqSampleSeq.PrintFastq(readsFile, fastqSampleSeq.length+1);
}
else {
fastqSampleSeq.PrintSeq(readsFile);
fastqSampleSeq.PrintQual(sangerFastqFile);
}
delete[] fastqSampleSeq.qual.data;
delete[] fastqSampleSeq.title;
}
if (stratify) {
seqPos += readLength;
}
}
return 0;
}