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; }
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); }