示例#1
0
static const AjPStr assemSAMGetReadgroupHeaderlines(const AjPAssem assem)
{
    AjPStr* rgids = NULL;
    const AjPAssemReadgroup rg = NULL;
    ajint i =0;

    ajTableToarrayKeys(assem->Readgroups, (void***)&rgids);

    ajStrAssignC(&assemoutSamLinetxt, "");

    while (rgids[i])  /* read groups */
    {
	rg = ajTableFetchS(assem->Readgroups, rgids[i++]);
	ajFmtPrintAppS(&assemoutSamLinetxt, "@RG\tID:%S", rg->ID);

	if(rg->CN)
	    ajFmtPrintAppS(&assemoutSamLinetxt, "\tCN:%S", rg->CN);

	if(rg->Desc)
	    ajFmtPrintAppS(&assemoutSamLinetxt, "\tDS:%S", rg->Desc);

	if(rg->Date)
	    ajFmtPrintAppS(&assemoutSamLinetxt, "\tDT:%S", rg->Date);

	if(rg->FlowOrder)
	    ajFmtPrintAppS(&assemoutSamLinetxt, "\tFO:%S", rg->FlowOrder);

	if(rg->KeySeq)
	    ajFmtPrintAppS(&assemoutSamLinetxt, "\tKS:%S", rg->KeySeq);

	if(rg->Library)
	    ajFmtPrintAppS(&assemoutSamLinetxt, "\tLB:%S", rg->Library);

	if(rg->Programs)
	    ajFmtPrintAppS(&assemoutSamLinetxt, "\tPG:%S", rg->Programs);

	if(rg->Isize)
	    ajFmtPrintAppS(&assemoutSamLinetxt, "\tPI:%d", rg->Isize);

	if(rg->Platform)
	    ajFmtPrintAppS(&assemoutSamLinetxt, "\tPL:%s",
	                   ajAssemreadgroupGetPlatformname(rg));

	if(rg->Unit)
	    ajFmtPrintAppS(&assemoutSamLinetxt, "\tPU:%S", rg->Unit);

	if(rg->Sample)
	    ajFmtPrintAppS(&assemoutSamLinetxt, "\tSM:%S", rg->Sample);

	ajStrAppendC(&assemoutSamLinetxt, "\n");

    }

    AJFREE(rgids);

    return assemoutSamLinetxt;
}
示例#2
0
static void remap_CutList(AjPFile outfile, const AjPTable hittable,
			  AjBool isos,
			  AjBool html, ajint mincuts, ajint maxcuts)
{
    const PValue value;
    void **keyarray = NULL;		/* array for table */
    ajint i;

    /* print title */
    if(html)
	ajFmtPrintF(outfile, "<H2>");
    ajFmtPrintF(outfile, "\n\n# Enzymes that cut  Frequency");
    if(isos)
	ajFmtPrintF(outfile, "\tIsoschizomers\n");
    else
	ajFmtPrintF(outfile, "\n");

    if(html)
	ajFmtPrintF(outfile, "</H2>\n");

    if(ajTableGetLength(hittable))
    {
        ajTableToarrayKeys(hittable, &keyarray);
        qsort(keyarray, ajTableGetLength(hittable), sizeof (*keyarray),
	      ajStrVcmp);

	/* enzymes that cut the required number of times */
	if(html)
	    ajFmtPrintF(outfile, "<PRE>");

	for(i = 0; keyarray[i]; i++)
	{
	    value = ajTableFetchS(hittable,keyarray[i]);
	    if(value->count >= mincuts && value->count <= maxcuts)
	    ajFmtPrintF(outfile, "%10S\t    %d\t%S\n",
		    (AjPStr) keyarray[i], value->count,
		    value->iso);
        }

        ajFmtPrintF(outfile, "\n");

        if(html)
	    ajFmtPrintF(outfile, "</PRE>\n");
    }

    /* enzymes that cut <mincuts */

    /* print title */
    if(html)
        ajFmtPrintF(outfile, "<H2>");
    ajFmtPrintF(outfile, "\n\n# Enzymes which cut less frequently than the ");
    ajFmtPrintF(outfile, "MINCUTS criterion\n# Enzymes < MINCUTS Frequency");

    if(isos)
        ajFmtPrintF(outfile, "\tIsoschizomers\n");
    else
	ajFmtPrintF(outfile, "\n");

    if(html)
	ajFmtPrintF(outfile, "</H2>\n");

    if(ajTableGetLength(hittable))
    {
	/* print out results */
	if(html)
	    ajFmtPrintF(outfile, "<PRE>");

	for(i = 0; keyarray[i]; i++)
	{
	    value = ajTableFetchS(hittable,keyarray[i]);
	    if(value->count < mincuts)
	    ajFmtPrintF(outfile, "%10S\t    %d\t%S\n",
			    (AjPStr) keyarray[i], value->count,
			    value->iso);
	}
        ajFmtPrintF(outfile, "\n");

        if(html)
	    ajFmtPrintF(outfile, "</PRE>\n");
    }

    /* enzymes that cut >maxcuts */

    /* print title */
    if(html)
	ajFmtPrintF(outfile, "<H2>");
    ajFmtPrintF(outfile, "\n\n# Enzymes which cut more frequently than the ");
    ajFmtPrintF(outfile, "MAXCUTS criterion\n# Enzymes > MAXCUTS Frequency");

    if(isos)
	ajFmtPrintF(outfile, "\tIsoschizomers\n");
    else
	ajFmtPrintF(outfile, "\n");

    if(html)
	ajFmtPrintF(outfile, "</H2>\n");

    if(ajTableGetLength(hittable))
    {
	/* print out results */
	if(html)
	    ajFmtPrintF(outfile, "<PRE>");

	for(i = 0; keyarray[i]; i++)
	{
	    value = ajTableFetchS(hittable,keyarray[i]);
	    if(value->count > maxcuts)
	    ajFmtPrintF(outfile, "%10S\t    %d\t%S\n",
			    (AjPStr) keyarray[i], value->count,
			    value->iso);
	}

        ajFmtPrintF(outfile, "\n");

        if(html)
	    ajFmtPrintF(outfile, "</PRE>\n");

	AJFREE(keyarray);
    }

    return;
}