Example #1
0
int main(int argc, char* argv[])
{
optionInit(&argc, argv, options);
if (argc != 3)
    usage();
char *cdsFile = optionVal("cds", NULL);
bool doPosName = optionExists("posName");
struct hash *cdsHash = NULL;

if (cdsFile != NULL)
    cdsHash = getCdsHash(cdsFile);

pslToBed(argv[1], argv[2], cdsHash, doPosName);
return 0;
}
void createBeds(struct hash *bedHash, struct hash *pslHash, char *file, int numExps)
{
struct stanMad *smList=NULL, *sm=NULL;
struct psl *psl = NULL;
struct bed *bed = NULL;
char buff[256];
warn("File is %s", file);
smList = stanMadLoadAll(file);

for(sm=smList; sm != NULL; sm = sm->next)
    {
    sprintf(buff, "%d", sm->clid);
    psl = hashFindVal(pslHash, buff);
    if(psl != NULL) 
	{
	snprintf(buff,sizeof(buff), "%d-%s-%d", sm->clid, sm->prow, sm->pcol);
	bed = pslToBed(psl);
	bed->expCount = numExps;
	bed->expIds = needMem(sizeof(int) * numExps);
	bed->expScores = needMem(sizeof(float) * numExps);
	hashAddUnique(bedHash, buff, bed);
	}
    }
}