1 /* saledit.h 2 * =========================================================================== 3 * 4 * PUBLIC DOMAIN NOTICE 5 * National Center for Biotechnology Information (NCBI) 6 * 7 * This software/database is a "United States Government Work" under the 8 * terms of the United States Copyright Act. It was written as part of 9 * the author's official duties as a United States Government employee and 10 * thus cannot be copyrighted. This software/database is freely available 11 * to the public for use. The National Library of Medicine and the U.S. 12 * Government do not place any restriction on its use or reproduction. 13 * We would, however, appreciate having the NCBI and the author cited in 14 * any work or product based on this material 15 * 16 * Although all reasonable efforts have been taken to ensure the accuracy 17 * and reliability of the software and data, the NLM and the U.S. 18 * Government do not and cannot warrant the performance or results that 19 * may be obtained by using this software or data. The NLM and the U.S. 20 * Government disclaim all warranties, express or implied, including 21 * warranties of performance, merchantability or fitness for any particular 22 * purpose. 23 * 24 * =========================================================================== 25 * 26 * File Name: saledit.h 27 * 28 * Author: Colombe Chappey 29 * 30 * Version Creation Date: 2/19/97 31 * 32 * $Revision: 6.39 $ 33 * 34 * File Description: 35 * 36 * Modifications: 37 * -------------------------------------------------------------------------- 38 * Date Name Description of modification 39 * ------- ---------- ----------------------------------------------------- 40 * 41 * 42 * ========================================================================== 43 */ 44 45 #ifndef _SALEDIT_ 46 #define _SALEDIT_ 47 48 #include <ncbi.h> 49 #include <objseq.h> 50 #include <objmgr.h> 51 #include <objfdef.h> 52 #include <gather.h> 53 #include <vibrant.h> 54 #include <salsa.h> 55 #include <viewer.h> 56 #include <util/creaders/alnread.h> 57 58 typedef struct seqeditview { 59 60 FORM_MESSAGE_BLOCK 61 PaneL pnl; 62 ValNodePtr data; 63 VieweR graph; 64 65 PrompT pos; 66 TexT gototxt, 67 lookattxt; 68 TexT fromtxt, totxt; 69 70 ButtoN gotobt, 71 lookatbt; 72 73 GrouP btngp; 74 ButtoN showfeatbt; 75 ButtoN translatebt; 76 ButtoN savefeatbt; 77 ButtoN refreshbt; 78 ButtoN closebt; 79 ButtoN svclosebt; 80 ButtoN gap_choicebn; 81 ButtoN keep_protid1, 82 keep_protid2; 83 84 MenU menu_align; 85 IteM editmodeitem, 86 viewmodeitem; 87 IteM prefitem; 88 IteM undoitem; 89 IteM cutitem, delitem, copyitem, pasteitem, insitem; 90 IteM rfitem[10]; 91 IteM conscolor; 92 IteM importseq, 93 importalg, 94 importnet, 95 expfsagitem, 96 expalgitem, 97 expasnitem; 98 IteM showfeatitem, 99 hidefeatitem; 100 IteM propaitem; 101 IteM tmpcdsnitem, tmpcdspitem; 102 IteM selmaster; 103 IteM selall, 104 selsubs; 105 IteM showdifitem, 106 showallitem; 107 IteM dotmat; 108 IteM alreport; 109 /** not used **/ 110 IteM translateitem; 111 IteM codonstitem; 112 IteM savefeatitem; 113 114 GrouP replaceMergeCopyGroup; 115 GrouP rmcExtra [3]; 116 ButtoN acceptBtn; 117 118 Boolean extended_align_menu; 119 Boolean extended_dist_menu; 120 Boolean extended_tree_menu; 121 } SeqEditViewForm, PNTR SeqEditViewFormPtr; 122 123 124 typedef struct dialogboxdata 125 { 126 FORM_MESSAGE_BLOCK 127 WindoW w; 128 TexT txt1, txt2, txt3, txt4, txt5, txt6; 129 LisT lst1, lst2, lst3; 130 ButtoN bt; 131 ButtoN bt2; 132 PopuP color[10]; 133 Int2 align_format, mol_type; 134 Int2 matrix, separator; 135 Boolean db_bool; 136 PrompT prompt; 137 138 } DialogBoxData, PNTR DialogBoxDataPtr; 139 140 141 /* 142 * The SeqEditViewProcsPtr may be registered with a call to SetAppProperty 143 * e.g., SetAppProperty ("SeqEditDisplayForm", &viewprocs), where viewprocs 144 * is a persistent structure filled with callback function pointers specific 145 * for a given application. 146 */ 147 148 typedef SeqEntryPtr (LIBCALLBACK *SeqEdDwnloadProc) (CharPtr program, CharPtr accession, Int4 uid, Boolean is_na, BoolPtr is_new); 149 150 typedef struct seqeditviewprocs { 151 152 WndActnProc activateForm; 153 FormMessageFunc handleMessages; 154 Int2 minPixelWidth; 155 Int2 minPixelHeight; 156 157 Boolean viewer_mode; 158 Boolean showfeat; 159 Boolean extended_align_menu; 160 Boolean extended_dist_menu; 161 Boolean extended_tree_menu; 162 163 SeqEdDwnloadProc download; /* application links to Entrez network service */ 164 165 Boolean Cn3D_On; 166 IteM conscolor; 167 Uint1 colorR_HL, colorG_HL, colorB_HL; /* yanli added to store highlight color */ 168 ValNodePtr seqinfo; /* yanli added */ 169 /* data initially filled by cn3d to store SeqId, entityID, itemID, visible status and color arrays for those sequences loaded into memory by cn3d. seqinfo->data.ptrvalue is MediaInfoPtr(see "cn3dmsg.h"), each node is for one sequence */ 170 171 } SeqEditViewProcs, PNTR SeqEditViewProcsPtr; 172 173 174 #define REGISTER_NEW_BIOSEQ_EDIT ObjMgrProcLoad(OMPROC_EDIT,"New Edit Bioseq","BioseqEditor",OBJ_BIOSEQ,Seq_repr_raw,OBJ_BIOSEQ,Seq_repr_raw,NULL,SeqEditFunc,PROC_PRIORITY_DEFAULT) 175 #define REGISTER_DELTA_BIOSEQ_EDIT ObjMgrProcLoad(OMPROC_EDIT,"Edit Delta Bioseq","BioseqEditor",OBJ_BIOSEQ,Seq_repr_delta,OBJ_BIOSEQ,Seq_repr_delta,NULL,SeqEditFunc,PROC_PRIORITY_DEFAULT) 176 177 #define REGISTER_NEW_SEQALIGN_EDIT ObjMgrProcLoad(OMPROC_EDIT, "New Edit SeqAlign","SeqAlignEditor",OBJ_SEQALIGN,0,OBJ_SEQALIGN,0,NULL,AlgEditFunc,PROC_PRIORITY_DEFAULT) 178 179 #define REGISTER_NEW_SEQANNOT_EDIT ObjMgrProcLoad(OMPROC_EDIT, "New Edit SeqAnnot","SeqAnnotEditor",OBJ_SEQANNOT,0,OBJ_SEQANNOT,0,NULL,AnnotAlgEditFunc,PROC_PRIORITY_DEFAULT) 180 181 #define REGISTER_NEW_SEQALIGN_VIEW ObjMgrProcLoad(OMPROC_VIEW, "New View SeqAlign","CCSeqAlignViewer",OBJ_SEQALIGN,0,OBJ_SEQALIGN,0,NULL,AlgViewFunc,PROC_PRIORITY_DEFAULT) 182 183 184 extern EditAlignDataPtr EditAlignDataRepopulateFromSeqAlign (PaneL pnl, EditAlignDataPtr adp, SeqAlignPtr salp); 185 186 extern void SalsaPanelHasResized (PaneL pnl); 187 extern Boolean FindIdsInSalsaPanel (PaneL pnl, PoinT pt, Uint2 *entityID, Uint4 *itemID, Uint2 *itemtype); 188 extern void SaveSalsaPanel (PaneL pnl); 189 extern PaneL SalsaTextPanel (GrouP g, Int2 wid, Int2 hgt); 190 extern void PopulateSalsaPanel (PaneL pnl, SeqEntryPtr sep, Boolean all_seq, Uint1 sequence_shown, Uint1 show_feat, Uint1 numbering, FonT font); 191 extern void repopulate_panel (WindoW w, EditAlignDataPtr adp, SeqAlignPtr salp); 192 193 extern Int2 LIBCALLBACK SeqEditFunc PROTO((Pointer data)); 194 extern Int2 LIBCALLBACK AlgEditFunc PROTO((Pointer data)); 195 extern Int2 LIBCALLBACK AnnotAlgEditFunc PROTO((Pointer data)); 196 extern Int2 LIBCALLBACK AlgViewFunc (Pointer data); 197 extern void OldAlignmentEditor (IteM i); 198 199 extern void LaunchAnnotAlignEditor (SeqAnnotPtr sap); 200 extern void LaunchAlignEditor (SeqAlignPtr salp); 201 extern void LaunchAlignViewer (SeqAlignPtr salp); 202 extern void OpenNewAlignmentEditor (SeqAlignPtr salp, Uint2 input_entityID); 203 extern Int2 LIBCALLBACK LaunchAlignEditorFromDesktop (Pointer data); 204 extern Int2 LIBCALLBACK LaunchAlignEditorFromDesktop2 (Pointer data); 205 206 extern Int2 LIBCALLBACK UpdateSeqAlign (Pointer data); 207 208 /**************************************************** 209 ValidateSeqAlignandACC 210 211 validates a SeqAlign using the ValidateSeqAlign function 212 in api directory, and tests for occurrence of ACC string in sequence ID. 213 ACC|ACC# will be compared with the corresponding sequence (ACC#) 214 in the database and replaced by a far pointer if the sequences 215 are identical. 216 217 ******************************************************/ 218 NLM_EXTERN Int2 LIBCALLBACK ValidateSeqAlignandACCFromData (Pointer data); 219 220 NLM_EXTERN Boolean ValidateSeqAlignandACC (SeqAlignPtr salp, Uint2 entityID, 221 Boolean message, 222 Boolean msg_success, Boolean find_remote_bsp, 223 Boolean find_acc_bsp, 224 Boolean delete_bsp, Boolean delete_salp, BoolPtr dirty); 225 226 NLM_EXTERN Boolean ValidateSeqAlignandACCInSeqEntry (SeqEntryPtr sep, 227 Boolean message, 228 Boolean msg_success, Boolean find_remote_bsp, 229 Boolean find_acc_bsp, 230 Boolean delete_bsp, Boolean delete_salp); 231 232 NLM_EXTERN void CalculateAlignmentOffsets (SeqEntryPtr sepnew, SeqEntryPtr sepold); 233 NLM_EXTERN Boolean CheckAlignmentSequenceLengths (SeqAlignPtr salp); 234 235 NLM_EXTERN Boolean UpdateOneSeqAlignFarPointer (SeqAlignPtr salp, Int4 pos); 236 237 extern const char *nucleotide_alphabet; 238 extern const char *protein_alphabet; 239 NLM_EXTERN DialoG AlnSettingsDlg (GrouP h, Boolean allow_sequence_type); 240 NLM_EXTERN TSequenceInfoPtr GetAlignmentOptions (Uint1Ptr moltype, TSequenceInfoPtr sequence_info); 241 NLM_EXTERN SeqAlignPtr ReadAlignmentForSeqEntry (SeqEntryPtr sep, Boolean is_nuc, Boolean allow_options, Boolean from_clipboard); 242 NLM_EXTERN void ProduceAlignmentNotes (TAlignmentFilePtr afp, TErrorInfoPtr error_list); 243 NLM_EXTERN Boolean CorrectAlignmentIDs (TAlignmentFilePtr afp, Uint1 moltype); 244 245 246 #endif 247 248 249 /*****************!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 250 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 251 * for debugging purpose, wdpext is a global SeqEditViewProcsPtr 252 * printEntityIDForMsg prints the OMUserDataPtr's 253 extern void printEntityIDForMsg (SeqEditViewFormPtr wdp, CharPtr str); 254 SeqEditViewFormPtr wdpext; 255 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 256 extern void printEntityIDForMsg (SeqEditViewFormPtr wdp, CharPtr str) 257 { 258 EditAlignDataPtr adp; 259 AlignNodePtr anp; 260 ValNodePtr vnp; 261 OMUserDataPtr omudp; 262 Uint2 eID; 263 SeqEntryPtr sep; 264 265 FILE *fp; 266 267 if (wdp==NULL) return; 268 GetPanelExtra (wdp->pnl, &adp); 269 if ( adp == NULL ) 270 return ; 271 if ( adp->seqnumber == 0 ) 272 return; 273 274 fp = FileOpen("ObjMgr.log", "a"); 275 276 fprintf (fp, "printEntityID %s\n", str); 277 for (vnp=adp->anp_list; vnp!=NULL; vnp=vnp->next) { 278 anp = (AlignNodePtr) vnp->data.ptrvalue; 279 if (anp!=NULL) { 280 sep = GetTopSeqEntryForEntityID (anp->seq_entityID); 281 if (sep!=NULL) { 282 eID = SeqMgrGetEntityIDForSeqEntry(sep); 283 omudp = ObjMgrGetUserData (eID, wdp->procid, OMPROC_EDIT, wdp->userkey); 284 if (omudp != NULL) 285 { 286 fprintf(fp, "PRINTENTITYID-OMUDP %d %d %d %d\n", eID, anp->entityID, wdp->input_entityID, anp->seq_entityID); 287 if (omudp->userdata.ptrvalue == NULL) 288 fprintf(fp, " OMUDP->userdata.ptrvalue == NULL \n"); 289 else 290 fprintf(fp, " OMUDP->userdata.ptrvalue NON NULL \n"); 291 if (omudp->messagefunc == NULL) 292 fprintf(fp, " OMUDP->messagefunc == NULL \n"); 293 else 294 fprintf(fp, " OMUDP->messagefunc NON NULL \n"); 295 } 296 else { 297 if (eID != wdp->input_entityID) { 298 fprintf(fp, "PRINTENTITYID-OMUDPNULL %d %d %d %d\n", eID, anp->entityID, wdp->input_entityID, anp->seq_entityID); 299 } 300 } 301 } 302 } 303 } 304 FileClose(fp); 305 } 306 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 307 !!!!!!!!!!!!!!!!!!******************/ 308 309