Skip to content

Commit

Permalink
quick-tested: plugged some memory leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
gpertea committed May 4, 2015
1 parent 719fbfb commit 7391565
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 23 deletions.
8 changes: 3 additions & 5 deletions rlink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ extern FILE *c_out; // file handle for the input transcripts that are fu

extern bool specific;
extern bool trim;
extern bool partialcov;
//extern bool partialcov;
extern bool complete;
//extern bool debugMode;
//extern bool verbose;
extern bool eonly;

extern int maxReadCov;
Expand Down Expand Up @@ -7781,15 +7779,15 @@ int build_graphs(BundleData* bdata, bool fast) {

//if(guides.Count()) fprintf(stderr,"No of guides=%d partialcov=%d\n",guides.Count(),partialcov);

if(partialcov) {
/* if(partialcov) {
for(int g=0;g<guides.Count();g++) {
int s=0;
if(guides[g]->strand=='+') s=2;
get_partial_covered(guides[g],bundle[s],bnode[s],junction);
}
return(0);
}

*/
if(c_out || (bundle[1].Count() && bnode[1].Count())) // coverage is needed
for(int g=0;g<guides.Count();g++) {
//fprintf(stderr,"consider guide %d\n",g);
Expand Down
4 changes: 1 addition & 3 deletions rlink.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,8 @@ struct GRefData {
GError("Error: invalid genomic sequence data (%s)!\n",gseq_name);
rnas.setCapacity(gffr->gseqStats[gseq_id]->fcount);
}
//int tidx=
rnas.Add(t);
t->isUsed(true);
//t->udata=tidx;
}

bool operator==(GRefData& d){
Expand Down Expand Up @@ -337,7 +335,7 @@ struct BundleData {
void rc_init(GffObj* t) {
if (rc_data==NULL) {
rc_data = new RC_BundleData(t->start, t->end);
}
}
}
/* after reference annotation was loaded
void rc_finalize_refs() {
Expand Down
24 changes: 12 additions & 12 deletions stringtie.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ bool fast=true;
bool eonly=false; // parameter -e
bool specific=false;
bool complete=true;
bool partialcov=false;
//bool partialcov=false;
int num_cpus=1;
int mintranscriptlen=200; // minimum length for a transcript to be printed
int sensitivitylevel=1;
Expand Down Expand Up @@ -375,11 +375,11 @@ if (ballgown)
/*if (guides && ng_end>=ng_start) {
for (int gi=ng_start;gi<=ng_end;gi++) {
int tidx=bundle->keepguides.Add((*guides)[gi]);
(*guides)[gi]->udata=tidx; //tid when not ballgown
(*guides)[gi]->udata=tidx+1; //tid when not ballgown
}
}*/
// geneno=infer_transcripts(geneno, lastref, $label,\@readlist,$readthr,
// \@junction,$junctionthr,$mintranscriptlen,\@keepguides);
// \@junction,$junctionthr,$mintranscriptlen,\@keepguides);
// (readthr, junctionthr, mintranscriptlen are globals)
bundle->getReady(currentstart, currentend);
#ifndef NOTHREADS
Expand Down Expand Up @@ -521,9 +521,10 @@ if (ballgown)
} while (cend_changed);
}
} //adjusted currentend and checked for overlapping reference transcripts
bool ref_overlap=false;
//bool ref_overlap=false;
//if (ballgown && bundle->rc_data)
ref_overlap=bundle->evalReadAln(*brec, xstrand, nh);
//ref_overlap=
bundle->evalReadAln(*brec, xstrand, nh);
if (xstrand=='+') strand=1;
else if (xstrand=='-') strand=-1;
countFragment(*bundle, *brec, hi);
Expand Down Expand Up @@ -567,8 +568,7 @@ if (ballgown)

//if (f_out && f_out!=stdout) fclose(f_out);
fclose(f_out);

// write the FPKMs
if (c_out && c_out!=stdout) fclose(c_out);

if(verbose) {
GMessage("Total count of aligned fragments: %llu\n",Num_Fragments);
Expand All @@ -581,6 +581,7 @@ if (ballgown)
f_out=fopen(outfname.chars(), "w");
if (f_out==NULL) GError("Error creating output file %s\n", outfname.chars());
}

fprintf(f_out,"# ");
args.printCmdLine(f_out);
fprintf(f_out,"# StringTie version %s\n",VERSION);
Expand Down Expand Up @@ -804,22 +805,21 @@ GStr Process_Options(GArgs* args) {
if (ballgown && !guided)
GError("Error: invalid -B/-b usage, GFF reference not given (-G option required).\n");

s=args->getOpt('P');
/* s=args->getOpt('P');
if (!s.is_empty()) {
if(!guided) GError("Error: option -G with reference annotation file has to be specified.\n");
c_out=fopen(s.chars(), "w");
if (c_out==NULL) GError("Error creating output file %s\n", s.chars());
partialcov=true;
}
else {
else { */
s=args->getOpt('C');
if (!s.is_empty()) {
if(!guided) GError("Error: invalid -C usage, GFF reference not given (-G option required).\n");
c_out=fopen(s.chars(), "w");
if (c_out==NULL) GError("Error creating output file %s\n", s.chars());
num_cpus=1;
}
}
//}

int numbam=args->startNonOpt();
if (numbam==0 || numbam>1) {
Expand Down Expand Up @@ -891,7 +891,7 @@ void processBundle(BundleData* bundle) {
#endif
}
int ngenes=infer_transcripts(bundle, fast | bundle->covSaturated);
if (bundle->rc_data) {
if (ballgown && bundle->rc_data) {
rc_update_exons(*(bundle->rc_data));
}
if (bundle->pred.Count()>0) {
Expand Down
3 changes: 1 addition & 2 deletions tablemaker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void BundleData::keepGuide(GffObj* t) {
if (rc_data==NULL) {
rc_init(t);
}
t->udata=keepguides.Add(t);
t->udata=keepguides.Add(t)+1;
rc_data->addTranscript(*t);
}

Expand All @@ -40,7 +40,6 @@ struct COvlSorter {
}
} OvlSorter;


void rc_updateExonCounts(const RC_Feature* exon, int nh) {
exon->rcount++;
exon->mrcount += (nh > 1) ? (1.0/nh) : 1;
Expand Down
7 changes: 6 additions & 1 deletion tablemaker.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,12 @@ struct RC_BundleData {
exons(true, false, true), introns(true, false, true),
xcache(0), xcache_pos(0)
{
if (rmax>lmin && ballgown) updateCovSpan();
if (ballgown) {
if (rmax>lmin) updateCovSpan();
}else {
exons.setFreeItem(true);
introns.setFreeItem(true);
}
}

~RC_BundleData() {
Expand Down

0 comments on commit 7391565

Please sign in to comment.