Skip to content

Commit

Permalink
writing unbundled reference genes to the -A file
Browse files Browse the repository at this point in the history
  • Loading branch information
gpertea committed May 11, 2016
1 parent d160c1d commit 59ddccd
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions stringtie.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,6 @@ void processBundle(BundleData* bundle) {

#ifndef NOTHREADS


bool noThreadsWaiting() {
waitMutex.lock();
int v=threadsWaiting;
Expand Down Expand Up @@ -1287,6 +1286,17 @@ int waitForData(BundleData* bundles) {
return bidx;
}

void writeUnbundledGenes(GHash<CGene>& geneabs, const char* refseq, FILE* gout) {
//write unbundled genes from this chromosome
geneabs.startIterate();
while (CGene* g=geneabs.NextData()) {
fprintf(gout, "%s\t%s\t%s\t%c\t%d\t%d\t%d\t0.0\t0.0\t0.0\n",
g->geneID, g->geneName, refseq,
g->strand, g->start, g->end, g->len());
}
geneabs.Clear();
}

void writeUnbundledGuides(GVec<GRefData>& refdata, FILE* fout, FILE* gout) {
for (int g=0;g<refdata.Count();++g) {
GRefData& crefd=refdata[g];
Expand All @@ -1296,7 +1306,11 @@ void writeUnbundledGuides(GVec<GRefData>& refdata, FILE* fout, FILE* gout) {
for (int m=0;m<crefd.rnas.Count();++m) {
GffObj &t = *crefd.rnas[m];
RC_TData &td = *(RC_TData*) (t.uptr);
if (td.in_bundle) continue;
if (td.in_bundle) {
if (gout && m==crefd.rnas.Count()-1)
writeUnbundledGenes(geneabs, crefd.gseq_name, gout);
continue;
}
//write these guides to output
//for --merge and -e
if (mergeMode || eonly) {
Expand Down Expand Up @@ -1353,15 +1367,8 @@ void writeUnbundledGuides(GVec<GRefData>& refdata, FILE* fout, FILE* gout) {
geneabs.Add(geneid, new CGene(t.start, t.end, t.strand, t.getGeneID(), t.getGeneName()));
}
}
if (m==crefd.rnas.Count()-1) {
//write unbundled genes from this chromosome
geneabs.startIterate();
while (CGene* g=geneabs.NextData()) {
fprintf(gout, "%s\t%s\t%s\t%c\t%d\t%d\t%d\t0.0\t0.0\t0.0\n",
g->geneID, g->geneName, crefd.gseq_name,
g->strand, g->start, g->end, g->len());
}
}
if (m==crefd.rnas.Count()-1)
writeUnbundledGenes(geneabs, crefd.gseq_name, gout);
} //if geneabundance
}
}
Expand Down

0 comments on commit 59ddccd

Please sign in to comment.