File: vibpcc.c

package info (click to toggle)
ncbi-tools6 6.1.20120620-8
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 241,628 kB
  • ctags: 101,236
  • sloc: ansic: 1,431,713; cpp: 6,248; pascal: 3,949; xml: 3,390; sh: 3,090; perl: 1,077; csh: 488; makefile: 449; ruby: 93; lisp: 81
file content (52 lines) | stat: -rw-r--r-- 1,173 bytes parent folder | download | duplicates (14)
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;
}