예제 #1
0
파일: cgi.c 프로젝트: Accio/ribios
SEXP r_cgiGet2Post() {
  char *res=cgiGet2Post();
  if(res) {
    return mkString(res);
  }
  return R_NilValue;
}
예제 #2
0
int main (int argc, char *argv[]) 
{
  char *queryString;

  if ((Conf = confp_open(getenv("FUSIONSEQ_CONFPATH"))) == NULL)
    return EXIT_FAILURE;

  cgiInit();
  cgiHeader("text/html");
  queryString = cgiGet2Post();
  if (queryString[0] == '\0') {
    puts ("<html>");
    puts ("<head>");
    html_printGenericStyleSheet (12);
    puts ("<title>geneFusions</title>\n");
    puts ("</head>");
    puts ("<body>");
    puts ("<h1>Identification of potential gene fusions using paired-end reads</h1><br><br>");
    printf ("<form action=%s/geneFusions_cgi method=get>", confp_get(Conf, "WEB_URL_CGI"));
    puts ("<b>Data prefix</b>:&nbsp;");
    puts ("<input type=text name=prefix>");
    puts ("<br><br><br>");
    puts ("<b>Minimum number of paired-end reads connecting two genes</b>:&nbsp;");
    puts ("<select name=minNum>");
    puts ("<option value=2>2");
    puts ("<option value=3>3");
    puts ("<option value=5 selected>5");
    puts ("<option value=10>10");
    puts ("</select>");
    puts ("<br><br><br>");
    puts ("<b>Type of gene fusion</b>:&nbsp;");
    puts ("<select name=type>");
    puts ("<option value=read-through>Read-through events");
    puts ("<option value=cis>Cis events");
    puts ("<option value=intra>Intra-chromosomal events");
    puts ("<option value=same>Genes on the same chromosome");
    puts ("<option value=inter>Genes on different chromosomes");
    puts ("<option value=all selected>All potential gene fusions");
    puts ("</select>");
    puts ("<br><br><br>");
    puts ("<input type=submit value=Submit>");
    puts ("<input type=reset value=Reset>");
    puts ("</form>");
    puts ("</body>");
    puts ("</html>");
    fflush (stdout);
  }
  else {
    int first;
    Stringa item = stringCreate (20);
    Stringa value = stringCreate (20);
    char *iPtr,*vPtr,*prefix,*type;
    int minNum;

    first = 1;
    cgiGetInit ();
    while (cgiGetNextPair (&first,item,value)) {
      iPtr = string (item);
      vPtr = string (value);
      if (strEqual (iPtr,"prefix")) {
	prefix = hlr_strdup (vPtr);
      }
      if (strEqual (iPtr,"type")) {
	type = hlr_strdup (vPtr);
      }
      if (strEqual (iPtr,"minNum")) {
	minNum = atoi (vPtr);
      }
    }
    generateOutput (prefix,type,minNum);
  }
  confp_close(Conf);

  return EXIT_SUCCESS;
}