From 019648be71e0b8ea5772530b5496720fcb841bba Mon Sep 17 00:00:00 2001 From: Bo Li Date: Fri, 8 Apr 2011 22:28:12 -0500 Subject: [PATCH] fixed a bug for transcript set as reference --- BamWriter.h | 1 + synthesisRef.cpp | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/BamWriter.h b/BamWriter.h index 7f3c562..e33a07f 100644 --- a/BamWriter.h +++ b/BamWriter.h @@ -174,6 +174,7 @@ BamWriter::BamWriter(char inpType, const char* inpF, const char* fn_list, const } } + out = samopen(outF, "wb", out_header); assert(out != 0); diff --git a/synthesisRef.cpp b/synthesisRef.cpp index 005cf95..3bb2808 100644 --- a/synthesisRef.cpp +++ b/synthesisRef.cpp @@ -18,7 +18,7 @@ map name2seq; map::iterator iter; Transcripts transcripts; -char groupF[STRLEN], tiF[STRLEN], refFastaF[STRLEN]; +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,9 +91,16 @@ void writeResults(char* refName) { } fout<<">"<second<second.length()<