void getIndexedGenomeDescriptionsZoo(char ***retArray, int *retCount, boolean blatOnly)
/* Find out the list of genomes that have blat servers on them. */
{
struct dbDb *dbList = NULL, *db;
int i, count = 0;
char **array;
if(blatOnly)
    dbList = hGetBlatIndexedDatabases();
else
    dbList = hGetIndexedDatabases();

/* Call zooCount instead of human count */
count = zooCount(dbList);

if (count == 0)
    errAbort("No active %s servers in database", (blatOnly ? "blat" : "nib" ));
AllocArray(array, count);
i = 0;
for (db=dbList; db != NULL; db=db->next)
    {
    /* Get the proper Zoo species omitting combo */
     if(strstrNoCase(db->name, "zoo") && !strstrNoCase(db->name,"combo")){
    array[i++] = cloneString(db->description);
    }
    }
dbDbFreeList(&dbList);
*retArray = array;
*retCount = count;
}
/* Zoo count  is very similar to its human brethren below except it searchers for zoo*/
int zooCount(struct dbDb *dbList)
/* Count the number of human organism records. */
{
struct dbDb *db = NULL;
int count = 0;
for(db = dbList; db != NULL; db = db->next)
    {
    
    /*  Make sure zoo Combo isn't included and that the species are zoo */
    if(strstrNoCase(db->name, "zoo") && !strstrNoCase(db->name,"combo"))
	count++;
    }
return count;
}
int humanCount(struct dbDb *dbList)
/* Count the number of human organism records. */
{
struct dbDb *db = NULL;
int count = 0;
for(db = dbList; db != NULL; db = db->next)
    {
    if(sameString("Human", db->organism) && !strstrNoCase(db->name, "zoo"))
	count++;
    }
return count;
}
static boolean isDescriptionMatch(struct track *track, char **words, int wordCount)
// We parse str and look for every word at the start of any word in track description (i.e. google style).
{
if(words)
    {
    // We do NOT lookup up parent hierarchy for html descriptions.
    char *html = track->tdb->html;
    if(!isEmpty(html))
        {
        /* This probably could be made more efficient by parsing the html into some kind of b-tree, but I am assuming
           that the inner html loop while only happen for 1-2 words for vast majority of the tracks. */

        int i, numMatches = 0;
        html = stripRegEx(html, "<[^>]*>", REG_ICASE);
        for(i = 0; i < wordCount; i++)
            {
            char *needle = words[i];
            char *haystack, *tmp = cloneString(html);
            boolean found = FALSE;
            while((haystack = nextWord(&tmp)))
                {
                char *ptr = strstrNoCase(haystack, needle);
                if(ptr != NULL && ptr == haystack)
                    {
                    found = TRUE;
                    break;
                    }
                }
            if(found)
                numMatches++;
            else
                break;
            }
        if(numMatches == wordCount)
            return TRUE;
        }
    }
return FALSE;
}
void getIndexedGenomeDescriptions(char ***retArray, int *retCount, boolean blatOnly)
/* Find out the list of genomes that have blat servers on them. */
{
struct dbDb *dbList = NULL, *db;
int i, count = 0;
char **array;
if(blatOnly)
    dbList = hGetBlatIndexedDatabases();
else
    dbList = hGetIndexedDatabases();
count = humanCount(dbList);
if (count == 0)
    errAbort("No active %s servers in database", (blatOnly ? "blat" : "nib" ));
AllocArray(array, count);
i = 0;
for (db=dbList; db != NULL; db=db->next)
    {
    if(sameString("Human", db->organism) && !strstrNoCase(db->name, "zoo"))
	array[i++] = cloneString(db->description);
    }
dbDbFreeList(&dbList);
*retArray = array;
*retCount = count;
}
Beispiel #6
0
static Color gvfColor(struct track *tg, void *item, struct hvGfx *hvg)
/* Color item by var_type attribute, according to Deanna Church's document
 * SvRepresentation2.doc attached to redmine #34. */
{
struct bed8Attrs *gvf = item;
Color dbVarUnknown = hvGfxFindColorIx(hvg, 0xb2, 0xb2, 0xb2);
int ix = stringArrayIx("var_type", gvf->attrTags, gvf->attrCount);
if (ix < 0)
    return dbVarUnknown;
char *varType = gvf->attrVals[ix];
if (sameString(varType, "CNV") || sameString(varType, "copy_number_variation"))
    return MG_BLACK;
else if (strstrNoCase(varType, "Gain"))
    return hvGfxFindColorIx(hvg, 0x00, 0x00, 0xff);
else if (strstrNoCase(varType, "Loss"))
    return hvGfxFindColorIx(hvg, 0xff, 0x00, 0x00);
else if (strstrNoCase(varType, "Insertion"))
    return hvGfxFindColorIx(hvg, 0xff, 0xcc, 0x00);
else if (strstrNoCase(varType, "Complex"))
    return hvGfxFindColorIx(hvg, 0x99, 0xcc, 0xff);
else if (strstrNoCase(varType, "Unknown"))
    return dbVarUnknown;
else if (strstrNoCase(varType, "Other"))
    return hvGfxFindColorIx(hvg, 0xcc, 0x99, 0xff);
else if (strstrNoCase(varType, "Inversion"))
    return hvGfxFindColorIx(hvg, 0x99, 0x33, 0xff); // Needs pattern
else if (strstrNoCase(varType, "LOH"))
    return hvGfxFindColorIx(hvg, 0x00, 0x00, 0xff); // Needs pattern
else if (strstrNoCase(varType, "Everted"))
    return hvGfxFindColorIx(hvg, 0x66, 0x66, 0x66); // Needs pattern
else if (strstrNoCase(varType, "Transchr"))
    return hvGfxFindColorIx(hvg, 0xb2, 0xb2, 0xb2); // Plus black vert. bar at broken end
else if (strstrNoCase(varType, "UPD"))
    return hvGfxFindColorIx(hvg, 0x00, 0xff, 0xff); // Needs pattern
return dbVarUnknown;
}