Beispiel #1
0
void estOrientInfoFreeList(struct estOrientInfo **pList)
/* Free a list of dynamically allocated estOrientInfo's */
{
struct estOrientInfo *el, *next;

for (el = *pList; el != NULL; el = next)
    {
    next = el->next;
    estOrientInfoFree(&el);
    }
*pList = NULL;
}
Beispiel #2
0
static void processOIFile(struct sqlConnection *conn, struct gbSelect* select,
                          struct gbStatusTbl* statusTbl, char* oiPath)
/* Parse a psl file looking for accessions to add to the database. */
{
char *row[EST_ORIENT_INFO_NUM_COLS];
struct lineFile *oiLf = gzLineFileOpen(oiPath);
while (lineFileNextRow(oiLf, row, EST_ORIENT_INFO_NUM_COLS))
    {
    struct estOrientInfo* oi = estOrientInfoLoad(row);
    processOI(conn, select, statusTbl, oi, oiLf);
    estOrientInfoFree(&oi);
    }
gzLineFileClose(&oiLf);
}
Beispiel #3
0
static void processOrgCatOi(struct gbSelect* select, unsigned orgCat)
/* process files in an update an organism category.  OIs are only available
 * for native, however this follow the structure of the PSL code */
{
char inOi[PATH_LEN], *row[EST_ORIENT_INFO_NUM_COLS];
struct lineFile* inOiLf;
unsigned orgCatsHold = select->orgCats;
select->orgCats = orgCat;

gbAlignedGetPath(select, "oi.gz", NULL, inOi);

inOiLf = gzLineFileOpen(inOi);
while (lineFileNextRowTab(inOiLf, row, EST_ORIENT_INFO_NUM_COLS))
    {
    struct estOrientInfo* oi = estOrientInfoLoad(row);
    processOi(select, oi);
    estOrientInfoFree(&oi);
    }
gzLineFileClose(&inOiLf);
select->orgCats = orgCatsHold;
}
Beispiel #4
0
struct hash *readEstInfo(char *fileName)
/* Read in EST info from file. */
{
struct lineFile *lf = lineFileOpen(fileName, TRUE);
char *row[9];
struct hash *hash = newHash(20);

while (lineFileRow(lf, row))
    {
    struct estOrientInfo *ei = estOrientInfoLoad(row), *oldEi;
    oldEi = hashFindVal(hash, ei->name);
    if (oldEi != NULL)
        {
	if (scoreEi(ei, NULL) < scoreEi(oldEi, NULL))
	     {
	     estOrientInfoFree(&ei);
	     continue;
	     }
	}
    hashAdd(hash, ei->name, ei);
    }
return hash;
}
Beispiel #5
0
void migrateOrientInfos(struct migrateAligns* migrate, FILE* outOiFh)
/* Migrate estOrientInfo records */
{
char inOi[PATH_LEN];
struct lineFile* inOiLf;
char *row[EST_ORIENT_INFO_NUM_COLS];

gbAlignedGetPath(migrate->prevSelect, "oi.gz", NULL, inOi);

if (fileExists(inOi))
    {
    gbVerbEnter(2, "migrating from %s", inOi);
    inOiLf = gzLineFileOpen(inOi);
    while (lineFileNextRowTab(inOiLf, row, ArraySize(row)))
        {
        struct estOrientInfo *oi = estOrientInfoLoad(row);
        migrateOrientInfo(migrate, oi, inOi, outOiFh);
        estOrientInfoFree(&oi);
        }
    gzLineFileClose(&inOiLf);
    gbVerbLeave(2, "migrating from %s", inOi);
    }
}
Beispiel #6
0
void copyOrientInfos(struct gbSelect* select, FILE* outOiFh,
                     struct recCounts* recCounts)
/* Copy an OI file from the work directory, if it exists, count alignments
 * for index. */
{
char inOi[PATH_LEN];
struct lineFile* inOiLf;
char *row[EST_ORIENT_INFO_NUM_COLS];

gbAlignedGetPath(select, "oi", gWorkDir, inOi);
if (fileExists(inOi))
    {
    gbVerbEnter(2, "installing from %s", inOi);
    inOiLf = gzLineFileOpen(inOi);
    while (lineFileNextRowTab(inOiLf, row, ArraySize(row)))
        {
        struct estOrientInfo *oi = estOrientInfoLoad(row);
        copyOrientInfo(select, oi, inOi, outOiFh, recCounts);
        estOrientInfoFree(&oi);
        }
    gzLineFileClose(&inOiLf);
    gbVerbLeave(2, "installing from %s", inOi);
    }
}