map<string, string> name2seq;
map<string, string>::iterator iter;
-Transcripts transcripts;
-char groupF[STRLEN], tiF[STRLEN], refFastaF[STRLEN];
+Transcripts transcripts(1); // no genome, just transcript set
+char groupF[STRLEN], tiF[STRLEN], refFastaF[STRLEN], chromListF[STRLEN];
bool hasMappingFile;
char mappingFile[STRLEN];
}
void writeResults(char* refName) {
- ofstream fout;
+ ofstream fout, fout2;
string cur_gene_id, name;
sprintf(groupF, "%s.grp", refName);
sprintf(tiF, "%s.ti", refName);
sprintf(refFastaF, "%s.transcripts.fa", refName);
+ sprintf(chromListF, "%s.chrlist", refName);
transcripts.writeTo(tiF);
if (verbose) { printf("Transcript Information File is generated!\n"); }
fout.close();
if (verbose) { printf("Group File is generated!\n"); }
- // We have to generate this .transcripts.fa, even reference_file is only one. Reason : polyA choice 2, need ">transcript_id"
+ fout2.open(chromListF);
fout.open(refFastaF);
for (int i = 1; i <= M; i++) {
name = transcripts.getTranscriptAt(i).getTranscriptID();
}
fout<<">"<<name<<endl;
fout<<iter->second<<endl;
+
+ fout2<<name<<'\t'<<iter->second.length()<<endl;
}
fout.close();
- if (verbose) { printf("Extracted Sequences File is generated!\n"); }
+ fout2.close();
+
+ if (verbose) {
+ printf("Chromosome List File is generated!\n");
+ printf("Extracted Sequences File is generated!\n");
+ }
}
int main(int argc, char* argv[]) {
- if (argc < 5 || (hasMappingFile = atoi(argv[3])) && argc < 6) {
+ if (argc < 5 || ((hasMappingFile = atoi(argv[3])) && argc < 6)) {
printf("Usage: synthesisRef refName quiet hasMappingFile [mappingFile] reference_file_1 [reference_file_2 ...]\n");
exit(-1);
}
ifstream fin;
string line, gseq;
string seqname, gene_id;
- void* pt;
vector<Interval> vec;
for (int i = start; i < argc; i++) {
fin.open(argv[i]);
if (!fin.is_open()) { fprintf(stderr, "Cannot open %s! It may not exist.\n", argv[i]); exit(-1); }
- pt = getline(fin, line);
- while (pt != 0 && line[0] == '>') {
+ getline(fin, line);
+ while ((fin) && (line[0] == '>')) {
istringstream strin(line.substr(1));
strin>>seqname;
gseq = "";
- while((pt = getline(fin, line)) && line[0] != '>') {
+ while((getline(fin, line)) && (line[0] != '>')) {
gseq += line;
}