Example #1
0
struct hTableInfo *bigBedToHti(char *table, struct sqlConnection *conn)
/* Get fields of bigBed into hti structure. */
{
/* Get columns in asObject format. */
char *fileName = bigBedFileName(table, conn);
struct bbiFile *bbi = bigBedFileOpen(fileName);
struct asObject *as = bigBedAsOrDefault(bbi);

/* Allocate hTableInfo structure and fill in info about bed fields. */
struct hash *colHash = asColumnHash(as);
struct hTableInfo *hti;
AllocVar(hti);
hti->rootName = cloneString(table);
hti->isPos= TRUE;
fillField(colHash, "chrom", hti->chromField);
fillField(colHash, "chromStart", hti->startField);
fillField(colHash, "chromEnd", hti->endField);
fillField(colHash, "name", hti->nameField);
fillField(colHash, "score", hti->scoreField);
fillField(colHash, "strand", hti->strandField);
fillField(colHash, "thickStart", hti->cdsStartField);
fillField(colHash, "thickEnd", hti->cdsEndField);
fillField(colHash, "blockCount", hti->countField);
fillField(colHash, "chromStarts", hti->startsField);
fillField(colHash, "blockSizes", hti->endsSizesField);
hti->hasCDS = (bbi->definedFieldCount >= 8);
hti->hasBlocks = (bbi->definedFieldCount >= 12);
char type[256];
safef(type, sizeof(type), "bed %d %c", bbi->definedFieldCount,
	(bbi->definedFieldCount == bbi->fieldCount ? '.' : '+'));
hti->type = cloneString(type);

freeMem(fileName);
hashFree(&colHash);
bbiFileClose(&bbi);
return hti;
}
Example #2
0
std::string InputForm::Run()
{
  for (int i = 0;i < choices;i++)
  {
    fillField();
    form_driver(form, REQ_NEXT_FIELD);
    form_driver(form, REQ_NEXT_FIELD);
    index++;
    index %= choices;
  }
  fillField();
  wrefresh(win);
  show_panel(panel);
  int ch;  
  bool exit = false;
  while (!exit && (ch = wgetch(stdscr)) != KEY_ESC)
  {	
    switch(ch)
    {
      case KEY_LEFT:
      case KEY_RIGHT:
        switchOkCancle();
        form_driver(form, (int)'0');
        form_driver(form, REQ_DEL_PREV);  
        break;
      case KEY_UP:
      case KEY_BTAB:
        index--;
        index = (index+choices)%choices;
        form_driver(form, REQ_PREV_FIELD);
        form_driver(form, REQ_PREV_FIELD);
        fillField();
        break;
      case KEY_DOWN:
      case KEY_TAB:  
        index++;
        index %= choices;
        form_driver(form, REQ_NEXT_FIELD);
        form_driver(form, REQ_NEXT_FIELD);
        fillField();
        break;
      case KEY_BACKSPACE:
        delAchar(); 	
        break;
      case KEY_NL:
        if (index == choices-1 || !okCancle)
        {
          exit = true;
        }
        else
        {
          index++;
          index %= choices;
          form_driver(form, REQ_NEXT_FIELD);
          form_driver(form, REQ_NEXT_FIELD);
          fillField();
        }
        break;
      default:
        if (itemTypes[index].compare("password") == 0) 
        {
          itemInputs[index].push_back(ch);
          form_driver(form, '*');
        }
        else if (itemTypes[index].compare("checklist") == 0)
        {
          if (ch == ' ')
          {
            if (itemInputs[index].compare("y") == 0)
            {
              itemInputs[index] = "n"; 
              fillCheckList(false);
            }
            else
            {
              itemInputs[index] = "y";
              fillCheckList(true);
            }
          }
        }
        else
        {
          itemInputs[index].push_back(ch);
          form_driver(form, ch);
        }
        break;
    }
    update_panels();
    doupdate();
  }
  hide_panel(panel);
  if (ch == KEY_ESC || !okCancle)
    return "cancle";
  else
    return makeCommand();
}