|
NCBI Home IEB Home C Toolkit docs C++ Toolkit source browser C Toolkit source browser (2) |
NCBI C Toolkit Cross ReferenceC/desktop/gbfview.c |
source navigation diff markup identifier search freetext search file search |
1 /* gbfview.c
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: gbfview.c
27 *
28 * Author: Jonathan Kans
29 *
30 * Version Creation Date: 2/5/97
31 *
32 * $Revision: 6.101 $
33 *
34 * File Description:
35 *
36 * Modifications:
37 * --------------------------------------------------------------------------
38 * Date Name Description of modification
39 * ------- ---------- -----------------------------------------------------
40 *
41 *
42 * ==========================================================================
43 */
44
45 #include <bspview.h>
46 #include <objsub.h>
47 #include <asn2gnbp.h>
48 #include <asn2gnbi.h>
49 #include <tofasta.h>
50 #include <explore.h>
51 #include <subutil.h>
52
53 static ParData ffParFmt = {FALSE, FALSE, FALSE, FALSE, TRUE, 0, 0};
54 static ColData ffColFmt = {0, 0, 80, 0, NULL, 'l', FALSE, FALSE, FALSE, FALSE, TRUE};
55
56 typedef struct docdescrstruct {
57 Uint2 entityID, itemtype;
58 Uint4 itemID;
59 Int2 docitem;
60 } DocDescrStruct, PNTR DocDescrPtr;
61
62 #define NOT_A_CDS 0
63 #define CDS_UNTESTED 1
64 #define CDS_OKAY 2
65 #define CDS_INVALID 3
66
67 typedef struct flatstruct {
68 Asn2gbJobPtr ajp;
69 BaseBlockPtr PNTR paragraphs;
70 Int4 numParagraphs;
71 SeqEntryPtr sep;
72 Int4 numdescr;
73 DocDescrPtr descr;
74 Uint1Ptr cdsstatus;
75 } FlatStruct, PNTR FlatStructPtr;
76
77 static Boolean GetIDsFromDoc (DoC d, Int2 item, Uint2Ptr entityPtr,
78 Uint4Ptr itemPtr, Uint2Ptr typePtr)
79
80 {
81 BaseBlockPtr bbp;
82 BioseqViewPtr bvp;
83 Pointer dataPtr;
84 Uint2 entityID;
85 FlatStructPtr fsp;
86 Uint4 itemID;
87 Uint2 itemtype;
88 Boolean okay;
89 BaseBlockPtr PNTR paragraphs;
90
91 okay = FALSE;
92 entityID = 0;
93 itemID = 0;
94 itemtype = 0;
95 bvp = (BioseqViewPtr) GetObjectExtra (d);
96 if (bvp != NULL) {
97 if (! bvp->highlightSelections) return FALSE;
98 if (bvp->useScrollText) return FALSE;
99 GetItemParams (d, item, NULL, NULL, NULL, NULL, &dataPtr);
100 if (dataPtr != NULL) {
101 fsp = (FlatStructPtr) dataPtr;
102 paragraphs = fsp->paragraphs;
103 if (paragraphs != NULL) {
104 bbp = paragraphs [item - 1];
105 if (bbp != NULL) {
106 entityID = bbp->entityID;
107 itemID = bbp->itemID;
108 itemtype = bbp->itemtype;
109 okay = (Boolean) (entityID > 0 && itemID > 0 && itemtype > 0);
110 }
111 }
112 }
113 }
114 if (entityPtr != NULL) {
115 *entityPtr = entityID;
116 }
117 if (itemPtr != NULL) {
118 *itemPtr = itemID;
119 }
120 if (typePtr != NULL) {
121 *typePtr = itemtype;
122 }
123 return okay;
124 }
125
126 static void DrawIcon (DoC d, RectPtr r, Int2 item, Int2 firstLine)
127
128 {
129 BioseqViewPtr bvp;
130 Uint2 entityID;
131 Uint4 itemID;
132 Uint2 itemtype;
133 RecT rct;
134 SelStructPtr sel;
135
136 bvp = (BioseqViewPtr) GetObjectExtra (d);
137 if (bvp == NULL) return;
138 if (! bvp->highlightSelections) return;
139 if (GetIDsFromDoc (d, item, &entityID, &itemID, &itemtype)) {
140 for (sel = ObjMgrGetSelected (); sel != NULL; sel = sel->next) {
141 if (entityID == sel->entityID &&
142 itemID == sel->itemID &&
143 itemtype == sel->itemtype) {
144 rct = *r;
145 rct.right = rct.left + 4;
146 PaintRect (&rct);
147 }
148 }
149 }
150 }
151
152 static DocDescrPtr FindFFPDocDescr (DocDescrPtr doscr, Int4 numdescr,
153 Uint2 entityID, Uint2 itemID, Uint2 itemtype)
154
155 {
156 DocDescrPtr dsp;
157 Int4 L, R, mid;
158 DocDescrPtr rsult;
159
160 L = 0;
161 R = numdescr - 1;
162 while (L <= R) {
163 mid = (L + R) / 2;
164 dsp = &(doscr [mid]);
165 if (dsp == NULL) return NULL;
166 if (dsp->entityID > entityID) {
167 R = mid - 1;
168 } else if (dsp->entityID < entityID) {
169 L = mid + 1;
170 } else if (dsp->itemtype > itemtype) {
171 R = mid - 1;
172 } else if (dsp->itemtype < itemtype) {
173 L = mid + 1;
174 } else if (dsp->itemID > itemID) {
175 R = mid - 1;
176 } else if (dsp->itemID < itemID) {
177 L = mid + 1;
178 } else {
179 rsult = dsp;
180 /* scan to first paragraph for item */
181 while (mid >= 0) {
182 dsp = &(doscr [mid]);
183 if (dsp != NULL) {
184 if (dsp->entityID == entityID &&
185 dsp->itemtype == itemtype &&
186 dsp->itemID == itemID) {
187 rsult = dsp;
188 }
189 }
190 mid--;
191 }
192 return rsult;
193 }
194 }
195
196 return NULL;
197 }
198
199 static Boolean OverlapgGeneIsPseudo (SeqFeatPtr sfp)
200
201 {
202 SeqFeatPtr gene;
203 GeneRefPtr grp;
204
205 if (sfp == NULL)
206 return FALSE;
207 grp = SeqMgrGetGeneXref (sfp);
208 if (grp != NULL) {
209 if (grp->pseudo)
210 return TRUE;
211 return FALSE;
212 }
213 gene = SeqMgrGetOverlappingGene (sfp->location, NULL);
214 if (gene != NULL) {
215 if (gene->pseudo)
216 return TRUE;
217 grp = (GeneRefPtr) gene->data.value.ptrvalue;
218 if (grp != NULL) {
219 if (grp->pseudo)
220 return TRUE;
221 }
222 }
223 return FALSE;
224 }
225
226 static CharPtr bypass_cds_check [] = {
227 "RNA editing",
228 "reasons given in citation",
229 "artificial frameshift",
230 "rearrangement required for product",
231 "unclassified translation discrepancy",
232 "mismatches in translation",
233 "adjusted for low-quality genome",
234 NULL
235 };
236
237 static Boolean CdsIsInvalid (SeqFeatPtr sfp)
238
239 {
240 ByteStorePtr bs;
241 BioseqPtr bsp;
242 Char ch;
243 CdRegionPtr crp;
244 Int2 i;
245 CharPtr ptr, str1, str2;
246
247 if (sfp->pseudo) return FALSE;
248 if (OverlapgGeneIsPseudo (sfp)) return FALSE;
249
250 crp = (CdRegionPtr) (sfp->data.value.ptrvalue);
251 if (crp != NULL && crp->conflict) return FALSE;
252
253 if (sfp->excpt && StringDoesHaveText (sfp->except_text)) {
254 for (i = 0; bypass_cds_check [i] != NULL; i++) {
255 if (StringISearch (sfp->except_text, bypass_cds_check [i]) != NULL) return FALSE;
256 }
257 }
258
259 bsp = BioseqFindFromSeqLoc (sfp->product);
260 str1 = GetSequenceByBsp (bsp);
261 if (str1 != NULL) {
262 ptr = str1;
263 ch = *ptr;
264 while (ch != '\0') {
265 if (ch == '-' || ch == '*') {
266 MemFree (str1);
267 return TRUE;
268 }
269 ptr++;
270 ch = *ptr;
271 }
272 }
273 bs = TransTableTranslateCdRegion (NULL, sfp, FALSE, FALSE, FALSE);
274 str2 = (CharPtr) BSMerge (bs, NULL);
275 BSFree (bs);
276
277 if (str1 != NULL && str2 != NULL && StringCmp (str1, str2) != 0) {
278 MemFree (str1);
279 MemFree (str2);
280 return TRUE;
281 }
282
283 MemFree (str1);
284 MemFree (str2);
285
286 return FALSE;
287 }
288
289 static Boolean ColorIcon (
290 DoC d,
291 Int2 item,
292 Int2 row,
293 Int2 col
294 )
295
296 {
297 SeqMgrFeatContext context;
298 Uint2 entityID;
299 FlatStructPtr fsp;
300 Uint4 itemID;
301 Uint2 itemtype;
302 SeqFeatPtr sfp;
303 Uint1 status;
304
305 fsp = (FlatStructPtr) GetDocData (d);
306 if (fsp == NULL) return FALSE;
307
308 status = fsp->cdsstatus [item - 1];
309 if (status == NOT_A_CDS) return FALSE;
310 if (status == CDS_OKAY) return FALSE;
311
312 if (status == CDS_UNTESTED) {
313 if (GetIDsFromDoc (d, item, &entityID, &itemID, &itemtype) && itemtype == OBJ_SEQFEAT) {
314 sfp = SeqMgrGetDesiredFeature (entityID, NULL, itemID, 0, NULL, &context);
315 if (sfp != NULL && sfp->idx.subtype == FEATDEF_CDS) {
316 if (CdsIsInvalid (sfp)) {
317 status = CDS_INVALID;
318 fsp->cdsstatus [item - 1] = status;
319 }
320 }
321 }
322 }
323
324 if (status == CDS_INVALID) {
325 Red ();
326 return TRUE;
327 }
328
329 fsp->cdsstatus [item - 1] = CDS_OKAY;
330 return FALSE;
331 }
332
333 static void ClickIcon (DoC d, PoinT pt)
334
335 {
336 BioseqViewPtr bvp;
337
338 bvp = (BioseqViewPtr) GetObjectExtra (d);
339 if (bvp == NULL) return;
340 bvp->wasDoubleClick = dblClick;
341 bvp->wasShiftKey = shftKey;
342 MapDocPoint (d, pt, &(bvp->itemClicked), NULL, NULL, NULL);
343 }
344
345 typedef struct matchstruc {
346 CharPtr str;
347 Uint4 editItemID;
348 Boolean found;
349 Boolean slashgene;
350 Boolean slashproduct;
351 } MatchStruc, PNTR MatchStrucPtr;
352
353 static void LIBCALLBACK FindStringCallBack (AsnExpOptStructPtr pAEOS)
354
355 {
356 MatchStrucPtr msp;
357 CharPtr pchSource;
358
359 if (pAEOS == NULL) return;
360 msp = (MatchStrucPtr) pAEOS->data;
361 if (msp == NULL) return;
362 if (! ISA_STRINGTYPE (AsnFindBaseIsa (pAEOS->atp))) return;
363 pchSource = (CharPtr) pAEOS->dvp->ptrvalue;
364 if (StringSearch (pchSource, msp->str) == NULL) return;
365 msp->found = TRUE;
366 }
367
368 static void CheckForStringInFeature (SeqFeatPtr sfp, MatchStrucPtr msp)
369
370 {
371 AsnExpOptPtr aeop;
372 AsnIoPtr aip;
373 SeqLocPtr location;
374 SeqLocPtr product;
375 ValNode vn;
376
377 if (sfp == NULL || msp == NULL) return;
378 msp->found = FALSE;
379 aip = AsnIoNullOpen ();
380 if (aip != NULL) {
381 aeop = AsnExpOptNew (aip, NULL, NULL, FindStringCallBack);
382 if (aeop != NULL) {
383 aeop->user_data = msp;
384 location = sfp->location;
385 product = sfp->product;
386 vn.choice = SEQLOC_NULL;
387 vn.data.ptrvalue = NULL;
388 sfp->location = &vn;
389 sfp->product = &vn;
390 SeqFeatAsnWrite (sfp, aip, NULL);
391 sfp->location = location;
392 sfp->product = product;
393 }
394 AsnIoClose (aip);
395 }
396 }
397
398 typedef struct protgenegatherlist {
399 SeqLocPtr slp;
400 Uint2 choice;
401 Int4 min;
402 Uint2 entityID;
403 Uint4 itemID;
404 Uint2 itemtype;
405 Boolean found;
406 } ProtGeneGatherList, PNTR ProtGeneGatherPtr;
407
408 static Boolean ProtGeneMatchFunc (GatherContextPtr gcp)
409
410 {
411 Int4 diff;
412 ProtGeneGatherPtr pgp;
413 SeqFeatPtr sfp;
414
415 if (gcp == NULL) return TRUE;
416
417 pgp = (ProtGeneGatherPtr) gcp->userdata;
418 if (pgp == NULL) return TRUE;
419
420 if (gcp->thistype != OBJ_SEQFEAT) return TRUE;
421 sfp = (SeqFeatPtr) gcp->thisitem;
422 if (sfp == NULL || sfp->data.choice != pgp->choice ||
423 sfp->data.value.ptrvalue == NULL) return TRUE;
424 if (pgp->choice == SEQFEAT_PROT) {
425 diff = SeqLocAinB (sfp->location, pgp->slp);
426 } else {
427 diff = SeqLocAinB (pgp->slp, sfp->location);
428 }
429 if (diff < 0) return TRUE;
430 if (diff >= pgp->min) return TRUE;
431 pgp->min = diff;
432 pgp->entityID = gcp->entityID;
433 pgp->itemID = gcp->itemID;
434 pgp->itemtype = gcp->thistype;
435 pgp->found = TRUE;
436
437 return TRUE;
438 }
439
440 static Uint2 GetBestGeneOrProteinFeature (Uint2 entityID, SeqEntryPtr scope,
441 SeqLocPtr location, Uint2 choice)
442
443 {
444 GatherScope gs;
445 ProtGeneGatherList pgl;
446
447 if (entityID == 0 || location == NULL) return 0;
448 pgl.entityID = 0;
449 pgl.itemID = 0;
450 pgl.itemtype = 0;
451 pgl.found = FALSE;
452 pgl.slp = location;
453 pgl.choice = choice;
454 pgl.min = INT4_MAX;
455 MemSet ((Pointer) (&gs), 0, sizeof (GatherScope));
456 gs.seglevels = 1;
457 gs.get_feats_location = FALSE;
458 gs.scope = scope;
459 MemSet((Pointer)(gs.ignore), (int)(TRUE), (size_t)(OBJ_MAX * sizeof(Boolean)));
460 gs.ignore[OBJ_BIOSEQ] = FALSE;
461 gs.ignore[OBJ_BIOSEQ_SEG] = FALSE;
462 gs.ignore[OBJ_SEQFEAT] = FALSE;
463 gs.ignore[OBJ_SEQANNOT] = FALSE;
464 GatherEntity (entityID, (Pointer) &pgl, ProtGeneMatchFunc, &gs);
465 return pgl.itemID;
466 }
467
468 static Boolean MatchSubItemInFlatFileProc (GatherContextPtr gcp)
469
470 {
471 MatchStrucPtr msp;
472 SeqFeatPtr sfp;
473
474 if (gcp == NULL || gcp->thisitem == NULL || gcp->thistype != OBJ_SEQFEAT) {
475 return FALSE;
476 }
477 msp = (MatchStrucPtr) gcp->userdata;
478 if (msp == NULL) return FALSE;
479 sfp = (SeqFeatPtr) gcp->thisitem;
480 CheckForStringInFeature (sfp, msp);
481 return FALSE;
482 }
483
484 static Boolean MatchItemInFlatFileProc (GatherContextPtr gcp)
485
486 {
487 Uint4 itemID;
488 MatchStrucPtr msp;
489 SeqFeatPtr sfp;
490
491 if (gcp == NULL || gcp->thisitem == NULL || gcp->thistype != OBJ_SEQFEAT) {
492 return FALSE;
493 }
494 msp = (MatchStrucPtr) gcp->userdata;
495 if (msp == NULL) return FALSE;
496 sfp = (SeqFeatPtr) gcp->thisitem;
497 /*
498 if (msp->slashgene) {
499 itemID = GetBestGeneOrProteinFeature (gcp->entityID, NULL, sfp->location, SEQFEAT_GENE);
500 if (itemID != 0) {
501 GatherItem (gcp->entityID, itemID, OBJ_SEQFEAT, (Pointer) msp, MatchSubItemInFlatFileProc);
502 if (msp->found) {
503 msp->editItemID = itemID;
504 return TRUE;
505 }
506 }
507 }
508 CheckForStringInFeature (sfp, msp);
509 if (msp->found) {
510 return TRUE;
511 }
512 */
513 if (sfp->data.choice == SEQFEAT_CDREGION) {
514 itemID = GetBestGeneOrProteinFeature (gcp->entityID, NULL, sfp->product, SEQFEAT_PROT);
515 if (itemID != 0) {
516 GatherItem (gcp->entityID, itemID, OBJ_SEQFEAT, (Pointer) msp, MatchSubItemInFlatFileProc);
517 if (msp->found) {
518 msp->editItemID = itemID;
519 return TRUE;
520 }
521 }
522 }
523 /*
524 if (! msp->slashgene) {
525 itemID = GetBestGeneOrProteinFeature (gcp->entityID, NULL, sfp->location, SEQFEAT_GENE);
526 if (itemID != 0) {
527 GatherItem (gcp->entityID, itemID, OBJ_SEQFEAT, (Pointer) msp, MatchSubItemInFlatFileProc);
528 if (msp->found) {
529 msp->editItemID = itemID;
530 return TRUE;
531 }
532 }
533 }
534 */
535 return FALSE;
536 }
537
538 static Uint2 MatchItemInFlatFile (Uint2 entityID, Uint4 itemID, CharPtr str,
539 Boolean slashgene, Boolean slashproduct)
540
541 {
542 MatchStruc ms;
543
544 ms.editItemID = itemID;
545 ms.str = str;
546 ms.slashgene = slashgene;
547 ms.slashproduct = slashproduct;
548 GatherItem (entityID, itemID, OBJ_SEQFEAT, (Pointer) &ms, MatchItemInFlatFileProc);
549 return ms.editItemID;
550 }
551
552 static CharPtr google_earth_1 =
553 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" \
554 "<kml xmlns=\"http://earth.google.com/kml/2.2\">\n" \
555 "<Document>\n" \
556 " <name>KmlFile</name>\n" \
557 " <StyleMap id=\"default_copy0+nicon=http://maps.google.com/mapfiles/kml/pal3/icon60.png+hicon=http://maps.google.com/mapfiles/kml/pal3/icon52.png\">\n" \
558 " <Pair>\n" \
559 " <key>normal</key>\n" \
560 " <styleUrl>#default_copy0+icon=http://maps.google.com/mapfiles/kml/pal3/icon60.png</styleUrl>\n" \
561 " </Pair>\n" \
562 " <Pair>\n" \
563 " <key>highlight</key>\n" \
564 " <styleUrl>#default_copy0+icon=http://maps.google.com/mapfiles/kml/pal3/icon52.png</styleUrl>\n" \
565 " </Pair>\n" \
566 " </StyleMap>\n" \
567 " <Style id=\"default_copy0+icon=http://maps.google.com/mapfiles/kml/pal3/icon60.png\">\n" \
568 " <IconStyle>\n" \
569 " <Icon>\n" \
570 " <href>http://maps.google.com/mapfiles/kml/pal3/icon60.png</href>\n" \
571 " </Icon>\n" \
572 " </IconStyle>\n" \
573 " </Style>\n" \
574 " <Placemark>\n";
575
576 static CharPtr google_earth_2 =
577 " <styleUrl>#default_copy0+nicon=http://maps.google.com/mapfiles/kml/pal3/icon60.png+hicon=http://maps.google.com/mapfiles/kml/pal3/icon52.png</styleUrl>\n" \
578 " <Point>\n";
579
580 static CharPtr google_earth_3 =
581 " </Point>\n" \
582 " </Placemark>\n" \
583 "</Document>\n" \
584 "</kml>\n";
585
586 static void ReleaseIcon (DoC d, PoinT pt)
587
588 {
589 BioSourcePtr biop;
590 BioseqViewPtr bvp;
591 Char ch;
592 SeqMgrDescContext context;
593 CharPtr dst;
594 Uint4 editItemID;
595 Uint2 entityID;
596 Boolean format_ok = FALSE;
597 FILE *fp;
598 Int2 handled;
599 Int2 item;
600 Uint4 itemID;
601 Uint2 itemtype;
602 FloatHi lat = 0.0;
603 FloatHi lon = 0.0;
604 CharPtr lat_lon = NULL;
605 Boolean lat_in_range = FALSE;
606 Boolean lon_in_range = FALSE;
607 Char path [PATH_MAX];
608 Int2 row;
609 SeqDescPtr sdp;
610 SeqEntryPtr sep;
611 Boolean slashgene;
612 Boolean slashproduct;
613 CharPtr src;
614 SubSourcePtr ssp;
615 CharPtr str;
616 #ifdef OS_UNIX
617 Char cmmd [256];
618 #endif
619
620 bvp = (BioseqViewPtr) GetObjectExtra (d);
621 if (bvp == NULL) return;
622 MapDocPoint (d, pt, &item, &row, NULL, NULL);
623 if (row != 0 && item != 0 && item == bvp->itemClicked) {
624 if (GetIDsFromDoc (d, item, &entityID, &itemID, &itemtype)) {
625 if (bvp->wasDoubleClick) {
626
627 if (bvp->wasShiftKey) {
628 if (itemtype == OBJ_SEQDESC) {
629 sdp = SeqMgrGetDesiredDescriptor (entityID, NULL, itemID, 0, NULL, &context);
630 if (sdp != NULL && sdp->choice == Seq_descr_source) {
631 biop = (BioSourcePtr) sdp->data.ptrvalue;
632 if (biop != NULL) {
633 for (ssp = biop->subtype; ssp != NULL; ssp = ssp->next) {
634 if (ssp->subtype != SUBSRC_lat_lon) continue;
635 lat_lon = ssp->name;
636 if (StringHasNoText (lat_lon)) continue;
637 IsCorrectLatLonFormat (lat_lon, &format_ok, &lat_in_range, &lon_in_range);
638 if (! format_ok) continue;
639 if (! lat_in_range) continue;
640 if (! lon_in_range) continue;
641 if (! ParseLatLon (lat_lon, &lat, &lon)) continue;
642 TmpNam (path);
643 /* write to original temp file, so next temp file name will not collide */
644 fp = FileOpen (path, "w");
645 if (fp != NULL) {
646 fprintf (fp, "\n");
647 FileClose (fp);
648 RememberSqnTempFile (path);
649 }
650 /* now append .kml extension so proper application is launched */
651 StringCat (path, ".kml");
652 fp = FileOpen (path, "w");
653 if (fp != NULL) {
654 fprintf (fp, "%s", google_earth_1);
655 fprintf (fp, " <name>%s</name>\n", lat_lon);
656 fprintf (fp, "%s", google_earth_2);
657 fprintf (fp, " <coordinates>%lf,%lf</coordinates>\n", (double) lon, (double) lat);
658 fprintf (fp, "%s", google_earth_3);
659 FileClose (fp);
660 RememberSqnTempFile (path);
661 #ifdef OS_UNIX
662 sprintf (cmmd, "open %s", path);
663 system (cmmd);
664 #endif
665 #ifdef WIN_MSWIN
666 Nlm_MSWin_OpenDocument (path);
667 #endif
668 }
669 return;
670 }
671 }
672 }
673 }
674 }
675
676 sep = GetTopSeqEntryForEntityID (entityID);
677 if (bvp->launchSubviewers) {
678 WatchCursor ();
679 Update ();
680 LaunchNewBioseqViewer (bvp->bsp, entityID, itemID, itemtype);
681 ArrowCursor ();
682 Update ();
683 return;
684 } else if (LaunchViewerNotEditor (bvp, sep, entityID, itemID, itemtype)) {
685 WatchCursor ();
686 Update ();
687 LaunchNewBioseqViewer (bvp->bsp, entityID, itemID, itemtype);
688 ArrowCursor ();
689 Update ();
690 return;
691 } else if (bvp->launchEditors) {
692 WatchCursor ();
693 Update ();
694 editItemID = itemID;
695 if (itemtype == OBJ_SEQFEAT && GetAppProperty ("InternalNcbiSequin") != NULL) {
696 str = GetDocText (d, item, row, 1);
697 TrimSpacesAroundString (str);
698 src = str;
699 dst = str;
700 ch = *src;
701 slashgene = FALSE;
702 slashproduct = FALSE;
703 if (str != NULL && str [0] == '/') {
704 if (StringStr (str, "/gene") != NULL) {
705 slashgene = TRUE;
706 }
707 if (StringStr (str, "/product") != NULL) {
708 slashproduct = TRUE;
709 }
710 while (ch != '=' && ch != '\0') {
711 src++;
712 ch = *src;
713 }
714 if (ch == '=') {
715 src++;
716 ch = *src;
717 }
718 }
719 while (ch != '\0') {
720 if (ch != '"') {
721 *dst = ch;
722 dst++;
723 }
724 src++;
725 ch = *src;
726 }
727 *dst = '\0';
728 editItemID = MatchItemInFlatFile (entityID, itemID, str, slashgene, slashproduct);
729 MemFree (str);
730 }
731 handled = GatherProcLaunch (OMPROC_EDIT, FALSE, entityID, editItemID,
732 itemtype, 0, 0, itemtype, 0);
733 ArrowCursor ();
734 Update ();
735 if (handled == OM_MSG_RET_DONE || handled == OM_MSG_RET_NOPROC) {
736 return;
737 }
738 } else {
739 return;
740 }
741 }
742 if (! bvp->sendSelectMessages) return;
743 if (bvp->wasShiftKey) {
744 ObjMgrAlsoSelect (entityID, itemID, itemtype,0,NULL);
745 } else {
746 ObjMgrSelect (entityID, itemID, itemtype,0,NULL);
747 }
748 }
749 } else if (item == bvp->itemClicked) {
750 if (! bvp->sendSelectMessages) return;
751 ObjMgrDeSelect (0, 0, 0,0,NULL);
752 }
753 }
754
755 static void DocFreeFlat (DoC d, VoidPtr data)
756
757 {
758 FlatStructPtr fsp;
759
760 if (data != NULL) {
761 fsp = (FlatStructPtr) data;
762 fsp->ajp = asn2gnbk_cleanup (fsp->ajp);
763 MemFree (fsp->descr);
764 MemFree (fsp->cdsstatus);
765 MemFree (fsp);
766 }
767 }
768
769 static CharPtr FFPrintFunc (DoC d, Int2 index, Pointer data)
770
771 {
772 BaseBlockPtr bbp;
773 BaseFormPtr bfp;
774 BioseqPtr bsp;
775 BioseqViewPtr bvp;
776 FlatStructPtr fsp;
777 ErrSev level;
778 SeqEntryPtr oldsep = NULL;
779 OMUserDataPtr omudp;
780 BaseBlockPtr PNTR paragraphs;
781 CharPtr str = NULL;
782 SeqEntryPtr topsep;
783
784 bvp = (BioseqViewPtr) GetObjectExtra (d);
785 fsp = (FlatStructPtr) data;
786 if (bvp == NULL || bvp->bsp == NULL || fsp == NULL) return StringSave ("?\n");
787 level = ErrSetMessageLevel (SEV_MAX);
788 bsp = BioseqLock (bvp->bsp);
789 bfp = (BaseFormPtr) GetObjectExtra (bvp->form);
790 if (bfp != NULL) {
791 topsep = GetTopSeqEntryForEntityID (bfp->input_entityID);
792 oldsep = SeqEntrySetScope (topsep);
793 }
794 str = asn2gnbk_format (fsp->ajp, (Int4) (index - 1));
795 if (oldsep != NULL) {
796 SeqEntrySetScope (oldsep);
797 }
798 if (bfp != NULL && bfp->userkey > 0) {
799 paragraphs = fsp->paragraphs;
800 if (paragraphs != NULL) {
801 bbp = paragraphs [index - 1];
802 if (bbp != NULL && bbp->entityID != 0 && bbp->entityID != bfp->input_entityID) {
803 if (! InBioseqViewEntityList (bbp->entityID, bvp)) {
804 ValNodeAddInt (&(bvp->entityList), 0, (Int4) bbp->entityID);
805 omudp = ObjMgrAddUserData (bbp->entityID, bfp->procid,
806 OMPROC_VIEW, bfp->userkey);
807 if (omudp != NULL) {
808 omudp->userdata.ptrvalue = (Pointer) bfp;
809 omudp->messagefunc = BioseqViewMsgFunc;
810 }
811 }
812 }
813 }
814 }
815 BioseqUnlock (bsp);
816 ErrSetMessageLevel (level);
817 return str;
818 }
819
820 static int LIBCALLBACK SortDescrProc (VoidPtr vp1, VoidPtr vp2)
821
822 {
823 DocDescrPtr descr1;
824 DocDescrPtr descr2;
825
826 descr1 = (DocDescrPtr) vp1;
827 descr2 = (DocDescrPtr) vp2;
828 if (descr1 == NULL || descr2 == NULL) return 0;
829
830 if (descr1->entityID > descr2->entityID) return 1;
831 if (descr1->entityID < descr2->entityID) return -1;
832
833 if (descr1->itemtype > descr2->itemtype) return 1;
834 if (descr1->itemtype < descr2->itemtype) return -1;
835
836 if (descr1->itemID > descr2->itemID) return 1;
837 if (descr1->itemID < descr2->itemID) return -1;
838
839 if (descr1->docitem > descr2->docitem) return 1;
840 if (descr1->docitem < descr2->docitem) return -1;
841
842 return 0;
843 }
844
845 typedef struct lookforids {
846 Boolean isGED;
847 Boolean isNTorNWorNG;
848 Boolean isNC;
849 Boolean isTPA;
850 Boolean isAEorCH;
851 } LookForIDs, PNTR LookForIDsPtr;
852
853 static void LookForSeqIDs (BioseqPtr bsp, Pointer userdata)
854
855 {
856 LookForIDsPtr lfip;
857 SeqIdPtr sip;
858 TextSeqIdPtr tsip;
859
860 lfip = (LookForIDsPtr) userdata;
861 for (sip = bsp->id; sip != NULL; sip = sip->next) {
862 switch (sip->choice) {
863 case SEQID_GENBANK :
864 case SEQID_EMBL :
865 case SEQID_DDBJ :
866 lfip->isGED = TRUE;
867 tsip = (TextSeqIdPtr) sip->data.ptrvalue;
868 if (tsip != NULL) {
869 if (StringNCmp (tsip->accession, "AE", 2) == 0) {
870 lfip->isAEorCH = TRUE;
871 } else if (StringNCmp (tsip->accession, "CH", 2) == 0) {
872 lfip->isAEorCH = TRUE;
873 }
874 }
875 break;
876 case SEQID_TPG :
877 case SEQID_TPE :
878 case SEQID_TPD :
879 lfip->isTPA = TRUE;
880 break;
881 case SEQID_OTHER :
882 tsip = (TextSeqIdPtr) sip->data.ptrvalue;
883 if (tsip != NULL) {
884 if (StringNCmp (tsip->accession, "NC_", 3) == 0) {
885 lfip->isNC = TRUE;
886 } else if (StringNCmp (tsip->accession, "NT_", 3) == 0) {
887 lfip->isNTorNWorNG = TRUE;
888 } else if (StringNCmp (tsip->accession, "NW_", 3) == 0) {
889 lfip->isNTorNWorNG = TRUE;
890 } else if (StringNCmp (tsip->accession, "NG_", 3) == 0) {
891 lfip->isNTorNWorNG = TRUE;
892 }
893 }
894 break;
895 default :
896 break;
897 }
898 }
899 }
900
901 static void LookForGEDetc (
902 SeqEntryPtr topsep,
903 BoolPtr isGED,
904 BoolPtr isNTorNWorNG,
905 BoolPtr isNC,
906 BoolPtr isTPA,
907 BoolPtr isAEorCH
908 )
909
910 {
911 LookForIDs lfi;
912
913 MemSet ((Pointer) &lfi, 0, sizeof (LookForIDs));
914 VisitBioseqsInSep (topsep, (Pointer) &lfi, LookForSeqIDs);
915 *isGED = lfi.isGED;
916 *isNTorNWorNG = lfi.isNTorNWorNG;
917 *isNC = lfi.isNC;
918 *isTPA = lfi.isTPA;
919 *isAEorCH = lfi.isAEorCH;
920 }
921
922 static void LookForNonLocalID (BioseqPtr bsp, Pointer userdata)
923
924 {
925 BoolPtr isNonLocalPtr;
926 SeqIdPtr sip;
927
928 isNonLocalPtr = (BoolPtr) userdata;
929 for (sip = bsp->id; sip != NULL; sip = sip->next) {
930 switch (sip->choice) {
931 case SEQID_LOCAL :
932 break;
933 default :
934 *isNonLocalPtr = TRUE;
935 break;
936 }
937 }
938 }
939
940 static void LookForPubs (BioseqPtr bsp, Pointer userdata)
941
942 {
943 BoolPtr hasPub;
944
945 hasPub = (BoolPtr) userdata;
946 *hasPub = TRUE;
947 }
948
949 static void CheckVersionWithGi (BioseqPtr bsp, Pointer userdata)
950
951 {
952 Boolean hasGi = FALSE;
953 BoolPtr missingVersion;
954 SeqIdPtr sip;
955 TextSeqIdPtr tsip;
956 Boolean zeroVersion = FALSE;
957
958 for (sip = bsp->id; sip != NULL; sip = sip->next) {
959 switch (sip->choice) {
960 case SEQID_TPG:
961 case SEQID_TPE:
962 case SEQID_TPD:
963 case SEQID_GENBANK:
964 case SEQID_EMBL:
965 case SEQID_DDBJ:
966 tsip = (TextSeqIdPtr) sip->data.ptrvalue;
967 if (tsip != NULL && tsip->version == 0) {
968 zeroVersion = TRUE;
969 }
970 break;
971 case SEQID_GI :
972 hasGi = TRUE;
973 break;
974 default :
975 break;
976 }
977 }
978 if (hasGi && zeroVersion) {
979 missingVersion = (BoolPtr) userdata;
980 *missingVersion = TRUE;
981 }
982 }
983
984 static CharPtr relmodemsg1 = "Record cannot only have a local Seq-id for release mode";
985 static CharPtr relmodemsg2 = "Record must have a publication for release mode";
986 static CharPtr relmodemsg3 = "Record with gi must have version number for release mode";
987 static CharPtr relmodemsg4 = "Release mode failure";
988
989 static CharPtr RelModeFailText (
990 BioseqPtr bsp,
991 SeqEntryPtr usethetop,
992 SeqEntryPtr topsep
993 )
994
995 {
996 SeqMgrDescContext dcontext;
997 SeqMgrFeatContext fcontext;
998 Boolean missingVersion;
999 Boolean nonLocalID;
1000 Boolean hasPubs;
1001
1002 nonLocalID = FALSE;
1003 if (usethetop) {
1004 VisitBioseqsInSep (usethetop, (Pointer) &nonLocalID, LookForNonLocalID);
1005 } else {
1006 LookForNonLocalID (bsp, (Pointer) &nonLocalID);
1007 }
1008 if (! nonLocalID) {
1009 return StringSave (relmodemsg1);
1010 }
1011
1012 hasPubs = FALSE;
1013 if (usethetop) {
1014 if (VisitPubdescsInSep (usethetop, NULL, NULL) == 0) {
1015 return StringSave (relmodemsg2);
1016 }
1017 } else {
1018 if (SeqMgrGetNextDescriptor (bsp, NULL, Seq_descr_pub, &dcontext) == NULL) {
1019 if (SeqMgrGetNextFeature (bsp, NULL, SEQFEAT_PUB, 0, &fcontext) == NULL) {
1020 return StringSave (relmodemsg2);
1021 }
1022 }
1023 }
1024
1025 missingVersion = FALSE;
1026 VisitBioseqsInSep (topsep, (Pointer) &missingVersion, CheckVersionWithGi);
1027 if (missingVersion) {
1028 return StringSave (relmodemsg3);
1029 }
1030
1031 return StringSave (relmodemsg4);
1032 }
1033
1034 static Int2 asn2gb_line_estimate [27] = {
1035 0,
1036 1,
1037 1,
1038 1,
1039 1,
1040 1,
1041 1,
1042 1,
1043 1,
1044 1,
1045 1,
1046 1,
1047 2, /* organism */
1048 6, /* reference */
1049 4, /* primary */
1050 4, /* comment */
1051 1,
1052 4, /* source */
1053 6, /* feature */
1054 1,
1055 1,
1056 20, /* sequence */
1057 4, /* contig */
1058 1,
1059 1,
1060 1,
1061 1
1062 };
1063
1064 static Boolean PopulateFF (
1065 DoC d,
1066 SeqEntryPtr sep,
1067 BioseqPtr bsp,
1068 SeqEntryPtr usethetop,
1069 FmtType format,
1070 ModType mode,
1071 StlType style,
1072 FlgType flags,
1073 CstType custom
1074 )
1075
1076 {
1077 Asn2gbJobPtr ajp;
1078 BaseBlockPtr bbp;
1079 BlockType blocktype;
1080 BioseqSetPtr bssp;
1081 BioseqViewPtr bvp;
1082 Uint1Ptr cdsstatus;
1083 DocDescrPtr doscr;
1084 DocDescrPtr doscrp;
1085 Int2 estimate;
1086 XtraBlock extra;
1087 FeatBlockPtr fbp;
1088 FonT fnt;
1089 FlatStructPtr fsp;
1090 Int4 index;
1091 ErrSev level;
1092 Boolean rsult;
1093
1094 rsult = FALSE;
1095 if (d != NULL && sep != NULL && bsp != NULL && spop != NULL) {
1096 fnt = programFont;
1097 bvp = (BioseqViewPtr) GetObjectExtra (d);
1098 if (bvp != NULL && bvp->displayFont != NULL) {
1099 fnt = bvp->displayFont;
1100 }
1101 fsp = MemNew (sizeof (FlatStruct));
1102 if (fsp != NULL) {
1103 fsp->sep = sep;
1104 SetDocData (d, (Pointer) fsp, DocFreeFlat);
1105 level = ErrSetMessageLevel (SEV_MAX);
1106 MemSet ((Pointer) &extra, 0, sizeof (XtraBlock));
1107 if (usethetop != NULL && IS_Bioseq_set (usethetop)) {
1108 bssp = (BioseqSetPtr) usethetop->data.ptrvalue;
1109 ajp = asn2gnbk_setup (NULL, bssp, NULL, format, mode, style, flags, 0, custom, &extra);
1110 } else {
1111 ajp = asn2gnbk_setup (bsp, NULL, NULL, format, mode, style, flags, 0, custom, &extra);
1112 }
1113 if (ajp == NULL) return FALSE;
1114 fsp->ajp = ajp;
1115 fsp->numParagraphs = ajp->numParagraphs;
1116 fsp->paragraphs = ajp->paragraphArray;
1117 if (fsp->numParagraphs > 0 && fsp->paragraphs != NULL) {
1118 fsp->numdescr = 0;
1119 for (index = 0; index < fsp->numParagraphs; index++) {
1120 estimate = 1;
1121 bbp = fsp->paragraphs [index];
1122 if (bbp != NULL) {
1123 blocktype = bbp->blocktype;
1124 if (blocktype >= HEAD_BLOCK && blocktype <= TAIL_BLOCK) {
1125 estimate = asn2gb_line_estimate [(int) blocktype];
1126 }
1127 }
1128 AppendItem (d, FFPrintFunc, (Pointer) fsp, FALSE,
1129 estimate, &ffParFmt, &ffColFmt, fnt);
1130 if (bbp != NULL) {
1131 (fsp->numdescr)++;
1132 }
1133 }
1134 doscrp = (DocDescrPtr) MemNew (sizeof (DocDescrStruct) * (size_t) (fsp->numdescr + 1));
1135 fsp->descr = doscrp;
1136 cdsstatus = (Uint1Ptr) MemNew (sizeof (Uint1) * (size_t) (fsp->numdescr + 1));
1137 fsp->cdsstatus = cdsstatus;
1138 fsp->numdescr = 0;
1139 if (doscrp != NULL && cdsstatus != NULL) {
1140 for (index = 0; index < fsp->numParagraphs; index++) {
1141 bbp = fsp->paragraphs [index];
1142 if (bbp != NULL) {
1143 doscr = &(doscrp [fsp->numdescr]);
1144 doscr->entityID = bbp->entityID;
1145 doscr->itemID = bbp->itemID;
1146 doscr->itemtype = bbp->itemtype;
1147 doscr->docitem = index + 1;
1148 if (bbp->blocktype == FEATURE_BLOCK) {
1149 fbp = (FeatBlockPtr) bbp;
1150 if (fbp->featdeftype == FEATDEF_CDS) {
1151 cdsstatus [index] = CDS_UNTESTED;
1152 }
1153 }
1154 (fsp->numdescr)++;
1155 }
1156 }
1157 }
1158 HeapSort (doscrp, (size_t) fsp->numdescr, sizeof (DocDescrStruct), SortDescrProc);
1159 rsult = TRUE;
1160 }
1161 ErrSetMessageLevel (level);
1162 }
1163 }
1164 return rsult;
1165 }
1166
1167 static void LookForTpa (
1168 SeqDescrPtr sdp,
1169 Pointer userdata
1170 )
1171
1172 {
1173 BoolPtr hastpaP;
1174 ObjectIdPtr oip;
1175 UserObjectPtr uop;
1176
1177 if (sdp == NULL || sdp->choice != Seq_descr_user) return;
1178 uop = (UserObjectPtr) sdp->data.ptrvalue;
1179 if (uop == NULL) return;
1180
1181 oip = uop->type;
1182 if (oip == NULL) return;
1183 if (StringCmp (oip->str, "TpaAssembly") != 0) return;
1184
1185 hastpaP = (BoolPtr) userdata;
1186 *hastpaP = TRUE;
1187 }
1188
1189 static void LookForFarBsp (
1190 BioseqPtr bsp,
1191 Pointer userdata
1192 )
1193
1194 {
1195 BoolPtr doColorsP;
1196
1197 if (bsp == NULL) return;
1198 doColorsP = (BoolPtr) userdata;
1199 if (doColorsP == NULL) return;
1200
1201 if (bsp->repr == Seq_repr_seg && (! SegHasParts (bsp))) {
1202 *doColorsP = FALSE;
1203 } else if (bsp->repr == Seq_repr_delta && (! DeltaLitOnly (bsp))) {
1204 *doColorsP = FALSE;
1205 }
1206 }
1207
1208 static void LookForFarProds (
1209 SeqFeatPtr sfp,
1210 Pointer userdata
1211 )
1212
1213 {
1214 BoolPtr doColorsP;
1215
1216 if (sfp == NULL) return;
1217 doColorsP = (BoolPtr) userdata;
1218 if (doColorsP == NULL) return;
1219
1220 if (sfp->idx.subtype != FEATDEF_CDS) return;
1221 if (sfp->product == NULL) return;
1222 if (BioseqFindFromSeqLoc (sfp->product) == NULL) {
1223 *doColorsP = FALSE;
1224 }
1225 }
1226
1227 static void GbfLookFarFeatFetchPolicy (
1228 SeqDescrPtr sdp,
1229 Pointer userdata
1230 )
1231
1232 {
1233 BoolPtr forceOnlyNearFeatsP;
1234 ObjectIdPtr oip;
1235 UserFieldPtr ufp;
1236 UserObjectPtr uop;
1237
1238 if (sdp == NULL || sdp->choice != Seq_descr_user) return;
1239 forceOnlyNearFeatsP = (BoolPtr) userdata;
1240 if (forceOnlyNearFeatsP == NULL) return;
1241
1242 uop = (UserObjectPtr) sdp->data.ptrvalue;
1243 if (uop == NULL) return;
1244 oip = uop->type;
1245 if (oip == NULL) return;
1246 if (StringCmp (oip->str, "FeatureFetchPolicy") != 0) return;
1247
1248 for (ufp = uop->data; ufp != NULL; ufp = ufp->next) {
1249 oip = ufp->label;
1250 if (oip == NULL || ufp->data.ptrvalue == NULL) continue;
1251 if (StringCmp (oip->str, "Policy") == 0) {
1252 if (StringICmp ((CharPtr) ufp->data.ptrvalue, "OnlyNearFeatures") == 0) {
1253 *forceOnlyNearFeatsP = TRUE;
1254 }
1255 }
1256 }
1257 }
1258
1259 static void PopulateFlatFile (BioseqViewPtr bvp, FmtType format, FlgType flags)
1260
1261 {
1262 BioseqPtr bsp;
1263 SeqMgrFeatContext context;
1264 CstType custom = 0;
1265 DoC doc;
1266 Boolean doColors;
1267 Boolean doLockFarComponents = FALSE;
1268 Uint2 entityID;
1269 Int4 feats_with_product_count;
1270 FonT fnt;
1271 Boolean forceOnlyNearFeats = FALSE;
1272 FILE *fp;
1273 Boolean hastpaaligns;
1274 Int2 into;
1275 Boolean isAEorCH;
1276 Boolean isGED;
1277 Boolean isNTorNWorNG;
1278 Boolean isNC;
1279 Boolean isTPA;
1280 Int2 item;
1281 ErrSev level;
1282 Boolean lockFar = FALSE;
1283 Boolean lookupFar = FALSE;
1284 ModType mode = SEQUIN_MODE;
1285 SeqEntryPtr oldsep;
1286 Char path [PATH_MAX];
1287 BaR sb = NULL;
1288 SeqEntryPtr sep;
1289 SeqFeatPtr sfp;
1290 Int4 startsAt;
1291 CharPtr str;
1292 StlType style = NORMAL_STYLE;
1293 SeqViewProcsPtr svpp;
1294 SeqEntryPtr topsep;
1295 TexT txt;
1296 SeqEntryPtr usethetop = NULL;
1297 Int2 val;
1298
1299 if (bvp == NULL) return;
1300 if (bvp->hasTargetControl && bvp->ffModeCtrl != NULL) {
1301 val = GetValue (bvp->ffModeCtrl);
1302 switch (val) {
1303 case 1 :
1304 mode = RELEASE_MODE;
1305 break;
1306 case 2 :
1307 mode = ENTREZ_MODE;
1308 break;
1309 case 3 :
1310 mode = SEQUIN_MODE;
1311 break;
1312 case 4 :
1313 mode = DUMP_MODE;
1314 break;
1315 default :
1316 break;
1317 }
1318 }
1319 /* now using control instead of seqid type */
1320 if (bvp->ffStyleCtrl != NULL) {
1321 val = GetValue (bvp->ffStyleCtrl);
1322 switch (val) {
1323 case 1 :
1324 style = NORMAL_STYLE;
1325 lookupFar = TRUE;
1326 break;
1327 case 2 :
1328 style = SEGMENT_STYLE;
1329 lockFar = TRUE;
1330 break;
1331 case 3 :
1332 style = MASTER_STYLE;
1333 lockFar = TRUE;
1334 break;
1335 case 4 :
1336 style = CONTIG_STYLE;
1337 lookupFar = TRUE;
1338 break;
1339 default :
1340 break;
1341 }
1342 }
1343
1344 bsp = bvp->bsp;
1345 entityID = ObjMgrGetEntityIDForPointer (bsp);
1346 topsep = GetTopSeqEntryForEntityID (entityID);
1347 LookForGEDetc (topsep, &isGED, &isNTorNWorNG, &isNC, &isTPA, &isAEorCH);
1348 VisitDescriptorsInSep (topsep, (Pointer) &forceOnlyNearFeats, GbfLookFarFeatFetchPolicy);
1349
1350 if ((flags & SHOW_CONTIG_FEATURES) != 0 || (flags & SHOW_CONTIG_SOURCES) != 0) {
1351 if (isNTorNWorNG || isTPA) {
1352 lockFar = FALSE;
1353 lookupFar = TRUE;
1354 if (GetAppProperty ("InternalNcbiSequin") != NULL) {
1355 doLockFarComponents = TRUE;
1356 }
1357 } else {
1358 lockFar = TRUE;
1359 }
1360 }
1361 if (bvp->hasTargetControl && bvp->ffCustomBtn != NULL) {
1362 if (GetValue (bvp->ffCustomBtn) == 2) {
1363 flags |= REFSEQ_CONVENTIONS | SHOW_TRANCRIPTION | SHOW_PEPTIDE | FORCE_PRIMARY_BLOCK;
1364 }
1365 }
1366 if (bvp->hasTargetControl && bvp->ffRifCtrl != NULL) {
1367 val = GetValue (bvp->ffRifCtrl);
1368 switch (val) {
1369 case 1 :
1370 break;
1371 case 2 :
1372 custom |= HIDE_GENE_RIFS;
1373 break;
1374 case 3 :
1375 custom |= ONLY_GENE_RIFS;
1376 break;
1377 case 4 :
1378 custom |= NEWEST_PUBS;
1379 break;
1380 case 5 :
1381 custom |= OLDEST_PUBS;
1382 break;
1383 case 6 :
1384 custom |= ONLY_REVIEW_PUBS;
1385 break;
1386 case 7 :
1387 custom |= HIDE_ALL_PUBS;
1388 break;
1389 default :
1390 break;
1391 }
1392 }
1393 doc = NULL;
1394 txt = NULL;
1395 bsp = bvp->bsp;
1396 if (bvp->useScrollText) {
1397 txt = bvp->text;
1398 Reset (txt);
1399 Update ();
1400 } else {
1401 doc = bvp->doc;
1402 GetScrlParams (doc, NULL, &item, &into);
1403 sb = GetSlateVScrollBar ((SlatE) doc);
1404 Reset (doc);
1405 SetDocShade (doc, NULL, NULL, NULL, NULL);
1406 SetDocProcs (doc, NULL, NULL, NULL, NULL);
1407 SetDocCache (doc, NULL, NULL, NULL);
1408 Update ();
1409 SetDocAutoAdjust (doc, FALSE);
1410 }
1411 if (bsp == NULL) return;
1412 if (spop == NULL) {
1413 spop = StdPrintOptionsNew (NULL);
1414 if (spop != NULL) {
1415 spop->newline = "\r";
1416 spop->indent = "";
1417 } else {
1418 Message (MSG_ERROR, "StdPrintOptionsNew failed");
1419 }
1420 }
1421
1422 svpp = (SeqViewProcsPtr) GetAppProperty ("SeqDisplayForm");
1423 if (svpp != NULL) {
1424 if (svpp->lockFarComponents) {
1425 doLockFarComponents = TRUE;
1426 }
1427 }
1428
1429 if (mode == ENTREZ_MODE) {
1430 doLockFarComponents = FALSE;
1431 lockFar = FALSE;
1432 lookupFar = FALSE;
1433 flags = flags ^ (SHOW_CONTIG_FEATURES | SHOW_CONTIG_SOURCES | SHOW_FAR_TRANSLATION);
1434 }
1435
1436 if (doLockFarComponents) {
1437 entityID = ObjMgrGetEntityIDForPointer (bsp);
1438 sep = GetTopSeqEntryForEntityID (entityID);
1439 if (bvp->bsplist == NULL && lockFar) {
1440 bvp->bsplist = LockFarComponentsEx (sep, TRUE, FALSE, FALSE, NULL);
1441 }
1442 if (lookupFar) {
1443 feats_with_product_count = 0;
1444 sfp = SeqMgrGetNextFeature (bsp, NULL, 0, 0, &context);
1445 while (sfp != NULL) {
1446 if (sfp->product != NULL) {
1447 feats_with_product_count++;
1448 }
1449 sfp = SeqMgrGetNextFeature (bsp, sfp, 0, 0, &context);
1450 }
1451 if (feats_with_product_count > 500) {
1452 /* too many to lookup with older caching implementation - now sufficiently fast */
1453 /*
1454 lookupFar = FALSE;
1455 */
1456 }
1457 }
1458 if (lookupFar) {
1459 hastpaaligns = FALSE;
1460 VisitDescriptorsInSep (sep, (Pointer) &hastpaaligns, LookForTpa);
1461 LookupFarSeqIDs (sep, TRUE, TRUE, TRUE, FALSE, hastpaaligns, FALSE, TRUE);
1462 }
1463 }
1464
1465 sep = SeqMgrGetSeqEntryForData (bsp);
1466 entityID = ObjMgrGetEntityIDForChoice (sep);
1467 if (bvp->hasTargetControl) {
1468 if (bvp->viewWholeEntity) {
1469 sep = GetTopSeqEntryForEntityID (entityID);
1470 usethetop = sep;
1471 if (format == FTABLE_FMT) {
1472 custom |= SHOW_PROT_FTABLE;
1473 }
1474 } else if (ISA_na (bsp->mol) && bsp->repr == Seq_repr_seg) {
1475 sep = GetBestTopParentForData (entityID, bsp);
1476 } else if (ISA_aa (bsp->mol) && bsp->repr == Seq_repr_seg) {
1477 sep = GetBestTopParentForData (entityID, bsp);
1478 }
1479 } else {
1480 if (ISA_na (bsp->mol) || bsp->repr == Seq_repr_seg) {
1481 sep = GetBestTopParentForData (entityID, bsp);
1482 }
1483 }
1484 if (sep == NULL) return;
1485
1486 topsep = GetTopSeqEntryForEntityID (entityID);
1487 oldsep = SeqEntrySetScope (topsep);
1488
1489 WatchCursor ();
1490 ffColFmt.pixWidth = screenRect.right - screenRect.left;
1491 ffColFmt.pixInset = 8;
1492 /* LookForGEDetc (topsep, &isGED, &isNTorNWorNG, &isNC, &isTPA); */
1493 if ((flags & SHOW_CONTIG_FEATURES) != 0 || (flags & SHOW_CONTIG_SOURCES) != 0) {
1494 if (forceOnlyNearFeats) {
1495 flags |= ONLY_NEAR_FEATURES;
1496 } else if (isNTorNWorNG || isTPA) {
1497 flags |= ONLY_NEAR_FEATURES;
1498 } else if (isNC) {
1499 flags |= NEAR_FEATURES_SUPPRESS;
1500 } else if (isAEorCH) {
1501 flags |= NEAR_FEATURES_SUPPRESS;
1502 }
1503 }
1504 if (bvp->useScrollText) {
1505 TmpNam (path);
1506 fp = FileOpen (path, "w");
1507 if (fp != NULL) {
1508 level = ErrSetMessageLevel (SEV_MAX);
1509 if (SeqEntryToGnbk (sep, NULL, format, mode, style, flags, 0, custom, NULL, fp)) {
1510 FileClose (fp);
1511 if (! FileToScrollText (txt, path)) {
1512 SetTitle (txt, "(Text is too large to be displayed in this control.)");
1513 }
1514 } else if (mode == RELEASE_MODE) {
1515 str = RelModeFailText (bsp, usethetop, topsep);
1516 if (str != NULL) {
1517 fprintf (fp, "%s", str);
1518 }
1519 FileClose (fp);
1520 if (str != NULL) {
1521 FileToScrollText (txt, path);
1522 }
1523 MemFree (str);
1524 } else {
1525 FileClose (fp);
1526 }
1527 ErrSetMessageLevel (level);
1528 }
1529 FileRemove (path);
1530 } else {
1531 if (PopulateFF (doc, sep, bsp, usethetop, format, mode, style, flags, custom)) {
1532 doColors = TRUE;
1533 /*
1534 VisitBioseqsInSep (topsep, (Pointer) &doColors, LookForFarBsp);
1535 if (doColors) {
1536 VisitFeaturesInSep (topsep, (Pointer) &doColors, LookForFarProds);
1537 }
1538 if (doColors) {
1539 SetDocShade (doc, DrawIcon, NULL, NULL, ColorIcon);
1540 } else {
1541 SetDocShade (doc, DrawIcon, NULL, NULL, NULL);
1542 }
1543 */
1544 SetDocShade (doc, DrawIcon, NULL, NULL, NULL);
1545 SetDocProcs (doc, ClickIcon, NULL, ReleaseIcon, NULL);
1546 SetDocCache (doc, StdPutDocCache, StdGetDocCache, StdResetDocCache);
1547 SetDocAutoAdjust (doc, FALSE);
1548 ForceFormat (doc, item);
1549 SetDocAutoAdjust (doc, TRUE);
1550 AdjustDocScroll (doc);
1551 GetItemParams4 (doc, item, &startsAt, NULL, NULL, NULL, NULL);
1552 CorrectBarValue (sb, startsAt + into);
1553 UpdateDocument (doc, 0, 0);
1554 } else if (mode == RELEASE_MODE) {
1555 str = RelModeFailText (bsp, usethetop, topsep);
1556 if (str != NULL) {
1557 fnt = programFont;
1558 if (bvp != NULL && bvp->displayFont != NULL) {
1559 fnt = bvp->displayFont;
1560 }
1561 AppendText (doc, str, &ffParFmt, &ffColFmt, fnt);
1562 }
1563 MemFree (str);
1564 UpdateDocument (doc, 0, 0);
1565 }
1566 }
1567
1568 SeqEntrySetScope (oldsep);
1569
1570 ArrowCursor ();
1571 Update ();
1572 }
1573
1574 static void PopulateGenBank (BioseqViewPtr bvp)
1575
1576 {
1577 PopulateFlatFile (bvp, GENBANK_FMT, SHOW_CONTIG_FEATURES | SHOW_CONTIG_SOURCES | SHOW_FAR_TRANSLATION);
1578 }
1579
1580 static void PopulateEMBL (BioseqViewPtr bvp)
1581
1582 {
1583 if (bvp == NULL) return;
1584 if (bvp->hasTargetControl) {
1585 PopulateFlatFile (bvp, EMBL_FMT, 0);
1586 } else {
1587 PopulateFlatFile (bvp, EMBL_FMT, 0);
1588 }
1589 }
1590
1591 static void PopulateDDBJ (BioseqViewPtr bvp)
1592
1593 {
1594 PopulateFlatFile (bvp, GENBANK_FMT, DDBJ_VARIANT_FORMAT);
1595 }
1596
1597 static void PopulateGenPept (BioseqViewPtr bvp)
1598
1599 {
1600 PopulateFlatFile (bvp, GENPEPT_FMT, 0);
1601 }
1602
1603 static void PopulateFTable (BioseqViewPtr bvp)
1604
1605 {
1606 PopulateFlatFile (bvp, FTABLE_FMT, 0);
1607 }
1608
1609 static void PopulateFasta (BioseqViewPtr bvp)
1610
1611 {
1612 BioseqPtr bsp;
1613 DoC doc;
1614 Uint2 entityID;
1615 Boolean fastaOK;
1616 Boolean fastaNucOK;
1617 Boolean fastaPrtOK;
1618 FonT fnt;
1619 FILE *fp;
1620 Uint1 group_segs;
1621 Int2 into = 0;
1622 Int2 item = 0;
1623 Boolean master_style;
1624 Char path [PATH_MAX];
1625 BaR sb = NULL;
1626 SeqEntryPtr sep;
1627 Int4 startsAt = 0;
1628 SeqViewProcsPtr svpp;
1629 TexT txt;
1630
1631 if (bvp == NULL) return;
1632 doc = NULL;
1633 txt = NULL;
1634 bsp = bvp->bsp;
1635 if (bvp->useScrollText) {
1636 txt = bvp->text;
1637 Reset (txt);
1638 Update ();
1639 } else {
1640 doc = bvp->doc;
1641 GetScrlParams (doc, NULL, &item, &into);
1642 sb = GetSlateVScrollBar ((SlatE) doc);
1643 Reset (doc);
1644 SetDocShade (doc, NULL, NULL, NULL, NULL);
1645 SetDocProcs (doc, NULL, NULL, NULL, NULL);
1646 SetDocCache (doc, NULL, NULL, NULL);
1647 Update ();
1648 SetDocAutoAdjust (doc, FALSE);
1649 }
1650 if (bsp == NULL) return;
1651
1652 svpp = (SeqViewProcsPtr) GetAppProperty ("SeqDisplayForm");
1653 if (svpp != NULL && svpp->lockFarComponents) {
1654 entityID = ObjMgrGetEntityIDForPointer (bsp);
1655 sep = GetTopSeqEntryForEntityID (entityID);
1656 if (bvp->bsplist == NULL) {
1657 bvp->bsplist = LockFarComponentsEx (sep, TRUE, FALSE, FALSE, NULL);
1658 }
1659 }
1660
1661 sep = SeqMgrGetSeqEntryForData (bsp);
1662 if (bvp->hasTargetControl) {
1663 if (bvp->viewWholeEntity) {
1664 entityID = ObjMgrGetEntityIDForChoice (sep);
1665 sep = GetTopSeqEntryForEntityID (entityID);
1666 }
1667 } else {
1668 if (ISA_na (bsp->mol) || bsp->repr == Seq_repr_seg) {
1669 entityID = ObjMgrGetEntityIDForChoice (sep);
1670 sep = GetBestTopParentForData (entityID, bsp);
1671 }
1672 }
1673 if (sep == NULL) return;
1674
1675 WatchCursor ();
1676 ffColFmt.pixWidth = screenRect.right - screenRect.left;
1677 ffColFmt.pixInset = 8;
1678 TmpNam (path);
1679 fp = FileOpen (path, "w");
1680 if (fp != NULL) {
1681 fnt = programFont;
1682 if (bvp != NULL && bvp->displayFont != NULL) {
1683 fnt = bvp->displayFont;
1684 }
1685 fastaOK = FALSE;
1686 fastaNucOK = FALSE;
1687 fastaPrtOK = FALSE;
1688 if (ISA_na (bsp->mol)) {TRUE,
1689 group_segs = 0;
1690 master_style = FALSE;
1691 if (bvp->hasTargetControl) {
1692 if (bvp->viewWholeEntity) {
1693 if (bsp->repr == Seq_repr_seg) {
1694 group_segs = 2;
1695 }
1696 /*
1697 fastaNucOK = SeqEntrysToFasta (sep, fp, TRUE, group_segs);
1698 fastaPrtOK = SeqEntrysToFasta (sep, fp, FALSE, 0);
1699 */
1700 if (SeqEntryFastaStream (sep, fp, STREAM_EXPAND_GAPS | STREAM_CORRECT_INVAL,
1701 70, 0, 0, TRUE, FALSE, master_style) > 0)
1702 {
1703 fastaNucOK = TRUE;
1704 }
1705 else
1706 {
1707 fastaNucOK = FALSE;
1708 }
1709 if (SeqEntryFastaStream (sep, fp, STREAM_EXPAND_GAPS | STREAM_CORRECT_INVAL,
1710 70, 0, 0, FALSE, TRUE, master_style) > 0)
1711 {
1712 fastaPrtOK = TRUE;
1713 }
1714 else
1715 {
1716 fastaPrtOK = FALSE;
1717 }
1718 fastaOK = fastaNucOK || fastaPrtOK;
1719 } else {
1720 if (bsp->repr == Seq_repr_seg) {
1721 group_segs = 1;
1722 master_style = TRUE;
1723 } else if (bsp->repr == Seq_repr_delta) {
1724 group_segs = 3;
1725 }
1726 /*
1727 fastaOK = SeqEntrysToFasta (sep, fp, TRUE, group_segs);
1728 */
1729 if (SeqEntryFastaStream (sep, fp, STREAM_EXPAND_GAPS | STREAM_CORRECT_INVAL,
1730 70, 0, 0, TRUE, FALSE, master_style) > 0)
1731 {
1732 fastaOK = TRUE;
1733 }
1734 else
1735 {
1736 fastaOK = FALSE;
1737 }
1738 }
1739 } else {
1740 if (bsp->repr == Seq_repr_seg) {
1741 group_segs = 1;
1742 master_style = TRUE;
1743 } else if (bsp->repr == Seq_repr_delta) {
1744 group_segs = 3;
1745 }
1746 /*
1747 fastaOK = SeqEntrysToFasta (sep, fp, TRUE, group_segs);
1748 */
1749 if (SeqEntryFastaStream (sep, fp, STREAM_EXPAND_GAPS | STREAM_CORRECT_INVAL,
1750 70, 0, 0, TRUE, FALSE, master_style) > 0)
1751 {
1752 fastaOK = TRUE;
1753 }
1754 else
1755 {
1756 fastaOK = FALSE;
1757 }
1758 }
1759 } else if (ISA_aa (bsp->mol)) {
1760 /*
1761 fastaOK = SeqEntrysToFasta (sep, fp, FALSE, 0);
1762 */
1763 if (SeqEntryFastaStream (sep, fp, STREAM_EXPAND_GAPS | STREAM_CORRECT_INVAL,
1764 70, 0, 0, FALSE, TRUE, FALSE) > 0)
1765 {
1766 fastaOK = TRUE;
1767 }
1768 else
1769 {
1770 fastaOK = FALSE;
1771 }
1772 }
1773 if (fastaOK) {
1774 FileClose (fp);
1775 if (bvp->useScrollText) {
1776 if (! FileToScrollText (txt, path)) {
1777 SetTitle (txt, "(Text is too large to be displayed in this control.)");
1778 }
1779 } else {
1780 DisplayFancy (doc, path, &ffParFmt, &ffColFmt, fnt, 4);
1781 SetDocCache (doc, StdPutDocCache, StdGetDocCache, StdResetDocCache);
1782 SetDocAutoAdjust (doc, FALSE);
1783 ForceFormat (doc, item);
1784 SetDocAutoAdjust (doc, TRUE);
1785 AdjustDocScroll (doc);
1786 GetItemParams4 (doc, item, &startsAt, NULL, NULL, NULL, NULL);
1787 CorrectBarValue (sb, startsAt + into);
1788 UpdateDocument (doc, 0, 0);
1789 }
1790 } else {
1791 FileClose (fp);
1792 }
1793 }
1794 FileRemove (path);
1795 ArrowCursor ();
1796 Update ();
1797 }
1798
1799 static void PrintQualProc (CharPtr buf, Uint4 buflen, Pointer userdata)
1800
1801 {
1802 FILE *fp;
1803
1804 fp = (FILE*) userdata;
1805 fprintf (fp, "%s", buf);
1806 }
1807
1808 static void PrintQualScoresProc (SeqEntryPtr sep, Pointer mydata, Int4 index, Int2 indent)
1809
1810 {
1811 BioseqPtr bsp;
1812 FILE *fp;
1813
1814 if (! IS_Bioseq (sep)) return;
1815 bsp = (BioseqPtr) sep->data.ptrvalue;
1816 if (bsp == NULL) return;
1817 fp = (FILE*) mydata;
1818 PrintQualityScoresToBuffer (bsp, FALSE, fp, PrintQualProc);
1819 }
1820
1821 static void PrintFarQualScoresProc (SeqEntryPtr sep, Pointer mydata, Int4 index, Int2 indent)
1822
1823 {
1824 BioseqPtr bsp;
1825 FILE *fp;
1826
1827 if (! IS_Bioseq (sep)) return;
1828 bsp = (BioseqPtr) sep->data.ptrvalue;
1829 if (bsp == NULL) return;
1830 fp = (FILE*) mydata;
1831 PrintQualityScoresForContig (bsp, FALSE, fp);
1832 }
1833
1834 static void PopulateQuality (BioseqViewPtr bvp)
1835
1836 {
1837 BioseqPtr bsp;
1838 DoC doc;
1839 Uint2 entityID;
1840 FonT fnt;
1841 FILE *fp;
1842 Int2 into;
1843 Int2 item = 0;
1844 Char path [PATH_MAX];
1845 BaR sb = NULL;
1846 SeqEntryPtr sep;
1847 Int4 startsAt;
1848 TexT txt;
1849
1850 if (bvp == NULL) return;
1851 doc = NULL;
1852 txt = NULL;
1853 bsp = bvp->bsp;
1854 if (bvp->useScrollText) {
1855 txt = bvp->text;
1856 Reset (txt);
1857 Update ();
1858 } else {
1859 doc = bvp->doc;
1860 GetScrlParams (doc, NULL, &item, &into);
1861 sb = GetSlateVScrollBar ((SlatE) doc);
1862 Reset (doc);
1863 SetDocShade (doc, NULL, NULL, NULL, NULL);
1864 SetDocProcs (doc, NULL, NULL, NULL, NULL);
1865 SetDocCache (doc, NULL, NULL, NULL);
1866 Update ();
1867 SetDocAutoAdjust (doc, FALSE);
1868 }
1869 if (bsp == NULL) return;
1870 sep = SeqMgrGetSeqEntryForData (bsp);
1871 if (bvp->hasTargetControl) {
1872 if (bvp->viewWholeEntity) {
1873 entityID = ObjMgrGetEntityIDForChoice (sep);
1874 sep = GetTopSeqEntryForEntityID (entityID);
1875 }
1876 } else {
1877 if (ISA_na (bsp->mol) || bsp->repr == Seq_repr_seg) {
1878 entityID = ObjMgrGetEntityIDForChoice (sep);
1879 sep = GetBestTopParentForData (entityID, bsp);
1880 }
1881 }
1882 if (sep == NULL) return;
1883
1884 WatchCursor ();
1885 ffColFmt.pixWidth = screenRect.right - screenRect.left;
1886 ffColFmt.pixInset = 8;
1887 TmpNam (path);
1888 fp = FileOpen (path, "w");
1889 if (fp != NULL) {
1890 fnt = programFont;
1891 if (bvp != NULL && bvp->displayFont != NULL) {
1892 fnt = bvp->displayFont;
1893 }
1894 if (VisitGraphsInSep (sep, NULL, NULL) > 0) {
1895 SeqEntryExplore (sep, (Pointer) fp, PrintQualScoresProc);
1896 } else if (bsp->repr == Seq_repr_delta) {
1897 SeqEntryExplore (sep, (Pointer) fp, PrintFarQualScoresProc);
1898 } else {
1899 SeqEntryExplore (sep, (Pointer) fp, PrintQualScoresProc);
1900 }
1901 FileClose (fp);
1902 if (bvp->useScrollText) {
1903 if (! FileToScrollText (txt, path)) {
1904 SetTitle (txt, "(Text is too large to be displayed in this control.)");
1905 }
1906 } else {
1907 DisplayFancy (doc, path, &ffParFmt, &ffColFmt, fnt, 4);
1908 SetDocCache (doc, StdPutDocCache, StdGetDocCache, StdResetDocCache);
1909 SetDocAutoAdjust (doc, FALSE);
1910 ForceFormat (doc, item);
1911 SetDocAutoAdjust (doc, TRUE);
1912 AdjustDocScroll (doc);
1913 GetItemParams4 (doc, item, &startsAt, NULL, NULL, NULL, NULL);
1914 CorrectBarValue (sb, startsAt + into);
1915 UpdateDocument (doc, 0, 0);
1916 }
1917 }
1918 FileRemove (path);
1919 ArrowCursor ();
1920 Update ();
1921 }
1922
1923 NLM_EXTERN void AsnPrintNewLine PROTO((AsnIoPtr aip));
1924
1925 static void PopulateAsnOrXML (BioseqViewPtr bvp, CharPtr outmode, Boolean doGbseq)
1926
1927 {
1928 AsnIoPtr aipout = NULL;
1929 AsnTypePtr atp = NULL;
1930 BioseqPtr bsp;
1931 CstType custom = 0;
1932 DoC doc;
1933 Uint2 entityID;
1934 XtraPtr extra = NULL;
1935 FlgType flags = CREATE_XML_GBSEQ_FILE;
1936 FonT fnt;
1937 FmtType format = GENBANK_FMT;
1938 GBSeq gbsq;
1939 GBSet gbst;
1940 Int2 into = 0;
1941 Int2 item = 0;
1942 Boolean lockFar = FALSE;
1943 Boolean lookupFar = FALSE;
1944 ModType mode = SEQUIN_MODE;
1945 Char path [PATH_MAX];
1946 BaR sb = NULL;
1947 SeqEntryPtr sep;
1948 Int4 startsAt = 0;
1949 StlType style = NORMAL_STYLE;
1950 TexT txt;
1951 Int2 val;
1952 Char xmlbuf [128];
1953 XtraBlock xtra;
1954
1955 if (bvp == NULL) return;
1956 doc = NULL;
1957 txt = NULL;
1958 bsp = bvp->bsp;
1959 if (bvp->useScrollText) {
1960 txt = bvp->text;
1961 Reset (txt);
1962 Update ();
1963 } else {
1964 doc = bvp->doc;
1965 GetScrlParams (doc, NULL, &item, &into);
1966 sb = GetSlateVScrollBar ((SlatE) doc);
1967 Reset (doc);
1968 SetDocShade (doc, NULL, NULL, NULL, NULL);
1969 SetDocProcs (doc, NULL, NULL, NULL, NULL);
1970 SetDocCache (doc, NULL, NULL, NULL);
1971 Update ();
1972 SetDocAutoAdjust (doc, FALSE);
1973 }
1974 if (bsp == NULL) return;
1975 sep = SeqMgrGetSeqEntryForData (bsp);
1976 if (bvp->hasTargetControl) {
1977 if (bvp->viewWholeEntity) {
1978 entityID = ObjMgrGetEntityIDForChoice (sep);
1979 sep = GetTopSeqEntryForEntityID (entityID);
1980 }
1981 } else {
1982 if (ISA_na (bsp->mol) || bsp->repr == Seq_repr_seg) {
1983 entityID = ObjMgrGetEntityIDForChoice (sep);
1984 sep = GetBestTopParentForData (entityID, bsp);
1985 }
1986 }
1987 if (sep == NULL) return;
1988
1989 WatchCursor ();
1990 ffColFmt.pixWidth = screenRect.right - screenRect.left;
1991 ffColFmt.pixInset = 8;
1992 TmpNam (path);
1993 aipout = AsnIoOpen (path, outmode);
1994 fnt = programFont;
1995 if (bvp != NULL && bvp->displayFont != NULL) {
1996 fnt = bvp->displayFont;
1997 }
1998 if (bsp != NULL && ISA_aa (bsp->mol)) {
1999 format = GENPEPT_FMT;
2000 }
2001 if (doGbseq && aipout != NULL) {
2002 if (bvp->hasTargetControl && bvp->ffModeCtrl != NULL) {
2003 val = GetValue (bvp->ffModeCtrl);
2004 switch (val) {
2005 case 1 :
2006 mode = RELEASE_MODE;
2007 break;
2008 case 2 :
2009 mode = ENTREZ_MODE;
2010 break;
2011 case 3 :
2012 mode = SEQUIN_MODE;
2013 break;
2014 case 4 :
2015 mode = DUMP_MODE;
2016 break;
2017 default :
2018 break;
2019 }
2020 }
2021 /* now using control instead of seqid type */
2022 if (bvp->ffStyleCtrl != NULL) {
2023 val = GetValue (bvp->ffStyleCtrl);
2024 switch (val) {
2025 case 1 :
2026 style = NORMAL_STYLE;
2027 lookupFar = TRUE;
2028 break;
2029 case 2 :
2030 style = SEGMENT_STYLE;
2031 lockFar = TRUE;
2032 break;
2033 case 3 :
2034 style = MASTER_STYLE;
2035 lockFar = TRUE;
2036 break;
2037 case 4 :
2038 style = CONTIG_STYLE;
2039 lookupFar = TRUE;
2040 break;
2041 default :
2042 break;
2043 }
2044 }
2045 if (bvp->hasTargetControl && bvp->ffCustomBtn != NULL) {
2046 if (GetValue (bvp->ffCustomBtn) == 2) {
2047 flags = REFSEQ_CONVENTIONS | SHOW_TRANCRIPTION | SHOW_PEPTIDE | FORCE_PRIMARY_BLOCK;
2048 }
2049 }
2050 if (bvp->hasTargetControl && bvp->ffRifCtrl != NULL) {
2051 val = GetValue (bvp->ffRifCtrl);
2052 switch (val) {
2053 case 1 :
2054 break;
2055 case 2 :
2056 custom |= HIDE_GENE_RIFS;
2057 break;
2058 case 3 :
2059 custom |= ONLY_GENE_RIFS;
2060 break;
2061 case 4 :
2062 custom |= NEWEST_PUBS;
2063 break;
2064 case 5 :
2065 custom |= OLDEST_PUBS;
2066 break;
2067 case 6 :
2068 custom |= ONLY_REVIEW_PUBS;
2069 break;
2070 case 7 :
2071 custom |= HIDE_ALL_PUBS;
2072 break;
2073 default :
2074 break;
2075 }
2076 }
2077 if (GetAppParam ("NCBI", "SETTINGS", "XMLPREFIX", NULL, xmlbuf, sizeof (xmlbuf))) {
2078 AsnSetXMLmodulePrefix (StringSave (xmlbuf));
2079 }
2080 objgbseqAsnLoad ();
2081 objinsdseqAsnLoad ();
2082 MemSet ((Pointer) &xtra, 0, sizeof (XtraBlock));
2083 MemSet ((Pointer) &gbsq, 0, sizeof (GBSeq));
2084 xtra.gbseq = &gbsq;
2085 xtra.aip = aipout;
2086 /*
2087 atp = AsnLinkType (NULL, AsnFind ("GBSet"));
2088 xtra.atp = AsnLinkType (NULL, AsnFind ("GBSet.E"));
2089 */
2090 atp = AsnLinkType (NULL, AsnFind ("INSDSet"));
2091 xtra.atp = AsnLinkType (NULL, AsnFind ("INSDSet.E"));
2092 extra = &xtra;
2093 MemSet ((Pointer) &gbst, 0, sizeof (GBSet));
2094 AsnOpenStruct (aipout, atp, (Pointer) &gbst);
2095 if (SeqEntryToGnbk (sep, NULL, format, mode, style, flags, 0, custom, extra, NULL)) {
2096 AsnCloseStruct (aipout, atp, NULL);
2097 AsnPrintNewLine (aipout);
2098 AsnIoClose (aipout);
2099 if (bvp->useScrollText) {
2100 if (! FileToScrollText (txt, path)) {
2101 SetTitle (txt, "(Text is too large to be displayed in this control.)");
2102 }
2103 } else {
2104 DisplayFancy (doc, path, &ffParFmt, &ffColFmt, fnt, 4);
2105 SetDocCache (doc, StdPutDocCache, StdGetDocCache, StdResetDocCache);
2106 SetDocAutoAdjust (doc, FALSE);
2107 ForceFormat (doc, item);
2108 SetDocAutoAdjust (doc, TRUE);
2109 AdjustDocScroll (doc);
2110 GetItemParams4 (doc, item, &startsAt, NULL, NULL, NULL, NULL);
2111 CorrectBarValue (sb, startsAt + into);
2112 UpdateDocument (doc, 0, 0);
2113 }
2114 } else {
2115 AsnIoClose (aipout);
2116 }
2117 } else if (aipout != NULL) {
2118 if (SeqEntryAsnWrite (sep, aipout, NULL)) {
2119 AsnIoClose (aipout);
2120 if (bvp->useScrollText) {
2121 if (! FileToScrollText (txt, path)) {
2122 SetTitle (txt, "(Text is too large to be displayed in this control.)");
2123 }
2124 } else {
2125 DisplayFancy (doc, path, &ffParFmt, &ffColFmt, fnt, 4);
2126 SetDocCache (doc, StdPutDocCache, StdGetDocCache, StdResetDocCache);
2127 SetDocAutoAdjust (doc, FALSE);
2128 ForceFormat (doc, item);
2129 SetDocAutoAdjust (doc, TRUE);
2130 AdjustDocScroll (doc);
2131 GetItemParams4 (doc, item, &startsAt, NULL, NULL, NULL, NULL);
2132 CorrectBarValue (sb, startsAt + into);
2133 UpdateDocument (doc, 0, 0);
2134 }
2135 } else {
2136 AsnIoClose (aipout);
2137 }
2138 }
2139 FileRemove (path);
2140 ArrowCursor ();
2141 Update ();
2142 }
2143
2144 static void PopulateXML (BioseqViewPtr bvp)
2145
2146 {
2147 PopulateAsnOrXML (bvp, "wx", FALSE);
2148 }
2149
2150 static void PopulateAsn (BioseqViewPtr bvp)
2151
2152 {
2153 PopulateAsnOrXML (bvp, "w", FALSE);
2154 }
2155
2156 static void PopulateGBSeq (BioseqViewPtr bvp)
2157
2158 {
2159 PopulateAsnOrXML (bvp, "wx", TRUE);
2160 }
2161
2162 static void ShowFlatFile (BioseqViewPtr bvp, Boolean show)
2163
2164 {
2165 if (bvp == NULL) return;
2166 if (show) {
2167 if (bvp->useScrollText) {
2168 SafeShow (bvp->text);
2169 } else {
2170 SafeShow (bvp->doc);
2171 }
2172 SafeShow (bvp->baseCtgControlGrp);
2173 SafeShow (bvp->modeControlGrp);
2174 SafeShow (bvp->extraControlGrp);
2175 SafeShow (bvp->docTxtControlGrp);
2176 SafeShow (bvp->clickMe);
2177 } else {
2178 SafeHide (bvp->text);
2179 SafeHide (bvp->doc);
2180 Reset (bvp->text);
2181 Reset (bvp->doc);
2182 SetDocShade (bvp->doc, NULL, NULL, NULL, NULL);
2183 SetDocProcs (bvp->doc, NULL, NULL, NULL, NULL);
2184 SetDocCache (bvp->doc, NULL, NULL, NULL);
2185 SafeHide (bvp->styleControlGrp);
2186 SafeHide (bvp->scaleControlGrp);
2187 EnableDisableLegendItem (bvp, FALSE);
2188 SafeHide (bvp->findGeneGrp);
2189 SafeHide (bvp->docTxtControlGrp);
2190 SafeHide (bvp->baseCtgControlGrp);
2191 SafeHide (bvp->modeControlGrp);
2192 SafeHide (bvp->extraControlGrp);
2193 SafeHide (bvp->newGphControlGrp);
2194 SafeHide (bvp->clickMe);
2195 }
2196 }
2197
2198 static void ShowFastaOrAsn (BioseqViewPtr bvp, Boolean show)
2199
2200 {
2201 if (bvp == NULL) return;
2202 if (show) {
2203 if (bvp->useScrollText) {
2204 SafeShow (bvp->text);
2205 } else {
2206 SafeShow (bvp->doc);
2207 }
2208 SafeHide (bvp->modeControlGrp);
2209 SafeHide (bvp->baseCtgControlGrp);
2210 SafeHide (bvp->extraControlGrp);
2211 SafeShow (bvp->docTxtControlGrp);
2212 SafeHide (bvp->clickMe);
2213 } else {
2214 SafeHide (bvp->text);
2215 SafeHide (bvp->doc);
2216 Reset (bvp->text);
2217 Reset (bvp->doc);
2218 SetDocShade (bvp->doc, NULL, NULL, NULL, NULL);
2219 SetDocProcs (bvp->doc, NULL, NULL, NULL, NULL);
2220 SetDocCache (bvp->doc, NULL, NULL, NULL);
2221 SafeHide (bvp->styleControlGrp);
2222 SafeHide (bvp->scaleControlGrp);
2223 EnableDisableLegendItem (bvp, FALSE);
2224 SafeHide (bvp->findGeneGrp);
2225 SafeHide (bvp->docTxtControlGrp);
2226 SafeHide (bvp->baseCtgControlGrp);
2227 SafeHide (bvp->modeControlGrp);
2228 SafeHide (bvp->extraControlGrp);
2229 SafeHide (bvp->newGphControlGrp);
2230 SafeHide (bvp->clickMe);
2231 }
2232 }
2233
2234 static void ShowGBSeq (BioseqViewPtr bvp, Boolean show)
2235
2236 {
2237 if (bvp == NULL) return;
2238 if (show) {
2239 if (bvp->useScrollText) {
2240 SafeShow (bvp->text);
2241 } else {
2242 SafeShow (bvp->doc);
2243 }
2244 SafeShow (bvp->modeControlGrp);
2245 SafeShow (bvp->baseCtgControlGrp);
2246 SafeShow (bvp->extraControlGrp);
2247 SafeShow (bvp->docTxtControlGrp);
2248 SafeHide (bvp->clickMe);
2249 } else {
2250 SafeHide (bvp->text);
2251 SafeHide (bvp->doc);
2252 Reset (bvp->text);
2253 Reset (bvp->doc);
2254 SetDocShade (bvp->doc, NULL, NULL, NULL, NULL);
2255 SetDocProcs (bvp->doc, NULL, NULL, NULL, NULL);
2256 SetDocCache (bvp->doc, NULL, NULL, NULL);
2257 SafeHide (bvp->styleControlGrp);
2258 SafeHide (bvp->scaleControlGrp);
2259 EnableDisableLegendItem (bvp, FALSE);
2260 SafeHide (bvp->findGeneGrp);
2261 SafeHide (bvp->docTxtControlGrp);
2262 SafeHide (bvp->baseCtgControlGrp);
2263 SafeHide (bvp->modeControlGrp);
2264 SafeHide (bvp->extraControlGrp);
2265 SafeHide (bvp->newGphControlGrp);
2266 SafeHide (bvp->clickMe);
2267 }
2268 }
2269
2270 static void SelectFlatFile (BioseqViewPtr bvp, Uint2 selentityID, Uint4 selitemID,
2271 Uint2 selitemtype, SeqLocPtr region,
2272 Boolean select, Boolean scrollto)
2273
2274 {
2275 Int2 bottom = 0;
2276 DoC doc;
2277 DocDescrPtr dsp;
2278 FlatStructPtr fsp;
2279 Uint2 entityID;
2280 Uint4 itemID;
2281 Uint2 itemtype;
2282 Int2 item;
2283 Boolean needToScroll;
2284 Int2 numItems;
2285 RecT rct;
2286 BaR sb;
2287 Int2 scrollhere;
2288 Int4 startsAt;
2289 WindoW tempPort;
2290 CharPtr text;
2291 Int2 top = 0;
2292
2293 if (bvp == NULL) return;
2294 if (! bvp->highlightSelections) return;
2295 if (bvp->useScrollText) return;
2296 doc = bvp->doc;
2297 if (doc == NULL) return;
2298 tempPort = SavePort (doc);
2299 Select (doc);
2300 GetDocParams (doc, &numItems, NULL);
2301 needToScroll = TRUE;
2302 scrollhere = 0;
2303 fsp = (FlatStructPtr) GetDocData (doc);
2304 if (fsp != NULL && fsp->descr != NULL && fsp->numdescr > 0) {
2305 if (GetScrlParams (doc, NULL, &item, NULL)) {
2306 while (item <= numItems && ItemIsVisible (doc, item, &top, &bottom, NULL)) {
2307 if (GetIDsFromDoc (doc, item, &entityID, &itemID, &itemtype)) {
2308 if (entityID == selentityID &&
2309 itemID == selitemID &&
2310 itemtype == selitemtype) {
2311 needToScroll = FALSE;
2312 ObjectRect (doc, &rct);
2313 InsetRect (&rct, 4, 4);
2314 rct.right = rct.left + 4;
2315 rct.top = top;
2316 rct.bottom = bottom;
2317 InsetRect (&rct, -1, -1);
2318 InvalRect (&rct);
2319 }
2320 }
2321 item++;
2322 }
2323 }
2324 dsp = FindFFPDocDescr (fsp->descr, fsp->numdescr,
2325 selentityID, selitemID, selitemtype);
2326 scrollhere = 0;
2327 if (dsp != NULL) {
2328 scrollhere = dsp->docitem;
2329 }
2330 if (scrollhere > 0) {
2331 if (ItemIsVisible (doc, scrollhere, &top, &bottom, NULL)) {
2332 needToScroll = FALSE;
2333 }
2334 ObjectRect (doc, &rct);
2335 InsetRect (&rct, 4, 4);
2336 rct.right = rct.left + 4;
2337 rct.top = top;
2338 rct.bottom = bottom;
2339 InsetRect (&rct, -1, -1);
2340 InvalRect (&rct);
2341 } else if (selitemtype == OBJ_BIOSEQ) { /* not preindexed in fsp descr */
2342 ObjectRect (doc, &rct);
2343 InsetRect (&rct, 4, 4);
2344 rct.right = rct.left + 4;
2345 rct.top = top;
2346 rct.bottom = bottom;
2347 InsetRect (&rct, -1, -1);
2348 InvalRect (&rct);
2349 }
2350 }
2351 /* for items currently not preindexed (LOCUS, ORGANISM), do a short linear search */
2352 if (/* scrollhere == 0 && */ selitemID > 0 /* && needToScroll */) {
2353 for (item = 1; item <= numItems && item < 10; item++) {
2354 if (GetIDsFromDoc (doc, item, &entityID, &itemID, &itemtype)) {
2355 if (entityID == selentityID &&
2356 itemID == selitemID &&
2357 itemtype == selitemtype) {
2358 /*
2359 if (ItemIsVisible (doc, item, &top, &bottom, NULL)) {
2360 needToScroll = FALSE;
2361 ObjectRect (doc, &rct);
2362 InsetRect (&rct, 4, 4);
2363 rct.right = rct.left + 4;
2364 rct.top = top;
2365 rct.bottom = bottom;
2366 InsetRect (&rct, -1, -1);
2367 InvalRect (&rct);
2368 } else if (scrollhere == 0) {
2369 scrollhere = item;
2370 }
2371 */
2372 if (needToScroll) {
2373 scrollhere = item;
2374 item = 10; /* break the for loop */
2375 }
2376 }
2377 }
2378 }
2379 }
2380 if (scrollto && needToScroll && scrollhere > 0 && selitemtype != OBJ_BIOSEQ) {
2381 text = GetDocText (doc, scrollhere, 0, 1); /* forces format if not before */
2382 MemFree (text);
2383 ForceFormat (doc, scrollhere); /* forces UpdateLineStarts */
2384 GetItemParams4 (doc, scrollhere, &startsAt, NULL, NULL, NULL, NULL);
2385 sb = GetSlateVScrollBar ((SlatE) doc);
2386 CorrectBarValue (sb, startsAt);
2387 ObjectRect (doc, &rct);
2388 InsetRect (&rct, 4, 4);
2389 InsetRect (&rct, -1, -1);
2390 InvalRect (&rct);
2391 }
2392 RestorePort (tempPort);
2393 }
2394
2395 static void CopyFlatFileFastaOrAsn (BioseqViewPtr bvp)
2396
2397 {
2398 FILE *fp;
2399 Char path [PATH_MAX];
2400
2401 if (bvp == NULL) return;
2402 if (bvp->useScrollText) {
2403 if (bvp->text != NULL) {
2404 CopyText (bvp->text);
2405 }
2406 } else {
2407 TmpNam (path);
2408 fp = FileOpen (path, "w");
2409 if (fp != NULL) {
2410 SaveDocument (bvp->doc, fp);
2411 FileClose (fp);
2412 FileToClipboard (path);
2413 }
2414 FileRemove (path);
2415 }
2416 }
2417
2418 #ifdef WIN_MOTIF
2419 extern CharPtr Nlm_XrmGetResource (const Char PNTR _resource);
2420 #endif
2421
2422 static void PrintFlatFileFastaOrAsn (BioseqViewPtr bvp)
2423
2424 {
2425 DoC doc;
2426 TexT txt;
2427 #ifdef WIN_MOTIF
2428 Char cmmd [256];
2429 Int2 len;
2430 CharPtr printCmd;
2431 Char str [PATH_MAX];
2432 #endif
2433
2434 if (bvp == NULL) return;
2435 if (bvp->bsp == NULL) return;
2436 doc = NULL;
2437 txt = NULL;
2438 if (bvp->useScrollText) {
2439 txt = bvp->text;
2440 } else {
2441 doc = bvp->doc;
2442 }
2443 if (doc != NULL) {
2444 PrintDocument (doc);
2445 } else if (txt != NULL) {
2446 #ifdef WIN_MOTIF
2447 TmpNam (str);
2448 ScrollTextToFile (txt, str);
2449 printCmd = Nlm_XrmGetResource ("printCommand");
2450 if (printCmd != NULL) {
2451 StringNCpy_0 (cmmd, printCmd, sizeof (cmmd) - 1);
2452 } else {
2453 StringCpy (cmmd, "lp -c");
2454 }
2455 MemFree (printCmd);
2456 len = (Int2) StringLen (cmmd);
2457 while (len > 0 && cmmd [len] == ' ') {
2458 cmmd [len] = '\0';
2459 len--;
2460 }
2461 StringCat (cmmd, " ");
2462 StringCat (cmmd, str);
2463 StringCat (cmmd, "; rm ");
2464 StringCat (cmmd, str);
2465 system (cmmd);
2466 /*
2467 FileRemove (str);
2468 */
2469 #endif
2470 }
2471 }
2472
2473 static void ExportFlatFileFastaOrAsnEx (BioseqViewPtr bvp, CharPtr filename, CharPtr dfault, Boolean specialSave)
2474
2475 {
2476 Char ch;
2477 Char dfaultFile [32];
2478 DoC doc;
2479 FILE *f;
2480 Int2 i;
2481 Int2 j;
2482 Int2 k;
2483 Int2 numItems;
2484 Char path [PATH_MAX];
2485 CharPtr str;
2486 TexT txt;
2487
2488 if (bvp == NULL) return;
2489 if (bvp->bsp == NULL) return;
2490 doc = NULL;
2491 txt = NULL;
2492 if (bvp->useScrollText) {
2493 txt = bvp->text;
2494 } else {
2495 doc = bvp->doc;
2496 }
2497 if (doc != NULL || txt != NULL) {
2498 dfault [0] = '\0';
2499 StringNCpy_0 (dfaultFile, dfault, sizeof (dfaultFile));
2500 j = 0;
2501 k = 0;
2502 ch = dfaultFile [j];
2503 while (j < sizeof (dfaultFile) && ch != '\0') {
2504 if (ch <= ' ') {
2505 j++;
2506 } else {
2507 dfaultFile [k] = dfaultFile [j];
2508 k++;
2509 j++;
2510 }
2511 ch = dfaultFile [j];
2512 }
2513 dfaultFile [k] = '\0';
2514 #ifdef WIN_MSWIN
2515 j = 0;
2516 ch = dfaultFile [j];
2517 while (j < sizeof (dfaultFile) && ch != '\0') {
2518 if (ch == '_' || IS_ALPHANUM (ch)) {
2519 j++;
2520 ch = dfaultFile [j];
2521 } else {
2522 ch = '\0';
2523 }
2524 }
2525 dfaultFile [j] = '\0';
2526 #endif
2527 path [0] = '\0';
2528 StringNCpy_0 (path, filename, sizeof (path));
2529 if (path [0] != '\0' || GetOutputFileName (path, sizeof (path), dfaultFile)) {
2530 WatchCursor ();
2531 #ifdef WIN_MAC
2532 f = FileOpen (path, "r");
2533 if (f != NULL) {
2534 FileClose (f);
2535 } else {
2536 FileCreate (path, "TEXT", "ttxt");
2537 }
2538 #endif
2539 if (filename == NULL || filename [0] == '\0') {
2540 f = FileOpen (path, "w");
2541 } else {
2542 f = FileOpen (path, "a");
2543 }
2544 if (f != NULL) {
2545 if (bvp->useScrollText) {
2546 ScrollTextToFile (txt, path);
2547 } else if (specialSave) {
2548 GetDocParams (doc, &numItems, NULL);
2549 for (i = 1; i <= numItems; i++) {
2550 str = GetDocText (doc, i, 0, 0);
2551 if (! StringHasNoText (str)) {
2552 fprintf (f, "%s", str);
2553 }
2554 MemFree (str);
2555 }
2556 } else {
2557 SaveDocument (doc, f);
2558 }
2559 FileClose (f);
2560 }
2561 ArrowCursor ();
2562 }
2563 }
2564 }
2565
2566 static void ExportFlatFileFastaOrAsn (BioseqViewPtr bvp, CharPtr filename, CharPtr dfault)
2567
2568 {
2569 ExportFlatFileFastaOrAsnEx (bvp, filename, dfault, FALSE);
2570 }
2571
2572 static void ExportFeatureTable (BioseqViewPtr bvp, CharPtr filename, CharPtr dfault)
2573
2574 {
2575 ExportFlatFileFastaOrAsnEx (bvp, filename, dfault, TRUE);
2576 }
2577
2578 static CharPtr asnconfirmmsg =
2579 "'Export' saves only the targeted portion of the record.\n\
2580 Use 'Save' to save the entire record to a file, so that\n\
2581 it can be submitted to the database. Proceed with export?";
2582
2583 static void ExportAsnAfterConfirming (BioseqViewPtr bvp, CharPtr filename, CharPtr dfault)
2584
2585 {
2586 MsgAnswer ans;
2587
2588 if (bvp->hasTargetControl) {
2589 ans = Message (MSG_YN, "%s", asnconfirmmsg);
2590 if (ans == ANS_NO) return;
2591 }
2592 ExportFlatFileFastaOrAsn (bvp, filename, dfault);
2593 }
2594
2595 static void ResizeFlatFileFastaOrAsn (BioseqViewPtr bvp)
2596
2597 {
2598 if (bvp == NULL) return;
2599 if (bvp->doc != NULL) {
2600 if (Visible (bvp->doc) && AllParentsVisible (bvp->doc)) {
2601 UpdateDocument (bvp->doc, 0, 0);
2602 }
2603 }
2604 }
2605
2606 BioseqPageData gbgnPageData = {
2607 "GenBank", FALSE, FALSE, TRUE, FALSE, -1,
2608 PopulateGenBank, ShowFlatFile, SelectFlatFile,
2609 CopyFlatFileFastaOrAsn, PrintFlatFileFastaOrAsn,
2610 ExportFlatFileFastaOrAsn, NULL, ResizeFlatFileFastaOrAsn, NULL
2611 };
2612
2613 BioseqPageData gnbkPageData = {
2614 "GenBank", TRUE, FALSE, FALSE, FALSE, -1,
2615 PopulateGenBank, ShowFlatFile, SelectFlatFile,
2616 CopyFlatFileFastaOrAsn, PrintFlatFileFastaOrAsn,
2617 ExportFlatFileFastaOrAsn, NULL, ResizeFlatFileFastaOrAsn, NULL
2618 };
2619
2620 BioseqPageData emblPageData = {
2621 "EMBL", TRUE, FALSE, FALSE, FALSE, -1,
2622 PopulateEMBL, ShowFlatFile, SelectFlatFile,
2623 CopyFlatFileFastaOrAsn, PrintFlatFileFastaOrAsn,
2624 ExportFlatFileFastaOrAsn, NULL, ResizeFlatFileFastaOrAsn, NULL
2625 };
2626
2627 BioseqPageData ddbjPageData = {
2628 "DDBJ", TRUE, FALSE, FALSE, FALSE, -1,
2629 PopulateDDBJ, ShowFlatFile, SelectFlatFile,
2630 CopyFlatFileFastaOrAsn, PrintFlatFileFastaOrAsn,
2631 ExportFlatFileFastaOrAsn, NULL, ResizeFlatFileFastaOrAsn, NULL
2632 };
2633
2634 BioseqPageData gnptPageData = {
2635 "GenPept", FALSE, TRUE, FALSE, FALSE, -1,
2636 PopulateGenPept, ShowFlatFile, SelectFlatFile,
2637 CopyFlatFileFastaOrAsn, PrintFlatFileFastaOrAsn,
2638 ExportFlatFileFastaOrAsn, NULL, ResizeFlatFileFastaOrAsn, NULL
2639 };
2640
2641 BioseqPageData ftblPageData = {
2642 "Table", TRUE, TRUE, TRUE, FALSE, -1,
2643 PopulateFTable, ShowFlatFile, SelectFlatFile,
2644 CopyFlatFileFastaOrAsn, PrintFlatFileFastaOrAsn,
2645 ExportFeatureTable, NULL, ResizeFlatFileFastaOrAsn, NULL
2646 };
2647
2648 BioseqPageData fstaPageData = {
2649 "FASTA", TRUE, TRUE, TRUE, FALSE, -1,
2650 PopulateFasta, ShowFastaOrAsn, NULL,
2651 CopyFlatFileFastaOrAsn, PrintFlatFileFastaOrAsn,
2652 ExportFlatFileFastaOrAsn, NULL, ResizeFlatFileFastaOrAsn, NULL
2653 };
2654
2655 BioseqPageData qualPageData = {
2656 "Quality", TRUE, TRUE, FALSE, FALSE, -1,
2657 PopulateQuality, ShowFastaOrAsn, NULL,
2658 CopyFlatFileFastaOrAsn, PrintFlatFileFastaOrAsn,
2659 ExportFlatFileFastaOrAsn, NULL, ResizeFlatFileFastaOrAsn, NULL
2660 };
2661
2662 BioseqPageData asnPageData = {
2663 "ASN.1", TRUE, TRUE, TRUE, FALSE, -1,
2664 PopulateAsn, ShowFastaOrAsn, NULL,
2665 CopyFlatFileFastaOrAsn, PrintFlatFileFastaOrAsn,
2666 ExportAsnAfterConfirming, NULL, ResizeFlatFileFastaOrAsn, NULL
2667 };
2668
2669 BioseqPageData xmlPageData = {
2670 "XML", TRUE, TRUE, TRUE, FALSE, -1,
2671 PopulateXML, ShowFastaOrAsn, NULL,
2672 CopyFlatFileFastaOrAsn, PrintFlatFileFastaOrAsn,
2673 ExportAsnAfterConfirming, NULL, ResizeFlatFileFastaOrAsn, NULL
2674 };
2675
2676 BioseqPageData gbseqPageData = {
2677 "INSDSeq", TRUE, TRUE, TRUE, FALSE, -1,
2678 PopulateGBSeq, ShowGBSeq, NULL,
2679 CopyFlatFileFastaOrAsn, PrintFlatFileFastaOrAsn,
2680 ExportAsnAfterConfirming, NULL, ResizeFlatFileFastaOrAsn, NULL
2681 };
2682
2683 |
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more information. |