Ejemplo n.º 1
0
static void pepnet_plotresidue(char c, float x, float y, const char *squares,
			       const char *octags, const char *diamonds)
{
    static char cs[2];

    cs[1] = '\0';
    *cs=c;


    ajGraphicsSetFgcolour(GREEN);

    if(strstr(squares,cs))
    {
	ajGraphicsSetFgcolour(BLUE);
	ajGraphicsDrawposBox(x-(float)1.5,y-(float)1.32,(float)3.0);
    }

    if(strstr(octags,cs))
    {
	ajGraphicsSetFgcolour(BLUEVIOLET);
	pepnet_drawocta(x,y+(float)0.225,(float)20.0);
    }

    if(strstr(diamonds,cs))
    {
	ajGraphicsSetFgcolour(RED);
	ajGraphicsDrawposDia(x-(float)2.5,y-(float)2.25,(float)5.0);
    }

    ajGraphicsDrawposTextJustify(x,y,cs,0.5);
    ajGraphicsSetFgcolour(GREEN);

    return;
}
Ejemplo n.º 2
0
static void pepwheel_plotresidue(char c, float r, float a, const char *squares,
				 const char *octags, const char *diamonds,
				 float xmin, float xmax,
				 float ymin, float ymax)
{
    float  x;
    float  y;

    static char cs[2];

    cs[1] = '\0';
    *cs   = c;

    ajCvtPolToRec(r, a, &x, &y);

    if(x<xmin+.1 || x>xmax-.1 || y<ymin+.2 || y>ymax-.2)
	return;


    ajGraphicsSetFgcolour(AJB_PURPLE);

    if(strstr(squares,cs))
    {
	ajGraphicsSetFgcolour(AJB_BLUE);
	ajGraphicsDrawposBox(x-(float)0.025,y-(float)0.022,(float)0.05);
    }

    if(strstr(octags,cs))
    {
	ajGraphicsSetFgcolour(AJB_BLACK);
	pepwheel_drawocta(x,y+(float)0.003,(float)0.28);
    }

    if(strstr(diamonds,cs))
    {
	ajGraphicsSetFgcolour(AJB_RED);
	ajGraphicsDrawposDia(x-(float)0.042,y-(float)0.04,(float)0.085);
    }

    ajGraphicsDrawposTextJustify(x,y,cs,0.5);
    ajGraphicsSetFgcolour(AJB_BLACK);
 
    return;
}
Ejemplo n.º 3
0
int main(int argc, char **argv)
{
    AjPSeq    seq = NULL;
    AjPStr    strand   = NULL;
    AjPStr    substr   = NULL;
    AjPStr    squares  = NULL;
    AjPStr    diamonds = NULL;
    AjPStr    octags   = NULL;
    AjBool    amphipathic;
    AjPStr    txt   = NULL;
    AjPGraph  graph = NULL;

    ajint begin;
    ajint end;

    ajint lc;

    ajint i;
    ajint j;
    ajint r;

    ajint count;
    ajint pstart;
    ajint pstop;

    float xmin =   0.0;
    float xmax = 150.0;
    float ymin =   0.0;
    float ymax = 112.5;

    float xstart;
    float ystart;
    float ch = (float)1.8;
    float xinc;
    float yinc;
    AjPStr fstr = NULL;

    float x;
    float y;


    embInit("pepnet", argc, argv);


    seq         = ajAcdGetSeq("sequence");
    graph       = ajAcdGetGraph("graph");
    octags      = ajAcdGetString("octags");
    squares     = ajAcdGetString("squares");
    diamonds    = ajAcdGetString("diamonds");
    amphipathic = ajAcdGetToggle("amphipathic");

    ajStrFmtUpper(&octags);
    ajStrFmtUpper(&squares);
    ajStrFmtUpper(&diamonds);

    if(amphipathic)
    {
	ajStrAssignC(&squares,"ACFGILMVWY");
	ajStrAssignC(&diamonds,"");
	ajStrAssignC(&octags,"");
    }


    substr = ajStrNew();
    txt    = ajStrNew();
    fstr   = ajStrNew();




    begin = ajSeqGetBegin(seq);
    end   = ajSeqGetEnd(seq);

    strand = ajSeqGetSeqCopyS(seq);

    ajStrFmtUpper(&strand);
    ajStrAssignSubC(&substr,ajStrGetPtr(strand),begin-1,end-1);

    ajGraphAppendTitleS(graph, ajSeqGetUsaS(seq));

    ajGraphOpenWin(graph, xmin,xmax,ymin,ymax);

    for(count=begin-1,r=0;count<end;count+=231)
    {
	if (count > begin)
	    ajGraphNewpage(graph, ajFalse);
	pstart=count;
	pstop = AJMIN(end-1, count+230);

	ajGraphicsSetCharscale(0.75);

	xstart = 145.0;
	ystart =  80.0;

	yinc = ch * (float)2.5;
	xinc = yinc / (float)2.5;

	x = xstart;

	for(i=pstart;i<=pstop;i+=7)
	{
	    lc = i;
	    if(x < 10.0*xinc)
	    {
		x = xstart;
		ystart -= (float)7.5*yinc;
	    }
	    y=ystart;

	    ajFmtPrintS(&txt,"%d",i+1);

	    ajGraphicsSetFgcolour(RED);
	    ajGraphicsDrawposTextJustify(x-xinc,y-yinc-1,ajStrGetPtr(txt),0.5);

	    for(j=0;j<4;++j)
	    {
		x -= xinc;
		y += yinc;
		if(lc <= pstop)
		    pepnet_plotresidue(*(ajStrGetPtr(substr)+r),x,y,
				       ajStrGetPtr(squares),ajStrGetPtr(octags),
				       ajStrGetPtr(diamonds));
		++r;
		++lc;
	    }
	    y=ystart+yinc/(float)2.0;

	    for(j=4;j<7;++j)
	    {
		x -= xinc;
		y += yinc;
		if(lc <= pstop)
		    pepnet_plotresidue(*(ajStrGetPtr(substr)+r),x,y,
				       ajStrGetPtr(squares),ajStrGetPtr(octags),
				       ajStrGetPtr(diamonds));
		++r;
		++lc;
	    }
	}
    }

    ajGraphicsClose();
    ajGraphxyDel(&graph);

    ajStrDel(&strand);
    ajStrDel(&fstr);

    ajSeqDel(&seq);
    ajStrDel(&substr);

    ajStrDel(&squares);
    ajStrDel(&diamonds);
    ajStrDel(&octags);
    ajStrDel(&txt);

    embExit();

    return 0;
}