[metapost] trouble with metapost conversion to pdf image
Mia Champion
champion at broadinstitute.org
Thu Jul 30 19:07:28 CEST 2009
Hi,
I am not at all familiar with the metapost language and have an output
file from a program that I am using for genome analysis (see below).
In order for the data to be linked into other output files from the
program, the metapost script below must be converted into individual pdf
files.
I have tried a couple of different metapost converters online just to
see what the output would look like and keep getting errors that quit
the conversion and seem to
have general trouble with the code. I would really appreciate it if a
metapost expert could give me advice regarding this code and what might
be the best conversion
program to use in order to generate pdf image files (the image outputs
are phylogenetic trees).
Thanks so much,
Mia
beginfig(1)
u:=1in;
pair p[];
pair mid[];
p0 = (0.000000u,0.000000u);
p1 = (0.875000u,2.333333u);
p2 = (1.750000u,0.000000u);
p3 = (2.625000u,4.666667u);
p4 = (3.500000u,0.000000u);
p5 = (4.375000u,2.333333u);
p6 = (5.250000u,0.000000u);
p7 = (3.500000u,7.000000u);
p8 = (7.000000u,0.000000u);
% draw line
draw p[0] -- ( xpart p[0], ypart p[1] ) -- p[1] ;
label.urt( btex 0 etex, p[0]);
xpart mid[0] = xpart(p[0]);
ypart mid[0] = (ypart(p[0])+ypart(p[1]))/2;
label.rt( btex $l = 6$ etex, mid[0]);
label.rt( btex $\lambda=0.001700$ etex, mid[0] + (0,-0.150000u));
draw p[1] -- ( xpart p[1], ypart p[3] ) -- p[3] ;
label.urt( btex 0 \small{(0.500, 0.500)} etex, p[1]);
xpart mid[1] = xpart(p[1]);
ypart mid[1] = (ypart(p[1])+ypart(p[3]))/2;
label.rt( btex $l = 81$ etex, mid[1]);
label.rt( btex $\lambda=0.001700$ etex, mid[1] + (0,-0.150000u));
draw p[2] -- ( xpart p[2], ypart p[1] ) -- p[1] ;
label.urt( btex 0 etex, p[2]);
xpart mid[2] = xpart(p[2]);
ypart mid[2] = (ypart(p[2])+ypart(p[1]))/2;
label.rt( btex $l = 6$ etex, mid[2]);
label.rt( btex $\lambda=0.001700$ etex, mid[2] + (0,-0.150000u));
draw p[3] -- ( xpart p[3], ypart p[7] ) -- p[7] ;
label.urt( btex 0 \small{(0.500, 0.500)} etex, p[3]);
xpart mid[3] = xpart(p[3]);
ypart mid[3] = (ypart(p[3])+ypart(p[7]))/2;
label.rt( btex $l = 6$ etex, mid[3]);
label.rt( btex $\lambda=0.001700$ etex, mid[3] + (0,-0.150000u));
draw p[4] -- ( xpart p[4], ypart p[5] ) -- p[5] ;
label.urt( btex 0 etex, p[4]);
xpart mid[4] = xpart(p[4]);
ypart mid[4] = (ypart(p[4])+ypart(p[5]))/2;
label.rt( btex $l = 17$ etex, mid[4]);
label.rt( btex $\lambda=0.001700$ etex, mid[4] + (0,-0.150000u));
draw p[5] -- ( xpart p[5], ypart p[3] ) -- p[3] ;
label.urt( btex 0 \small{(0.500, 0.500)} etex, p[5]);
xpart mid[5] = xpart(p[5]);
ypart mid[5] = (ypart(p[5])+ypart(p[3]))/2;
label.rt( btex $l = 70$ etex, mid[5]);
label.rt( btex $\lambda=0.001700$ etex, mid[5] + (0,-0.150000u));
draw p[6] -- ( xpart p[6], ypart p[5] ) -- p[5] ;
label.urt( btex 0 etex, p[6]);
xpart mid[6] = xpart(p[6]);
ypart mid[6] = (ypart(p[6])+ypart(p[5]))/2;
label.rt( btex $l = 17$ etex, mid[6]);
label.rt( btex $\lambda=0.001700$ etex, mid[6] + (0,-0.150000u));
draw p[7] -- ( p[7] + (0,0.333333u) );
label.urt( btex 1 \small{(0.015, 0.186)} etex, p[7]);
draw p[8] -- ( xpart p[8], ypart p[7] ) -- p[7] ;
label.urt( btex 0 etex, p[8]);
xpart mid[8] = xpart(p[8]);
ypart mid[8] = (ypart(p[8])+ypart(p[7]))/2;
label.rt( btex $l = 93$ etex, mid[8]);
label.rt( btex $\lambda=0.001700$ etex, mid[8] + (0,-0.150000u));
% add name
labeloffset := 10; dotlabel.bot(btex chimp etex, p[0]);
labeloffset := 10; dotlabel.bot(btex human etex, p[2]);
labeloffset := 10; dotlabel.bot(btex mouse etex, p[4]);
labeloffset := 10; dotlabel.bot(btex rat etex, p[6]);
labeloffset := 10; dotlabel.bot(btex dog etex, p[8]);
% Mark duplication
% annotation
label( btex etex, (0.1u, 7.700000u));
label( btex ENSF00000002057 etex, (0.1u, 7.500000u));
label(btex Max p-value = 0.000 etex, (0.1u, 7.300000u));
endfig;
beginfig(2)
u:=1in;
pair p[];
pair mid[];
p0 = (0.000000u,0.000000u);
p1 = (0.875000u,2.333333u);
p2 = (1.750000u,0.000000u);
p3 = (2.625000u,4.666667u);
More information about the metapost
mailing list