本文整理汇总了C++中Transcripts::sort方法的典型用法代码示例。如果您正苦于以下问题:C++ Transcripts::sort方法的具体用法?C++ Transcripts::sort怎么用?C++ Transcripts::sort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transcripts
的用法示例。
在下文中一共展示了Transcripts::sort方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char* argv[]) {
if (argc < 5 || ((hasMappingFile = atoi(argv[3])) && argc < 6)) {
printf("Usage: synthesisRef refName quiet hasMappingFile<0,no;1,yes;2,allele-specific> [mappingFile] reference_file_1 [reference_file_2 ...]\n");
exit(-1);
}
verbose = !atoi(argv[2]);
if (hasMappingFile) { loadMappingInfo(hasMappingFile, argv[4]); }
// allele-specific
if (hasMappingFile == 2) { transcripts.setType(2); }
int start = hasMappingFile ? 5 : 4;
ifstream fin;
string line, gseq;
string seqname, gene_id, transcript_id;
vector<Interval> vec;
M = 0;
name2seq.clear();
for (int i = start; i < argc; i++) {
fin.open(argv[i]);
general_assert(fin.is_open(), "Cannot open " + cstrtos(argv[i]) + "! It may not exist.");
unsigned long int line_no = 0; //Keep track of file line number
getline(fin, line);
line_no += 1;
while ((fin) && (line[0] == '>')) {
istringstream strin(line.substr(1));
strin>>seqname;
gseq = "";
while((getline(fin, line)) && (line[0] != '>')) {
line_no += 1;
gseq += line;
}
int len = gseq.length();
assert(len > 0);
for (int j = 0; j < len; j++) gseq[j] = check(gseq[j],line_no);
name2seq[seqname] = gseq;
transcript_id = seqname;
gene_id = seqname;
if (hasMappingFile) {
mi_iter = mi_table.find(seqname);
general_assert(mi_iter != mi_table.end(), "Mapping Info is not correct, cannot find " + seqname + "'s gene_id!");
gene_id = mi_iter->second;
if (hasMappingFile == 2) {
mi_iter2 = mi_table2.find(seqname);
general_assert(mi_iter2 != mi_table2.end(), "Mapping Info is not correct, cannot find allele " + seqname + "'s transcript_id!");
transcript_id = mi_iter2->second;
}
}
vec.clear();
vec.push_back(Interval(1, len));
transcripts.add(Transcript(transcript_id, gene_id, seqname, '+', vec, ""));
++M;
if (verbose && M % 1000000 == 0) { printf("%d sequences are processed!\n", M); }
}
fin.close();
}
if (M < 1) {
fprintf(stderr, "Number of transcripts in the reference is less than 1!\n");
exit(-1);
}
assert(M == transcripts.getM());
transcripts.sort();
writeResults(hasMappingFile, argv[1]);
return 0;
}