void checkMrnaPartition(struct gbSelect* select)
/* Check an mRNA partition.  For genbank, check all ESTs against
 * this mRNA partation. */
{
struct hashCookie cookie;
struct hashEl* hel;

gbReleaseLoadProcessed(select);
struct gbSelect* prevSelect = gbProcessedGetPrevRel(select);
if (prevSelect != NULL)
    gbReleaseLoadProcessed(prevSelect);

gbVerbEnter(2, "checking %s", gbSelectDesc(select));
cookie = hashFirst(select->release->entryTbl);
while ((hel = hashNext(&cookie)) != NULL)
    checkOrgCat(hel->val, prevSelect);
gbVerbLeave(2, "checking %s", gbSelectDesc(select));
if (select->release->srcDb == GB_GENBANK)
    checkEstPartitions(select->release);

gbReleaseUnload(select->release);
if (prevSelect != NULL)
    {
    gbReleaseUnload(prevSelect->release);
    freeMem(prevSelect);
    }
}
示例#2
0
struct gbRelease* loadIndex(char* relName, unsigned types, char* database)
/* load processed section of index for release */
{
struct gbIndex* index = gbIndexNew(database, NULL);
struct gbSelect select;
ZeroVar(&select);
select.release = gbIndexMustFindRelease(index, relName);

if (types & GB_MRNA)
    {
    select.type = GB_MRNA;
    gbReleaseLoadProcessed(&select);
    }
if ((types & GB_EST) && (select.release->srcDb == GB_GENBANK))
    {
    struct slName* prefixes, *prefix;
    select.type = GB_EST;
    prefixes = gbReleaseGetAccPrefixes(select.release, GB_PROCESSED, GB_EST);
    for (prefix = prefixes; prefix != NULL; prefix = prefix->next)
        {
        select.accPrefix = prefix->name;
        gbReleaseLoadProcessed(&select);
        }
    select.accPrefix = NULL;
    slFreeList(&prefixes);
    }

return select.release;
}
struct gbAlignInfo gbAlignGet(struct gbSelect* select,
                              struct gbSelect* prevSelect)
/* Build files to align in the work directory.  If this is not a full release,
 * or there is no previously aligned release, prevSelect should be NULL.
 */
{
struct gbAlignInfo alignInfo;

gbVerbEnter(1, "gbAlignGet: %s", gbSelectDesc(select));
if (prevSelect != NULL)
    prevSelect->orgCats = select->orgCats;

/* load the required entry data */
gbReleaseLoadProcessed(select);
if (prevSelect != NULL)
    {
    gbReleaseLoadProcessed(prevSelect);
    gbReleaseLoadAligned(prevSelect);
    }

/* select entries to align */
gbVerbEnter(2, "selecting seqs to align");
alignInfo = gbAlignFindNeedAligned(select, prevSelect);
gbVerbLeave(2, "selecting seqs to align");

if (alignInfo.migrate.accTotalCnt > 0)
    gbVerbMsg(1, "gbAlignGet: %d %s entries, %d alignments will be migrated",
              alignInfo.migrate.accTotalCnt, gbFmtSelect(select->type),
              alignInfo.migrate.recTotalCnt);

/* create fasta with sequences to align if not empty */
if (alignInfo.align.accTotalCnt > 0)
    {
    gbVerbMsg(1, "gbAlignGet: %d %s sequences will be align",
              alignInfo.align.accTotalCnt, gbFmtSelect(select->type));
    copySelectedFasta(select);
    }

/* leave calling cards */
if (select->orgCats & GB_NATIVE)
    markAligns(select, GB_NATIVE);
if (select->orgCats & GB_XENO)
    markAligns(select, GB_XENO);

/* print before releasing memory */
gbVerbLeave(1, "gbAlignGet: %s", gbSelectDesc(select));

/* unload entries to free memory */
gbReleaseUnload(select->release);
if (prevSelect != NULL)
    gbReleaseUnload(prevSelect->release);
return alignInfo;
}
示例#4
0
void gbAlignInstall(struct gbSelect* select, struct gbSelect* prevSelect)
/* Install alignments, optionally migrating unchanged ones from a previous
 * release.  This does one update, accPrefix and either native or xeno */
{
char nativeAlignIdx[PATH_LEN], xenoAlignIdx[PATH_LEN];
struct gbAlignInfo alignInfo;

gbVerbEnter(1, "gbAlignInstall: %s", gbSelectDesc(select));

/* load required entry date */
gbReleaseLoadProcessed(select);
if (prevSelect != NULL)
    {
    gbReleaseLoadProcessed(prevSelect);
    gbReleaseLoadAligned(prevSelect);
    }

/* mark entries and updates to migrate or align */
alignInfo = gbAlignFindNeedAligned(select, prevSelect);

/* Process each category */
if (select->orgCats & GB_NATIVE)
    installOrgCatAligned(select, GB_NATIVE, prevSelect, &alignInfo,
                         nativeAlignIdx);
if (select->orgCats & GB_XENO)
    installOrgCatAligned(select, GB_XENO, prevSelect, &alignInfo,
                         xenoAlignIdx);

/* now indices can be renamed, not completely atomic, but good enough */
if (select->orgCats & GB_NATIVE)
    gbOutputRename(nativeAlignIdx, NULL);
if (select->orgCats & GB_XENO)
    gbOutputRename(xenoAlignIdx, NULL);

/* print message before memory is freed */
gbVerbLeave(1, "gbAlignInstall: %s", gbSelectDesc(select));

/* unload entries to free memory */
gbReleaseUnload(select->release);
if (prevSelect != NULL)
    gbReleaseUnload(prevSelect->release);
}
void checkEstPartition(struct gbRelease* mrnaRelease,
                       struct gbSelect* select)
/* Check an EST partition */
{
struct hashCookie cookie;
struct hashEl* hel;

gbVerbEnter(2, "checking %s", gbSelectDesc(select));
gbReleaseLoadProcessed(select);
struct gbSelect* prevSelect = gbProcessedGetPrevRel(select);
if (prevSelect != NULL)
    gbReleaseLoadProcessed(prevSelect);
cookie = hashFirst(select->release->entryTbl);
while ((hel = hashNext(&cookie)) != NULL)
    checkEst(mrnaRelease, hel->val, prevSelect);
gbReleaseUnload(select->release);
if (prevSelect != NULL)
    {
    gbReleaseUnload(prevSelect->release);
    freeMem(prevSelect);
    }
gbVerbLeave(2, "checking %s", gbSelectDesc(select));
}
示例#6
0
static void chkGbRelease(struct gbSelect* select,
                         struct metaDataTbls* metaDataTbls)
/* Check a partation of gbRelease */
{
gbVerbEnter(1, "check: %s", gbSelectDesc(select));
/* load required entry date */
gbReleaseLoadProcessed(select);
gbReleaseLoadAligned(select);

chkGbIndex(select, metaDataTbls);

/* unload entries to free memory */
gbReleaseUnload(select->release);
gbVerbLeave(1, "check: %s", gbSelectDesc(select));
}
void doLoadPartition(struct gbSelect* select)
/* Do work of syncing the database with the state in the genbank respository for
 * a given partition.  */
{
gbVerbEnter(2, "load for %s", gbSelectDesc(select));

/* load required entry date */
gbReleaseLoadProcessed(select);
gbReleaseLoadAligned(select);

databaseUpdate(select);

gbVerbLeave(2, "load for %s", gbSelectDesc(select));

/* unload entries to free memory */
gbReleaseUnload(select->release);
}
示例#8
0
static void testLoad(struct gbSelect* select, unsigned flags)
/* do load testing of part of a release */
{
char desc[512];
struct stepInfo info;
select->type = (flags & DO_MRNA) ? GB_MRNA : GB_EST;
safef(desc, sizeof(desc), "%s %s",
      ((flags & DO_PROCESSED) ? "processed" : "aligned"),
      gbSelectDesc(select));
info = beginStep(select->release->index, select->release, desc);
if (flags & DO_PROCESSED)
    gbReleaseLoadProcessed(select);
else
    {
    select->orgCats = GB_NATIVE|GB_XENO;
    gbReleaseLoadAligned(select);
    }
endStep(select->release->index, &info);
select->type = 0;
}