📄 sequence_set.cpp
字号:
if (!registers) throw "can't allocate registers"; patternBuffer->regs_allocated = REGS_UNALLOCATED; } // update pattern buffer if not the same pattern as before static string previousPrositePattern; static int nGroups; int i; if (prositePattern != previousPrositePattern) { // convert from ProSite syntax string regexPattern; if (!Prosite2Regex(prositePattern, ®exPattern, &nGroups)) throw "error converting ProSite to regex syntax"; // create pattern buffer TRACEMSG("compiling pattern '" << regexPattern << "'"); const char *error = re_compile_pattern(regexPattern.c_str(), regexPattern.size(), patternBuffer); if (error) throw error; // optimize pattern buffer int err = re_compile_fastmap(patternBuffer); if (err) throw "re_compile_fastmap internal error"; previousPrositePattern = prositePattern; } // do the search, finding all non-overlapping matches int start = 0; while (start < Length()) { int result = re_search(patternBuffer, sequenceString.c_str(), Length(), start, Length(), registers); if (result == -1) break; else if (result == -2) throw "re_search internal error"; // re_search gives the longest hit, but we want the shortest; so try to find the // shortest hit within the hit already found by limiting the length of the string // allowed to be included in the search. (This isn't very efficient! but // the regex API doesn't have an option for finding the shortest hit...) int stringSize = start + 1; while (stringSize <= Length()) { result = re_search(patternBuffer, sequenceString.c_str(), stringSize, start, stringSize, registers); if (result >= 0) break; ++stringSize; } // parse the match registers, highlight ranges// TESTMSG("found match starting at " << identifier->ToString() << " loc " << result+1); int lastMatched = result; for (i=1; i<registers->num_regs; ++i) { int from = registers->start[i], to = registers->end[i] - 1; if (from >= 0 && to >= 0) { if (to > lastMatched) lastMatched = to; // highlight this ranage// TESTMSG("register " << i << ": from " << from+1 << " to " << to+1); GlobalMessenger()->AddHighlights(this, from, to); } } start = lastMatched + 1; } } catch (const char *err) { ERRORMSG("Sequence::HighlightPattern() - " << err); retval = false; } // cleanup re_set_syntax(oldSyntax); return retval;}END_SCOPE(Cn3D)/** ---------------------------------------------------------------------------* $Log: sequence_set.cpp,v $* Revision 1000.4 2004/06/01 18:29:07 gouriano* PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.68** Revision 1.68 2004/05/21 21:41:39 gorelenk* Added PCH ncbi_pch.hpp** Revision 1.67 2004/05/21 17:29:51 thiessen* allow conversion of mime to cdd data** Revision 1.66 2004/03/15 18:27:12 thiessen* prefer prefix vs. postfix ++/-- operators** Revision 1.65 2004/03/01 22:56:09 thiessen* convert 'T' to 'U' for RNA with IUPACna** Revision 1.64 2004/02/19 17:05:06 thiessen* remove cn3d/ from include paths; add pragma to disable annoying msvc warning** Revision 1.63 2004/01/05 17:09:16 thiessen* abort import and warn if same accession different gi** Revision 1.62 2003/11/26 20:37:54 thiessen* prefer gi for URLs** Revision 1.61 2003/11/20 22:08:49 thiessen* update Entrez url** Revision 1.60 2003/09/03 18:14:01 thiessen* hopefully fix Seq-id issues** Revision 1.59 2003/08/30 14:01:15 thiessen* use existing CSeq_id instead of creating new one** Revision 1.58 2003/07/14 18:37:08 thiessen* change GetUngappedAlignedBlocks() param types; other syntax changes** Revision 1.57 2003/03/13 14:26:18 thiessen* add file_messaging module; split cn3d_main_wxwin into cn3d_app, cn3d_glcanvas, structure_window, cn3d_tools** Revision 1.56 2003/02/03 19:20:05 thiessen* format changes: move CVS Log to bottom of file, remove std:: from .cpp files, and use new diagnostic macros** Revision 1.55 2002/12/12 15:04:11 thiessen* fix for report launch on nucleotides** Revision 1.54 2002/12/09 16:25:04 thiessen* allow negative score threshholds** Revision 1.53 2002/11/22 19:54:29 thiessen* fixes for wxMac/OSX** Revision 1.52 2002/11/19 21:19:44 thiessen* more const changes for objects; fix user vs default style bug** Revision 1.51 2002/11/06 00:18:10 thiessen* fixes for new CRef/const rules in objects** Revision 1.50 2002/10/11 17:21:39 thiessen* initial Mac OSX build** Revision 1.49 2002/09/13 14:21:45 thiessen* finish hooking up browser launch on unix** Revision 1.48 2002/09/06 18:56:48 thiessen* add taxonomy to description** Revision 1.47 2002/09/05 17:14:14 thiessen* create new netscape window on unix** Revision 1.46 2002/07/12 13:24:10 thiessen* fixes for PSSM creation to agree with cddumper/RPSBLAST** Revision 1.45 2002/01/24 20:08:17 thiessen* fix local id problem** Revision 1.44 2002/01/19 02:34:46 thiessen* fixes for changes in asn serialization API** Revision 1.43 2002/01/11 15:49:01 thiessen* update for Mac CW7** Revision 1.42 2001/11/30 14:59:55 thiessen* add netscape launch for Mac** Revision 1.41 2001/11/30 14:02:05 thiessen* progress on sequence imports to single structures** Revision 1.40 2001/11/27 16:26:09 thiessen* major update to data management system** Revision 1.39 2001/09/27 15:37:59 thiessen* decouple sequence import and BLAST** Revision 1.38 2001/08/21 01:10:31 thiessen* fix lit. launch for nucleotides** Revision 1.37 2001/08/09 19:07:13 thiessen* add temperature and hydrophobicity coloring** Revision 1.36 2001/07/24 15:02:59 thiessen* use ProSite syntax for pattern searches** Revision 1.35 2001/07/23 20:09:23 thiessen* add regex pattern search** Revision 1.34 2001/07/19 19:14:38 thiessen* working CDD alignment annotator ; misc tweaks** Revision 1.33 2001/07/10 16:39:55 thiessen* change selection control keys; add CDD name/notes dialogs** Revision 1.32 2001/06/21 02:02:34 thiessen* major update to molecule identification and highlighting ; add toggle highlight (via alt)** Revision 1.31 2001/06/18 21:48:27 thiessen* add [PACC] to Entrez query for PDB id's** Revision 1.30 2001/06/02 17:22:46 thiessen* fixes for GCC** Revision 1.29 2001/05/31 18:47:09 thiessen* add preliminary style dialog; remove LIST_TYPE; add thread single and delete all; misc tweaks** Revision 1.28 2001/05/31 14:32:03 thiessen* better netscape launch for unix** Revision 1.27 2001/05/25 01:38:16 thiessen* minor fixes for compiling on SGI** Revision 1.26 2001/05/24 13:32:32 thiessen* further tweaks for GTK** Revision 1.25 2001/05/15 23:48:37 thiessen* minor adjustments to compile under Solaris/wxGTK** Revision 1.24 2001/05/02 16:35:15 thiessen* launch entrez web page on sequence identifier** Revision 1.23 2001/04/20 18:03:22 thiessen* add ncbistdaa parsing** Revision 1.22 2001/04/18 15:46:53 thiessen* show description, length, and PDB numbering in status line** Revision 1.21 2001/03/28 23:02:17 thiessen* first working full threading** Revision 1.20 2001/02/16 00:40:01 thiessen* remove unused sequences from asn data** Revision 1.19 2001/02/13 01:03:57 thiessen* backward-compatible domain ID's in output; add ability to delete rows** Revision 1.18 2001/02/08 23:01:50 thiessen* hook up C-toolkit stuff for threading; working PSSM calculation** Revision 1.17 2001/01/25 20:21:18 thiessen* fix ostrstream memory leaks** Revision 1.16 2001/01/09 21:45:00 thiessen* always use pdbID as title if known** Revision 1.15 2001/01/04 18:20:52 thiessen* deal with accession seq-id** Revision 1.14 2000/12/29 19:23:39 thiessen* save row order** Revision 1.13 2000/12/28 20:43:09 vakatov* Do not use "set" as identifier.* Do not include <strstream>. Use "CNcbiOstrstream" instead of "ostrstream".** Revision 1.12 2000/12/21 23:42:15 thiessen* load structures from cdd's** Revision 1.11 2000/12/20 23:47:48 thiessen* load CDD's** Revision 1.10 2000/12/15 15:51:47 thiessen* show/hide system installed** Revision 1.9 2000/11/17 19:48:13 thiessen* working show/hide alignment row** Revision 1.8 2000/11/11 21:15:54 thiessen* create Seq-annot from BlockMultipleAlignment** Revision 1.7 2000/09/15 19:24:22 thiessen* allow repeated structures w/o different local id** Revision 1.6 2000/09/03 18:46:49 thiessen* working generalized sequence viewer** Revision 1.5 2000/08/30 23:46:27 thiessen* working alignment display** Revision 1.4 2000/08/30 19:48:41 thiessen* working sequence window** Revision 1.3 2000/08/28 23:47:19 thiessen* functional denseg and dendiag alignment parsing** Revision 1.2 2000/08/28 18:52:42 thiessen* start unpacking alignments** Revision 1.1 2000/08/27 18:52:22 thiessen* extract sequence information**/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -