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
|
#include <vibpcc.h>
extern SeqGraphPtr PccGraph (Int4 start, Int4 end, FloatHiPtr score)
{
SeqGraphPtr sgp;
Int4 gwidth = 500;
Int4 i;
Boolean flagCC = FALSE;
if (score == NULL)
return NULL;
if ((sgp = SeqGraphNew ()) != NULL)
{
/* type and number of values and compression */
sgp->numval = end - start + 1;
sgp->compr = (Int4) (sgp->numval / gwidth);
if ((sgp->numval%gwidth) != 0)
sgp->compr += 1;
/* graph type */
sgp->flags[2] = 1;
sgp->values = (Pointer) score;
/* min/max */
sgp->max.realvalue = 20.0;
sgp->min.realvalue = 0.0;
sgp->axis.realvalue = 0.0;
score = (FloatHiPtr) sgp->values;
for (i = 0; i < sgp->numval; i++)
{
*score *= 100.0;
if (*score > 100.0)
*score = 100.0;
if (*score > 40.0)
flagCC = TRUE;
score++;
}
score = (FloatHiPtr) sgp->values;
for (i = 0; i < sgp->numval; i++)
{
*score = (*score / 100.0 * sgp->max.realvalue);
score++;
}
/* scaling */
sgp->flags[1] = 1;
sgp->a = 2;
sgp->b = 0;
/* do it */
if (!flagCC)
sgp = SeqGraphFree (sgp);
}
return sgp;
}
|