[prev in list] [next in list] [prev in thread] [next in thread]
List: cairo
Subject: [cairo] haven't compiled in a while.. cairo objects not found
From: Kayven Riese <kayvey () gmail ! com>
Date: 2012-07-12 19:06:58
Message-ID: CAN7GeQdWwQzm_CwrNiczLkUKgpDOffKTr1jX-ZHYHtg=p9kqNQ () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Hi. I have a program I call promog that should be able to be made with the
attached files with the command "make promog"
I am running Ubuntu
kayve@kayve-Ubuntu11:~/Documents/microArray/Project/release$ uname -a
Linux kayve-Ubuntu11 3.2.0-26-generic-pae #41-Ubuntu SMP Thu Jun 14
16:45:14 UTC 2012 i686 i686 i386 GNU/Linux
kayve@kayve-Ubuntu11:~/Documents/microArray/Project/release$
included in the attachments is the file "make.errors" which contains the
behavior of my attempt on my machine.
What do I need to do to get my project to compile?
--
Sincerely,
Kayven Riese
*----------------------------------------------------------*
Kayven Riese, MSCS,
MS (Physiology and Biophysics)
(415) 902 5513 cellular
http://kayve.net
Webmaster http://ChessYoga.org
*----------------------------------------------------------*
[Attachment #5 (text/html)]
Hi. I have a program I call promog that should be able to be made with the attached \
files with the command "make promog" <br clear="all"><br><br>I am running \
Ubuntu <br><br>kayve@kayve-Ubuntu11:~/Documents/microArray/Project/release$ uname \
-a<br> Linux kayve-Ubuntu11 3.2.0-26-generic-pae #41-Ubuntu SMP Thu Jun 14 16:45:14 \
UTC 2012 i686 i686 i386 \
GNU/Linux<br>kayve@kayve-Ubuntu11:~/Documents/microArray/Project/release$ \
<br><br>included in the attachments is the file "make.errors" which \
contains the behavior of my attempt on my machine. <br> <br>What do I need to do to \
get my project to compile?<br>-- <br> Sincerely,<div><br></div><div> Kayven \
Riese<br>*----------------------------------------------------------*<br> Kayven \
Riese, MSCS, <br> MS (Physiology and Biophysics)<br> (415) 902 \
5513 cellular<br> <a href="http://kayve.net" \
target="_blank">http://kayve.net</a><br> Webmaster <a href="http://ChessYoga.org" \
target="_blank">http://ChessYoga.org</a><br>*----------------------------------------------------------*<br>
<br><br></div><br>
--f46d04462fbcf8767904c4a6aae7--
["cellgram.c" (text/x-csrc)]
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <cairo.h>
#include <string.h>
#include <stddef.h>
#include <time.h>
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int cellgram(const char* title, const char* infile, double nuclear, double cytosolic, \
double membrane, double extracellular ) {
const double BORDER = 50.0;
// const double SQUISH_COEFF = 3204;
// const double SQUISH_TERM = 0.058;
const double SQUISH_SQRD = 24067359.9345;
const double SQUISH_COEFF = 1668.29167;
const double SQUISH_TERM = 0.118221111688; /**/
const double SQ_SQRD_SOLUBLE = 13191199.7122462;
const double SQ_COEFF_SOLUBLE = 1370.798595007;
const double SQ_TERM_SOLUBLE = 0.142868029; /**/
const double SQ_SQRD_MEMBRANE = 19061482.2047439;
const double SQ_COEFF_MEMBRANE = 1431.454645434;
const double SQ_TERM_MEMBRANE = 0.27104213693896; /**/
const double SQ_SQRD_EXTRACELLULAR = 22487557.4627347;
const double SQ_COEFF_EXTRACELLULAR = 1461.360250876;
const double SQ_TERM_EXTRACELLULAR = 0.3310297234; /**/
/* 500 to 6927 parameters
const double SQUISH_COEFF = 3150.1491947;
const double SQUISH_TERM = 0.15872264; /**/
const double TOP_BORDER = 250.0;
const double NUCLEUS_BUF = 30.0;
const double CELL_DIAM = 1000.0;
const double CORNER_RADIUS = 100.0;
const double SIDE_BORDER = 50.0;
const double BOTTOM_BORDER = 50.0;
const double RIGHT_BORDER = 50.0;
const double LEFT_BORDER = 300.0;
const double PCT_O_RATIO = 350.0;
const double txsq_PCTs = 0.35;
const double PCTs_BORDER_SHIFT = 1.0;
const double PCTs_SQUISH = 0.004;
const double PCTs_SQ_DENOM = 100.4;
const char* month_array[] = \
{"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
int i,j;
size_t end_name = strlen(title);
size_t begin_exten = end_name+17;
time_t time_now;
struct tm *tm_now;
char year_now[5];
char month_now[3];
char min_now[3];
char hour_now[3];
char day_now[3];
char datestamp[20];
datestamp[19]='\0';
time(&time_now);
tm_now = localtime(&time_now);
strcpy(datestamp,month_array[tm_now->tm_mon]);
datestamp[3] = ' ';
sprintf(year_now,"%d\0",1900+tm_now->tm_year);
sprintf(month_now,"%d\0",1+tm_now->tm_mon);
sprintf(day_now,"%d\0",tm_now->tm_mday);
strcpy(&(datestamp[4]),day_now);
i = 4 + strlen(day_now);
datestamp[i] = ',';
i++;
printf("i is %d\n",i);
printf("datestamp is %s\n",datestamp);
datestamp[i] = ' ';
i++;
strcpy(&(datestamp[i]),year_now);
i += strlen(year_now);
datestamp[i] = ' ';
i++;
printf("i is %d\n",i);
printf("datestamp is %s\n",datestamp);
printf("the day is %s\n",day_now);
sprintf(hour_now,"%d\0",tm_now->tm_hour);
printf("the hour is %s\n",hour_now);
sprintf(min_now,"%d\0",tm_now->tm_min);
strcpy(&(datestamp[i]),hour_now);
i += strlen(hour_now);
datestamp[i] = ':';
i++;
printf("i is %d\n",i);
printf("datestamp is %s\n",datestamp);
strcpy(&(datestamp[i]),min_now);
printf("the minute is %s\n",min_now);
printf("begin_exten is %d\n",begin_exten);
printf("end_name is %d\n",end_name);
printf("i is %d\n",i);
printf("datestamp is %s\n",datestamp);
/**********************************
* Construct Datestamped Filename
**********************************/
char * filename = malloc(sizeof(size_t)*(strlen(title) + 22));
char * infile_hdr = malloc(sizeof(size_t)*(strlen(title) + 12));
sprintf(infile_hdr,"Input File: %s\0",infile);
for (i=0;i<end_name;i++)
filename[i]=title[i];
filename[end_name] = '.';
filename[end_name+1] = year_now[0];
filename[end_name+2] = year_now[1];
filename[end_name+3] = year_now[2];
filename[end_name+4] = year_now[3];
filename[end_name+5] = '.';
if (tm_now->tm_mon < 10 ) {
filename[end_name+6] = '0';
filename[end_name+7] = month_now[0];
}
else {
filename[end_name+6] = month_now[0];
filename[end_name+7] = month_now[1];
}
filename[end_name+8] = '.';
if (tm_now->tm_mday < 10 ) {
filename[end_name+9] = '0';
filename[end_name+10] = day_now[0];
}
else {
filename[end_name+9] = day_now[0];
filename[end_name+10] = day_now[1];
}
filename[end_name+11] = '.';
if (tm_now->tm_hour < 10 ) {
filename[end_name+12] = '0';
filename[end_name+13] = hour_now[0];
}
else {
filename[end_name+12] = hour_now[0];
filename[end_name+13] = hour_now[1];
}
filename[end_name+14] = '.';
if (tm_now->tm_min < 10 ) {
filename[end_name+15] = '0';
filename[end_name+16] = min_now[0];
}
else {
filename[end_name+15] = min_now[0];
filename[end_name+16] = min_now[1];
}
filename[begin_exten] = '.';
filename[begin_exten+1] = 'p';
filename[begin_exten+2] = 'n';
filename[begin_exten+3] = 'g';
filename[begin_exten+4] = '\0';
printf("the filename is %s\n",filename);
/**********************************
* Create Surface
**********************************/
cairo_surface_t *surface =
cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
CELL_DIAM + RIGHT_BORDER + LEFT_BORDER, CELL_DIAM+TOP_BORDER \
+BORDER); cairo_t *cr =
cairo_create (surface);
cairo_matrix_t fatrix;
double total = nuclear + cytosolic + membrane + extracellular;
/**********************************
* Color Background
**********************************/
cairo_rectangle(cr,0,0,CELL_DIAM + LEFT_BORDER + RIGHT_BORDER,
TOP_BORDER + CELL_DIAM + BORDER);
cairo_set_source_rgb(cr,1,1,0.8);
cairo_fill(cr);
/**********************************
* Draw Cell
**********************************/
double in_cell = (total - extracellular)/total;
double nt_r = nuclear/total;
double ct_r = cytosolic/total;
double mt_r = membrane/total;
double et_r = extracellular/total;
printf("in_cell is %6.2f\n",in_cell);
char nt_r_string[6];
char ct_r_string[6];
char mt_r_string[6];
char et_r_string[6];
sprintf(nt_r_string,"%.1f%%\0",100*nt_r);
sprintf(ct_r_string,"%.1f%%\0",100*ct_r);
sprintf(mt_r_string,"%.1f%%\0",100*mt_r);
sprintf(et_r_string,"%.1f%%\0",100*et_r);
cairo_new_path(cr);
cairo_set_source_rgb(cr,1,1,0.4);
/******************* TOP ********************/
cairo_move_to(cr,LEFT_BORDER+CORNER_RADIUS,TOP_BORDER);
cairo_line_to(cr,LEFT_BORDER+CELL_DIAM-CORNER_RADIUS,TOP_BORDER);
cairo_curve_to(cr,LEFT_BORDER+CELL_DIAM-CORNER_RADIUS,TOP_BORDER,
CELL_DIAM+LEFT_BORDER-CORNER_RADIUS*0.193,TOP_BORDER+CORNER_RADIUS*0.193,
LEFT_BORDER+CELL_DIAM,TOP_BORDER+CORNER_RADIUS);
/****************** RIGHT SIDE ****************/
cairo_line_to(cr,LEFT_BORDER+CELL_DIAM,TOP_BORDER+in_cell*CELL_DIAM-CORNER_RADIUS);
cairo_curve_to(cr,LEFT_BORDER+CELL_DIAM,TOP_BORDER+in_cell*CELL_DIAM-CORNER_RADIUS,
CELL_DIAM+LEFT_BORDER-CORNER_RADIUS*0.193,TOP_BORDER+in_cell*CELL_DIAM-
CORNER_RADIUS*0.193,LEFT_BORDER+CELL_DIAM-CORNER_RADIUS,
TOP_BORDER+in_cell*CELL_DIAM);
/****************** BOTTOM ****************/
cairo_line_to(cr,LEFT_BORDER+CORNER_RADIUS,TOP_BORDER+in_cell*CELL_DIAM);
cairo_curve_to(cr,LEFT_BORDER+CORNER_RADIUS,TOP_BORDER+in_cell*CELL_DIAM,
LEFT_BORDER+CORNER_RADIUS*0.193,TOP_BORDER+in_cell*CELL_DIAM-CORNER_RADIUS*
0.193,LEFT_BORDER,TOP_BORDER+in_cell*CELL_DIAM-CORNER_RADIUS);
/****************** LEFT SIDE ****************/
cairo_line_to(cr,LEFT_BORDER,TOP_BORDER+CORNER_RADIUS);
cairo_curve_to(cr,LEFT_BORDER,TOP_BORDER+CORNER_RADIUS,LEFT_BORDER+CORNER_RADIUS*0.193,
TOP_BORDER+CORNER_RADIUS*0.193,LEFT_BORDER+CORNER_RADIUS,TOP_BORDER);
cairo_close_path(cr);
cairo_set_source_rgba(cr,0.4,1,0.8,0.5);
cairo_fill_preserve(cr);
cairo_set_source_rgba(cr,1,1,0.4,0.8);
cairo_set_line_width(cr,10);
cairo_stroke(cr);
/**********************************
* Draw Nuclear Envelope
**********************************/
cairo_new_path(cr);
cairo_set_source_rgb(cr,0.6,0.0,0.6);
/******************* TOP ********************/
cairo_move_to(cr,LEFT_BORDER+CORNER_RADIUS+NUCLEUS_BUF,TOP_BORDER+NUCLEUS_BUF);
cairo_line_to(cr,LEFT_BORDER+CELL_DIAM-CORNER_RADIUS-NUCLEUS_BUF,
TOP_BORDER+NUCLEUS_BUF);
printf("nuclear/total is %6.2f\n",nt_r);
printf("nuclear/total*CELL_DIAM is %6.2f\n",nt_r*CELL_DIAM);
printf("(nuclear/total*CELL_DIAM-NUCLEUS_BUF) is %6.2f\n",
(nt_r*CELL_DIAM-NUCLEUS_BUF));
printf("NUCLEUS_BUF is %6.2f\n",NUCLEUS_BUF);
printf("CORNER_RADIUS is %6.2f\n",CORNER_RADIUS);
if (((nt_r)*CELL_DIAM-NUCLEUS_BUF) > 2*CORNER_RADIUS)
cairo_curve_to(cr,LEFT_BORDER+CELL_DIAM-CORNER_RADIUS-NUCLEUS_BUF,
TOP_BORDER+NUCLEUS_BUF,CELL_DIAM+LEFT_BORDER-CORNER_RADIUS*0.193-
NUCLEUS_BUF,TOP_BORDER+CORNER_RADIUS*0.193+NUCLEUS_BUF,LEFT_BORDER+
CELL_DIAM-NUCLEUS_BUF,TOP_BORDER+CORNER_RADIUS+NUCLEUS_BUF);
else
cairo_curve_to(cr,LEFT_BORDER+CELL_DIAM-CORNER_RADIUS-NUCLEUS_BUF,
TOP_BORDER+NUCLEUS_BUF,CELL_DIAM+LEFT_BORDER-((nuclear/total)*
CELL_DIAM-NUCLEUS_BUF)*0.193/2-NUCLEUS_BUF,TOP_BORDER+
((nuclear/total)*CELL_DIAM-NUCLEUS_BUF)*0.193/2+NUCLEUS_BUF,
LEFT_BORDER+CELL_DIAM-1.5*NUCLEUS_BUF,TOP_BORDER+((nuclear/total)*
CELL_DIAM +NUCLEUS_BUF)/2);
/****************** RIGHT SIDE ****************/
if (((nuclear/total)*CELL_DIAM-NUCLEUS_BUF) > 2*CORNER_RADIUS) {
cairo_line_to(cr,LEFT_BORDER+CELL_DIAM-NUCLEUS_BUF,TOP_BORDER+nuclear/total*
CELL_DIAM-CORNER_RADIUS);
cairo_curve_to(cr,LEFT_BORDER+CELL_DIAM-NUCLEUS_BUF,TOP_BORDER+nuclear/total*
CELL_DIAM-CORNER_RADIUS,CELL_DIAM+LEFT_BORDER-CORNER_RADIUS*0.193-NUCLEUS_BUF,
TOP_BORDER+nuclear/total*CELL_DIAM-CORNER_RADIUS*0.193,LEFT_BORDER+CELL_DIAM-
CORNER_RADIUS-NUCLEUS_BUF,TOP_BORDER+nuclear/total*CELL_DIAM);
}
else
cairo_curve_to(cr,LEFT_BORDER+CELL_DIAM-1.5*NUCLEUS_BUF,TOP_BORDER+((nuclear/total)*
CELL_DIAM +NUCLEUS_BUF)/2,CELL_DIAM+LEFT_BORDER-((nuclear/total)*
CELL_DIAM-NUCLEUS_BUF)*0.193/2-NUCLEUS_BUF,TOP_BORDER+nuclear/total*
CELL_DIAM-((nuclear/total)*CELL_DIAM-NUCLEUS_BUF)*0.193/2,LEFT_BORDER+
CELL_DIAM-CORNER_RADIUS-NUCLEUS_BUF,TOP_BORDER+nuclear/total*CELL_DIAM);
/****************** BOTTOM ****************/
cairo_line_to(cr,LEFT_BORDER+CORNER_RADIUS+NUCLEUS_BUF,TOP_BORDER+nuclear/total*
CELL_DIAM);
if (((nuclear/total)*CELL_DIAM-NUCLEUS_BUF) > 2*CORNER_RADIUS)
cairo_curve_to(cr,LEFT_BORDER+CORNER_RADIUS+NUCLEUS_BUF,TOP_BORDER+nuclear/total*
CELL_DIAM,LEFT_BORDER+CORNER_RADIUS*0.193+NUCLEUS_BUF,TOP_BORDER+nuclear/total*
CELL_DIAM-CORNER_RADIUS*0.193,LEFT_BORDER+NUCLEUS_BUF,TOP_BORDER+nuclear/total*
CELL_DIAM-CORNER_RADIUS);
else
cairo_curve_to(cr,LEFT_BORDER+CORNER_RADIUS+NUCLEUS_BUF,TOP_BORDER+nuclear/total*
CELL_DIAM,LEFT_BORDER+((nuclear/total)*CELL_DIAM-NUCLEUS_BUF)*0.193/2+NUCLEUS_BUF,
TOP_BORDER+nuclear/total*CELL_DIAM-((nuclear/total)*CELL_DIAM-NUCLEUS_BUF)*
0.193/2,LEFT_BORDER+1.5*NUCLEUS_BUF,TOP_BORDER+((nuclear/total)*CELL_DIAM \
+ NUCLEUS_BUF)/2);
/****************** LEFT SIDE ****************/
if (((nuclear/total)*CELL_DIAM-NUCLEUS_BUF) > 2*CORNER_RADIUS) {
cairo_line_to(cr,LEFT_BORDER+NUCLEUS_BUF,TOP_BORDER+CORNER_RADIUS+NUCLEUS_BUF);
cairo_curve_to(cr,LEFT_BORDER+NUCLEUS_BUF,TOP_BORDER+CORNER_RADIUS+NUCLEUS_BUF,
LEFT_BORDER+CORNER_RADIUS*0.193+NUCLEUS_BUF,TOP_BORDER+CORNER_RADIUS*0.193+
NUCLEUS_BUF,LEFT_BORDER+CORNER_RADIUS+NUCLEUS_BUF,TOP_BORDER+NUCLEUS_BUF);
}
else
cairo_curve_to(cr,LEFT_BORDER+1.5*NUCLEUS_BUF,TOP_BORDER+((nuclear/total)*CELL_DIAM+
NUCLEUS_BUF)/2,LEFT_BORDER+((nuclear/total)*CELL_DIAM-NUCLEUS_BUF)*0.193/2+
NUCLEUS_BUF,TOP_BORDER+((nuclear/total)*CELL_DIAM-NUCLEUS_BUF)*0.193/2+
NUCLEUS_BUF,LEFT_BORDER+CORNER_RADIUS+NUCLEUS_BUF,TOP_BORDER+NUCLEUS_BUF);
cairo_close_path(cr);
cairo_set_line_width(cr,10);
cairo_stroke(cr);
/**********************************
* Write location ratio lines
**********************************/
cairo_select_font_face (cr, "sans", CAIRO_FONT_SLANT_NORMAL, \
CAIRO_FONT_WEIGHT_BOLD);
cairo_set_line_width(cr,1);
//cairo_set_source_rgba (cr, 0.2,0.4,0.4,0.0 );
cairo_set_source_rgba (cr, 0.2,0.4,0.4,0.5);
#if 1
cairo_move_to(cr, LEFT_BORDER+3*CORNER_RADIUS, TOP_BORDER+0.025*CELL_DIAM);
cairo_line_to(cr, LEFT_BORDER+CELL_DIAM-3*CORNER_RADIUS, \
TOP_BORDER+0.025*CELL_DIAM);
cairo_move_to(cr, LEFT_BORDER+2*CORNER_RADIUS, TOP_BORDER+0.05*CELL_DIAM);
cairo_line_to(cr, LEFT_BORDER+CELL_DIAM-2*CORNER_RADIUS, \
TOP_BORDER+0.05*CELL_DIAM);
cairo_move_to(cr, LEFT_BORDER+3*CORNER_RADIUS, TOP_BORDER+0.075*CELL_DIAM);
cairo_line_to(cr, LEFT_BORDER+CELL_DIAM-3*CORNER_RADIUS, \
TOP_BORDER+0.075*CELL_DIAM); cairo_stroke(cr);
#endif
#if 1
for (i = 1; i<10; i++) {
cairo_set_line_width(cr,2);
cairo_set_source_rgba (cr, 0,0,0,0.5 );
if (i > (in_cell*10))
cairo_set_source_rgba (cr, 0,0,0,0.5 );
if (i == 5) { //thicker wider 50% line
cairo_set_line_width(cr,3);
cairo_move_to(cr, LEFT_BORDER+CORNER_RADIUS, \
TOP_BORDER+(double)i/10*CELL_DIAM);
cairo_line_to(cr, LEFT_BORDER+CELL_DIAM-CORNER_RADIUS, \
TOP_BORDER+(double)i/10* CELL_DIAM);
}
else {
cairo_move_to(cr, LEFT_BORDER+1.5*CORNER_RADIUS, \
TOP_BORDER+(double)i/10* CELL_DIAM);
cairo_line_to(cr, LEFT_BORDER+CELL_DIAM-1.5*CORNER_RADIUS, TOP_BORDER+
(double)i/10*CELL_DIAM);
}
cairo_stroke(cr);
cairo_set_line_width(cr,1);
cairo_set_source_rgba (cr, 0.2,0.4,0.4,0.5);
cairo_move_to(cr, LEFT_BORDER+3*CORNER_RADIUS, TOP_BORDER+(double)i/10*
CELL_DIAM+0.025*CELL_DIAM);
cairo_line_to(cr, LEFT_BORDER+CELL_DIAM-3*CORNER_RADIUS, TOP_BORDER+
(double)i/10*CELL_DIAM+0.025*CELL_DIAM);
cairo_move_to(cr, LEFT_BORDER+2*CORNER_RADIUS, TOP_BORDER+
(double)i/10*CELL_DIAM+0.05*CELL_DIAM);
cairo_line_to(cr, LEFT_BORDER+CELL_DIAM-2*CORNER_RADIUS, TOP_BORDER+
(double)i/10*CELL_DIAM+0.05*CELL_DIAM);
cairo_move_to(cr, LEFT_BORDER+3*CORNER_RADIUS, TOP_BORDER+(double)i/10*
CELL_DIAM+0.075*CELL_DIAM);
cairo_line_to(cr, LEFT_BORDER+CELL_DIAM-3*CORNER_RADIUS, TOP_BORDER+
(double)i/10*CELL_DIAM+0.075*CELL_DIAM);/**/
cairo_stroke(cr);
}/**/
#endif
#if 1
cairo_set_line_width(cr,3);
cairo_move_to(cr, LEFT_BORDER +CORNER_RADIUS , CELL_DIAM + TOP_BORDER);
cairo_line_to(cr, LEFT_BORDER+CELL_DIAM-CORNER_RADIUS , TOP_BORDER+ \
CELL_DIAM);/**/ #if 0
cairo_move_to(cr, LEFT_BORDER+CORNER_RADIUS , TOP_BORDER);
cairo_line_to(cr, LEFT_BORDER+CELL_DIAM-CORNER_RADIUS , TOP_BORDER);/**/
#endif
cairo_stroke(cr);
#endif
/**********************************
* Cellgram Header
**********************************/
cairo_text_extents_t tx_title, tx_datestamp, tx_infile_hdr;
cairo_set_source_rgb (cr, 0.4, 0.8, 0.8);
cairo_set_font_size (cr, TOP_BORDER*0.55);
cairo_text_extents(cr,title,&tx_title);
cairo_move_to (cr,1.5*SIDE_BORDER,3.6*SIDE_BORDER);
cairo_show_text (cr, title);
cairo_set_font_size (cr, TOP_BORDER*0.15);
cairo_text_extents(cr,datestamp,&tx_datestamp);
cairo_move_to (cr,LEFT_BORDER+CELL_DIAM - 0.5*BORDER - \
tx_datestamp.x_advance, BORDER + tx_datestamp.y_advance);
cairo_show_text (cr, datestamp);
cairo_set_font_size (cr, TOP_BORDER*0.1);
cairo_text_extents(cr,infile_hdr,&tx_infile_hdr);
cairo_move_to (cr,LEFT_BORDER+CELL_DIAM - 0.5*BORDER - \
tx_infile_hdr.x_advance, TOP_BORDER - 0.3*BORDER );
cairo_show_text (cr, infile_hdr);
/**********************************
* Nuclear Proteins
**********************************/
// Get text extents of fragments
cairo_text_extents_t tx_NUc, tx_L, tx_ec, tx_eAR, tx_DNA;
cairo_set_font_size (cr, (1250.0*(nuclear/total)-2*NUCLEUS_BUF));
cairo_text_extents(cr, "NUc", &tx_NUc);
cairo_text_extents(cr, "ec", &tx_ec);
cairo_text_extents(cr, "eAR", &tx_eAR);
cairo_set_font_size (cr, 1.346*tx_ec.height);
cairo_text_extents(cr, "L", &tx_L);
// Compute height, width, and origin
double tx_width = tx_NUc.x_advance + tx_eAR.x_advance + tx_L.x_advance;
double tx_height = tx_NUc.height;
tx_height = MAX(tx_height, tx_eAR.height);
tx_height = MAX(tx_height, tx_L.height);
double tx_L_height = tx_L.height;
double tx_squish = 1;
if (tx_width > 200)
tx_squish = exp(tx_width*tx_width/SQUISH_SQRD-1*(tx_width/SQUISH_COEFF)+
SQUISH_TERM);
// txo_x and txo_y are "origin" coordinates--where to move to to write \
"NUcLeAR"
// based on different Nuclear Protein ratios (nt_r = nuclear/total) different
// format tweaks are implemented
double txo_x = LEFT_BORDER + CELL_DIAM/2 + -tx_squish*tx_width/2;
if ((nt_r >= 0.3)&&(nt_r < 0.4))
txo_x += 5*nt_r;
if ((nt_r >= 0.4)&&(nt_r < 0.48))
txo_x += 35*nt_r;
if ((nt_r >= 0.48)&&(nt_r < 0.58))
txo_x += 125*nt_r;
if ((nt_r >= 0.58)&&(nt_r < 0.78))
txo_x += 65*(5*nt_r-2.32);
if ((nt_r >= 0.78)&&(nt_r < 0.92))
txo_x += 135*(2.5*nt_r-1.17);
if (nt_r >= 0.92)
txo_x += 184*nt_r;
double txo_y = TOP_BORDER + 1000*nt_r - 2*NUCLEUS_BUF
+ 2.3*NUCLEUS_BUF*(1-nt_r)*(1-nt_r);
if ((nt_r >= 0.45)&&(nt_r < 0.58))
txo_y += 15*nt_r;
if ((nt_r >= 0.58)&&(nt_r < 0.78))
txo_y += 15*(1.5*nt_r-0.29);
if ((nt_r >= 0.78)&&(nt_r < 0.92))
txo_y += 10*nt_r;
if (nt_r >= 0.92)
txo_y += 2*nt_r;
if ((nuclear/total > 0.2) && (nuclear/total < 0.9))
txo_y += 0.07*NUCLEUS_BUF*(4.5-4.5*nuclear/total);
// Write "DNA" -- txs_DNA is the size that "DNA" is to be written
double txs_DNA = 1.23*(tx_height-tx_L_height);
printf("txs_DNA is %6.2f\n",(float)txs_DNA);
cairo_set_font_size (cr, txs_DNA);
cairo_text_extents(cr, "DNA", &tx_DNA);
printf("tx_DNA.height is %6.2f\n",(float)tx_DNA.height);
cairo_set_source_rgb (cr, 0.4, 0.0, 0.4);
// set origin of "DNA" - similar to txo_x and txo_y, txo_DNA_x and txo_DNA_y
// are where to move to to write "DNA." Again nt_r specific tweaks \
implemented double txo_DNA_y = TOP_BORDER+1.18*txs_DNA+NUCLEUS_BUF;
double txsq_DNA =1;
if ((nuclear/total < 0.235) && (nuclear/total)>0.12)
txo_DNA_y -= 4*NUCLEUS_BUF*(1 -(1.12-(nuclear/total)));
if ((nuclear/total < 0.31) && (nuclear/total)>=0.235)
txo_DNA_y -= 3.5*(1-0.012977+nt_r*nt_r*nt_r) *NUCLEUS_BUF*(1
-(1.12-nt_r));
if ((nuclear/total < 0.40) && (nuclear/total)>=0.31)
txo_DNA_y -= (2.5+ 1.3*(1-0.0961+nt_r*nt_r)) *NUCLEUS_BUF*(1
-(1.12-nt_r));
if ((nuclear/total < 0.48) && (nuclear/total)>=0.40) {
txsq_DNA = 0.9;
txo_DNA_y -= (2.5+ 1.3*(1-0.16+nt_r*nt_r)) *NUCLEUS_BUF*(1
-(1.12-nt_r));
}
if ((nuclear/total < 0.58) && (nuclear/total)>=0.48) {
txsq_DNA = 0.7/(0.52+nt_r);
txo_DNA_y -= (2.0 + 1.3*(1-0.2304+nt_r*nt_r))
*NUCLEUS_BUF*(1 -(1.12-nt_r));
}
if ((nuclear/total < 0.78) && (nuclear/total)>=0.58) {
txsq_DNA = 0.45/nt_r;
txo_DNA_y -= (2.0 + 1.3*(1-0.58+nt_r))
*NUCLEUS_BUF*(1 -(1.12-nt_r));
}
if ((nt_r >= 0.78)&&(nt_r < 0.92)) {
txsq_DNA = 0.45/nt_r;
txo_DNA_y -= 10 + (2.0 + 1.3*(1.014 - 0.3*nt_r))
*NUCLEUS_BUF*(1 -(1.12-nt_r));
}
if (nt_r >= 0.92) {
txsq_DNA = 0.45/nt_r;
txo_DNA_y -= 3.7*nt_r *NUCLEUS_BUF*(1 -(1.12-nt_r));
}
double txo_DNA_x = LEFT_BORDER+CELL_DIAM/2-txsq_DNA*tx_DNA.x_advance/2;
if (nt_r > 0.3)
txo_DNA_x += 15*nt_r;
if ((nt_r >= 0.4)&&(nt_r < 0.48))
txo_DNA_x += 35*nt_r;
if ((nt_r >= 0.48)&&(nt_r < 0.58))
txo_DNA_x += 15*nt_r;
if (nt_r >= 0.92)
txo_DNA_x += 10*nt_r;
//double txo_DNA_x = BORDER+CELL_DIAM/2-10-tx_DNA.x_advance/2;
cairo_move_to (cr, txo_DNA_x, txo_DNA_y);
cairo_scale(cr,txsq_DNA,1);
cairo_show_text (cr, "DNA");/**/
printf("txo_x is %6.2f\n",(float)txo_x);
printf("txo_y is %6.2f\n",(float)txo_y);
cairo_set_font_size (cr, (1250.0*(nuclear/total)-2*NUCLEUS_BUF));
cairo_set_source_rgb (cr, 0.4, 0.2, 0.6);
cairo_move_to (cr, txo_x, txo_y);
cairo_scale(cr,tx_squish/txsq_DNA,1);
cairo_show_text (cr, "NUc");
//cairo_set_font_size (cr, (1040.0*(nuclear/total)-3*NUCLEUS_BUF));
cairo_set_font_size (cr, 1.346*(tx_ec.height));
cairo_show_text (cr, "L");/**/
cairo_set_font_size (cr, (1250.0*(nuclear/total)-2*NUCLEUS_BUF));
cairo_show_text (cr, "eAR");/**/
cairo_scale(cr,1/tx_squish,1);
cairo_scale(cr,txsq_PCTs/(2*nt_r),1);
cairo_set_font_size (cr, (PCT_O_RATIO*nt_r));
cairo_text_extents_t tx_nt_r_pct;
cairo_text_extents(cr, nt_r_string, &tx_nt_r_pct);
cairo_move_to (cr, PCTs_BORDER_SHIFT*BORDER - PCTs_SQUISH
*(0.5-(txsq_PCTs/(nt_r + PCTs_SQ_DENOM)))*tx_nt_r_pct.x_advance, \
txo_y); cairo_show_text (cr, nt_r_string);/**/
cairo_scale(cr,2*nt_r/txsq_PCTs,1);
/**********************************
* Soluble (cytosolic) Proteins
**********************************/
// Get text extents of fragments
cairo_text_extents_t tx_soluble;
cairo_set_font_size (cr, (1250.0*ct_r));
cairo_text_extents(cr, "soluble", &tx_soluble);
// Compute height, width, and origin
double txsq_soluble = exp(tx_soluble.x_advance*tx_soluble.x_advance
/SQ_SQRD_SOLUBLE-(tx_soluble.x_advance/SQ_COEFF_SOLUBLE)
+SQ_TERM_SOLUBLE); /**/
// txo_soluble_x and txo_soluble_y "origin" coordinates
// based on different cytosolic ratios (ct_r = cytosolic/total)
double txo_soluble_x = LEFT_BORDER + CELL_DIAM/2
- txsq_soluble*tx_soluble.x_advance/2;
double txo_soluble_y = TOP_BORDER + 1000*(ct_r + nt_r);
cairo_move_to (cr, txo_soluble_x, txo_soluble_y);
cairo_scale(cr,txsq_soluble,1);
cairo_set_source_rgb (cr, 0.2, 0.6, 0.8);
cairo_show_text (cr, "soluble");/**/
cairo_scale(cr,1/txsq_soluble,1);
cairo_scale(cr,txsq_PCTs/(2*ct_r),1);
cairo_set_font_size (cr, (PCT_O_RATIO*ct_r));
cairo_text_extents_t tx_ct_r_pct;
cairo_text_extents(cr, ct_r_string, &tx_ct_r_pct);
cairo_move_to (cr, PCTs_BORDER_SHIFT*BORDER - PCTs_SQUISH
*(0.5-(txsq_PCTs/(ct_r + PCTs_SQ_DENOM)))*tx_ct_r_pct.x_advance, \
txo_soluble_y); cairo_show_text (cr, ct_r_string);/**/
cairo_scale(cr,2*ct_r/txsq_PCTs,1);
/**********************************
* Membrane Proteins
**********************************/
// Get text extents of fragments
cairo_text_extents_t tx_membrane;
cairo_set_font_size (cr, (1250.0*mt_r));
cairo_text_extents(cr, "membrane", &tx_membrane);
printf("tx_membrane.x_advance is %6.2f\n",(float)tx_membrane.x_advance);
// Compute height, width, and origin
double txsq_membrane= exp(tx_membrane.x_advance*tx_membrane.x_advance
/SQ_SQRD_MEMBRANE-(tx_membrane.x_advance/SQ_COEFF_MEMBRANE)
+SQ_TERM_MEMBRANE); /**/
// txo_membrane_x and txo_membrane_y "origin" coordinates
// based on different membrane ratios (mt_r = membrane/total)
double txo_membrane_x = LEFT_BORDER + CELL_DIAM/2
- txsq_membrane*tx_membrane.x_advance/2;
double txo_membrane_y = TOP_BORDER + 1000*(mt_r + ct_r + nt_r);
cairo_move_to (cr, txo_membrane_x, txo_membrane_y);
cairo_scale(cr,txsq_membrane,1);
cairo_set_source_rgb(cr,1,0.8,0.2);
cairo_show_text (cr, "membrane");/**/
cairo_scale(cr,1/txsq_membrane,1);
cairo_scale(cr,txsq_PCTs/(2*mt_r),1);
cairo_set_font_size (cr, (PCT_O_RATIO*mt_r));
cairo_text_extents_t tx_mt_r_pct;
cairo_text_extents(cr, mt_r_string, &tx_mt_r_pct);
cairo_move_to (cr, PCTs_BORDER_SHIFT*BORDER - PCTs_SQUISH
*(0.5-(txsq_PCTs/(mt_r + PCTs_SQ_DENOM)))*tx_mt_r_pct.x_advance, \
txo_membrane_y); cairo_show_text (cr, mt_r_string);/**/
cairo_scale(cr,2*mt_r/txsq_PCTs,1);
printf("txo_membrane is %6.2f\n",(float)txo_membrane_x);
printf("txsq_membrane is %6.2f\n",(float)txsq_membrane);
printf("tx_membrane.x_advance is %6.2f\n",(float)tx_membrane.x_advance);
printf("tx_membrane.height is %6.2f\n",(float)tx_membrane.height);/**/
/**********************************
* Extracellular Proteins
**********************************/
// Get text extents of fragments
cairo_text_extents_t tx_extracellular;
cairo_set_font_size (cr, (1250.0*et_r));
cairo_text_extents(cr, "extracellular", &tx_extracellular);
printf("tx_extracellular.x_advance is \
%6.2f\n",(float)tx_extracellular.x_advance); // Compute height, width, and origin
double txsq_extracellular= exp(tx_extracellular.x_advance*
tx_extracellular.x_advance/SQ_SQRD_EXTRACELLULAR-
(tx_extracellular.x_advance/SQ_COEFF_EXTRACELLULAR)+SQ_TERM_EXTRACELLULAR);
// txo_extracellular_x and txo_extracellular_y "origin" coordinates
// based on different extracellular ratios (et_r = extracellular/total)
double txo_extracellular_x = LEFT_BORDER + CELL_DIAM/2
- txsq_extracellular*tx_extracellular.x_advance/2;
double txo_extracellular_y = TOP_BORDER + 1000*(mt_r + ct_r + nt_r + et_r);
cairo_move_to (cr, txo_extracellular_x, txo_extracellular_y);
cairo_scale(cr,txsq_extracellular,1);
cairo_set_source_rgb(cr,0.6,0,0);
cairo_show_text (cr, "extracellular");/**/
cairo_scale(cr,1/txsq_extracellular,1);
cairo_scale(cr,txsq_PCTs/(2*et_r),1);
cairo_set_font_size (cr, (PCT_O_RATIO*et_r));
cairo_text_extents_t tx_et_r_pct;
cairo_text_extents(cr, et_r_string, &tx_et_r_pct);
cairo_move_to (cr, PCTs_BORDER_SHIFT*BORDER - PCTs_SQUISH
*(0.5-(txsq_PCTs/(et_r + PCTs_SQ_DENOM)))*tx_et_r_pct.x_advance, \
txo_extracellular_y); cairo_show_text (cr, et_r_string);/**/
cairo_scale(cr,2*et_r/txsq_PCTs,1);
printf("txo_extracellular is %6.2f\n",(float)txo_extracellular_x);
printf("txsq_membrane is %6.2f\n",(float)txsq_extracellular);
printf("tx_membrane.x_advance is %6.2f\n",(float)tx_membrane.x_advance);
printf("tx_membrane.height is %6.2f\n",(float)tx_membrane.height);/**/
/**********************************
* ******** CLEAN UP **********
**********************************/
cairo_destroy (cr);
cairo_surface_write_to_png (surface, filename);
cairo_surface_destroy (surface);
return 0;
}
["promog.c" (text/x-csrc)]
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <fcntl.h>
#include <regex.h>
#include <sys/mman.h>
#include <sys/stat.h>
#define BILLION 1000000000
#define STDOUT 1
#define STDIN 0
static char * line;
int main (int argc, char *argv[]) {
const int MAXLINE = getpagesize();
const int PAGESIZE = getpagesize();
const int GOOD_EXIT = 0;
const int FALSE = 0;
const int TRUE = 1;
const int BAD_ARGC = -1;
const int BAD_DATAFILE = -2 ;
const int BAD_FSTAT = -3 ;
const int TIME_ERR = -4 ;
const int REGEX_ERR = -5 ;
const int BLOCKSIZE = 1<<14;
// const long long BLOCKSIZE = 1<<31;
/*********************************************************************
* Determinants of "membrane" count
*********************************************************************/
const int MEMB_INDEX = 1;
const int CELL_MEMB_INDEX = 0;
const int CELL_SURF_INDEX = 21;
const int GO_PMEMB_INDEX = 6;
const int GO_INT_MEMB_INDEX = 4;
/*********************************************************************
* Determinants of "cytoplasmic" count
*********************************************************************/
const int CYTOPLASM_INDEX = 2;
const int CYTOSOL_INDEX = 3;
const int SOLUBLE_INDEX = 41;
const int GO_CYTOSOL_INDEX = 7;
const int GO_CYTOPLASM_INDEX = 2;
/*********************************************************************
* Determinants of "extracellular" count
*********************************************************************/
const int EXTRACELLULAR_INDEX = 4;
const int SECRETED_INDEX = 5;
const int GO_EXTRACELLULAR_INDEX = 3;
const int GO_ECM_INDEX = 5;
/*********************************************************************
* Determinants of "nucleus" count
*********************************************************************/
const int NUCLEUS_INDEX = 6;
const int TELOMERE_INDEX = 30;
const int GO_NUCLEUS_INDEX = 0;
const int GO_DNA_BIND_INDEX = 8;
/*********************************************************************
* Regular expression data
*********************************************************************/
const int REGEX_COUNT = 45;
const char* REGEX_RAW_ARRAY[] = { "[Cc]ell [Mm]embrane", "[mM]embrane", \
"[cC]ytoplasm",
"[cC]ytosol", "[Ee]xtracellular", "[Ss]ecreted", "[Nn]ucleus",
"[Mm]itochondrion", "[Ee]ndoplasmic reticulum lumen", "[Cc]ell \
junction", "[Pp]eriplasm", "[Vv]acuole", "[Pp]lastid", "[Cc]apsid",
"[Ee]ndoplasmic reticulum", "[Ee]ndosome", "[Ll]ysosome", "[Vv]irion", \
"[Cc]entromere", "[Pp]eroxisome", "[Gg]olgi", "[Cc]ell [Ss]urface",
"[Gg]lyoxysome", "[Gg]lyocosome", "[Zz]ona pellucida", \
"[Kk]inetochore",
"[Ss]pore", "[Bb]acterial", "[Ff]imbrium", "[Mm]elanosome", \
"[Tt]elomere",
"[Pp]odosome", "[Cc]ilium", "[Tt]richocyst", "[Hh]ydrogenosome",
"[Ss]arcoplasmic [Rr]eticulum", "[Aa]xon", "[Mm]icrosome", \
"[Aa]ngiotensin",
"[Cc]hlorosome", "[tT]hylakoid", "[Ss]oluble", "[bB]ud", \
"[Ff]lagellum", "[Vv]iral"};
const char* NAMES_ARRAY[] = { "Cell Membrane", "Membrane", "Cytoplasm", "Cytosol",
"Extracellular", "Secreted", "Nucleus", "Mitochondrion",
"Endoplasmic reticulum lumen", "Cell junction", "Periplasm", \
"Vacuole",
"Plastid", "Capsid", "Endoplasmic reticulum", "Endosome", "Lysosome",
"Virion", "Centromere", "Peroxisome", "Golgi", "Cell Surface",
"Glyoxysome", "Glyocosome", "Zona pellucida", "Kinetochore", "Spore",
"Bacterial", "Fimbrium", "Melanosome", "Telomere", "Podosome", \
"Cilium",
"Trichocyst", "Hydrogenosome", "Sarcoplasmic Reticulum", "Axon", \
"Microsome",
"Angiotensin", "Chlorosome", "Thylakoid", "Soluble", "Bud", \
"Flagellum", "Viral"};
const int GO_COUNT = 9;
const char * GO_RAW_REGEX_ARRAY[] = \
{"GO:0005634","GO:0007165","GO:0005737","GO:0005576","GO:0016021","GO:0031012","GO:0005886","GO:0005829","GO:0003677"};
const char * GO_NAMES_ARRAY[] = {"Nucleus","Signal \
Transduction","Cytoplasm","Extracellular","Integral to Membrane","Extracellular \
Matrix","Plasma Membrane","Cytosol","DNA binding"};
const int GO_MINOR_COUNT = 5;
const char * GO_RAW_REGEX_MINOR_ARRAY[] = \
{"GO:0009103","GO:0030573","GO:0055114","GO:0033644"}; const char * \
GO_NAMES_MINOR_ARRAY[] = {"lipopolysaccharide biosynthetic process","Bile Aid \
Catabolic Process","Oxidation Reduction","Host Cell Membrane" };
/*********************************************************************
* Essential counters & roll flaps
*********************************************************************/
int a,b,c, i, len, tot, j,k,l,m,n,got_EOL, line_WRAP;
int tot_proteins, tot_human_proteins, line_num, wrap_SHIFT;
int wrap_ANNEAL, done, block_done, n_prot_lines, corrupt_infile;
int max_prot_lines,max_prot_chars, this_prot_chars, bytes_read;
int max_line, zero_line;
/*********************************************************************
* File Descriptors
*********************************************************************/
int fd, fd_plist, fd_ERROR, fd_GO_REMAINDER;
int fd_FT_TOPO_DOM, fd_REMAINDER;
/*********************************************************************
* Boolean protein attribute flags
*********************************************************************/
int is_FT_TRANSMEM, is_FT_INTRAMEM, is_FT_TD_extracellular, is_FT_TD_cytoplasmic;
int is_me_DUPE, is_REMAINDER, has_FT_SIGNAL, has_FT_SIG_TRANSMEM, has_FT_DNA_BIND;
int is_FT_LIPID, is_mc_DUPE, is_mn_DUPE, is_ce_DUPE, is_cn_DUPE, is_ne_DUPE;
int is_FLAGGED, is_SCL_ARRAY[REGEX_COUNT], has_SCL, has_DR_GO, \
has_GO_ARRAY[GO_COUNT]; int is_GO_REMAINDER, has_GO_MINOR_ARRAY[GO_MINOR_COUNT], \
is_brain, is_muscle;
/*********************************************************************
* Human protein tabulators
*********************************************************************/
int hum_transmem, hum_extracellular, hum_cytoplasmic, hum_SIGNAL, hum_SIG_TRANSMEM;
int hum_DNA_BIND, hum_mem, hum_intramem, hum_itmem, hum_lipid_bind, hum_membrane;
int in_SCL, hum_REMAINDER, hum_SCL_ARRAY[REGEX_COUNT], hum_SCL_NULL, hum_DR_GO;
int hum_GO_ARRAY[GO_COUNT], hum_GO_MINOR_ARRAY[GO_MINOR_COUNT], hum_nuclear;
/*********************************************************************
* Total protein tabulators
*********************************************************************/
int tot_transmem, tot_extracellular, tot_cytoplasmic, tot_SIGNAL, tot_SIG_TRANSMEM;
int tot_DNA_BIND, tot_mem, tot_intramem, tot_itmem, tot_lipid_bind, tot_REMAINDER;
int tot_SCL_ARRAY[REGEX_COUNT], tot_membrane, tot_SCL_NULL, tot_DR_GO;
int tot_GO_ARRAY[GO_COUNT], tot_GO_MINOR_ARRAY[GO_MINOR_COUNT], tot_nuclear;
int tot_muscle, tot_brain, brain_cytoplasmic, brain_nuclear, brain_membrane;
int brain_extracellular, muscle_cytoplasmic, muscle_nuclear, muscle_membrane;
int muscle_extracellular;
/*********************************************************************
* Miscellaneous, timing, memory
*********************************************************************/
int file_arg = 1, bs_arg = 2, this_is_human = 0;
float r;
long long this_seek, line_begin, seek_result, last_lbegin,status;
long long char_count;
char *this_line, this_char, *block, *wrap_frag, err_msg[MAXLINE],opt;
char alloc_type = 'v', mem_method[20];
struct stat statbuf;
struct timespec t_begin, t_end, t_res;
/*********************************************************************
* REGular EXpressions compiled variables
*********************************************************************/
regex_t rgx_array[REGEX_COUNT], rgx_GO_array[GO_COUNT],
rgx_GO_minor_array[GO_MINOR_COUNT], rgx_brain, rgx_muscle;
int regex_status;
/*********************************************************************
* END VARIABLES SECTION
* ************* ************** ************** **************
* END VARIABLES SECTION
* ************* ************** ************** **************
* END VARIABLES SECTION
* ************* ************** ************** **************
* END VARIABLES SECTION
*********************************************************************/
line = malloc((MAXLINE+2)*sizeof(char));
#if 0
for (i=0;i<REGEX_COUNT;i++)
printf("index %d: RAW REGEX: %s NAME: %s\n",i,REGEX_RAW_ARRAY[i],NAMES_ARRAY[i]);
#endif
/*********************************************************************
* REGular EXpression COMPilations
*********************************************************************/
for (i=0;i<REGEX_COUNT;i++) {
regex_status = regcomp(&rgx_array[i],REGEX_RAW_ARRAY[i] , \
REG_EXTENDED|REG_NOSUB); if (regex_status) {
fprintf(stderr, "Could not compile regex for %s\n",REGEX_RAW_ARRAY[i]);
exit(REGEX_ERR);
}
}
for (i=0;i<GO_COUNT;i++) {
regex_status = regcomp(&rgx_GO_array[i],GO_RAW_REGEX_ARRAY[i] , \
REG_EXTENDED|REG_NOSUB); if (regex_status) {
fprintf(stderr, "Could not compile regex for %s\n",GO_RAW_REGEX_ARRAY[i]);
exit(REGEX_ERR);
}
}
for (i=0;i<GO_MINOR_COUNT;i++) {
regex_status = regcomp(&rgx_GO_minor_array[i],GO_RAW_REGEX_MINOR_ARRAY[i]
, REG_EXTENDED|REG_NOSUB);
if (regex_status) {
fprintf(stderr, "Could not compile regex for \
%s\n",GO_RAW_REGEX_MINOR_ARRAY[i]); exit(REGEX_ERR);
}
}
regex_status = regcomp(&rgx_brain,"TISSUE=Brain", REG_EXTENDED|REG_NOSUB);
if (regex_status) {
fprintf(stderr, "Could not compile regex for %s\n","TISSUE=Brain");
exit(REGEX_ERR);
}
regex_status = regcomp(&rgx_muscle,"TISSUE=Muscle", REG_EXTENDED|REG_NOSUB);
if (regex_status) {
fprintf(stderr, "Could not compile regex for %s\n","TISSUE=Muscle");
exit(REGEX_ERR);
}
if (argc < 2) {
sprintf(err_msg,"USAGE: demog_script_friendly [-mvap] <datafile> [log base 2 of \
BLOCKSIZE] O:=} Not"); perror(err_msg);
return BAD_ARGC;
}
while ((opt = getopt(argc,argv,"mvap")) !=EOF) {
switch (opt) {
case 'm':
alloc_type = 'm';
file_arg++;
bs_arg++;
break;
case 'a':
alloc_type = 'a';
file_arg++;
bs_arg++;
break;
case 'v':
alloc_type = 'v';
file_arg++;
bs_arg++;
break;
case 'p':
alloc_type = 'p';
file_arg++;
bs_arg++;
break;
case '?':
sprintf(err_msg,"invalid option to %s:",argv[0]);
perror(err_msg);
}//--- switch (opt) ---//
}//--- while ((opt= getopt(argc,argv,"m")) !=EOF) ---//
#if 0
const long long BLOCKSIZE;
if (argc >= 3)
BLOCKSIZE = 1 << atoi(argv[bs_arg]);
else
BLOCKSIZE = 1 << 14;
#endif
if ((fd = open( argv[file_arg], O_RDONLY )) < 0) {
sprintf(err_msg,"CAN'T OPEN FILE: %s \ncause", argv[file_arg]);
perror(err_msg);
close(fd);
return BAD_DATAFILE;
}
#if 0
if ((fd_plist = open( "human_subc_loc.txt", O_WRONLY )) < 0) {
sprintf(err_msg,"CAN'T OPEN FILE: %s \ncause", "human_subc_loc.txt");
perror(err_msg);
close(fd_plist);
return BAD_DATAFILE;
}
if ((fd_FT_TOPO_DOM = open( "human_FT_TOPO_DOM.txt", O_WRONLY )) < 0) {
sprintf(err_msg,"CAN'T OPEN FILE: %s \ncause", "human_FT_TOPO_DOM.txt");
perror(err_msg);
close(fd_FT_TOPO_DOM);
return BAD_DATAFILE;
}
if ((fd_GO_REMAINDER = open( "GO_REMAINDER.txt", O_WRONLY )) < 0) {
sprintf(err_msg,"CAN'T OPEN FILE: %s \ncause", "GO_REMAINDER.txt");
perror(err_msg);
close(fd_FT_TOPO_DOM);
return BAD_DATAFILE;
}
if ((fd_REMAINDER = open( "human_REMAINDER.txt", O_WRONLY )) < 0) {
sprintf(err_msg,"CAN'T OPEN FILE: %s \ncause", "human_REMAINDER.txt");
perror(err_msg);
close(fd_REMAINDER);
return BAD_DATAFILE;
}
if ((fd_ERROR = open( "ERROR.txt", O_WRONLY )) < 0) {
sprintf(err_msg,"CAN'T OPEN FILE: %s \ncause", "ERROR.txt");
perror(err_msg);
close(fd_ERROR);
return BAD_DATAFILE;
}
#endif
if (fstat(fd, &statbuf) < 0 ) {
sprintf(err_msg,"BAD FILE STATS: %s \ncause", argv[1]);
perror(err_msg);
close(fd);
return BAD_FSTAT;
}
i=0;
a=0;
b=0;
c=0;
tot_proteins = 0;
line_num = 0;
char_count = 0;
tot_human_proteins = 0;
hum_transmem = 0;
hum_mem = 0;
hum_DR_GO = 0;
hum_itmem = 0;
hum_intramem = 0;
hum_SIGNAL= 0;
tot_transmem = 0;
tot_mem = 0;
tot_brain = 0;
tot_muscle = 0;
tot_lipid_bind = 0;
hum_lipid_bind = 0;
tot_itmem = 0;
tot_intramem = 0;
tot_SIGNAL= 0;
hum_DNA_BIND = 0;
hum_REMAINDER = 0;
tot_REMAINDER = 0;
hum_nuclear = 0;
tot_nuclear = 0;
brain_nuclear = 0;
muscle_nuclear = 0;
hum_extracellular = 0;
brain_extracellular = 0;
muscle_extracellular = 0;
hum_cytoplasmic = 0;
brain_cytoplasmic = 0;
muscle_cytoplasmic = 0;
hum_membrane = 0;
brain_membrane = 0;
muscle_membrane = 0;
hum_SCL_NULL = 0;
tot_SCL_NULL = 0;
tot_DR_GO = 0;
for(i=0;i<REGEX_COUNT;i++) {
hum_SCL_ARRAY[i] = 0;
tot_SCL_ARRAY[i] = 0;
is_SCL_ARRAY[i] = FALSE;
}
for(i=0;i<GO_COUNT;i++) {
hum_GO_ARRAY[i] = 0;
tot_GO_ARRAY[i] = 0;
has_GO_ARRAY[i] = FALSE;
}
for(i=0;i<GO_MINOR_COUNT;i++) {
hum_GO_MINOR_ARRAY[i] = 0;
tot_GO_MINOR_ARRAY[i] = 0;
has_GO_MINOR_ARRAY[i] = FALSE;
}
tot_extracellular = 0;
tot_membrane = 0;
tot_cytoplasmic = 0;
max_prot_lines = 0;
char_count = 0;
zero_line = FALSE;
corrupt_infile = FALSE;
max_prot_chars = 0;
this_prot_chars = 0;
n_prot_lines = 0;
this_is_human = FALSE;
is_FT_TRANSMEM = FALSE;
is_brain = FALSE;
is_muscle = FALSE;
is_REMAINDER = TRUE;
is_GO_REMAINDER = TRUE;
is_FT_INTRAMEM = FALSE;
is_FT_LIPID = FALSE;
has_FT_SIGNAL = FALSE;
has_DR_GO = FALSE;
has_SCL = FALSE;
has_FT_DNA_BIND = FALSE;
has_FT_SIG_TRANSMEM = FALSE;
is_FT_TD_extracellular = FALSE;
is_FT_TD_cytoplasmic = FALSE;
in_SCL = FALSE;
is_FLAGGED = FALSE;
/********************************************************
*
* Data parameterization:
*
* BLOCKSIZE chunks of the files are removed as this_seek
* is incremented by that amount in the outer while
* loop with termination on read failure. The next
* level of while loop iterates on a variable line_begin,
* which must be less than BLOCKSIZE. This index steps
* through the currently examined block by leaps determined
* by an iterator b that checks for newline.
*
********************************************************/
this_seek = 0;
max_line = 0;
line_WRAP = FALSE;
done = FALSE;
block_done = FALSE;
wrap_ANNEAL = FALSE;
if ((seek_result = lseek(fd, (off_t) this_seek, SEEK_SET))<0)
done = TRUE;
switch (alloc_type) {
case 'm':
block = malloc(BLOCKSIZE);
strcpy(mem_method, "malloc");
break;
case 'p':
posix_memalign((void **)&block,BLOCKSIZE,PAGESIZE);
strcpy(mem_method, "posix_memalign");
break;
case 'a':
block = alloca(BLOCKSIZE);
strcpy(mem_method, "alloca");
break;
case 'v':
block = valloc(BLOCKSIZE);
strcpy(mem_method, "valloc");
break;
default:
block = valloc(BLOCKSIZE);
} //--- switch (alloc_type) ---//
line_begin = 0;
last_lbegin = 0;
n_prot_lines = 0;
if (clock_gettime(CLOCK_REALTIME, &t_begin)) {
sprintf(err_msg, "failed to get start time\n\0");
perror(err_msg);
return TIME_ERR;
}
/*********************************************************************
* this_seek--ing BLOCKSIZE steps
*********************************************************************/
if ((bytes_read = read(fd, block, BLOCKSIZE)) <= 0)
done = TRUE;
while (!done) {
/*****************************************************************
* hopping line by line through one block
* block_done indicates data in block has been exhausted.
*
*****************************************************************/
block_done = FALSE;
while (!block_done) {
b=0;
/**************************************************************
* finding next line_begin with b
**************************************************************/
got_EOL = FALSE;
while (!got_EOL) {
//printf ("e!gE.");
if (line_begin == bytes_read) {
this_seek += BLOCKSIZE;
if ((status= (lseek(fd, (off_t) this_seek, SEEK_SET)) < 0)) {
done = TRUE;
got_EOL = TRUE;
block_done = TRUE;
break;
}
if ((bytes_read = read(fd, block, BLOCKSIZE)) <= 0) {
got_EOL = TRUE;
block_done = TRUE;
done = TRUE;
break;
}
else
line_begin = 0;
}
b++;
if (line_begin + b >= bytes_read) {
/**************************************************************
* this line has wrapped accross a block.
* shift the file pointer so that the beginning of the line
* is the beginning of the new block.
**************************************************************/
if (bytes_read < BLOCKSIZE) {
/**************************************************************
* If bytes_read is less than BLOCKSIZE, this should imply
* that we are reading the last block of the infile. Therefore,
* all loops should end. In the event the file does not terminate
* correctly, the corrupt_infile flag is set.
**************************************************************/
if (block[bytes_read-1] != '\n' )
corrupt_infile = TRUE;
got_EOL = TRUE;
block_done = TRUE;
done = TRUE;
break;
}
wrap_SHIFT = b;
this_seek += BLOCKSIZE - wrap_SHIFT;
if ((status= (lseek(fd, (off_t) this_seek, SEEK_SET)) < 0))
done = TRUE;
line_begin = 0;
last_lbegin = 0;
if ((bytes_read = read(fd, block, BLOCKSIZE)) <= 0) {
/**************************************************************
*
* there is no more file to read--end all loops.
*
**************************************************************/
//printf("status is %lld\n",status);
got_EOL = TRUE;
block_done = TRUE;
done = TRUE;
}
}// if (line_begin + b == bytes_read) {
if ( block[line_begin + b ] == '\n') {
n_prot_lines++;
char_count += b;
this_prot_chars += b;
got_EOL = TRUE;
}
if ( b == MAXLINE) {
b -= 2;
got_EOL = TRUE;
}//----- if ( b == MAXLINE) -----//
}//----- while (!got_EOL) -----//
if (line_begin == bytes_read)
break;
if ( b > max_line)
max_line = b;
if (line_begin != bytes_read)
line_num++;
#if 0
if (b != 0)
printas(STDOUT,block,line_begin,line_begin+b-1);
#endif
a = 0;
if ((block[line_begin] == '/')&&(block[line_begin+1] == '/')) {
/*****************************************************************
* END OF RECORD
*****************************************************************/
tot_proteins++;
if ( n_prot_lines > max_prot_lines)
max_prot_lines = n_prot_lines;
if (this_prot_chars > max_prot_chars)
max_prot_chars = this_prot_chars;
if (this_is_human) {
/*****************************************************************
* HUMAN DATA
*****************************************************************/
if (!has_SCL) {
hum_SCL_NULL++;
is_REMAINDER = FALSE;
}
if (is_REMAINDER)
hum_REMAINDER++;
if (is_FT_TRANSMEM)
hum_transmem++;
if (is_FT_INTRAMEM)
hum_intramem++;
if (is_FT_LIPID)
hum_lipid_bind++;
if ((is_FT_INTRAMEM)&&(is_FT_TRANSMEM))
hum_itmem++;
if (is_FT_TD_extracellular)
hum_extracellular++;
if (is_FT_TD_cytoplasmic)
hum_cytoplasmic++;
if (has_FT_SIGNAL)
hum_SIGNAL++;
if (has_FT_DNA_BIND)
hum_DNA_BIND++;
if (has_DR_GO)
hum_DR_GO++;
if ((has_FT_SIGNAL) && (is_FT_TRANSMEM))
hum_SIG_TRANSMEM++;
for(i=0;i<REGEX_COUNT;i++)
if(is_SCL_ARRAY[i])
hum_SCL_ARRAY[i]++;
for(i=0;i<GO_COUNT;i++)
if(has_GO_ARRAY[i])
hum_GO_ARRAY[i]++;
for(i=0;i<GO_MINOR_COUNT;i++)
if(has_GO_MINOR_ARRAY[i])
hum_GO_MINOR_ARRAY[i]++;
if ((is_FT_TRANSMEM) || (is_FT_INTRAMEM) || (is_FT_LIPID) ||
(is_SCL_ARRAY[CELL_SURF_INDEX]) || (is_SCL_ARRAY[CELL_MEMB_INDEX])
|| (is_SCL_ARRAY[MEMB_INDEX]) )
hum_membrane++;
if ((is_SCL_ARRAY[CYTOPLASM_INDEX]) || (is_SCL_ARRAY[CYTOSOL_INDEX]) ||
(is_SCL_ARRAY[SOLUBLE_INDEX]) || (has_GO_ARRAY[GO_CYTOSOL_INDEX]) ||
(has_GO_ARRAY[GO_CYTOPLASM_INDEX]))
hum_cytoplasmic++;
if ((has_FT_SIGNAL) || (is_SCL_ARRAY[EXTRACELLULAR_INDEX]) ||
(is_SCL_ARRAY[SECRETED_INDEX]) || \
(has_GO_ARRAY[GO_EXTRACELLULAR_INDEX]) || (has_GO_ARRAY[GO_ECM_INDEX]))
hum_extracellular++;
if ((is_SCL_ARRAY[NUCLEUS_INDEX]) || (is_SCL_ARRAY[TELOMERE_INDEX]) ||
(has_GO_ARRAY[GO_NUCLEUS_INDEX]) || (has_GO_ARRAY[GO_DNA_BIND_INDEX]))
hum_nuclear++;
}//---- HUMAN DATA -----//
/*****************************************************************
* TOTAL DATA
*****************************************************************/
if (is_FT_TRANSMEM)
tot_transmem++;
if (!has_SCL) {
tot_SCL_NULL++;
is_REMAINDER = FALSE;
}
if (is_REMAINDER)
tot_REMAINDER++;
if (is_muscle)
tot_muscle++;
if (is_brain)
tot_brain++;
if (is_FT_LIPID)
tot_lipid_bind++;
if (has_DR_GO)
tot_DR_GO++;
if (is_FT_INTRAMEM)
tot_intramem++;
if ((is_FT_INTRAMEM)&&(is_FT_TRANSMEM))
tot_itmem++;
if (is_FT_TD_extracellular)
tot_extracellular++;
if (is_FT_TD_cytoplasmic)
tot_cytoplasmic++;
if (has_FT_SIGNAL)
tot_SIGNAL++;
if (has_FT_DNA_BIND)
tot_DNA_BIND++;
if ((has_FT_SIGNAL) && (is_FT_TRANSMEM))
tot_SIG_TRANSMEM++;
for(i=0;i<REGEX_COUNT;i++)
if(is_SCL_ARRAY[i])
tot_SCL_ARRAY[i]++;
for(i=0;i<GO_COUNT;i++)
if(has_GO_ARRAY[i])
tot_GO_ARRAY[i]++;
for(i=0;i<GO_MINOR_COUNT;i++)
if(has_GO_MINOR_ARRAY[i])
tot_GO_MINOR_ARRAY[i]++;
if ((is_FT_TRANSMEM) || (is_FT_INTRAMEM) || (is_FT_LIPID) ||
(is_SCL_ARRAY[CELL_SURF_INDEX]) || (is_SCL_ARRAY[CELL_MEMB_INDEX])
|| (is_SCL_ARRAY[MEMB_INDEX]) )
{
tot_membrane++;
if (is_brain)
brain_membrane++;
if (is_muscle)
muscle_membrane++;
}
if ((is_SCL_ARRAY[CYTOPLASM_INDEX]) || (is_SCL_ARRAY[CYTOSOL_INDEX]) ||
(is_SCL_ARRAY[SOLUBLE_INDEX]) || (has_GO_ARRAY[GO_CYTOSOL_INDEX]) ||
(has_GO_ARRAY[GO_CYTOPLASM_INDEX]))
{
tot_cytoplasmic++;
if (is_brain)
brain_cytoplasmic++;
if (is_muscle)
muscle_cytoplasmic++;
}
if ((has_FT_SIGNAL) || (is_SCL_ARRAY[EXTRACELLULAR_INDEX]) ||
(is_SCL_ARRAY[SECRETED_INDEX]) || (has_GO_ARRAY[GO_EXTRACELLULAR_INDEX]) \
|| (has_GO_ARRAY[GO_ECM_INDEX]))
{
tot_extracellular++;
if (is_brain)
brain_extracellular++;
if (is_muscle)
muscle_extracellular++;
}
if ((is_SCL_ARRAY[NUCLEUS_INDEX]) || (is_SCL_ARRAY[TELOMERE_INDEX]) ||
(has_GO_ARRAY[GO_NUCLEUS_INDEX]) || (has_GO_ARRAY[GO_DNA_BIND_INDEX]))
{
tot_nuclear++;
if (is_brain)
brain_nuclear++;
if (is_muscle)
muscle_nuclear++;
}
/*****************************************************************
* RESET this protein data
*****************************************************************/
n_prot_lines = 0;
this_prot_chars= 0;
this_is_human = FALSE;
is_FT_TRANSMEM = FALSE;
is_REMAINDER = TRUE;
is_GO_REMAINDER = TRUE;
is_FT_INTRAMEM = FALSE;
is_FT_LIPID = FALSE;
is_brain = FALSE;
is_muscle = FALSE;
has_FT_SIGNAL = FALSE;
has_SCL = FALSE;
has_DR_GO = FALSE;
has_FT_DNA_BIND = FALSE;
has_FT_SIG_TRANSMEM = FALSE;
is_FT_TD_extracellular = FALSE;
is_FT_TD_cytoplasmic = FALSE;
in_SCL = FALSE;
is_FLAGGED = FALSE;
for(i=0;i<REGEX_COUNT;i++)
is_SCL_ARRAY[i] = FALSE;
for(i=0;i<GO_COUNT;i++)
has_GO_ARRAY[i] = FALSE;
for(i=0;i<GO_MINOR_COUNT;i++)
has_GO_MINOR_ARRAY[i] = FALSE;
}// ---if ((block[line_begin] == '/')&&(block[line_begin+1] == '/'))---//
/*****************************************************************
* Done with End Record processing
*****************************************************************/
#if 1
if ((block[line_begin] == 'R')&&(block[line_begin+1] == 'C')) {
/*****************************************************************
*
* Reference Comment (RC) line
*
* http://ca.expasy.org/sprot/userman.html#RC_line
*
*****************************************************************/
for(i=0;i<b+1;i++)
line[i] = block[line_begin+i];
line[i] = '\0';
if (!(regexec(&rgx_muscle, line, (size_t)0,NULL,0))) {
is_muscle = TRUE;
}
if (!(regexec(&rgx_brain, line, (size_t)0,NULL,0))) {
is_brain = TRUE;
}
for(i=0;i<b+2;i++)
line[i] = '\0';
}//---if ((block[line_begin] == 'R')&&(block[line_begin+1] == 'C'))---//
#endif
if ((block[line_begin] == 'O')&&(block[line_begin+1] == 'S')) {
/*****************************************************************
*
* Organism Species (OS) line
*
* http://ca.expasy.org/sprot/userman.html#OS_line
*
*****************************************************************/
if ((block[line_begin+5] == 'H')&&(block[line_begin+7] == 'm')
&&(block[line_begin+10] == 's')) {
/*****************************************************************
* Human protein (Homo Sapiens)
*****************************************************************/
tot_human_proteins++;
this_is_human = TRUE;
}
}
if ((block[line_begin] == 'F')&&(block[line_begin+1] == 'T') ) {
/*****************************************************************
*
* Feature Table (FT) line
*
* http://www.expasy.org/sprot/userman.html#FT_line
*
*****************************************************************/
if ((block[line_begin+5] == 'T') && (block[line_begin+6] == 'R') &&
(block[line_begin+7] == 'A') && (block[line_begin+8] == 'N') &&
(block[line_begin+9] == 'S') && (block[line_begin+10] == 'M') &&
(block[line_begin+11] == 'E') && (block[line_begin+12] == 'M')) {
is_FT_TRANSMEM = TRUE;
is_REMAINDER = FALSE;
} //--- if FT TRANSMEM ----//
if ((block[line_begin+5] == 'L') && (block[line_begin+6] == 'I') &&
(block[line_begin+7] == 'P') && (block[line_begin+8] == 'I') &&
(block[line_begin+9] == 'D')) {
is_FT_LIPID= TRUE;
is_REMAINDER = FALSE;
} //--- if FT LIPID ----//
if ((block[line_begin+5] == 'I') && (block[line_begin+6] == 'N') &&
(block[line_begin+7] == 'T') && (block[line_begin+8] == 'R') &&
(block[line_begin+9] == 'A') && (block[line_begin+10] == 'M') &&
(block[line_begin+11] == 'E') && (block[line_begin+12] == 'M')) {
is_FT_INTRAMEM = TRUE;
is_REMAINDER = FALSE;
} //--- if FT INTRAMEM ----//
if ((block[line_begin+5] == 'S') && (block[line_begin+6] == 'I') &&
(block[line_begin+7] == 'G') && (block[line_begin+8] == 'N') &&
(block[line_begin+9] == 'A') && (block[line_begin+10] == 'L')) {
has_FT_SIGNAL = TRUE;
is_REMAINDER = FALSE;
} //--- if FT SIGNAL ----//
if ((block[line_begin+5] == 'D') && (block[line_begin+6] == 'N') &&
(block[line_begin+7] == 'A') && (block[line_begin+8] == '_') &&
(block[line_begin+9] == 'B') && (block[line_begin+10] == 'I') &&
(block[line_begin+11] == 'N') && (block[line_begin+12] == 'D')) {
has_FT_DNA_BIND = TRUE;
is_REMAINDER = FALSE;
} //--- if FT DNA_BIND----//
} //---if ((block[line_begin] == 'F')&&(block[line_begin+1] == 'T')) {
if ((block[line_begin] == 'C')&&(block[line_begin+1] == 'C')) {
/*****************************************************************
*
* Comment Block (CC) line
*
* http://www.expasy.org/sprot/userman.html#CC_line
*
*****************************************************************/
if ((block[line_begin+9] == 'S') && (block[line_begin+10] == 'U')&&
(block[line_begin+11] == 'B') && (block[line_begin+12] == 'C')&&
(block[line_begin+13] == 'E') && (block[line_begin+14] == 'L')&&
(block[line_begin+15] == 'L') && (block[line_begin+16] == 'U')&&
(block[line_begin+17] == 'L') && (block[line_begin+18] == 'A')&&
(block[line_begin+19] == 'R') && (block[line_begin+21] == 'L')&&
(block[line_begin+22] == 'O') && (block[line_begin+23] == 'C')&&
(block[line_begin+24] == 'A') && (block[line_begin+25] == 'T')&&
(block[line_begin+26] == 'I') && (block[line_begin+27] == 'O')&&
(block[line_begin+5] == '-')&&(block[line_begin+6] == '!') &&
(block[line_begin+7] == '-') && (block[line_begin+28] == 'N')) {
/*****************************************************************
*
* CC -!- SUBCELLULAR LOCATION
*
*****************************************************************/
has_SCL = TRUE;
in_SCL = TRUE;
} //--- CC -!- SUBCELLULAR LOCATION ----//
else {
if (((block[line_begin+5] == '-')&&(block[line_begin+6] == '!') &&
(block[line_begin+7] == '-'))||
((block[line_begin+5] == '-')&&(block[line_begin+6] == '-') &&
(block[line_begin+7] == '-')))
in_SCL = FALSE;
}
if (in_SCL) {
#if 1
for(i=0;i<b+1;i++)
line[i] = block[line_begin+i];
line[i] = '\0';
#endif
for(i=0;i<REGEX_COUNT;i++) {
if (!(regexec(&rgx_array[i], line, (size_t)0,NULL,0))) {
is_SCL_ARRAY[i] = TRUE;
is_REMAINDER = FALSE;
}
}
}
} //---if ((block[line_begin] == 'C')&&(block[line_begin+1] == 'C')) {
if ((block[line_begin] == 'D')&&(block[line_begin+1] == 'R') ) {
/*****************************************************************
*
* DR -!- Database cross-Reference
*
*****************************************************************/
if ((block[line_begin+5] == 'G')&&(block[line_begin+6] == 'O') ) {
/*****************************************************************
*
* GO -!- Gene Ontology reference
*
*****************************************************************/
for(i=0;i<b+1;i++)
line[i] = block[line_begin+i];
line[i] = '\0';
for(i=0;i<GO_COUNT;i++) {
if (!(regexec(&rgx_GO_array[i], line, (size_t)0,NULL,0))) {
has_GO_ARRAY[i] = TRUE;
is_REMAINDER = FALSE;
is_GO_REMAINDER = FALSE;
}
}
for(i=0;i<GO_MINOR_COUNT;i++) {
if (!(regexec(&rgx_GO_minor_array[i], line, (size_t)0,NULL,0))) {
has_GO_MINOR_ARRAY[i] = TRUE;
is_REMAINDER = FALSE;
is_GO_REMAINDER = FALSE;
}
}
if (is_GO_REMAINDER)
write(fd_GO_REMAINDER,line,b+1);
} //--- ((block[line_begin+5] == 'G')&&(block[line_begin+6] == 'O') ) ---//
} //--- if ((block[line_begin] == 'D')&&(block[line_begin+1] == 'R') ) ---//
if (is_REMAINDER)
write(fd_REMAINDER,line,b+1);
last_lbegin = line_begin;
line_begin += b + 1;
if (line_begin >= bytes_read) {
block_done = TRUE;
}
}//----- while (!block_done)-----//
/*****************************************************************
* wrap up flip
*****************************************************************/
if (line_begin != bytes_read)
this_seek += BLOCKSIZE;
block_done = FALSE;
lseek(fd, (off_t) this_seek, SEEK_SET);
}//----- while (!done) was ((bytes_read = read(fd, block, BLOCKSIZE)) > 0) -----// \
hum_membrane -= hum_SIGNAL;
tot_membrane -= tot_SIGNAL;
if (clock_gettime(CLOCK_REALTIME, &t_end)) {
sprintf(err_msg,"failed to get end time\n\0");
perror(err_msg);
return TIME_ERR;
}
/*****************************************************************
*
* OUTPUT RESULTS
*
*****************************************************************/
printf("----------------------------------------\n");
printf("processing %s \n", argv[file_arg] );
printf("the memory allocation method is %s\n",mem_method);
printf("The longest line has %d characters\n",max_line);
printf("There are a total of %d lines\n",line_num);
printf("--------HUMAN PROTEINS--------------------\n");
printf("human proteins: %d\n",tot_human_proteins);
printf("human FT TRANSMEM proteins: %d\n",hum_transmem);
printf("human FT INTRAMEM proteins: %d\n",hum_intramem);
printf("human proteins with covalent lipid binding (FT LIPID): \
%d\n",hum_lipid_bind); printf("human proteins both intra- & trans- membrane: \
%d\n",hum_itmem); printf("human FT SIGNAL signal peptide containing proteins: \
%d\n",hum_SIGNAL); printf("human proteins with both signal sequence and \
transmembrane: %d\n",hum_SIG_TRANSMEM); printf("human proteins with DNA_BIND: \
%d\n",hum_DNA_BIND);
for(i=0;i<REGEX_COUNT;i++)
printf("%d: human proteins with CC SUBCELLULAR LOCATION \"%s\": %d\n",
i, NAMES_ARRAY[i], hum_SCL_ARRAY[i]);
for(i=0;i<GO_COUNT;i++)
printf("%d: human proteins with Gene Ontology \"%s\": %d\n",
i, GO_NAMES_ARRAY[i], hum_GO_ARRAY[i]);
printf("human proteins with no CC SUBCELLULAR LOCATION annotation: \
%d\n",hum_SCL_NULL); printf("human total membrane proteins: %d\n",hum_membrane);
printf("human cytoplasmic proteins: %d\n",hum_cytoplasmic);
printf("human extracellular proteins: %d\n",hum_extracellular);
printf("human nuclear proteins: %d\n",hum_nuclear);
printf("REMAINDER human proteins: %d\n",hum_REMAINDER);
printf("----------------------------------------\n");
printf("There are %d total proteins \n",tot_proteins);
printf("total FT TRANSMEM proteins: %d\n",tot_transmem);
printf("total FT INTRAMEM proteins: %d\n",tot_intramem);
printf("total proteins with covalent lipid binding: %d\n",tot_lipid_bind);
printf("total proteins both intra- & trans- membrane: %d\n",tot_itmem);
printf("total FT SIGNAL signal peptide containing proteins: %d\n",tot_SIGNAL);
printf("total proteins with both signal sequence and transmembrane: \
%d\n",tot_SIG_TRANSMEM); printf("total proteins with DNA_BIND: %d\n",tot_DNA_BIND);
for(i=0;i<REGEX_COUNT;i++)
printf("%d: total proteins with CC SUBCELLULAR LOCATION \"%s\": %d\n",
i, NAMES_ARRAY[i], tot_SCL_ARRAY[i]);
for(i=0;i<GO_COUNT;i++)
printf("%d: total proteins with Gene Ontology \"%s\": %d\n",
i, GO_NAMES_ARRAY[i], tot_GO_ARRAY[i]);
printf("total proteins with no CC SUBCELLULAR LOCATION annotation: \
%d\n",tot_SCL_NULL); printf("total total membrane proteins: %d\n",tot_membrane);
printf("total cytoplasmic proteins: %d\n",tot_cytoplasmic);
printf("total extracellular proteins: %d\n",tot_extracellular);
printf("total nuclear proteins: %d\n",tot_nuclear);
printf("REMAINDER total proteins: %d\n",tot_REMAINDER);
printf("----------------------------------------\n");
printf("total brain proteins: %d\n",tot_brain);
printf("brain nuclear proteins: %d\n",brain_nuclear);
printf("brain cytoplasmic proteins: %d\n",brain_cytoplasmic);
printf("brain membrane proteins: %d\n",brain_membrane);
printf("brain extracellular proteins: %d\n",brain_extracellular);
printf("----------------------------------------\n");
printf("total muscle proteins: %d\n",tot_muscle);
printf("muscle nuclear proteins: %d\n",muscle_nuclear);
printf("muscle cytoplasmic proteins: %d\n",muscle_cytoplasmic);
printf("muscle membrane proteins: %d\n",muscle_membrane);
printf("muscle extracellular proteins: %d\n",muscle_extracellular);
printf("----------------------------------------\n");
printf("The protein with the most lines has %d lines\n",max_prot_lines);/**/
printf("BLOCKSIZE IS %d\n",BLOCKSIZE);
printf("it took");
print_interval(&t_begin,&t_end);
printf(" to run.\n");
printf("----------------------------------------\n");
/*****************************************************************
*
*****************************************************************/
cellgram("human",argv[file_arg],(double)hum_nuclear,(double)hum_cytoplasmic,
(double)hum_membrane,(double)hum_extracellular);
cellgram("total",argv[file_arg],(double)tot_nuclear,(double)tot_cytoplasmic,
(double)tot_membrane,(double)tot_extracellular);
cellgram("brain",argv[file_arg],(double)brain_nuclear,(double)brain_cytoplasmic,
(double)brain_membrane,(double)brain_extracellular);
cellgram("muscle",argv[file_arg],(double)muscle_nuclear,(double)muscle_cytoplasmic,
(double)muscle_membrane,(double)muscle_extracellular);
close(fd);
return GOOD_EXIT;
}// int main (int argc, char *argv[]) -----//
int printas (int fd, char * s, long long begin, long long end) {
/*****************************************************************
*
* PRINTAS--Print Array Segment
*
* Prints an array segment to file fd avoiding segmentation fault
*
* String s[...begin to end. ...]
*
*****************************************************************/
long long i = begin;
if (begin <= end) {
while (i <= end ) {
write(fd,&s[i],1);
i++;
}
}
write(fd,"\n",1);
//flush(fd);
}
["Makefile" (application/octet-stream)]
["print_interval.c" (text/x-csrc)]
#include <stdio.h>
#include <time.h>
#include <sys/time.h>
#define BILLION 1000000000
#define MILLION 1000000
#define THOUSAND 1000
int print_interval(struct timespec* start, struct timespec* end) {
long long interval,ninterval;
int uinterval, sinterval,minterval;
interval = ((int)(end->tv_sec)-(int)(start->tv_sec));
ninterval = ((int)(end->tv_nsec)-(int)(start->tv_nsec));
ninterval += BILLION*interval;
if (ninterval < THOUSAND) {
printf(" %lld nsec",ninterval);
} // ----(ninterval < THOUSAND) -----//
else {
uinterval = ninterval/THOUSAND;
if (uinterval < THOUSAND) {
ninterval -= THOUSAND*uinterval;
if (ninterval > 99)
printf(" %d.%lld usec",uinterval,ninterval);
else
if (ninterval > 9)
printf(" %d.%d%lld usec",uinterval,0,ninterval);
else
printf(" %d.%d%d%lld usec",uinterval,0,0,ninterval);
} //-----(uinterval < THOUSAND) -----//
else {
minterval = uinterval/THOUSAND;
if (minterval < THOUSAND) {
uinterval -= THOUSAND*minterval;
if (uinterval > 99)
printf(" %d.%d msec",minterval,uinterval);
else
if (uinterval > 9)
printf(" %d.%d%d msec",minterval,0,uinterval);
else
printf(" %d.%d%d%d msec",minterval,0,0,uinterval);
} //------ (minterval < THOUSAND) -----//
else {
sinterval = minterval/THOUSAND;
minterval -= THOUSAND*sinterval;
if (minterval > 99)
printf(" %d.%d sec",sinterval,minterval);
else
if (minterval > 9)
printf(" %d.%d%d sec",sinterval,0,minterval);
else
printf(" %d.%d%d%d sec",sinterval,0,0,minterval);
} //------ ELSE (minterval >= THOUSAND) -----//
} //-----ELSE(uinterval >= THOUSAND) -----//
} // ----(ninterval < THOUSAND) -----//
} //----print_interval(struct timespec* start, struct timespec* end)----//
["make.errors" (application/octet-stream)]
--
cairo mailing list
cairo@cairographics.org
http://lists.cairographics.org/mailman/listinfo/cairo
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic