Skip to content

Commit d622680

Browse files
committed
actual fix for old Gencode GTF
1 parent 9ee2f3f commit d622680

4 files changed

Lines changed: 20 additions & 21 deletions

File tree

gclib/GHash.hh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public:
9797
//or NULL if no more
9898
//nextkey is SET to the corresponding key
9999
GHashEntry* NextEntry() { //returns a pointer to a GHashEntry
100-
register int pos=fCurrentEntry;
100+
int pos=fCurrentEntry;
101101
while (pos<fCapacity && hash[pos].hash<0) pos++;
102102
if (pos==fCapacity) {
103103
fCurrentEntry=fCapacity;
@@ -175,7 +175,7 @@ template <class OBJ> GHash<OBJ>::GHash(bool doFree) {
175175

176176
// Resize table
177177
template <class OBJ> void GHash<OBJ>::Resize(int m){
178-
register int i,n,p,x,h;
178+
int i,n,p,x,h;
179179
GHashEntry *k;
180180
GASSERT(fCount<=fCapacity);
181181
if(m<DEF_HASH_SIZE) m=DEF_HASH_SIZE;
@@ -211,7 +211,7 @@ template <class OBJ> void GHash<OBJ>::Resize(int m){
211211

212212
template <class OBJ> OBJ* GHash<OBJ>::Add(const char* ky,
213213
OBJ* pdata, bool mrk){
214-
register int p,i,x,h,n;
214+
int p,i,x,h,n;
215215
if(!ky) GError("GHash::insert: NULL key argument.\n");
216216
GASSERT(fCount<fCapacity);
217217
h=GSTR_HASH(ky);
@@ -296,7 +296,7 @@ template <class OBJ> OBJ* GHash<OBJ>::Add(const char* ky,
296296
*/
297297
template <class OBJ> OBJ* GHash<OBJ>::fAdd(const char* ky,
298298
OBJ* pdata){
299-
register int p,i,x,h,n;
299+
int p,i,x,h,n;
300300
if(!ky) GError("GHash::insert: NULL key argument.\n");
301301
GASSERT(fCount<fCapacity);
302302
h=GSTR_HASH(ky);
@@ -356,7 +356,7 @@ template <class OBJ> OBJ* GHash<OBJ>::fAdd(const char* ky,
356356

357357
template <class OBJ> OBJ* GHash<OBJ>::shkAdd(const char* ky,
358358
OBJ* pdata,bool mrk){
359-
register int p,i,x,h,n;
359+
int p,i,x,h,n;
360360
if(!ky) GError("GHash::insert: NULL key argument.\n");
361361
GASSERT(fCount<fCapacity);
362362
h=GSTR_HASH(ky);
@@ -398,7 +398,7 @@ template <class OBJ> OBJ* GHash<OBJ>::shkAdd(const char* ky,
398398

399399
// Add or replace entry
400400
template <class OBJ> OBJ* GHash<OBJ>::Replace(const char* ky, OBJ* pdata, bool mrk){
401-
register int p,i,x,h,n;
401+
int p,i,x,h,n;
402402
if(!ky){ GError("GHash::replace: NULL key argument.\n"); }
403403
GASSERT(fCount<fCapacity);
404404
h=GSTR_HASH(ky);
@@ -440,7 +440,7 @@ template <class OBJ> OBJ* GHash<OBJ>::Replace(const char* ky, OBJ* pdata, bool
440440

441441
// Remove entry
442442
template <class OBJ> OBJ* GHash<OBJ>::Remove(const char* ky){
443-
register int p,x,h,n;
443+
int p,x,h,n;
444444
if(!ky){ GError("GHash::remove: NULL key argument.\n"); }
445445
OBJ* removed=NULL;
446446
if(0<fCount){
@@ -477,7 +477,7 @@ template <class OBJ> OBJ* GHash<OBJ>::Remove(const char* ky){
477477

478478
// Find entry
479479
template <class OBJ> bool GHash<OBJ>::hasKey(const char* ky) {
480-
register int p,x,h,n;
480+
int p,x,h,n;
481481
if(!ky){ GError("GHash::find: NULL key argument.\n"); }
482482
if(0<fCount){
483483
h=GSTR_HASH(ky);
@@ -501,7 +501,7 @@ template <class OBJ> bool GHash<OBJ>::hasKey(const char* ky) {
501501

502502

503503
template <class OBJ> OBJ* GHash<OBJ>::Find(const char* ky, char** keyptr){
504-
register int p,x,h,n;
504+
int p,x,h,n;
505505
if(!ky){ GError("GHash::find: NULL key argument.\n"); }
506506
if (fCount==0) return NULL;
507507
h=GSTR_HASH(ky);

gclib/gff.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1144,7 +1144,8 @@ void GffReader::readAll(bool keepAttr, bool mergeCloseExons, bool noExonAttr) {
11441144
} //ID seen previously in the same locus
11451145
} //parent-like ID feature (non-exon)
11461146

1147-
if (gffline->parents==NULL || gffline->is_gtf_transcript) {
1147+
//if (gffline->parents==NULL || gffline->is_gtf_transcript) {
1148+
if (gffline->parents==NULL) {
11481149
//top level feature (transcript, gene), no parents (or parents can be ignored)
11491150
if (!prevseen) newGffRec(gffline, keepAttr, noExonAttr, NULL, NULL, prevgflst);
11501151
}

rlink.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5440,7 +5440,7 @@ bool fwd_to_sink_fast(int i,GVec<int>& path,GBitVec& pathpat,GPVec<CTransfrag>&
54405440
}
54415441
}
54425442
pathpat[i+1]=0; // these were 1 in the previous code, but it doesn't make sense -> I hope it was wrong
5443-
if(pos) pathpat[*pos]=0;
5443+
if(pos) pathpat[*pos]=0;
54445444

54455445
if(childcov) {
54465446
maxc=i+1;

stringtie.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include "proc_mem.h"
1212
#endif
1313

14-
#define VERSION "1.3.0"
14+
#define VERSION "1.3.0b"
1515

1616
//#define DEBUGPRINT 1
1717

@@ -29,7 +29,7 @@
2929
#define DBGPRINT5(a,b,c,d,e)
3030
#endif
3131

32-
#define USAGE "StringTie v"VERSION" usage:\n\
32+
#define USAGE "StringTie v" VERSION " usage:\n\
3333
stringtie <input.bam ..> [-G <guide_gff>] [-l <label>] [-o <out_gtf>] [-p <cpus>]\n\
3434
[-v] [-a <min_anchor_len>] [-m <min_tlen>] [-j <min_anchor_cov>] [-f <min_iso>]\n\
3535
[-C <coverage_file_name>] [-c <min_bundle_cov>] [-g <bdist>] [-u]\n\
@@ -267,9 +267,11 @@ int main(int argc, char * const argv[]) {
267267
GVec<int> alncounts(30,0); //keep track of the number of read alignments per chromosome [gseq_id]
268268

269269
int bamcount=bamreader.start(); //setup and open input files
270+
#ifndef GFF_DEBUG
270271
if (bamcount<1) {
271-
GError("%s. Error: no input files provided!\n");
272+
GError("%sError: no input files provided!\n",USAGE);
272273
}
274+
#endif
273275

274276
#ifdef DEBUGPRINT
275277
verbose=true;
@@ -324,7 +326,7 @@ const char* ERR_BAM_SORT="\nError: the input alignment file is not sorted!\n";
324326
if (verbose)
325327
GMessage("Warning: exonless GFF object %s found, added implicit exon %d-%d.\n",
326328
m->getID(),m->start, m->end);
327-
m->exons.Add(new GffExon(m->start, m->end));
329+
m->addExon(m->start, m->end); //should never happen!
328330
}
329331
//DONE: always keep a RC_TData pointer around, with additional info about guides
330332
RC_TData* tdata=new RC_TData(*m, ++c_tid);
@@ -750,14 +752,10 @@ if(!mergeMode) {
750752
while(fgetline(linebuf,linebuflen,ftmp_in)) {
751753
//sscanf(linebuf,"%d %d %d %g %g", &nl, &tlen, &t_id, &fpkm, &tcov);
752754
sscanf(linebuf,"%d %d %d %d %g", &istr, &nl, &tlen, &t_id, &tcov);
755+
//FIXME: for the rare cases tcov < 0, invert it
756+
if (tcov<0) tcov=-tcov;//this should not happen
753757
calc_fpkm=tcov*1000000000/Frag_Len;
754758
calc_tpm=tcov*1000000/Cov_Sum;
755-
/*
756-
double eff_len=1;
757-
if((float)tlen>AvgFrag) eff_len=tlen-AvgFrag+1;
758-
calc_fpkm2=calc_fpkm*tlen/eff_len;
759-
*/
760-
//fprintf(stderr,"istr=%d tid=%d tlen=%d tcov=%g calc_fpkm=%g calc_tpkm=%g\n",istr,t_id,tlen,tcov,calc_fpkm,calc_tpm);
761759
if(istr) { // this is a transcript
762760
if (ballgown && t_id>0) {
763761
guides_RC_tdata[t_id-1]->fpkm=calc_fpkm;

0 commit comments

Comments
 (0)