예제 #1
0
void metaTreeWrite(int level, int minLevel, int maxLevel, boolean isFile,
    char *parent, struct metaNode *node, struct hash *suppress, FILE *f)
/* Write out self and children to file recursively. */
{
if (level >= minLevel && level < maxLevel)
    {
    int indent = (level-minLevel)*3;
    spaceOut(f, indent);
    fprintf(f, "meta %s\n", node->name);
    if (withParent && parent != NULL)
	{
	spaceOut(f, indent);
	fprintf(f, "parent %s\n", parent);
	}
    struct mdbVar *v;
    for (v = node->vars; v != NULL; v = v->next)
	{
	if (!hashLookup(suppress, v->var))
	    {
	    spaceOut(f, indent);
	    fprintf(f, "%s %s\n", v->var, v->val);
	    }
	}
    fprintf(f, "\n");
    }
struct metaNode *child;
for (child = node->children; child != NULL; child = child->next)
    metaTreeWrite(level+1, minLevel, maxLevel, isFile, node->name, child, suppress, f);
}
예제 #2
0
파일: meta.c 프로젝트: avilella/methylQA
static void rMetaListWrite(struct meta *metaList, struct meta *parent,
                           boolean level, int indent, boolean withParent, FILE *f)
/* Write out list of stanzas at same level to file,  their children too. */
{
    int totalIndent = level * indent;
    struct meta *meta;
    for (meta = metaList; meta != NULL; meta = meta->next)
    {
        struct metaTagVal *mtv;
        boolean gotParent = FALSE;
        for (mtv = meta->tagList; mtv != NULL; mtv = mtv->next)
        {
            if (sameString(mtv->tag, "parent"))
            {
                if (withParent)
                    gotParent = TRUE;
                else
                    continue;
            }
            spaceOut(f, totalIndent);
            fprintf(f, "%s %s\n", mtv->tag, mtv->val);
        }
        if (withParent && !gotParent && parent != NULL)
        {
            spaceOut(f, totalIndent);
            fprintf(f, "%s %s\n", "parent", parent->name);
        }
        fprintf(f, "\n");
        if (meta->children)
            rMetaListWrite(meta->children, meta, level+1, indent, withParent, f);
    }
}
예제 #3
0
파일: main.c 프로젝트: bowhan/kent
static void printScopeInfo(FILE *f, int level, struct pfParse *pp)
/* Print out info on each new scope. */
{
switch (pp->type)
    {
    case pptProgram:
    case pptMainModule:
    case pptFor:
    case pptForeach:
    case pptForEachCall:
    case pptToDec:
    case pptFlowDec:
    case pptCompound:
	{
	char *name = pp->name;
	if (name == NULL)
	    name = "";
        spaceOut(f, 2*level);
	fprintf(f, "scope %d %s %s: ", pp->scope->id,
		pfParseTypeAsString(pp->type), name);
	pfScopeDump(pp->scope, f);
	fprintf(f, "\n");
	break;
	}
    }
for (pp = pp->children; pp != NULL; pp = pp->next)
    printScopeInfo(f, level+1, pp);
}
예제 #4
0
void rqlParseDump(struct rqlParse *p, int depth, FILE *f)
/* Dump out rqlParse tree and children. */
{
spaceOut(f, 3*depth);
fprintf(f, "%s ", rqlOpToString(p->op));
rqlValDump(p->val, p->type,  f);
fprintf(f, "\n");
struct rqlParse *child;
for (child = p->children; child != NULL; child= child->next)
    rqlParseDump(child, depth+1, f);
}
예제 #5
0
/**
 * Check if {word} is contained in {keywords}. If yes, erase {word} with
 * white spaces. {len} indicates the length of {word}, and {num} indicates
 * the length of the keyword list.
 */
void checkWord(char* word, int len, char** keywords, int num) {
  for(int i=0; i<num;i++)
    for (int j=0;j<len;j++)
    {if ((*(*(keywords+i)+j))!=*(word+j))
	return;}
     for(int k=0;k<len;k++)
       spaceOut(word,len);
     
  
  /*  FILL IN HERE  */
// Please remove the abort() when you implement this function
}
예제 #6
0
void fillOut(FILE *f, struct fill *fill, char *oChrom, int depth,
	int subSize, double subScore)
/* Output fill. */
{
struct chain *chain = fill->chain;
spaceOut(f, depth);
fprintf(f, "fill %d %d %s %c %d %d id %d score %1.0f ali %d\n", 
	fill->start, fill->end - fill->start,
	oChrom, chain->qStrand, 
	fill->oStart, fill->oEnd - fill->oStart, chain->id,
	subScore, subSize);
}
예제 #7
0
파일: rbTree.c 프로젝트: JinfengChen/pblat
static void rTreeDump(struct rbTreeNode *n)
/* Recursively dump. */
{
if (n == NULL)
    return;
spaceOut(dumpFile, ++dumpLevel * 3);
fprintf(dumpFile, "%c ", (n->color ==  rbTreeRed ? 'r' : 'b'));
dumpIt(n->item, dumpFile);
fprintf(dumpFile, "\n");
rTreeDump(n->left);
rTreeDump(n->right);
--dumpLevel;
}
예제 #8
0
파일: chainNet.c 프로젝트: bowhan/kent
void cnFillWrite(struct cnFill *fillList, FILE *f, int depth)
/* Recursively write out fill list. */
{
struct cnFill *fill;
for (fill = fillList; fill != NULL; fill = fill->next)
    {
    char *type = (fill->chainId ? "fill" : "gap");
    spaceOut(f, depth);
    fprintf(f, "%s %d %d %s %c %d %d", type, fill->tStart, fill->tSize,
    	fill->qName, fill->qStrand, fill->qStart, fill->qSize);
    if (fill->chainId)
        fprintf(f, " id %d", fill->chainId);
    if (fill->score > 0)
        fprintf(f, " score %1.0f", fill->score);
    if (fill->ali > 0)
        fprintf(f, " ali %d", fill->ali);
    if (fill->qOver >= 0)
        fprintf(f, " qOver %d", fill->qOver);
    if (fill->qFar >= 0)
        fprintf(f, " qFar %d", fill->qFar);
    if (fill->qDup >= 0)
        fprintf(f, " qDup %d", fill->qDup);
    if (fill->type != NULL)
        fprintf(f, " type %s", fill->type);
    if (fill->tN >= 0)
        fprintf(f, " tN %d", fill->tN);
    if (fill->qN >= 0)
        fprintf(f, " qN %d", fill->qN);
    if (fill->tR >= 0)
        fprintf(f, " tR %d", fill->tR);
    if (fill->qR >= 0)
        fprintf(f, " qR %d", fill->qR);
    if (fill->tNewR >= 0)
        fprintf(f, " tNewR %d", fill->tNewR);
    if (fill->qNewR >= 0)
        fprintf(f, " qNewR %d", fill->qNewR);
    if (fill->tOldR >= 0)
        fprintf(f, " tOldR %d", fill->tOldR);
    if (fill->qOldR >= 0)
        fprintf(f, " qOldR %d", fill->qOldR);
    if (fill->tTrf >= 0)
        fprintf(f, " tTrf %d", fill->tTrf);
    if (fill->qTrf >= 0)
        fprintf(f, " qTrf %d", fill->qTrf);
    fputc('\n', f);
    if (fill->children)
        cnFillWrite(fill->children, f, depth+1);
    }
}
예제 #9
0
static void rOutputGap(struct fill *parent, struct gap *gap, FILE *f)
/* Recursively output gap and it's fillers. */
{
struct fill *fill;
struct chain *chain = parent->chain;
char *oChrom = (rOutQ ? chain->tName : chain->qName);
++rOutDepth;
spaceOut(f, rOutDepth);
fprintf(f, "gap %d %d %s %c %d %d\n", 
	gap->start, gap->end - gap->start,
	oChrom, chain->qStrand, gap->oStart, gap->oEnd - gap->oStart);
for (fill = gap->fillList; fill != NULL; fill = fill->next)
    rOutputFill(fill, f);
--rOutDepth;
}
예제 #10
0
파일: detab.c 프로젝트: sktu/kentUtils
void detab(char *inFile, char *outFile)
/* detab - remove tabs from program. */
{
struct lineFile *lf = lineFileOpen(inFile, FALSE);
FILE *f = mustOpen(outFile, "w");
char *line;
int lineSize, i;

while (lineFileNext(lf, &line, &lineSize))
    {
    for (i=0; i<lineSize; ++i)
        {
	char c = line[i];
	if (c == '\t')
	    spaceOut(f, tabSize);
	else
	    fputc(c, f);
	}
    }
}
void rWriteTree(FILE *f, struct type *type, boolean isOptional, 
	boolean isList, struct hash *uniqHash, 
	boolean withAttributes, int level)
/* Write out type and it's children. */
{
struct attribute *att;
struct element *el;
static struct type *parentStack[256];
int i;


spaceOut(f, level*2);
if (withAttributes && type->textAttribute != NULL)
    writeAttValType(f, type->textAttribute);
fprintf(f, "%s", type->name);
if (isList)
    if (isOptional)
	fprintf(f, "*");
    else
	fprintf(f, "+");
else
    if (isOptional)
	fprintf(f, "?");
if (withAttributes)
    {
    for (att = type->attributes; att != NULL; att = att->next)
	writeAttribute(f, att);
    }
fprintf(f, "\n");

if (level >= ArraySize(parentStack))
    errAbort("Recursion too deep in rWriteTree");
parentStack[level] = type;
for (i=level-1; i>= 0; i -= 1)
    if (type == parentStack[i])
        return;	/* Avoid cycling on self. */

for (el = type->elements; el != NULL; el = el->next)
    rWriteTree(f, el->type, el->isOptional, el->isList, 
    	uniqHash, withAttributes, level+1);
}
예제 #12
0
void wordTreeDump(int level, struct wordTree *wt, int maxChainSize, FILE *f)
/* Write out wordTree to file. */
{
static char *words[64];
int i;
assert(level < ArraySize(words));

words[level] = wt->info->word;
if (!fullOnly || level == maxChainSize)
    {
    fprintf(f, "%d\t%d\t%d\t%d\t%f\t", 
	    level, wt->useCount, wt->outTarget, wt->outCount, wt->normVal);
    
    for (i=1; i<=level; ++i)
	{
	spaceOut(f, level*2);
	fprintf(f, "%s ", words[i]);
	}
    fprintf(f, "\n");
    }
struct wordTree *child;
for (child = wt->children; child != NULL; child = child->next)
    wordTreeDump(level+1, child, maxChainSize, f);
}