/* flydna.c - routines for accessing fly genome and cDNA sequences. * * This file is copyright 2002 Jim Kent, but license is hereby * granted for all use - public, private or commercial. */ #include "common.h" #include "snof.h" #include "dnautil.h" #include "dnaseq.h" #include "fa.h" #include "nt4.h" #include "cda.h" #include "wormdna.h" #include "flydna.h" static char *chromNames[] = {"adh"}; static char *ntFileNames[] = {"c:/biodata/fly/chrom/adh.nt"}; void flyLoadNt4Genome(struct nt4Seq ***retNt4Seq, int *retNt4Count) /* Load up entire packed fly genome into memory. */ { struct nt4Seq **pSeq; int i; pSeq = needMem(ArraySize(ntFileNames) * sizeof(pSeq[0]) ); for (i=0; iname = faComment+1; retInfo->motherString = faComment; s = strrchr(retInfo->name, '.'); retInfo->orientation = '+'; if (s != NULL) retInfo->orientation = (s[1] == '3' ? '-' : '+'); } } boolean flyCdnaSeq(char *name, struct dnaSeq **retDna, struct wormCdnaInfo *retInfo) /* Get a single fly cDNA sequence. Optionally (if retInfo is non-null) get additional * info about the sequence. */ { long offset; char *faComment; char **pFaComment = (retInfo == NULL ? NULL : &faComment); static struct snof *cdnaSnof = NULL; static FILE *cdnaFa; if (cdnaSnof == NULL) cdnaSnof = snofMustOpen("c:/biodata/fly/cDna/allcdna"); if (cdnaFa == NULL) cdnaFa = mustOpen("c:/biodata/fly/cDna/allcdna.fa", "rb"); if (!snofFindOffset(cdnaSnof, name, &offset)) return FALSE; fseek(cdnaFa, offset, SEEK_SET); if (!faReadNext(cdnaFa, name, TRUE, pFaComment, retDna)) return FALSE; flyFaCommentIntoInfo(faComment, retInfo); return TRUE; } char *flyFeaturesDir() /* Return the features directory. (Includes trailing slash.) */ { return "C:/biodata/fly/features/"; } FILE *flyOpenGoodAli() /* Opens good alignment file and reads signature. * (You can then cdaLoadOne() it.) */ { return cdaOpenVerify("C:/biodata/fly/cDNA/good.ali"); }