本文整理汇总了C++中Transcripts::writeTo方法的典型用法代码示例。如果您正苦于以下问题:C++ Transcripts::writeTo方法的具体用法?C++ Transcripts::writeTo怎么用?C++ Transcripts::writeTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transcripts
的用法示例。
在下文中一共展示了Transcripts::writeTo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeResults
void writeResults(char* refName) {
int s;
ofstream fout;
sprintf(groupF, "%s.grp", refName);
sprintf(tiF, "%s.ti", refName);
sprintf(refFastaF, "%s.transcripts.fa", refName);
sprintf(chromListF, "%s.chrlist", refName);
fout.open(groupF);
s = starts.size();
for (int i = 0; i < s; i++) fout<<starts[i]<<endl;
fout.close();
if (verbose) { printf("Group File is generated!\n"); }
transcripts.writeTo(tiF);
if (verbose) { printf("Transcript Information File is generated!\n"); }
fout.open(chromListF);
s = chrvec.size();
for (int i = 0; i < s; i++) {
fout<<chrvec[i].name<<'\t'<<chrvec[i].len<<endl;
}
fout.close();
if (verbose) { printf("Chromosome List File is generated!\n"); }
fout.open(refFastaF);
for (int i = 1; i <= M; i++) {
fout<<">"<<transcripts.getTranscriptAt(i).getTranscriptID()<<endl;
fout<<seqs[i]<<endl;
}
fout.close();
if (verbose) { printf("Extracted Sequences File is generated!\n"); }
}
示例2: writeToDisk
void writeToDisk(char* refName) {
ofstream fout;
sprintf(tiF, "%s.ti", refName);
transcripts.writeTo(tiF);
if (verbose) { printf("Transcript Information File is generated!\n"); }
sprintf(refFastaF, "%s.transcripts.fa", refName);
refs.writeTo(refFastaF);
sprintf(transListF, "%s.translist", refName);
refs.writeTransListTo(transListF);
sprintf(chromListF, "%s.chrlist", refName);
fout.open(chromListF);
for (int i = 0; i < (int)chrvec.size(); ++i)
fout<< chrvec[i].name<< '\t'<< chrvec[i].len<< endl;
fout.close();
if (verbose) { printf("Chromosome List File is generated!\n"); }
string cur_gene_id, cur_transcript_id, name;
vector<int> gi, gt, ta;
cur_gene_id = ""; gi.clear();
if (mappingType == 2) { cur_transcript_id = ""; gt.clear(); ta.clear(); }
for (int i = 1; i <= M; ++i) {
const Transcript& transcript = transcripts.getTranscriptAt(i);
if (cur_gene_id != transcript.getGeneID()) {
gi.push_back(i);
if (mappingType == 2) gt.push_back((int)ta.size());
cur_gene_id = transcript.getGeneID();
}
if ((mappingType == 2) && (cur_transcript_id != transcript.getTranscriptID())) {
ta.push_back(i);
cur_transcript_id = transcript.getTranscriptID();
}
}
gi.push_back(M + 1);
if (mappingType == 2) { gt.push_back((int)ta.size()); ta.push_back(M + 1); }
sprintf(groupF, "%s.grp", refName);
fout.open(groupF);
for (int i = 0; i < (int)gi.size(); ++i) fout<< gi[i]<< endl;
fout.close();
if (verbose) { printf("Group File is generated!\n"); }
if (mappingType == 2) {
sprintf(gtF, "%s.gt", refName);
fout.open(gtF);
for (int i = 0; i < (int)gt.size(); ++i) fout<< gt[i]<< endl;
fout.close();
sprintf(taF, "%s.ta", refName);
fout.open(taF);
for (int i = 0; i < (int)ta.size(); ++i) fout<< ta[i]<< endl;
fout.close();
if (verbose) { printf("Allele-specific group files are generated!\n"); }
}
if (n2g_idx) {
sprintf(n2g_idxF, "%s.n2g.idx.fa", refName);
fout.open(n2g_idxF);
for (int i = 1; i <= M; ++i)
fout<< '>'<< refs.getRef(i)->getName()<< endl<< n2g(refs.getRef(i)->getSeq())<< endl;
fout.close();
if (verbose) printf("%s is generated!\n", n2g_idxF);
}
}
示例3: writeResults
void writeResults(int option, char* refName) {
ofstream fout, fout2;
string cur_gene_id, cur_transcript_id, name;
vector<int> gi, gt, ta;
sprintf(tiF, "%s.ti", refName);
transcripts.writeTo(tiF);
if (verbose) { printf("Transcript Information File is generated!\n"); }
cur_gene_id = ""; gi.clear();
if (option == 2) { cur_transcript_id = ""; gt.clear(); ta.clear(); }
for (int i = 1; i <= M; i++) {
const Transcript& transcript = transcripts.getTranscriptAt(i);
if (cur_gene_id != transcript.getGeneID()) {
gi.push_back(i);
if (option == 2) gt.push_back((int)ta.size());
cur_gene_id = transcript.getGeneID();
}
if ((option == 2) && (cur_transcript_id != transcript.getTranscriptID())) {
ta.push_back(i);
cur_transcript_id = transcript.getTranscriptID();
}
}
gi.push_back(M + 1);
if (option == 2) { gt.push_back((int)ta.size()); ta.push_back(M + 1); }
sprintf(groupF, "%s.grp", refName);
fout.open(groupF);
for (int i = 0; i < (int)gi.size(); i++) fout<< gi[i]<< endl;
fout.close();
if (verbose) { printf("Group File is generated!\n"); }
if (option == 2) {
sprintf(gtF, "%s.gt", refName);
fout.open(gtF);
for (int i = 0; i < (int)gt.size(); i++) fout<< gt[i]<< endl;
fout.close();
sprintf(taF, "%s.ta", refName);
fout.open(taF);
for (int i = 0; i < (int)ta.size(); i++) fout<< ta[i]<< endl;
fout.close();
if (verbose) { printf("Allele-specific group files are generated!\n"); }
}
sprintf(refFastaF, "%s.transcripts.fa", refName);
sprintf(chromListF, "%s.chrlist", refName);
fout2.open(chromListF);
fout.open(refFastaF);
for (int i = 1; i <= M; i++) {
name = transcripts.getTranscriptAt(i).getSeqName();
iter = name2seq.find(name);
general_assert(iter != name2seq.end(), "Cannot recognize sequence ID" + name + "!");
fout<<">"<<name<<endl;
fout<<iter->second<<endl;
fout2<<name<<'\t'<<iter->second.length()<<endl;
}
fout.close();
fout2.close();
if (verbose) {
printf("Chromosome List File is generated!\n");
printf("Extracted Sequences File is generated!\n");
}
}