ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/gclib/gclib/gff.h
(Generate patch)
# Line 136 | Line 136
136        ftype=NULL;
137        fstart=0;
138        fend=0;
139 +      strand=0;phase=0;
140 +      llen=0;score=0;
141        info=NULL;
142        _parents=NULL;
143        _parents_len=0;
# Line 223 | Line 225
225     int idx;
226   public:
227     char* name;
228 <   GffNameInfo() { name=NULL; idx=-1; }
229 <   GffNameInfo(const char* n) {
228 <     name=Gstrdup(n);
228 >   GffNameInfo(const char* n=NULL):idx(-1),name(NULL) {
229 >     if (n) name=Gstrdup(n);
230       }
231  
232     ~GffNameInfo() {
# Line 253 | Line 254
254       byName.shkAdd(f->name,f);
255       }
256   public:
257 < GffNameList():GList<GffNameInfo>(false,true,true), byName(false) {
257 > GffNameList(int init_capacity=6):GList<GffNameInfo>(init_capacity, false,true,true), byName(false) {
258      idlast=-1;
259 +    setCapacity(init_capacity);
260      }
261   char* lastNameUsed() { return idlast<0 ? NULL : Get(idlast)->name; }
262   int lastNameId() { return idlast; }
# Line 266 | Line 268
268  
269   int addName(const char* tname) {//returns or create an id for the given name
270     //check idlast first, chances are it's the same feature name checked
271 <   if (idlast>=0 && strcmp(fList[idlast]->name,tname)==0)
272 <       return idlast;
271 >   /*if (idlast>=0 && strcmp(fList[idlast]->name,tname)==0)
272 >       return idlast;*/
273     GffNameInfo* f=byName.Find(tname);
274     int fidx=-1;
275     if (f!=NULL) fidx=f->idx;
# Line 894 | Line 896
896   public:
897     int gseqid; //gseq id in the global static pool of gseqs
898     char* gseqname; //just a pointer to the name of gseq
899 <   //int fcount;//number of features on this gseq
899 >   int fcount;//number of features on this gseq
900     uint mincoord;
901     uint maxcoord;
902     uint maxfeat_len; //maximum feature length on this genomic sequence
# Line 902 | Line 904
904     GSeqStat(int id=-1, char* name=NULL) {
905       gseqid=id;
906       gseqname=name;
907 +     fcount=0;
908       mincoord=MAXUINT;
909       maxcoord=0;
910       maxfeat_len=0;
# Line 938 | Line 941
941         }
942       }
943     void finalize(GffReader* gfr, bool mergeCloseExons,
944 <                bool keepAttrs=false, bool noExonAttr=true) { //if set, enforce sort by locus
945 <     if (mustSort) { //force (re-)sorting
943 <        this->setSorted(false);
944 <        this->setSorted((GCompareProc*)gfo_cmpByLoc);
945 <        }
946 <     int delcount=0;
947 <     for (int i=0;i<Count();i++) {
948 <       //finish the parsing for each GffObj
949 <       fList[i]->finalize(gfr, mergeCloseExons, keepAttrs, noExonAttr);
950 <       }
951 <     if (delcount>0) this->Pack();
952 <     }
944 >                bool keepAttrs=false, bool noExonAttr=true);
945 >
946     void freeAll() {
947       for (int i=0;i<fCount;i++) {
948         delete fList[i];
# Line 1027 | Line 1020
1020    void subfPoolAdd(GHash<CNonExon>& pex, GfoHolder* newgfo);
1021    GfoHolder* promoteFeature(CNonExon* subp, char*& subp_name, GHash<CNonExon>& pex,
1022                                    bool keepAttr, bool noExonAttr);
1023 +  GList<GSeqStat> gseqstats; //list of all genomic sequences seen by this reader, accumulates stats
1024   public:
1025    GfList gflst; //accumulate GffObjs being read
1026    GfoHolder* newGffRec(GffLine* gffline, bool keepAttr, bool noExonAttr,
# Line 1036 | Line 1030
1030                                           bool keepAttr);
1031    GfoHolder* updateParent(GfoHolder* newgfh, GffObj* parent);
1032    bool addExonFeature(GfoHolder* prevgfo, GffLine* gffline, GHash<CNonExon>& pex, bool noExonAttr);
1033 <  GList<GSeqStat> gseqstats; //list of all genomic sequences seen by this reader, accumulates stats
1033 >  GPVec<GSeqStat> gseqStats; //only populated after finalize()
1034    GffReader(FILE* f=NULL, bool t_only=false, bool sortbyloc=false):discarded_ids(true),
1035 <                       phash(true), gflst(sortbyloc), gseqstats(true,true,true) {
1035 >                       phash(true), gseqstats(true,true,true), gflst(sortbyloc), gseqStats(1, false) {
1036        gff_warns=gff_show_warnings;
1037        names=NULL;
1038        gffline=NULL;
# Line 1058 | Line 1052
1052        gflst.sortedByLoc(sortbyloc);
1053        }
1054    GffReader(char* fn, bool t_only=false, bool sort=false):discarded_ids(true), phash(true),
1055 <                             gflst(sort),gseqstats(true,true,true) {
1055 >            gseqstats(true,true,true), gflst(sort), gseqStats(1,false) {
1056        gff_warns=gff_show_warnings;
1057        names=NULL;
1058        fname=Gstrdup(fn);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines