1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
void ps_residues()
{
float xmin = 1e10, xmax = -1e10, ymin = 1e10, ymax = -1e10;
int width = 1000, height = 1000;
int k, chain_id = 0;
printf("%%!PS-Adobe-2.0 EPSF-2.0\n"
"%%%%BoundingBox: 0 0 %d %d\n\n",
width, height);
//
printf("/Courier findfont 12 scalefont setfont\n\n");
for (k = 0; k < nres; k++) {
if (residue[k].x < xmin) xmin = residue[k].x;
if (residue[k].x > xmax) xmax = residue[k].x;
if (residue[k].y < ymin) ymin = residue[k].y;
if (residue[k].y > ymax) ymax = residue[k].y;
}
for (k = 0; k < nres; k++) {
float px = (residue[k].x-xmin)/(xmax-xmin)*width;
float py = (residue[k].y-ymin)/(ymax-ymin)*height;
if (residue[k].chain_id != chain_id) {
chain_id = residue[k].chain_id;
if (k > 0)
printf("stroke\n");
if (residue[k].chain_id == 'A')
printf("255 0 0 setrgbcolor\n");
else
printf("0 0 255 setrgbcolor\n");
printf("newpath ");
printf("%f %f moveto\n", px, py);
}
else
printf("%f %f lineto\n", px, py);
}
printf("stroke\n");
printf("0 0 0 setrgbcolor\n");
for (k = 0; k < nres; k++) {
float px = (residue[k].x-xmin)/(xmax-xmin)*width;
float py = (residue[k].y-ymin)/(ymax-ymin)*height;
printf("%f %f moveto (%d) show\n", px, py, residue[k].res_seq);
}
printf("0 255 0 setrgbcolor\n");
for (k = 0; k < 10; k++) {
float px1 = (residue[res_pair[k].r1].x-xmin)/(xmax-xmin)*width;
float py1 = (residue[res_pair[k].r1].y-ymin)/(ymax-ymin)*height;
float px2 = (residue[res_pair[k].r2].x-xmin)/(xmax-xmin)*width;
float py2 = (residue[res_pair[k].r2].y-ymin)/(ymax-ymin)*height;
printf("newpath %f %f moveto %f %f lineto stroke\n", px1, py1, px2, py2);
}
printf("showpage\n");
} |
Partager