void WriteStdoutRamaOneModel(PMSD pmsdRoot, Int2 ModelNum ){ ValNodePtr vnpRama = NULL; PRS prsHead = NULL; PRS prsHere = NULL; float phi,psi; int num; Int4 linelen; Char aa[3]; Char ctemp[30]; Char chain[30]; PMGD pmgdAA = NULL; CharPtr NCBIstdaaUC = "-ABCDEFGHIKLMNPQRSTVWXYZU*"; vnpRama=ConvertNode((PFB)pmsdRoot,AM_MGD); if (vnpRama==NULL) return; prsHead=Rama(vnpRama,ModelNum); prsHere=prsHead; while(prsHere) { phi = 0.0; psi = 0.0; phi=(float)prsHere->Phi; psi=(float)prsHere->Psi; pmgdAA = (PMGD) prsHere->pfbThis; num = (int) (pmgdAA->pdnmgLink->choice); StringCpy(ctemp, StringChr(NCBIstdaaUC,pmgdAA->pcIUPAC[0])); StringCpy(chain, ParentMolName((PFB) pmgdAA)); aa[0] = ctemp[0]; aa[1] = '\0'; printf("%s, %s, %d, %f, %f\n", chain, aa , (int) num, phi,psi); prsHere=prsHere->next; } freeRS(prsHead); return; }
void TA_LELAdd(LexEntry *le, char *features, int maxlen, /* RESULTS */ LexEntry **le_le, char **le_feat, int *le_len) { int i, len; char buf[FEATLEN]; len = *le_len; if (!StringIn(F_VERB, features)) { /* This condition allows "Qui a peint Le Déjeuner sur l herbe?" to parse. * But is collapsing needed for verbs for other reasons? * It would be nice to collapse verbs to reduce number of parses, but we * can't reduce them because tense (and the resulting aspect) * information is significant. */ for (i = 0; i < len; i++) { if (le == le_le[i]) { StringIntersect(le_feat[i], features, buf); StringCpy(le_feat[i], buf, FEATLEN); return; } } } if (len < maxlen) { le_le[len] = le; le_feat[len] = MemAlloc(FEATLEN, "char TA_LELAdd"); StringCpy(le_feat[len], features, FEATLEN); len++; *le_len = len; } else { Dbg(DBGGEN, DBGBAD, "TA_LELAdd: increase maxlen <%s.%s>", le->srcphrase, le->features); } }
void TsToStringDate(Ts *ts, int show_nonspecific, int maxlen, /* RESULTS */ char *out) { struct tm *tms; *out = TERM; if (ts->flag & TSFLAG_TOD) { TodToString((Tod)ts->unixts, maxlen, out); } else if (ts->flag & TSFLAG_DUR) { DurToString((Tod)ts->unixts, maxlen, out); } else if (ts->unixts == UNIXTSNA) { if (show_nonspecific) StringCpy(out, "na", maxlen); } else if (ts->unixts == UNIXTSNEGINF) { if (show_nonspecific) StringCpy(out, "-Inf", maxlen); } else if (ts->unixts == UNIXTSPOSINF) { if (show_nonspecific) StringCpy(out, "Inf", maxlen); } else { if (NULL == (tms = localtime(&ts->unixts))) { StringCpy(out, "error", maxlen); } else { sprintf(out, "%.4d%.2d%.2d", 1900+tms->tm_year, tms->tm_mon+1, tms->tm_mday); } } if (ts->cx != ContextRoot) { ContextNameToString(ts->cx, StringEndOf(out)); } }
/* Returns a concatenation of all stack contents */ CharPtr SLRI_SSGetWholeString(SLRI_SStackPtr ssp) { SLRI_SStackItemPtr ssipCurr = NULL; CharPtr wholeString = NULL; if (ssp == NULL) { ErrPostEx(SEV_ERROR, 0, 0, "SLRI_SSGetWholeString: stack pointer is NULL"); return(NULL); } if (SLRI_SSIsEmpty(ssp)) { return(NULL); } wholeString = MemNew((ssp->totalStackSize + 1) * sizeof(Char)); /* Initialize wholeString with first item */ StringCpy(wholeString, ssp->bottom->string); /* Cycle through rest of stack to get remaining items */ ssipCurr = ssp->bottom->next; while (ssipCurr != NULL) { StringCat(wholeString, ssipCurr->string); ssipCurr = ssipCurr->next; } return(wholeString); }
WordFormRule *WordFormGetRules(char *suffix1, char *lefeat1) { char index[PHRASELEN]; StringCpy(index, suffix1, PHRASELEN); StringCat(index, lefeat1, PHRASELEN); return((WordFormRule *)HashTableGet(WordFormHt, index)); }
static void RecordThesis (ScanDataPtr sdp, CharPtr str) { StringSetPtr ssp; ValNodePtr vnp; if (sdp == NULL || StringHasNoText (str)) return; for (vnp = sdp->lcList; vnp != NULL; vnp = vnp->next) { ssp = (StringSetPtr) vnp->data.ptrvalue; if (ssp == NULL) continue; if (StringCmp (ssp->text, str) == 0) { (ssp->count)++; return; } } ssp = MemNew (sizeof (StringSet)); if (ssp == NULL) return; StringCpy (ssp->firstID, sdp->buf); StringNCpy_0 (ssp->text, str, sizeof (ssp->text)); ssp->count = 1; ValNodeAddPointer (&(sdp->lcList), 0, (Pointer) ssp); }
Int2 Nlm_Main(void) { Boolean use_new_engine=FALSE; char buf[256] = { '\0' }; StringCpy(buf, "mgblast "); StringNCat(buf, BlastGetVersionNumber(), sizeof(buf)-StringLen(buf)-1); if (! GetArgs (buf, NUMARG, myargs)) return (1); UseLocalAsnloadDataAndErrMsg (); if (! SeqEntryLoad()) return 1; ErrSetMessageLevel(SEV_WARNING); /* if (myargs[ARG_FORCE_OLD].intvalue == 0 && myargs[ARG_OUTTYPE].intvalue > 1 && myargs[ARG_GILIST].strvalue == NULL) use_new_engine = readdb_use_new_blast(myargs[ARG_DB].strvalue); if (myargs[ARG_MASKEDQUERY].strvalue) use_new_engine = FALSE; */ /*if (use_new_engine) return Main_new(); else */ return Main_old(); }
/*---------------- replace original seq_id by local_id --------------*/ void AssignLocaIdToBiostruc(SeqIdPtr sip, Char *PDBName, Char Chain,BiostrucPtr bsp) { BiostrucDescrPtr pbsdrThis = NULL; MoleculeGraphPtr pmgThis = NULL; BiomolDescrPtr pbmdrThis = NULL; Char ThisPDBName[Local_max], *ThisChain; StringCpy(ThisPDBName, PDBNAME_DEFAULT); pbsdrThis = ValNodeFindNext(bsp->descr, NULL, BiostrucDescr_name); if(pbsdrThis) StringNCpy(ThisPDBName, pbsdrThis ->data.ptrvalue, 4); /*if(StringCmp(PDBName, ThisPDBName) != 0) { printf("Something is wrong!\n"); return; } */ pmgThis = bsp->chemical_graph->molecule_graphs; while(pmgThis) { /* loop over molecule_graphs to match chain */ pbmdrThis = ValNodeFindNext(pmgThis->descr, NULL, BiomolDescr_name); if(pbmdrThis){ ThisChain = StringSave((CharPtr)pbmdrThis->data.ptrvalue); } else ThisChain = StringSave(STRING_UNK_MOL); if(Chain == *ThisChain) { pmgThis->seq_id = sip; return; } pmgThis = pmgThis->next; } }
Int2 Main (void) { Char buf[256] = { '\0' }; /* Used below for name and version. */ Int2 status = 0; /* return value of function. */ StringCpy(buf, "bl2seq "); StringNCat(buf, BlastGetVersionNumber(), sizeof(buf)-StringLen(buf)-1); if (! GetArgs (buf, NUMARG, myargs)) { return (1); } UseLocalAsnloadDataAndErrMsg (); if (! SeqEntryLoad()) return 1; ErrSetMessageLevel(SEV_WARNING); if (myargs[ARG_FORCE_OLD].intvalue != 0) status = Main_old(); else status = Main_new(); FreeArgs(NUMARG, myargs); return status; }
void DurToString(Dur dur, int maxlen, /* RESULTS */ char *r) { if (dur == TODNA) { StringCpy(r, "na", maxlen); } else { sprintf(r, "%ldsec", dur); } }
/******************************************************************************* Function : DDV_StartMainWin_Master() Purpose : start DDV main window as a standalone application. Never use this function for other purpose. If you want to start DDV as a slave, take a look at the functions below. Parameters : mWin_d; main program data ldp; logo data Return value : handle to the DDV main window *******************************************************************************/ static WindoW DDV_StartMainWin_Master(DdvMainWinPtr mWin_d,UDVLogoDataPtr ldp) { Int2 Margins; WindoW w; Boolean bRet; /*main window*/ Margins=10*stdCharWidth; w=DocumentWindow(Margins,Margins ,-10,-10, szAppName, DDV_WinMainProgQuit, DDV_WinMainResize); if (w==NULL){ Message (MSG_ERROR, "Viewer creation failed."); return(NULL); } SetObjectExtra (w, (Pointer)mWin_d, (FreeProc)DDV_WinMainCleanup); SetAppProperty("UDVLogoData",(Pointer)ldp); mWin_d->hWndMain=w; /*this is an autonomous viewer*/ mWin_d->AutonomeViewer=TRUE; /*use the Network ?*/ mWin_d->UseNetwork=TRUE;/*DDV_UseNetwork();*/ bRet=DDV_CreateViewerPanel(w,mWin_d,NULL,FALSE); /*FALSE for viewer */ if (!bRet) return(NULL); /*init logo_panel*/ LogoFontCreate(&ldp->f1,&ldp->f2,&ldp->f3); StringCpy(ldp->szTitle,"DDV"); StringCpy(ldp->szDesc,", a MSA viewer/editor"); mWin_d->Show_logo=TRUE; /*set the function to get a gi over the network*/ mWin_d->fetchSepProc=(UdvFetchSeqEntryProc)EntrezSeqEntryGet; mWin_d->NetCfgMenuProc=DDV_ConfigNetwork; mWin_d->NetStartProc=DDV_StartEntrez; return(w); }
void TranslatePunc(char *tgt, char *src, int srclang, int tgtlang) { StringCpy(tgt, src, PUNCLEN); if (srclang == F_ENGLISH && tgtlang == F_FRENCH) { StringMap(tgt, PUNCT_ENGLISH, PUNCT_FRENCH); } else if (srclang == F_FRENCH && tgtlang == F_ENGLISH) { StringMap(tgt, PUNCT_FRENCH, PUNCT_ENGLISH); } }
/************************************************************************** * MakePromptVal() **************************************************************************/ static CharPtr /*FCN*/MakePromptVal ( void ){ StringCpy ( promptVal, "Current style: " ); StringCat ( promptVal, Nlm_GetMuskStyleName(Nlm_GetMuskCurrentSt()) ); promptVal[40] = 0; return &(promptVal[0]); } /* End of MakePromptVal() */
BiostrucAnnotSetPtr LIBCALL VASTBsAnnotSetGet (Int4 uid) { AsnIoPtr aip = NULL; AsnTypePtr atp = NULL; Char path[PATH_MAX]; Char compath[PATH_MAX]; Char tempfile[PATH_MAX]; Char pcId[20]; Int2 iFileExists = 0; BiostrucAnnotSetPtr pbsa = NULL; int iAvail = 1; FILE *pipe; sprintf(pcId, "%ld", (long) uid); path[0] = '\0'; StringCpy(path, database); StringCat(path, pcId); StringCat(path, ".bas"); #ifdef MMDB_UNIXCOMPRESSED compath[0] = '\0'; sprintf(compath, "%s -d -c %s.gz ", gunzip, path); pipe = popen(compath, "rb"); if (pipe == NULL) { ErrPostEx(SEV_FATAL,0,0, "VASTBsAnnotSetGet failed: Can't find gunzip in path.\n"); return NULL; } aip = AsnIoNew(ASNIO_BIN_IN, pipe, NULL, NULL, NULL); #else iFileExists = FileLength(path); if (iFileExists == 0) { return NULL; } aip = AsnIoOpen(path, "rb"); #endif if (aip) { pbsa = BiostrucAnnotSetAsnRead(aip, NULL); AsnIoClose (aip); } #ifdef MMDB_UNIXCOMPRESSED pclose(pipe); #endif if (!pbsa) return NULL; return pbsa; }
Dur DurParseA(char *s) { char tok[DWORDLEN], *stem; if (streq(s, "na")) return(DURNA); if (NULL == (stem = NumberStem(s))) { Dbg(DBGGEN, DBGBAD, "DurParseA: trouble parsing <%s>", s); return(DURERR); } StringCpy(tok, s, DWORDLEN); tok[stem-s] = TERM; return(DurParse(tok, stem)); }
void TodToString(Tod tod, int maxlen, /* RESULTS */ char *r) { long hour, min, sec; if (tod == TODNA) { StringCpy(r, "na", maxlen); } else { hour = tod / 3600; min = (tod - 3600*hour)/60; sec = tod % 60; sprintf(r, "%.2ld%.2ld%.2ld", hour, min, sec); } }
/***************************************************************************** * * opens a file and reads SeqEntrys * calls ProcessSeqEntry to do the actual work on it * *****************************************************************************/ static void ProcessFile (FileListPtr flp, CharPtr root, CharPtr outputfile) { CASN_Handle casnh; FILE *fp; Char path [PATH_MAX]; SeqEntryPtr sep; CASN_Type type; Char buf[40]; Int4 ctr = 0; if (flp != NULL) { fp = FileOpen (outputfile, "a"); if (fp != NULL) { if (pmon != NULL) { sprintf(path, "Opening [%s]", flp->fname); MonitorStrValue(pmon, path); } StringCpy (path, root); FileBuildPath (path, flp->fdir, NULL); FileBuildPath (path, NULL, flp->fname); if ((casnh = CASN_Open (path)) != NULL) { if (! is_na) { type = CASN_Type_aa; } else { type = CASN_Type_nt; } if (CASN_DocType (casnh) == type) { while ((sep = CASN_NextSeqEntry (casnh)) != NULL) { if (pmon != NULL) { ctr++; sprintf(buf, "Processing %s Entry %ld", flp->fname,(long)ctr); MonitorStrValue(pmon, buf); } ProcessSeqEntry (sep, fp); SeqEntryFree (sep); } } CASN_Close (casnh); } else Message(MSG_ERROR, "Can't open [%s]", path); FileClose (fp); } else { Message (MSG_FATAL, "Unable to reopen output file [%s]", outputfile); } } }
static void DoVisitCodingRegions ( SeqFeatPtr sfp, Pointer userdata ) { BioseqPtr bsp; CharPtr caret5, caret3; CSpeedFlagPtr cfp; Char id [64]; SeqLocPtr loc, slp; Boolean partial5, partial3; SeqIdPtr sip; Int4 start, stop; if (sfp == NULL || sfp->data.choice != SEQFEAT_CDREGION) return; cfp = (CSpeedFlagPtr) userdata; if (cfp == NULL || cfp->ofp == NULL) return; loc = sfp->location; bsp = BioseqFindFromSeqLoc (loc); if (bsp == NULL) return; StringCpy (id, "?"); if (sfp->product != NULL) { sip = SeqLocId (sfp->product); if (sip != NULL) { SeqIdWrite (sip, id, PRINTID_FASTA_SHORT, sizeof (id) - 1); } } fprintf (cfp->ofp, "%s\n", id); slp = SeqLocFindNext (loc, NULL); while (slp != NULL) { start = GetOffsetInBioseq (slp, bsp, SEQLOC_START) + 1; stop = GetOffsetInBioseq (slp, bsp, SEQLOC_STOP) + 1; caret5 = ""; caret3 = ""; CheckSeqLocForPartial (slp, &partial5, &partial3); if (partial5) { caret5 = "<"; } if (partial3) { caret3 = ">"; } fprintf (cfp->ofp, "%s%ld\t%s%ld\n", caret5, (long) start, caret3, (long) stop); slp = SeqLocFindNext (loc, slp); } }
Bool WordFormUnderstand1(LexEntry *le, char *suffix, int stemlen) { int maxcount; Obj *maxcon; char word2[PHRASELEN], feat[PHRASELEN], *maxlinkfeat1, *maxlefeat1; WordFormRule *wfr, *maxwfr; IndexEntry *ie; LexEntryToObj *leo; maxcount = INTNEGINF; maxcon = NULL; maxlinkfeat1 = maxlefeat1 = NULL; maxwfr = NULL; memcpy(word2, le->srcphrase, stemlen); for (wfr = WordFormGetRules(suffix, le->features); wfr; wfr = wfr->next) { word2[stemlen] = TERM; StringCat(word2, wfr->suffix2, PHRASELEN); for (ie = IndexEntryGet(word2, LexEntryLangHt(wfr->lefeat2)); ie; ie = ie->next) { if (!FeatureCompatLexEntry(ie->lexentry->features, wfr->lefeat2)) { continue; } for (leo = ie->lexentry->leo; leo; leo = leo->next) { if (!WordFormLinkIsCompat(leo->features, wfr->linkfeat2)) continue; if (wfr->count > maxcount) { maxwfr = wfr; maxcount = wfr->count; maxcon = leo->obj; maxlinkfeat1 = wfr->linkfeat1; maxlefeat1 = wfr->lefeat1; } } } } if (maxcount > WORDFORM_COUNT_THRESH) { Dbg(DBGLEX, DBGDETAIL, "%d %s.%s%s -> %s.%s%s", maxwfr->count, maxwfr->suffix2, maxwfr->linkfeat2, maxwfr->lefeat2, maxwfr->suffix1, maxwfr->linkfeat1, maxwfr->lefeat1); Dbg(DBGLEX, DBGDETAIL, "====%s//%s.%s%s/", M(maxcon), le->srcphrase, maxlinkfeat1, le->features); StringCpy(feat, maxlinkfeat1, FEATLEN); StringCat(feat, maxlefeat1, FEATLEN); LexEntryLinkToObj(le, maxcon, feat, LexEntryLangHt(le->features), NULL, 0, NULL, NULL, NULL); return(1); } return(0); }
VOID MainMenuSelect(HWND hWnd, INT ID, INT Flags) { TCHAR Buffer[1024]; if (Flags & MF_POPUP || Flags == 0xFFFF) ID = 0; if ((ID >= ID_TOOLS_TOOL1) && (ID <= ID_TOOLS_TOOL10)) StringCpy(Buffer,ToolGetHelp(ID-ID_TOOLS_TOOL1)); else if (ID == 0 || !LoadString(hThisInstance, ID, Buffer, sizeof(Buffer))) Buffer[0] = 0; SetStatusBar(Buffer); }
/* Adds a space at the end of a string, ALLOCATES DYNAMIC MEMORY FOR THE RETURN STRING */ CharPtr LIBCALL PadString(CharPtr string) { CharPtr newstr = NULL; newstr = MemNew(strlen(string) + 2); if (newstr == NULL) { ErrPostEx(SEV_ERROR,0,0, "PadString: Failed to allocate memory."); return NULL; } StringCpy(newstr, string); newstr[strlen(string)] = ' '; newstr[strlen(string) + 1] = '\0'; return newstr; }
NLM_EXTERN Boolean get_synonym(ValNodePtr head, CharPtr syn) { if(head == NULL) return FALSE; StringCpy(syn, head->data.ptrvalue); head = head->next; while(head){ StringCat(syn, " "); StringCat(syn, head->data.ptrvalue); head = head->next; } return TRUE; }
static void DoReleaseFile (CharPtr inputFile, Boolean binary, Boolean compressed, FILE *fp, AsnIoPtr aop, AsnTypePtr atp_se) { ScanData sd; StringSetPtr ssp; ValNodePtr vnp; fprintf (fp, "\n***** %s *****\n\n", inputFile); sd.fp = fp; sd.aop = aop; sd.atp_se = atp_se; StringCpy (sd.buf, "?"); sd.bulk = FALSE; sd.cgList = NULL; sd.lcList = NULL; sd.impCdsCount = 0; sd.recordCount = 0; ScanBioseqSetRelease (inputFile, binary, compressed, (Pointer) &sd, DoRecord); for (vnp = sd.cgList; vnp != NULL; vnp = vnp->next) { ssp = (StringSetPtr) vnp->data.ptrvalue; if (ssp == NULL) continue; fprintf (sd.fp, "CG - %s (%ld) - %s\n", ssp->firstID, (long) ssp->count, ssp->text); } for (vnp = sd.lcList; vnp != NULL; vnp = vnp->next) { ssp = (StringSetPtr) vnp->data.ptrvalue; if (ssp == NULL) continue; fprintf (sd.fp, "LC - %s (%ld) - %s\n", ssp->firstID, (long) ssp->count, ssp->text); } if (sd.impCdsCount != 0) { fprintf (sd.fp, "IC - (%ld)\n", (long) sd.impCdsCount); } sd.cgList = ValNodeFreeData (sd.cgList); sd.lcList = ValNodeFreeData (sd.lcList); fprintf (fp, "\n\n!!!!! %s - %ld records !!!!!\n\n", inputFile, (long) sd.recordCount); }
Int2 Main() { static Char pcUname[2000]=""; /* Arg -l to keep the log file */ Int2 retval = 0; #ifdef OS_UNIX struct utsname utsbuf; #endif #define NUMARGS 1 static Nlm_Arg myargs[NUMARGS] = { /*0*/ { "Keep error.log file?", "F", NULL, NULL, TRUE, 'l', ARG_BOOLEAN, 0.0, 0, NULL} }; if ( !Nlm_GetArgs("Benchtraj", NUMARGS, myargs) ) return 1; ErrSetOptFlags(EO_SHOW_SEVERITY|EO_SHOW_CODES|EO_LOG_FILELINE|EO_SHOW_USERSTR|EO_SHOW_ERRTEXT|EO_BEEP|EO_WAIT_KEY|EO_LOGTO_USRFILE); #ifdef OS_UNIX /* use uname to get sysinfo */ if (uname(&utsbuf)>=0) { sprintf(pcUname,"%s %s %s %s %s\n",utsbuf.sysname,utsbuf.nodename,utsbuf.release,utsbuf.version,utsbuf.machine); } #else #ifdef OS_MSWIN /* assume ver is available */ if (GetMSWinVerInfo(pcUname)!=ERR_SUCCESS) { StringCpy(pcUname,"Not Available\n"); } #endif #endif printf("OS Reported:\n%s\n",pcUname); retval = TRADESBenchmark(); if (!myargs[0].intvalue) FileRemove("error.log"); return retval; }
ObjToLexEntry *WordFormGenerate1(LexEntry *le, char *suffix1, char *linkfeat1, char *lefeat2, char *linkfeat2, int stemlen, Obj *con) { int maxcount; char word2[PHRASELEN], feat[FEATLEN]; WordFormRule *wfr, *maxwfr; HashTable *ht; LexEntry *new_le; maxcount = INTNEGINF; maxwfr = NULL; for (wfr = WordFormGetRules(suffix1, le->features); wfr; wfr = wfr->next) { if (!FeatureCompatLexEntry(lefeat2, wfr->lefeat2)) continue; if (!WordFormLinkIsCompat(linkfeat1, wfr->linkfeat1)) continue; if (!WordFormLinkIsCompat(linkfeat2, wfr->linkfeat2)) continue; if (wfr->count > maxcount) { maxcount = wfr->count; maxwfr = wfr; } } if (maxwfr && (maxcount > WORDFORM_COUNT_THRESH)) { memcpy(word2, le->srcphrase, stemlen); word2[stemlen] = TERM; StringCat(word2, maxwfr->suffix2, PHRASELEN); Dbg(DBGLEX, DBGDETAIL, "rule <%d> <%s>.<%s><%s> -> <%s>.<%s><%s>", maxwfr->count, maxwfr->suffix1, maxwfr->linkfeat1, maxwfr->lefeat1, maxwfr->suffix2, maxwfr->linkfeat2, maxwfr->lefeat2); Dbg(DBGLEX, DBGDETAIL, "suggest new word ====%s//%s.%s%s/", M(con), word2, maxwfr->linkfeat2, maxwfr->lefeat2); ht = LexEntryLangHt(maxwfr->lefeat2); new_le = LexEntryNewWord(word2, maxwfr->lefeat2, con, ht); StringCpy(feat, maxwfr->linkfeat2, FEATLEN); StringCat(feat, maxwfr->lefeat2, FEATLEN); return(LexEntryLinkToObj(new_le, con, feat, ht, NULL, 0, NULL, NULL, NULL)); } return(NULL); }
void WordFormRuleAdd(char *suffix1, char *lefeat1, char *linkfeat1, char *suffix2, char *lefeat2, char *linkfeat2, LexEntry *le1, LexEntry *le2) { char index[PHRASELEN]; WordFormRule *wfr; wfr = CREATE(WordFormRule); wfr->count = 1; wfr->suffix1 = suffix1; wfr->lefeat1 = lefeat1; wfr->linkfeat1 = linkfeat1; wfr->suffix2 = suffix2; wfr->lefeat2 = lefeat2; wfr->linkfeat2 = linkfeat2; StringCpy(index, suffix1, PHRASELEN); StringCat(index, lefeat1, PHRASELEN); wfr->example1 = le1; wfr->example2 = le2; wfr->next = (WordFormRule *)HashTableGet(WordFormHt, index); HashTableSetDup(WordFormHt, index, wfr); }
static SeqIdReplaceListPtr SeqIdReplaceListNew (ValNodePtr id_list) { SeqIdReplaceListPtr replace_list; SeqIdPairPtr pair; Int4 i; replace_list = (SeqIdReplaceListPtr) MemNew (sizeof (SeqIdReplaceListData)); replace_list->num_ids = ValNodeLen (id_list); replace_list->list = (SeqIdPairPtr) MemNew (sizeof (SeqIdPairData) * replace_list->num_ids); for (i = 0; id_list != NULL; id_list = id_list->next, i++) { pair = (SeqIdPairPtr) id_list->data.ptrvalue; replace_list->list[i].sip_find = SeqIdDup (pair->sip_find); StringCpy (replace_list->list[i].buf_find, pair->buf_find); replace_list->list[i].sip_replace = SeqIdDup (pair->sip_replace); replace_list->list[i].is_complement = pair->is_complement; replace_list->list[i].trim5 = pair->trim5; replace_list->list[i].trim3 = pair->trim3; replace_list->list[i].is_consensus = pair->is_consensus; replace_list->list[i].ti = pair->ti; } return replace_list; }
/***************************************************************************** * * Nlm_DayTimeStr(buf, date, time) * fills buffer with formatted date and/or time * date requires a 13 character buffer * time requeres a 10 character buffer * data and time takes 23 * * eg. "Jan 28, 1988 12:59 PM" * *****************************************************************************/ NLM_EXTERN Nlm_Boolean LIBCALL Nlm_DayTimeStr (Nlm_CharPtr buf, Nlm_Boolean nlm_date, Nlm_Boolean nlm_time) { Nlm_DayTime dt; char localbuf[30]; int pm; buf[0] = '\0'; if ( ! Nlm_GetDayTime(&dt)) return FALSE; if (nlm_date) { sprintf (localbuf, "%s %d, %d", NCBI_months [dt.tm_mon], dt.tm_mday, dt.tm_year + 1900); StringCpy (buf, localbuf); } if (nlm_time) { pm = 1; if (dt.tm_hour == 0) { dt.tm_hour = 12; pm = 0; } else if (dt.tm_hour < 12) pm = 0; else if (dt.tm_hour > 12) dt.tm_hour -= 12; sprintf (localbuf, "%3d:%2d %s", dt.tm_hour, dt.tm_min, ampm[pm]); if (dt.tm_min < 10) localbuf[4] = '0'; StringCat (buf, localbuf); } return TRUE; }
Boolean LIBCALL IsVASTData(Int4 uid) { AsnIoPtr aip = NULL; AsnTypePtr atp = NULL; Char path[PATH_MAX]; Char pcId[30]; sprintf(pcId, "%ld", (long) uid); path[0] = '\0'; StringCpy(path, database); StringCat(path, pcId); StringCat(path, ".bas"); #ifdef MMDB_UNIXCOMPRESSED StringCat(path, ".gz"); if (FileLength(path) != 0) return TRUE; #else if (FileLength(path) != 0) return TRUE; #endif return FALSE; }
/*---------------------------------------------------------*/ void LIBCALL Cn3D_CountDomainProc(void) { Int4 iCount = 0; Int4 idom = 0; Int4 iCountStruc = 0, iCountChain = 0; PDNMS pdnmsMaster = NULL, pdnmsSlave = NULL; PMSD pmsdMaster = NULL, pmsdSlave = NULL; PDNMM pdnmmHead = NULL; PMMD pmmdThis = NULL; PDNMG pdnmg = NULL; PMGD pmgd = NULL; Boolean EncounterZeroDomain = FALSE; pdnmsMaster = GetSelectedModelstruc(); if (pdnmsMaster == NULL) return; if (pdnmsMaster != NULL) { pmsdMaster = (PMSD) pdnmsMaster->data.ptrvalue; pdnmmHead = pmsdMaster->pdnmmHead; while (pdnmmHead) { pmmdThis = pdnmmHead->data.ptrvalue; if (pmmdThis) { if (pmmdThis->bWhat != (Byte) AM_PROT && pmmdThis->bWhat != (Byte) AM_RNA && pmmdThis->bWhat != (Byte) AM_DNA) goto pre_setout1; idom = 0; EncounterZeroDomain = FALSE; for (pdnmg = pmmdThis->pdnmgHead; pdnmg != NULL; pdnmg = pdnmg->next) { pmgd = (PMGD) pdnmg->data.ptrvalue; if (!EncounterZeroDomain) { if (pmgd->iDomain == 0) { iCount++; EncounterZeroDomain = TRUE; } } if (pmgd->iDomain > idom) { idom = (Int4) pmgd->iDomain; iCount++; } } } pre_setout1: pdnmmHead = pdnmmHead->next; } pdnmsSlave = pmsdMaster->pdnmsSlaves; while (pdnmsSlave) { pmsdSlave = (PMSD) pdnmsSlave->data.ptrvalue; pdnmmHead = pmsdSlave->pdnmmHead; while (pdnmmHead) { pmmdThis = pdnmmHead->data.ptrvalue; if (pmmdThis) { if (pmmdThis->bWhat != (Byte) AM_PROT && pmmdThis->bWhat != (Byte) AM_RNA && pmmdThis->bWhat != (Byte) AM_DNA) goto pre_setout2; idom = 0; EncounterZeroDomain = FALSE; for (pdnmg = pmmdThis->pdnmgHead; pdnmg != NULL; pdnmg = pdnmg->next) { pmgd = (PMGD) pdnmg->data.ptrvalue; if (!EncounterZeroDomain) { if (pmgd->iDomain == 0) { iCount++; EncounterZeroDomain = TRUE; } } pmgd = (PMGD) pdnmg->data.ptrvalue; if (pmgd->iDomain > idom) { idom = (Int4) pmgd->iDomain; iCount++; } } } pre_setout2: pdnmmHead = pdnmmHead->next; } pdnmsSlave = pdnmsSlave->next; } } iDomainCount = iCount; /* to allocate memory for domaindata */ domaindata = (Pointer) MemNew((size_t) (iDomainCount * sizeof(Pointer))); for (iCount = 0; iCount < iDomainCount; iCount++) { domaindata[iCount] = (DomainInfoPtr) MemNew(sizeof(DomainInfo)); } /* to load pdbname, chain id, domain id into domaindata */ iCount = 0; iCountStruc = 0; iCountChain = 0; pdnmsMaster = GetSelectedModelstruc(); if (pdnmsMaster != NULL) { pmsdMaster = (PMSD) pdnmsMaster->data.ptrvalue; pdnmmHead = pmsdMaster->pdnmmHead; while (pdnmmHead) { pmmdThis = pdnmmHead->data.ptrvalue; if (pmmdThis) { if (pmmdThis->bWhat != (Byte) AM_PROT && pmmdThis->bWhat != (Byte) AM_RNA && pmmdThis->bWhat != (Byte) AM_DNA) goto setout1; Cn3D_SetVisible(Cn3D_ColorData.pDDVColorGlobal, pmmdThis, TRUE); idom = 0; EncounterZeroDomain = FALSE; for (pdnmg = pmmdThis->pdnmgHead; pdnmg != NULL; pdnmg = pdnmg->next) { pmgd = (PMGD) pdnmg->data.ptrvalue; if (!EncounterZeroDomain) { if (pmgd->iDomain == 0) { StringCpy(domaindata[iCount]->pcPDBName, pmsdMaster->pcPDBName); StringCpy(domaindata[iCount]->pcMolName, pmmdThis->pcMolName); domaindata[iCount]->iDomain = 0; domaindata[iCount]->iStrucIndex = iCountStruc; domaindata[iCount]->iChainIndex = iCountChain; domaindata[iCount]->bVisible = TRUE; domaindata[iCount]->bVisibleParent = TRUE; iCount++; EncounterZeroDomain = TRUE; } } if (pmgd->iDomain > idom) { idom = (Int4) pmgd->iDomain; StringCpy(domaindata[iCount]->pcPDBName, pmsdMaster->pcPDBName); StringCpy(domaindata[iCount]->pcMolName, pmmdThis->pcMolName); domaindata[iCount]->iDomain = pmgd->iDomain; domaindata[iCount]->iStrucIndex = iCountStruc; domaindata[iCount]->iChainIndex = iCountChain; domaindata[iCount]->bVisible = TRUE; domaindata[iCount]->bVisibleParent = TRUE; iCount++; } } iCountChain++; } setout1: pdnmmHead = pdnmmHead->next; } iCountStruc++; pdnmsSlave = pmsdMaster->pdnmsSlaves; while (pdnmsSlave) { pmsdSlave = (PMSD) pdnmsSlave->data.ptrvalue; pdnmmHead = pmsdSlave->pdnmmHead; while (pdnmmHead) { pmmdThis = pdnmmHead->data.ptrvalue; if (pmmdThis) { if (pmmdThis->bWhat != (Byte) AM_PROT && pmmdThis->bWhat != (Byte) AM_RNA && pmmdThis->bWhat != (Byte) AM_DNA) goto setout2; idom = 0; EncounterZeroDomain = FALSE; for (pdnmg = pmmdThis->pdnmgHead; pdnmg != NULL; pdnmg = pdnmg->next) { pmgd = (PMGD) pdnmg->data.ptrvalue; if (!EncounterZeroDomain) { if (pmgd->iDomain == 0) { StringCpy(domaindata[iCount]->pcPDBName, pmsdSlave->pcPDBName); StringCpy(domaindata[iCount]->pcMolName, pmmdThis->pcMolName); domaindata[iCount]->iDomain = 0; domaindata[iCount]->iStrucIndex = iCountStruc; domaindata[iCount]->iChainIndex = iCountChain; domaindata[iCount]->bVisible = TRUE; domaindata[iCount]->bVisibleParent = TRUE; iCount++; EncounterZeroDomain = TRUE; } } if (pmgd->iDomain > idom) { idom = (Int4) pmgd->iDomain; StringCpy(domaindata[iCount]->pcPDBName, pmsdSlave->pcPDBName); StringCpy(domaindata[iCount]->pcMolName, pmmdThis->pcMolName); domaindata[iCount]->iDomain = pmgd->iDomain; domaindata[iCount]->iStrucIndex = iCountStruc; domaindata[iCount]->iChainIndex = iCountChain; domaindata[iCount]->bVisible = TRUE; domaindata[iCount]->bVisibleParent = TRUE; iCount++; } /* if(pmgd->bReserved && !domaindata[iCount - 1]->bAligned) domaindata[iCount - 1]->bAligned = TRUE; */ } iCountChain++; } setout2: pdnmmHead = pdnmmHead->next; } iCountStruc++; pdnmsSlave = pdnmsSlave->next; } } if (pmsdMaster->iMimeType == NcbiMimeAsn1_strucseqs) { AssignDomainAlignedStatusForStrucSeqs(); } else AssignDomainAlignedStatus(); }