X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=synthesisRef.cpp;h=aa0d473b6537088fcb820f246de9898fa1864ef4;hb=5a1c0c7e480ffda84f83d224246c754a4761500f;hp=005cf95fee33e1031077a5993b1c771f1e4d6579;hpb=a95154919f950f86de9104b2b9dcf1f0c7e83387;p=rsem.git diff --git a/synthesisRef.cpp b/synthesisRef.cpp index 005cf95..aa0d473 100644 --- a/synthesisRef.cpp +++ b/synthesisRef.cpp @@ -17,8 +17,8 @@ int M; map name2seq; map::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]; @@ -56,12 +56,13 @@ char check(char c) { } 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"); } @@ -79,7 +80,7 @@ void writeResults(char* refName) { 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(); @@ -90,13 +91,20 @@ void writeResults(char* refName) { } fout<<">"<second<second.length()< vec; @@ -119,13 +126,13 @@ int main(int argc, char* argv[]) { 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; }