コード例 #1
0
ファイル: hapmap2.c プロジェクト: elmargb/kentUtils
int main(int argc, char *argv[])
{
if (argc != 2)
    usage();

hSetDb(argv[1]);

errorFileHandle = mustOpen("hapmap2.errors", "w");

nameHash = newHash(18);
verbose(1, "building CEU hash...\n");
hashCEU = getHash("hapmapSnpsCEU");  
verbose(1, "building CHB hash...\n");
hashCHB = getHash("hapmapSnpsCHB");  
verbose(1, "building JPT hash...\n");
hashJPT = getHash("hapmapSnpsJPT");  
verbose(1, "building YRI hash...\n");
hashYRI = getHash("hapmapSnpsYRI");  

verbose(1, "merging...\n");
mergeAll();

// freeHash(&nameHash);
// freeHash(&hashCEU);

carefulClose(&errorFileHandle);

return 0;
}
コード例 #2
0
void oneTrackInit()
/* Set up global variables using cart settings and initialize libs. */
{
hPrintDisable();
database = cartUsualString(cart, "db", "ce4");
hSetDb(database);
organism = hOrganism(database);
withLeftLabels = FALSE; /* Left labels are not supported. */
withCenterLabels = cartUsualBoolean(cart, "centerLabels", FALSE);
withGuidelines = cartUsualBoolean(cart, "guidelines", FALSE);
revCmplDisp = cartUsualBooleanDb(cart, database, REV_CMPL_DISP, FALSE);
position = cartUsualString(cart, "position", "chrI:4001-5000");
hgParseChromRange(position, &chromName, &winStart, &winEnd);
insideX = 0; /* Left labels are not supported. */
insideWidth = cartUsualInt(cart, "pix", 640);
leftLabelX = 0;
leftLabelWidth = 0; /* Left labels are not supported. */
winBaseCount = winEnd - winStart;
basesPerPixel = ((float)winBaseCount) / ((float)insideWidth);
zoomedToCdsColorLevel = (winBaseCount <= insideWidth*3);
seqBaseCount = hChromSize(database, chromName);
initTl();
zoomedToBaseLevel = (winBaseCount <= insideWidth / tl.mWidth);
zoomedToCodonLevel = (ceil(winBaseCount/3) * tl.mWidth) <= insideWidth;
createHgFindMatchHash();
}
コード例 #3
0
int main(int argc, char *argv[]) 
{
if(argc == 1 && !cgiIsOnWeb())
    usage();
cgiSpoof(&argc, argv);
checkArguments();
hSetDb(origGenome);
if(hgTest)
    runSamples("hgCoordConv.test.good", "hgCoordConv.test.bad", origGenome, origGenome, numTests);
else 
    {
/* do our thing  */
    if(calledSelf)  
        {
	cartEmptyShell(doConvertCoordinates, hUserCookie(), excludeVars, NULL);
        }
    else
        {
        /* Check to see if in zoo browser... if so call doFormZoo */
        if (!containsStringNoCase(origDb, "zoo"))
	cartEmptyShell(doForm, hUserCookie(), excludeVars, NULL);
    else
	cartEmptyShell(doFormZoo, hUserCookie(), excludeVars, NULL);
        }    
    }
return 0;
}
コード例 #4
0
ファイル: snpGetDeletions.c プロジェクト: elmargb/kentUtils
int main(int argc, char *argv[])
/* read snpTable, output deletions that pass input filtering */
{
struct slName *chromList = NULL;

if (argc != 4)
    usage();

database = argv[1];
hSetDb(database);

snpTable = argv[2];
if (!hTableExists(snpTable)) 
    errAbort("no %s table\n", snpTable);

exceptionsTable = argv[3];
if (!hTableExists(exceptionsTable)) 
    errAbort("no %s table\n", exceptionsTable);

verbose(1, "loading exceptions...\n");
getExceptions();

chromList = hAllChromNames();

outputFileHandle = mustOpen("deletions.tab", "w");
getDeletions();
carefulClose(&outputFileHandle);

return 0;
}
コード例 #5
0
void musAliAt(char *database, char *chrom, char *humanFa, char *mouseFa)
/* musAliAt - Produce .fa files where mouse alignments hit on chr22. */
{
char query[256], **row;
struct sqlResult *sr;
struct sqlConnection *conn;
struct dnaSeq *musSeq, *homoSeq;
struct psl *psl;
struct hash *musHash = newHash(10);
FILE *musOut = mustOpen(mouseFa, "w");

hSetDb(database);
conn = hAllocConn();
sqlSafef(query, sizeof query, "select * from blatMouse where tName = '%s'", chrom);
sr = sqlGetResult(conn, query);
while ((row = sqlNextRow(sr)) != NULL)
    {
    psl = pslLoad(row);
    if ((musSeq = hashFindVal(musHash, psl->qName)) == NULL)
        {
	musSeq = hExtSeq(psl->qName);
	hashAdd(musHash, psl->qName, NULL);
	faWriteNext(musOut, musSeq->name, musSeq->dna, musSeq->size);
	freeDnaSeq(&musSeq);
	}
    pslFree(&psl);
    }
}
コード例 #6
0
int main(int argc, char *argv[])
/* read snpTable, generate skinny sequence for chrom */
{
    char fileName[64];
    FILE *f;
    struct dnaSeq *skinnySeq = NULL;

    if (argc != 5)
        usage();

    database = argv[1];
    hSetDb(database);
    chromName = argv[2];

    snpTable = argv[4];
    if (!hTableExists(snpTable))
        errAbort("no %s table\n", snpTable);

    skinnySeq = getSkinnySeq(argv[3], chromName);
    stripChar(skinnySeq->dna, '-');
    safef(fileName, ArraySize(fileName), "%s.skinny", chromName);
    f = mustOpen(fileName, "w");
// faWriteNext(f, chromName, skinnySeq->dna, strlen(skinnySeq->dna));
    fprintf(f, ">%s\n", chromName);
    writeSeqWithBreaks(f, skinnySeq->dna, strlen(skinnySeq->dna), 50);
    carefulClose(&f);

    return 0;
}
コード例 #7
0
ファイル: hapmapOrtho.c プロジェクト: blumroy/kentUtils
int main(int argc, char *argv[])
/* get hapmapOrtho table from overall snpOrtho table */
/* hash in contents of hapmap table */
{
char *database = NULL;
char *hapmapTableName = NULL;
char *snpOrthoTableName = NULL;
struct hash *hapmapHash = NULL;

if (argc != 4)
    usage();

database = argv[1];
hapmapTableName = argv[2];
snpOrthoTableName = argv[3];

hSetDb(database);
if (!hTableExists(hapmapTableName))
    errAbort("no %s table in %s\n", hapmapTableName, database);
if (!hTableExists(snpOrthoTableName))
    errAbort("no %s table in %s\n", snpOrthoTableName, database);

hapmapHash = storeHapmap(hapmapTableName);
processSnps(snpOrthoTableName, hapmapHash);

return 0;
}
コード例 #8
0
ファイル: cnpLookup.c プロジェクト: elmargb/kentUtils
int main(int argc, char *argv[])
{
char *db = NULL;
char *bacTableName = NULL;
char *cnpTableName = NULL;
char fileName[64];
char liftFileName[64];
char logFileName[64];
struct hash *bacHash = NULL;

if (argc != 7)
    usage();

db = argv[1];
bacTableName = argv[2];
cnpTableName = argv[3];
safef(fileName, ArraySize(fileName), "%s", argv[4]);
safef(liftFileName, ArraySize(liftFileName), "%s", argv[5]);
safef(logFileName, ArraySize(logFileName), "%s", argv[6]);

/* process args */
hSetDb(db);
if (!hTableExists(bacTableName))
    errAbort("no %s table in %s\n", bacTableName, db);
if (!hTableExists(cnpTableName))
    errAbort("no %s table in %s\n", cnpTableName, db);

bacHash = storeBacs(bacTableName);
processCnps(bacHash, cnpTableName, fileName, liftFileName, logFileName);

return 0;
}
コード例 #9
0
int main(int argc, char *argv[])
/* read snpTable, report positions with more than annotation */
{
if (argc != 3)
    usage();

database = argv[1];
hSetDb(database);

snpTable = argv[2];
if (!hTableExists(snpTable)) 
    errAbort("no %s table\n", snpTable);

// chromList = hAllChromNames();

// outputFileHandle = mustOpen("snpCheckCluster2.out", "w");
// for (chromPtr = chromList; chromPtr != NULL; chromPtr = chromPtr->next)
    // {
    // verbose(1, "chrom = %s\n", chromPtr->name);
    // getBinKeeper(chromPtr->name);
    // checkForClusters(chromPtr->name);
    // }

// carefulClose(&outputFileHandle);

outputFileHandle = mustOpen("snpCheckCluster2.chr22", "w");
getBinKeeper("chr22");
checkForClusters("chr22");
carefulClose(&outputFileHandle);
return 0;
}
コード例 #10
0
int main(int argc, char *argv[])
/* Read ContigInfo into hash. */
/* Filter ContigLocusId and write to ContigLocusIdFilter. */
{

if (argc != 3)
    usage();

snpDb = argv[1];
contigGroup = argv[2];
hSetDb(snpDb);

/* check for needed tables */
if(!hTableExistsDb(snpDb, "ContigLocusId"))
    errAbort("no ContigLocusId table in %s\n", snpDb);
if(!hTableExistsDb(snpDb, "ContigInfo"))
    errAbort("no ContigInfo table in %s\n", snpDb);


contigHash = loadContigs(contigGroup);
if (contigHash == NULL) 
    {
    verbose(1, "couldn't get ContigInfo hash\n");
    return 1;
    }

filterSNPs();
createTable();
loadDatabase();

return 0;
}
コード例 #11
0
int main(int argc, char *argv[])
{

char *snpDb = NULL;
char *oldTableName = NULL;
char *newTableName = NULL;

if (argc != 4)
    usage();

snpDb = argv[1];
hSetDb(snpDb);

oldTableName = argv[2];
newTableName = argv[3];

/* check that tables exist */
if (!hTableExists(oldTableName))
    errAbort("no %s table in %s\n", oldTableName, snpDb);
if (!hTableExists(newTableName))
    errAbort("no %s table in %s\n", newTableName, snpDb);
if (!hTableExists("ContigLoc"))
    errAbort("no ContigLoc table in %s\n", snpDb);
if (!hTableExists("MapInfo"))
    errAbort("no MapInfo table in %s\n", snpDb);

processSnps(oldTableName, newTableName);

return 0;
}
コード例 #12
0
void doPlots()
/* Do all the plots. */
{
struct dyString *script = newDyString(2048);
struct dyString *dummy = newDyString(256);
char *skipPSet = cgiUsualString("skipPName", "G7153846@J939317_RC@j_at");
html = newDyString(1024);
hSetDb("mm5");
dyStringPrintf(script, "%s", rHeader);

/* Call query once to initialize altEvent. */
constructQueryForEvent(dummy, skipPSet, "dummy");
assert(altEvent);
fprintf(stdout, "<h3>Plots for %s (%s)</h3>\n", altEvent->geneName, skipPSet);
fflush(stdout);
/* Probe set plots. */
doRegressionPlot(script, skipPSet, 
		 "mouseAEvent_inc_intensity", 
		 "mouseAEvent_skip_intensity",
		 "mouseAEvent_gene_prob");
doProbeSet(script, skipPSet);
doProbeSetPVals(script, skipPSet);
doNormProbes(script, skipPSet);
fflush(stdout);
fflush(stderr);
invokeR(script);
fputs(html->string, stdout);
}
コード例 #13
0
ファイル: snpMultiple.c プロジェクト: blumroy/kentUtils
int main(int argc, char *argv[])
/* Read snp126. */
/* Write coords of multiple alignments to .tab file. */
/* Write counts to .log file. */
{

if (argc != 2)
    usage();

snpDb = argv[1];
hSetDb(snpDb);

outputFileHandle = mustOpen("snpMultiple.tab", "w");
logFileHandle = mustOpen("snpMultiple.log", "w");

readSnps();
writeResults();

// free hashes

carefulClose(&outputFileHandle);
carefulClose(&logFileHandle);

return 0;
}
コード例 #14
0
ファイル: snpOrthoJoin.c プロジェクト: blumroy/kentUtils
int main(int argc, char *argv[])
{
if (argc != 4)
    usage();

database = argv[1];
hSetDb(database);
snpSimpleTable = argv[2];
if (!hTableExistsDb(database, snpSimpleTable))
    errAbort("can't get table %s\n", snpSimpleTable);
orthoTable = argv[3];
if (!hTableExistsDb(database, orthoTable))
    errAbort("can't get table %s\n", orthoTable);

outputFileHandle = mustOpen("snpOrthoJoin.tab", "w");
missingFileHandle = mustOpen("snpOrthoJoin.missing", "w");

chimpHash = getOrtho(orthoTable, "panTro2");
macaqueHash = getOrtho(orthoTable, "rheMac2");
writeResults(snpSimpleTable);

carefulClose(&outputFileHandle);
carefulClose(&missingFileHandle);

return 0;
}
コード例 #15
0
int main(int argc, char *argv[])
/* work with singly aligning SNPs only */
/* load oldTable subset into list */
/* load newTable subset into hash */
{

char *snpDb = NULL;
struct weightList *oldTableList = NULL;
struct hash *newTableHash = NULL;
char *oldTableName = NULL;
char *newTableName = NULL;

if (argc != 4)
    usage();

oneToOne = 0;
oneToTwo = 0;
oneToThree = 0;
twoToTwo = 0;
twoToOne = 0;
twoToThree = 0;
threeToThree = 0;
threeToOne = 0;
threeToTwo = 0;

snpDb = argv[1];
hSetDb(snpDb);

oldTableName = argv[2];
newTableName = argv[3];

// check that tables exist
if (!hTableExists(oldTableName))
    errAbort("no %s table in %s\n", oldTableName, snpDb);
if (!hTableExists(newTableName))
    errAbort("no %s table in %s\n", newTableName, snpDb);

oldTableList = getTableList(oldTableName);
newTableHash = getTableHash(newTableName);

logFileHandle = mustOpen("snpCompareWeightLog.out", "w");
processSnps(oldTableList, newTableHash);
carefulClose(&logFileHandle);

countFileHandle = mustOpen("snpCompareWeightCounts.out", "w");
fprintf(countFileHandle, "oneToOne = %d\n", oneToOne);
fprintf(countFileHandle, "oneToTwo = %d\n", oneToTwo);
fprintf(countFileHandle, "oneToThree = %d\n", oneToThree);
fprintf(countFileHandle, "twoToTwo = %d\n", twoToTwo);
fprintf(countFileHandle, "twoToOne = %d\n", twoToOne);
fprintf(countFileHandle, "twoToThree = %d\n", twoToThree);
fprintf(countFileHandle, "threeToThree = %d\n", threeToThree);
fprintf(countFileHandle, "threeToOne = %d\n", threeToOne);
fprintf(countFileHandle, "threeToTwo = %d\n", threeToTwo);
carefulClose(&countFileHandle);

return 0;
}
コード例 #16
0
int main(int argc, char *argv[])
/* Process command line. */
{
optionInit(&argc, argv, options);
if (argc != 4)
    usage();
database=argv[1];
hSetDb(argv[1]);
protDbName = hPdbFromGdb(database);
fbName(argv[1], protDbName, argv[2], argv[3]);
return 0;
}
コード例 #17
0
ファイル: nmerParasolGenome.c プロジェクト: bowhan/kent
int main(int argc, char *argv[])
{
int oligoSize = 0;
if(argc != 6)
    usage();
hSetDb(argv[1]);
chunkSize = atoi(argv[2]);
oligoSize = atoi(argv[4]);
getChromNamesAndDirForDb(argv[1]);
writeOutJobs(argv[3], chunkSize, oligoSize, argv[5]);
return 0;
}
コード例 #18
0
void whyConserved(char *database, char *chrom, char *homologyTrack)
/* whyConserved - Try and analyse why a particular thing is conserved. */
{
struct sqlConnection *conn;
int chromSize;
Bits *h**o = NULL;
Bits *bits = NULL;
Bits *once = NULL;

hSetDb(database);
conn = hAllocConn();
chromSize = hChromSize(chrom);

h**o = bitAlloc(chromSize);
bits = bitAlloc(chromSize);
once = bitAlloc(chromSize);

/* Get homology bitmap and set once mask to be the same. */
fbOrTableBits(h**o, homologyTrack, chrom, chromSize, conn);
bitOr(once, h**o, chromSize);

/* printHeader */
printf("%-21s %8s %8s %5s %6s  %6s %5s  %5s \n",
	"Track Specification", "track", "overlap", 
	"track", "mus",  "track", "new",  "cum");
printf("%-21s %8s %8s %5s %6s  %6s %5s  %5s \n",
	"", "size", "size", 
	"geno", "track", "mus",  "mus",  "mus");
printf("-----------------------------------------------------------------------------\n");

/* Whittle awway at homology... */
explainSome(h**o, once, bits, chrom, chromSize, conn, NULL, homologyTrack);
explainSome(h**o, once, bits, chrom, chromSize, conn, "simpleRepeat", NULL);
explainSome(h**o, once, bits, chrom, chromSize, conn, "rmsk", NULL);
explainSome(h**o, once, bits, chrom, chromSize, conn, "sanger22:CDS:10", NULL);
explainSome(h**o, once, bits, chrom, chromSize, conn, "refGene:CDS:10", NULL);
explainSome(h**o, once, bits, chrom, chromSize, conn, "sanger22:exon:10", NULL);
explainSome(h**o, once, bits, chrom, chromSize, conn, "refGene:exon:10", NULL);
explainSome(h**o, once, bits, chrom, chromSize, conn, "ensGene:exon:10", NULL);
explainSome(h**o, once, bits, chrom, chromSize, conn, "rnaGene", NULL);
explainSome(h**o, once, bits, chrom, chromSize, conn, "mrna:exon:10", NULL);
explainSome(h**o, once, bits, chrom, chromSize, conn, "intronEst:exon:10", NULL);
explainSome(h**o, once, bits, chrom, chromSize, conn, "xenoMrna:exon:10", NULL);
explainSome(h**o, once, bits, chrom, chromSize, conn, "xenoEst:exon:10", NULL);
explainSome(h**o, once, bits, chrom, chromSize, conn, "genscan:exon:10", NULL);
explainSome(h**o, once, bits, chrom, chromSize, conn, "genscanSubopt", NULL);
explainSome(h**o, once, bits, chrom, chromSize, conn, "psu:exon:10", NULL);
explainSome(h**o, once, bits, chrom, chromSize, conn, "sanger22:upstream:200", NULL);
explainSome(h**o, once, bits, chrom, chromSize, conn, "refGene:upstream:200", NULL);
explainSome(h**o, once, bits, chrom, chromSize, conn, "mrna:upstream:200", NULL);
explainSome(h**o, once, bits, chrom, chromSize, conn, "est", NULL);
hFreeConn(&conn);
}
コード例 #19
0
int main(int argc, char *argv[])
/* Read snp125. */
{

if (argc != 2)
    usage();

snpDb = argv[1];
hSetDb(snpDb);
readSnps();
checkExceptions();
return 0;
}
コード例 #20
0
ファイル: fakeLinkage.c プロジェクト: davidhoover/kent
void fakeLinkage(char *database, char *output)
/* fakeLinkage - Fake some linkage data. */
{
FILE *f = mustOpen(output, "w");
hSetDb(database);
int i;
for (i=1; i<=22; ++i)
    {
    char chromName[256];
    safef(chromName, sizeof(chromName), "chr%d", i);
    fakeChromLinkage(database, chromName, f);
    }
carefulClose(&f);
}
コード例 #21
0
int main(int argc, char *argv[])
/* hash subsnp_class and var_str from UniVariation */
/* read SNP for univar_id, lookup into univarHash */
/* store univarHash elements in snpHash */
/* read through chrN_snpTmp, rewrite with extensions to individual chrom tables */
{
struct slName *chromList, *chromPtr;
char tableName[64];

if (argc != 2)
    usage();


snpDb = argv[1];
hSetDb(snpDb);

/* check for necessary tables */
if(!hTableExistsDb(snpDb, "SNP"))
    errAbort("missing SNP table");
if(!hTableExistsDb(snpDb, "UniVariation"))
    errAbort("missing UniVariation table");

chromList = hAllChromNamesDb(snpDb);

errorFileHandle = mustOpen("snpClassAndObserved.errors", "w");

univarHash = getUnivarHash();
snpHash = getSNPHash();

for (chromPtr = chromList; chromPtr != NULL; chromPtr = chromPtr->next)
    {
    safef(tableName, ArraySize(tableName), "%s_snpTmp", chromPtr->name);
    if (!hTableExists(tableName)) continue;
    verbose(1, "chrom = %s\n", chromPtr->name);
    processSnps(chromPtr->name);
    }

carefulClose(&errorFileHandle);

for (chromPtr = chromList; chromPtr != NULL; chromPtr = chromPtr->next)
    {
    safef(tableName, ArraySize(tableName), "%s_snpTmp", chromPtr->name);
    if (!hTableExists(tableName)) continue;
    recreateDatabaseTable(chromPtr->name);
    verbose(1, "loading chrom = %s\n", chromPtr->name);
    loadDatabase(chromPtr->name);
    }

return 0;
}
コード例 #22
0
ファイル: ldGencodeIntron.c プロジェクト: davidhoover/kent
void ldGencodeIntron(char *database, char *table,  
                        int gtfCount, char *gtfNames[])
/* Load Gencode intron status table from GTF files with
 * intron_id and intron_status keywords */
{
struct gffFile *gff, *gffList = NULL;
struct gffLine *gffLine;
struct gencodeIntron *intron, *intronList = NULL;
struct sqlConnection *conn;
FILE *f;
int i;
int introns = 0;

for (i=0; i<gtfCount; i++)
    {
    verbose(1, "Reading %s\n", gtfNames[i]);
    gff = gffRead(gtfNames[i]);
    for (gffLine = gff->lineList; gffLine != NULL; gffLine = gffLine->next)
        {
        if (sameWord(gffLine->feature, "intron"))
            {
            AllocVar(intron);
            intron->chrom = gffLine->seq;
            intron->chromStart = gffLine->start;
            intron->chromEnd = gffLine->end;
            intron->name = gffLine->intronId;
            intron->strand[0] = gffLine->strand;
            intron->strand[1] = 0;
            intron->status = gffLine->intronStatus;
            intron->transcript = gffLine->group;
            intron->geneId = gffLine->geneId;
            slAddHead(&intronList, intron);
            verbose(2, "%s %s\n", intron->chrom, intron->name);
            introns++;
            }
        }
    }
slSort(&intronList, bedCmp);
f = hgCreateTabFile(".", table);
for (intron = intronList; intron != NULL; intron = intron->next)
    gencodeIntronTabOut(intron, f);
carefulClose(&f);

verbose(1, "%d introns in %d files\n", introns, gtfCount);
hSetDb(database);
conn = sqlConnect(database);
gencodeIntronTableCreate(conn, table, hGetMinIndexLength());
hgLoadTabFile(conn, ".", table, &f);
sqlDisconnect(&conn);
}
コード例 #23
0
ファイル: snpSplitSimple.c プロジェクト: elmargb/kentUtils
int main(int argc, char *argv[])
/* read ContigLocFilter, writing to individual chrom tables */
{
struct hashCookie cookie;
struct hashEl *hel;
char *chromName;

if (argc != 3)
    usage();

snpDb = argv[1];
contigGroup = argv[2];
hSetDb(snpDb);

/* check for needed tables */
if(!hTableExistsDb(snpDb, "ContigLocFilter"))
    errAbort("no ContigLocFilter table in %s\n", snpDb);
if(!hTableExistsDb(snpDb, "ContigInfo"))
    errAbort("no ContigInfo table in %s\n", snpDb);

chromHash = loadChroms(contigGroup);
if (chromHash == NULL) 
    {
    verbose(1, "couldn't get chrom info\n");
    return 1;
    }

writeSplitTables();

verbose(1, "closing files...\n");
cookie = hashFirst(chromHash);
while (hel = hashNext(&cookie))
    fclose(hel->val);

verbose(1, "creating tables...\n");
cookie = hashFirst(chromHash);
while ((chromName = hashNextName(&cookie)) != NULL)
    createTable(chromName);

verbose(1, "loading database...\n");
cookie = hashFirst(chromHash);
while ((chromName = hashNextName(&cookie)) != NULL)
    {
    verbose(1, "chrom = %s\n", chromName);
    loadDatabase(chromName);
    }

return 0;
}
コード例 #24
0
ファイル: affyCheck.c プロジェクト: blumroy/kentUtils
int main(int argc, char *argv[])
/* Check args and call affyCheck. */
{
if (argc != 4)
    usage();
database = argv[1];
affyTable = argv[2];
lookupTable = argv[3];
hSetDb(database);

/* initialize ntCompTable[] */
dnaUtilOpen();
affyCheck();
return 0;
}
コード例 #25
0
int main(int argc, char *argv[])
/* Process command line. */
{
optionInit(&argc, argv, options);
if (argc != 5)
    usage();
hSetDb(argv[1]);
geneListHash = hashNew(0);
geneTable = optionVal("table", geneTable);
altTable = optionVal("alt", altTable);
thickOnly = optionExists("thickOnly");
meFirst = optionExists("meFirst");
mafOrtholog(argv[1], argv[2], argv[3], argv[4]);
return 0;
}
コード例 #26
0
void testIntersect(char *db, char *track1, char *track2)
/* testIntersect - Test some ideas on intersections. */
{
struct slName *chromList = NULL, *chrom;
struct sqlConnection *conn;

hSetDb(db);
if (optionExists("chrom"))
    chromList = slNameNew(optionVal("chrom", NULL));
else
    chromList = hAllChromNames();
conn = hAllocConn();
for (chrom = chromList; chrom != NULL; chrom = chrom->next)
     intersectOnChrom(db, conn, chrom->name, track1, track2);
hFreeConn(&conn);
}
コード例 #27
0
int main(int argc, char *argv[])
{
if (argc != 3)
    usage();

snpDb = argv[1];
snpTable = argv[2];

hSetDb(snpDb);
createAlleleHash();
createSnpHash(snpTable);
readFreq();
 
// freeHash(&alleleHash);
return 0;
}
コード例 #28
0
void randomEst(char *database, int count, char *output)
/* randomEst - Select random ESTs from database. */
{
struct sqlConnection *conn = sqlConnect(database);
struct sqlResult *sr;
char **row;
int i, elIx, okCount = 0;
struct slName *list = NULL, *el;
FILE *f = NULL;
char **array = NULL;
struct dnaSeq *seq;
struct hash *uniqHash = newHash(0);

hSetDb(database);
printf("Scanning database\n");
sr = sqlGetResult(conn, "select acc,type,direction from mrna");
while ((row = sqlNextRow(sr)) != NULL)
    {
    if (sameString(row[1], "EST") && sameString(row[2], "3"))
        {
	el = newSlName(row[0]);
	slAddHead(&list, el);
	++okCount;
	}
    }
sqlFreeResult(&sr);
printf("Got %d 3' ESTs\n", okCount);
AllocArray(array, okCount);
for (i=0, el = list; el != NULL; el = el->next, ++i)
    array[i] = el->name;

printf("Selecting %d to put into %s\n", count, output);
f = mustOpen(output, "w");
for (i=0; i<count; ++i)
    {
    char *name;
    elIx = rand()%okCount;
    name = array[elIx];
    if (!hashLookup(uniqHash, name))
	{
	hashAdd(uniqHash, name, NULL);
	seq = hRnaSeq(name);
	faWriteNext(f, seq->name, seq->dna, seq->size);
	freeDnaSeq(&seq);
	}
    }
}
コード例 #29
0
int main(int argc, char *argv[])
/* read chrN_snpTmp, lookup in snpFasta, rewrite to individual chrom tables */
{
struct slName *chromList, *chromPtr;
char tableName[64];

if (argc != 2)
    usage();

snpDb = argv[1];
hSetDb(snpDb);
chromList = hAllChromNamesDb(snpDb);
if (chromList == NULL) 
    {
    verbose(1, "couldn't get chrom info\n");
    return 1;
    }

errorFileHandle = mustOpen("snpSNP.errors", "w");

/* read into global hash */
verbose(1, "reading SNP table into hash...\n");
readSNP();
    
for (chromPtr = chromList; chromPtr != NULL; chromPtr = chromPtr->next)
    {
    safef(tableName, ArraySize(tableName), "%s_snpTmp", chromPtr->name);
    if (!hTableExists(tableName)) continue;
 
    verbose(1, "processing chrom = %s\n", chromPtr->name);
 
    processSnps(chromPtr->name);
    }

carefulClose(&errorFileHandle);

for (chromPtr = chromList; chromPtr != NULL; chromPtr = chromPtr->next)
    {
    safef(tableName, ArraySize(tableName), "%s_snpTmp", chromPtr->name);
    if (!hTableExists(tableName)) continue;
    recreateDatabaseTable(chromPtr->name);
    verbose(1, "loading chrom = %s\n", chromPtr->name);
    loadDatabase(chromPtr->name);
    }

return 0;
}
コード例 #30
0
ファイル: snpPAR.c プロジェクト: blumroy/kentUtils
int main(int argc, char *argv[])
{

if (argc != 2)
    usage();

snpDb = argv[1];
hSetDb(snpDb);
outputFileHandle = mustOpen("snpPAR.tab", "w");
exceptionFileHandle = mustOpen("snpPARexceptions.tab", "w");
getSnps();
getExceptions();
loadDatabase();
carefulClose(&outputFileHandle);
carefulClose(&exceptionFileHandle);

return 0;
}