/* Last edited: Sep 20 15:41 2001 (edgrif) */ #include #include #include typedef struct { STORE_HANDLE handle ; KEY original ; KEY root ; /* sequence hierarchy root */ int start, end ; /* in coords of root */ Array dna ; /* in acedb units - lazy */ SMap *smap ; /* the following are each indexed by KEYKEY(method) */ Array fsets ; /* of Array of Feature */ Array fsetDataInfo ; /* of FexFeatureSetDataInfo* */ Array fsetDrawInfo ; /* of FexFeatureSetDrawInfo* */ } ContextStruct ; /****************************************************************/ static void fexContextFinalize (void* ptr) { handleDestroy (((FexContext) ptr)->handle) ; } /* acedb implementation expects seqName to be : */ FexContext fexContext (FexDB db, char* seqName, int start, int end) { /* ignore db here - that is for client side code */ ContextStruct *context ; KEY key ; int startOrig = start, endOrig = end ; if (!lexClassKey (seqName, &key)) /* abort if can't find key */ return 0 ; /* now make the context */ context = (SeqContext*) handleAlloc (fexContextFinalize, sizeof(ContextStruct), 0) ; context->handle = handleCreate () ; context->original = key ; /* go up hierarchy to root to get full coordinate context, and make the smap object */ sMapTreeRoot (key, start, end, &key, &start, &end) ; context->smap = sMapCreate (context->handle, key, start, end) ; context->root = key ; context->start = start ; context->end = end ; return context ; } void fexReleaseContext (FexContext context) { messfree (context) ; /* calls fexContextFinalise */ } /***************************************************************/ char* fexDNA (FexContext context) { char *sequence = 0 ; if (!context->dna) /* get complete sequence for context */ context->dna = sMapDNA (context->smap) ; if (context->dna) { char *cp, *cq ; int len = arrayMax(dna) ; sequence = (char*) messalloc (len + 1) ; for (cp = sequence, cq = arrp(dna, 0, char) ; len-- ;) *cp++ = dnaDecodeChar[*cq++] ; } return sequence ; } /***************************************************************/ Array fexAvailableFeatureSets (FexContext context, FeatureType type) { KEYSET kset = sMapKeySet (context->smap) ; switch (type) { case BASIC_FEATURE: case TRANSCRIPT_FEATURE: } } /***************************************************************/ /***************************************************************/ /************************* end of file *************************/ #ifdef TO_DO #endif /* TO_DO */