Beispiel #1
0
int main(int argc, char *argv[])
/* Process command line. */
{
char *liftFileQ = NULL, *liftFileT = NULL;
optionInit(&argc, argv, optionSpecs);
if (argc != 5)
    usage();
tNewR = optionVal("tNewR", tNewR);
qNewR = optionVal("qNewR", qNewR);
noAr = optionExists("noAr");
qRepeatTable = optionVal("qRepeats", qRepeatTable);
tRepeatTable = optionVal("tRepeats", tRepeatTable);
liftFileQ = optionVal("liftQ", liftFileQ);
liftFileT = optionVal("liftT", liftFileT);
if (liftFileQ != NULL)
    {
    struct liftSpec *lifts = readLifts(liftFileQ);
    liftHashQ = hashLift(lifts, TRUE);
    }
if (liftFileT != NULL)
    {
    struct liftSpec *lifts = readLifts(liftFileT);
    liftHashT = hashLift(lifts, TRUE);
    }
netClass(argv[1], argv[2], argv[3], argv[4]);
return 0;
}
void fixNewLength(char *inFile, char *liftFile, long int size)
{
    FILE *liftFh = mustOpen(liftFile, "w");
    struct liftSpec *el, *lifts = readLifts(inFile);
    for (el = lifts; el != NULL; el = el->next)
    {
        fprintf(liftFh, "%ld\t%s\t%ld\t%s\t%d\n",el->offset, el->oldName, size, el->newName,  el->newSize);
    }
    carefulClose(&liftFh);
}
Beispiel #3
0
int main(int argc, char *argv[])
{
int i;
struct liftSpec *lsList = NULL;
struct hash *liftHash = NULL;
int grouping;
if(argc < 4)
    usage();
lsList = readLifts(argv[1]);
liftHash = hashLift(lsList);
grouping = atoi(argv[2]);
for(i=3; i<argc; i++)
    affyPairsToSample(liftHash, grouping , argv[i]);
fprintf(stderr,"\nfinished.\n");
return 0;
}
Beispiel #4
0
void netContigs(char *netFile, char *liftFile)
/* netContigs - get query-side contigs from a chrom-level net file */
{
struct lineFile *lf = lineFileOpen(netFile, TRUE);
struct chainNet *net;

struct liftSpec *lift, *prevLift, *lifts;
char *chrom;

/* read lift file and split into a hash of per-chrom lists */
lifts = readLifts(liftFile);
prevLift = NULL;
for (lift = lifts; lift != NULL; lift = lift->next)
    {
    //uglyf("reading lift: %s\n", lift->oldName);
    if (hashLookup(chromHash, lift->newName) == NULL)
        {
        /* new chrom */
        //uglyf("adding chrom: %s\n", lift->newName);
        hashAdd(chromHash, lift->newName, lift);
        /* terminate previous list */
        /* NOTE: expects input sorted by chrom */
        if (prevLift != NULL)
            prevLift->next = NULL;
        }
    prevLift = lift;
    }

/* read in nets and convert query side to contig coords */
//uglyf("reading in nets\n");
while ((net = chainNetRead(lf)) != NULL)
    {
    rLower(net->fillList);
    chainNetFree(&net);
    }
/* print accumulated contigs */
hashTraverseEls(contigNames, printContig);
}
void liftUp(char *destFile, char *liftFile, char *howSpec, int sourceCount, char *sources[])
/* liftUp - change coordinates of .psl, .agp, or .out file
 * to parent coordinate system. */
{
struct liftSpec *lifts = NULL;
struct hash *liftHash;
char *destType = optionVal("type", destFile);

if (sameWord(howSpec, "carry"))
    how = carryMissing;
else if (sameWord(howSpec, "warn"))
    how = warnMissing;
else if (sameWord(howSpec, "drop"))
    how = silentDrop;
else if (sameWord(howSpec, "error"))
    how = errorMissing;
else
    usage();
if (how == carryMissing && sameString("/dev/null", liftFile))
    verbose(1, "Carrying input -- ignoring /dev/null liftFile\n");
else
    {
    lifts = readLifts(liftFile);
    verbose(1, "Got %d lifts in %s\n", slCount(lifts), liftFile);
    }

if (endsWith(destType, ".out"))
    {
    rmChromPart(lifts);
    liftHash = hashLift(lifts, FALSE);
    liftOut(destFile, liftHash, sourceCount, sources);
    }
else if (endsWith(destType, ".pslx") || endsWith(destType, ".xa") || endsWith(destType, ".psl"))
    {
    rmChromPart(lifts);
    liftHash = hashLift(lifts, TRUE);
    liftPsl(destFile, liftHash, sourceCount, sources, 
    	optionExists("pslQ") || optionExists("pslq"), !endsWith(destType, ".psl") );
    }
else if (endsWith(destType, ".agp"))
    {
    liftHash = hashLift(lifts, FALSE);
    liftAgp(destFile, liftHash, sourceCount, sources);
    }
else if (endsWith(destType, ".gap"))
    {
    liftHash = hashLift(lifts, TRUE);
    liftGap(destFile, liftHash, sourceCount, sources);
    }
else if (endsWith(destType, ".gl"))
    {
    rmChromPart(lifts);
    liftHash = hashLift(lifts, FALSE);
    liftGl(destFile, liftHash, sourceCount, sources);
    }
else if (endsWith(destType, ".gff") || endsWith(destType, ".gtf"))
    {
    rmChromPart(lifts);
    liftHash = hashLift(lifts, TRUE);
    liftGff(destFile, liftHash, sourceCount, sources);
    }
else if (endsWith(destType, ".gdup"))
    {
    rmChromPart(lifts);
    liftHash = hashLift(lifts, FALSE);
    liftGdup(destFile, liftHash, sourceCount, sources);
    }
else if (endsWith(destType, ".bed"))
    {
    rmChromPart(lifts);
    liftHash = hashLift(lifts, TRUE);
    liftBed(destFile, liftHash, sourceCount, sources);
    }
else if (endsWith(destType, ".bed8"))
    {
    rmChromPart(lifts);
    liftHash = hashLift(lifts, TRUE);
    liftBed8(destFile, liftHash, sourceCount, sources);
    }
else if (endsWith(destType, ".gp") || endsWith(destType, ".genepred"))
    {
    rmChromPart(lifts);
    liftHash = hashLift(lifts, TRUE);
    if (extGenePred)
        liftGenePredExt(destFile, liftHash, sourceCount, sources);
    else
        liftGenePred(destFile, liftHash, sourceCount, sources);
    }
else if (endsWith(destType, ".bscore"))
    {
    rmChromPart(lifts);
    liftHash = hashLift(lifts, TRUE);
    liftBScore(destFile, liftHash, sourceCount, sources,
    	optionExists("pslQ") || optionExists("pslq"));
    }
else if (endsWith(destType, ".tab"))
    {
    rmChromPart(lifts);
    liftHash = hashLift(lifts, TRUE);
    liftBlast(destFile, liftHash, sourceCount, sources);
    }
else if (strstr(destType, "gold"))
    {
    rmChromPart(lifts);
    liftHash = hashLift(lifts, FALSE);
    liftAgp(destFile, liftHash, sourceCount, sources);
    }
else if (strstr(destType, ".axt"))
    {
    rmChromPart(lifts);
    liftHash = hashLift(lifts, FALSE);
    liftAxt(destFile, liftHash, sourceCount, sources, 	
    	optionExists("axtQ") || optionExists("axtq"));
    }
else if (strstr(destType, ".chain"))
    {
    rmChromPart(lifts);
    liftHash = hashLift(lifts, TRUE);
    liftChain(destFile, liftHash, sourceCount, sources, 	
    	optionExists("chainQ") || optionExists("chainq"));
    }
else if (strstr(destType, ".net"))
    {
    rmChromPart(lifts);
    liftHash = hashLift(lifts, FALSE);
    liftNet(destFile, liftHash, sourceCount, sources, 	
    	optionExists("netQ") || optionExists("netq"));
    }
else if (strstr(destType, ".wab"))
    {
    rmChromPart(lifts);
    liftHash = hashLift(lifts, FALSE);
    liftWab(destFile, liftHash, sourceCount, sources,
    	optionExists("wabaQ") || optionExists("wabaq"));
    }
else 
    {
    errAbort("Unknown file suffix for %s\n", destType);
    }
}