~ubuntu-branches/ubuntu/saucy/ncbi-tools6/saucy-proposed

« back to all changes in this revision

Viewing changes to sequin/sequin1.c

  • Committer: Bazaar Package Importer
  • Author(s): Aaron M. Ucko
  • Date: 2009-08-11 22:03:47 UTC
  • mfrom: (1.4.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 10.
  • Revision ID: james.westby@ubuntu.com-20090811220347-g4b6lzdvphvvbpiu
* New upstream release.
* debian/libncbi6.symbols: update accordingly.
* debian/control: clean up obsolete or redundant relationship declarations.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
*
30
30
* Version Creation Date:   1/22/95
31
31
*
32
 
* $Revision: 6.693 $
 
32
* $Revision: 6.709 $
33
33
*
34
34
* File Description: 
35
35
*
131
131
#include <Gestalt.h>
132
132
#endif
133
133
 
134
 
#define SEQ_APP_VER "9.20"
 
134
#define SEQ_APP_VER "9.55"
135
135
 
136
136
CharPtr SEQUIN_APPLICATION = SEQ_APP_VER;
137
137
CharPtr SEQUIN_SERVICES = NULL;
280
280
static MenU     newDescMenu = NULL;
281
281
static MenU     newFeatMenu = NULL;
282
282
static MenU     advTableMenu = NULL;
283
 
static MenU     sucMenu = NULL;
 
283
static IteM     sucItem = NULL;
284
284
static MenU     newPubMenu = NULL;
285
285
static MenU     batchApplyMenu = NULL;
286
286
static MenU     batchEditMenu = NULL;
392
392
static void TaxonValidate (SeqEntryPtr sep, ValidStructPtr vsp);
393
393
 
394
394
 
395
 
static Boolean OkayToWriteTheEntity (Uint2 entityID, ForM f)
396
 
 
397
 
{
398
 
  Boolean         allRawOrSeg = TRUE;
399
 
  MsgAnswer       ans = ANS_OK;
400
 
  Int2            errors;
401
 
  Int2            j;
402
 
  ErrSev          oldErrSev;
403
 
  SeqEntryPtr     sep;
404
 
  Char            str [32];
405
 
  ValidStructPtr  vsp;
406
 
 
407
 
  if (entityID < 1) return FALSE;
 
395
typedef enum {
 
396
  eOkToWriteEntity_Cancel = 0,
 
397
  eOkToWriteEntity_Continue,
 
398
  eOkToWriteEntity_Validate
 
399
} EOkToWriteEntity;
 
400
 
 
401
static EOkToWriteEntity GetValidationCancelContinue (ValidStructPtr vsp, Boolean allow_review)
 
402
{
 
403
  WindoW w;
 
404
  GrouP  h, c, prompts;
 
405
  PrompT p1, p2;
 
406
  ButtoN b;
 
407
  ModalAcceptCancelData acd;
 
408
  CharPtr msg, msg_format = "Reject %d, Error %d, Warning %d, Info %d";
 
409
  EOkToWriteEntity rval = eOkToWriteEntity_Cancel;
 
410
  
 
411
  acd.accepted = FALSE;
 
412
  acd.cancelled = FALSE;
 
413
  acd.third_option = FALSE;
 
414
  
 
415
  w = ModalWindow(-20, -13, -10, -10, NULL);
 
416
  h = HiddenGroup (w, -1, 0, NULL);
 
417
  SetGroupSpacing (h, 10, 10);
 
418
  
 
419
  prompts = HiddenGroup (h, -1, 0, NULL);
 
420
  SetGroupSpacing (prompts, 10, 10);
 
421
  p1 = StaticPrompt (prompts, "Submission failed validation test with:", 0, 0, programFont, 'l');
 
422
 
 
423
  msg = (CharPtr) MemNew (sizeof (Char) * (StringLen (msg_format) + 75));
 
424
  sprintf (msg, msg_format, 
 
425
              (int) vsp->errors [4], (int) vsp->errors [3],
 
426
              (int) vsp->errors [2], (int) vsp->errors [1]);
 
427
  p2 = StaticPrompt (h, msg, 0, 0, programFont, 'l'); 
 
428
  msg = MemFree (msg);
 
429
  AlignObjects (ALIGN_CENTER, (HANDLE) p1, (HANDLE) p2, NULL);
 
430
 
 
431
  c = HiddenGroup (h, 3, 0, NULL);
 
432
  SetGroupSpacing (c, 10, 10);
 
433
  b = PushButton (c, "Continue", ModalAcceptButton);
 
434
  SetObjectExtra (b, &acd, NULL);
 
435
  if (allow_review) {
 
436
    b = PushButton (c, "Review Errors", ModalThirdOptionButton);
 
437
    SetObjectExtra (b, &acd, NULL);
 
438
  }
 
439
  b = PushButton (c, "Cancel", ModalCancelButton);
 
440
  SetObjectExtra (b, &acd, NULL);
 
441
  AlignObjects (ALIGN_CENTER, (HANDLE) prompts, (HANDLE) c, NULL);
 
442
  
 
443
  Show(w); 
 
444
  Select (w);
 
445
  while (!acd.accepted && ! acd.cancelled && ! acd.third_option)
 
446
  {
 
447
    ProcessExternalEvent ();
 
448
    Update ();
 
449
  }
 
450
  ProcessAnEvent ();
 
451
  Remove (w);
 
452
  if (acd.third_option) 
 
453
  {
 
454
    rval = eOkToWriteEntity_Validate;
 
455
  } 
 
456
  else if (acd.accepted)
 
457
  {
 
458
    rval = eOkToWriteEntity_Continue;
 
459
  }
 
460
  else
 
461
  {
 
462
    rval = eOkToWriteEntity_Cancel;
 
463
  }
 
464
  return rval;
 
465
}
 
466
 
 
467
 
 
468
static EOkToWriteEntity OkayToWriteTheEntity (Uint2 entityID, ForM f, Boolean allow_review)
 
469
 
 
470
{
 
471
  Boolean          allRawOrSeg = TRUE;
 
472
  EOkToWriteEntity rval = eOkToWriteEntity_Continue;
 
473
  Int2             errors;
 
474
  Int2             j;
 
475
  ErrSev           oldErrSev;
 
476
  SeqEntryPtr      sep;
 
477
  Char             str [32];
 
478
  ValidStructPtr   vsp;
 
479
 
 
480
  if (entityID < 1) return 0;
408
481
  sep = GetTopSeqEntryForEntityID (entityID);
409
 
  if (sep == NULL) return FALSE;
 
482
  if (sep == NULL) return 0;
410
483
 
411
 
  if (!FixSpecialCharacters (entityID)) return FALSE;
 
484
  if (!FixSpecialCharacters (entityID)) return 0;
412
485
 
413
486
  if (GetSequinAppParam ("PREFERENCES", "ASKBEFOREVALIDATE", NULL, str, sizeof (str))) {
414
487
    if (StringICmp (str, "TRUE") == 0) {
415
488
      if (! (subtoolMode ||smartnetMode || backupMode) ) {
416
 
        if (Message (MSG_YN, "Do you wish to validate this entry?") == ANS_NO) return TRUE;
 
489
        if (Message (MSG_YN, "Do you wish to validate this entry?") == ANS_NO) return 1;
417
490
      }
418
491
    }
419
492
  }
474
547
      ArrowCursor ();
475
548
      Update ();
476
549
      if (subtoolMode || smartnetMode || backupMode) {
477
 
        ans = Message (MSG_OKC, "%s\nReject %d, Error %d, Warning %d, Info %d\n%s",
478
 
                       "Submission failed validation test with:",
479
 
                       (int) vsp->errors [4], (int) vsp->errors [3],
480
 
                       (int) vsp->errors [2], (int) vsp->errors [1],
481
 
                       "Continue anyway?");
 
550
        rval = GetValidationCancelContinue (vsp, allow_review);
482
551
      } else {
483
 
        ans = Message (MSG_OKC, validFailMsg);
 
552
        if (Message (MSG_OKC, validFailMsg) == ANS_CANCEL) {
 
553
          rval = eOkToWriteEntity_Cancel;
 
554
        }
484
555
      }
485
556
    }
486
557
    ValidStructFree (vsp);
487
558
  }
488
559
  ArrowCursor ();
489
560
  Update ();
490
 
  if (ans != ANS_OK) {
491
 
    /*SetChecklistValue (checklistForm, 5);*/
492
 
    return FALSE;
493
 
  }
494
 
  return TRUE;
 
561
  return rval;
495
562
}
496
563
 
497
564
static void ReplaceString (CharPtr PNTR target, CharPtr newstr)
620
687
  return rsult;
621
688
}
622
689
 
 
690
static ValNodePtr ExtractGivenSeqDescrUserObject (ValNodePtr PNTR headptr, CharPtr str, CharPtr cls)
 
691
 
 
692
{
 
693
  Boolean        extract_it;
 
694
  ValNodePtr     last = NULL, vnp;
 
695
  ObjectIdPtr    oip;
 
696
  UserObjectPtr  uop;
 
697
 
 
698
  if (headptr == NULL) return NULL;
 
699
  vnp = *headptr;
 
700
 
 
701
  while (vnp != NULL) {
 
702
    extract_it = FALSE;
 
703
    if (vnp->choice == Seq_descr_user) {
 
704
      uop = (UserObjectPtr) vnp->data.ptrvalue;
 
705
      if (uop != NULL) {
 
706
        if (StringDoesHaveText (cls)) {
 
707
          if (StringICmp (uop->_class, cls) == 0) {
 
708
            extract_it = TRUE;
 
709
          }
 
710
        }
 
711
        if (StringDoesHaveText (str)) {
 
712
          oip = uop->type;
 
713
          if (oip != NULL) {
 
714
            if (StringICmp (oip->str, str) == 0) {
 
715
              extract_it = TRUE;
 
716
            }
 
717
          }
 
718
        }
 
719
      }
 
720
    }
 
721
    if (extract_it) {
 
722
      if (last == NULL) {
 
723
        *headptr = vnp->next;
 
724
      } else {
 
725
        last->next = vnp->next;
 
726
      }
 
727
      vnp->next = NULL;
 
728
      return vnp;
 
729
    } else {
 
730
      last = vnp;
 
731
      vnp = vnp->next;
 
732
    }
 
733
  }
 
734
 
 
735
  return NULL;
 
736
}
 
737
 
 
738
typedef struct propgenbankdata {
 
739
  Boolean  ask;
 
740
  Boolean  asked;
 
741
  Boolean  bail;
 
742
  Boolean  changed;
 
743
} PropGenbankData, PNTR PropGenBankPtr;
 
744
 
 
745
static void DoPropagateFromGenBankBioseqSet (
 
746
  BioseqSetPtr seqset,
 
747
  Pointer userdata
 
748
)
 
749
 
 
750
{
 
751
  BioseqPtr       bsp;
 
752
  BioseqSetPtr    bssp;
 
753
  PropGenBankPtr  pgp;
 
754
  SeqEntryPtr     seqentry;
 
755
  ValNodePtr      smartuserobj;
 
756
  ValNodePtr      sourcedescr;
 
757
  UserObjectPtr   uop;
 
758
 
 
759
  if (seqset == NULL) return;
 
760
  if (seqset->_class != BioseqseqSet_class_genbank) return;
 
761
  pgp = (PropGenBankPtr) userdata;
 
762
  if (pgp == NULL) return;
 
763
 
 
764
  seqentry = seqset->seq_set;
 
765
  sourcedescr = seqset->descr;
 
766
  if (sourcedescr == NULL) return;
 
767
 
 
768
  /* if only descriptor is tracking user object, skip */
 
769
  if (sourcedescr->next == NULL && sourcedescr->choice == Seq_descr_user) {
 
770
    uop = (UserObjectPtr) sourcedescr->data.ptrvalue;
 
771
    if (uop != NULL && StringICmp (uop->_class, "SMART_V1.0") == 0) return;
 
772
  }
 
773
 
 
774
  /* optionally ask if propagation is desired */
 
775
  if (pgp->ask) {
 
776
    if (! pgp->asked) {
 
777
      if (Message (MSG_YN, "Propagate descriptors from top-level set?") == ANS_NO) {
 
778
        pgp->bail = TRUE;
 
779
      }
 
780
      pgp->asked = TRUE;
 
781
    }
 
782
  }
 
783
  if (pgp->bail) return;
 
784
 
 
785
  /* disconnect descriptors from parent bssp */
 
786
  seqset->descr = NULL;
 
787
 
 
788
  /* extract tracking user object */
 
789
  smartuserobj = ExtractGivenSeqDescrUserObject (&sourcedescr, NULL, "SMART_V1.0");
 
790
 
 
791
  while (seqentry != NULL) {
 
792
    if (seqentry->data.ptrvalue != NULL) {
 
793
      if (seqentry->choice == 1) {
 
794
        bsp = (BioseqPtr) seqentry->data.ptrvalue;
 
795
        ValNodeLink (&(bsp->descr),
 
796
                     AsnIoMemCopy ((Pointer) sourcedescr,
 
797
                                   (AsnReadFunc) SeqDescrAsnRead,
 
798
                                   (AsnWriteFunc) SeqDescrAsnWrite));
 
799
      } else if (seqentry->choice == 2) {
 
800
        bssp = (BioseqSetPtr) seqentry->data.ptrvalue;
 
801
        ValNodeLink (&(bssp->descr),
 
802
                     AsnIoMemCopy ((Pointer) sourcedescr,
 
803
                                   (AsnReadFunc) SeqDescrAsnRead,
 
804
                                   (AsnWriteFunc) SeqDescrAsnWrite));
 
805
      }
 
806
      pgp->changed = TRUE;
 
807
    }
 
808
    seqentry = seqentry->next;
 
809
  }
 
810
 
 
811
  /* free extracted original descriptors now that copies are propagated */
 
812
  SeqDescrFree (sourcedescr);
 
813
 
 
814
  /* restore tracking user object */
 
815
  if (smartuserobj != NULL) {
 
816
    ValNodeLink (&(seqset->descr), smartuserobj);
 
817
  }
 
818
 
 
819
  /* recurse */
 
820
  VisitSetsInSet (seqset, userdata, DoPropagateFromGenBankBioseqSet);
 
821
}
 
822
 
623
823
extern Boolean PropagateFromGenBankBioseqSet (SeqEntryPtr sep, Boolean ask)
624
824
 
625
825
{
626
 
  BioseqPtr     bsp;
627
 
  BioseqSetPtr  bssp;
628
 
  Uint1         _class;
629
 
  SeqEntryPtr   seqentry;
630
 
  ValNodePtr    sourcedescr;
631
 
 
632
 
  if (sep != NULL) {
633
 
    if (sep->choice == 2 && sep->data.ptrvalue != NULL) {
634
 
      bssp = (BioseqSetPtr) sep->data.ptrvalue;
635
 
      _class = bssp->_class;
636
 
      sourcedescr = bssp->descr;
637
 
      if (sourcedescr == NULL) return FALSE;
638
 
      if (_class == 7) {
639
 
        if (ask) {
640
 
          if (Message (MSG_YN, "Propagate descriptors from top-level set?") == ANS_NO) return FALSE;
641
 
        }
642
 
        seqentry = bssp->seq_set;
643
 
        while (seqentry != NULL) {
644
 
          if (seqentry->data.ptrvalue != NULL) {
645
 
            if (seqentry->choice == 1) {
646
 
              bsp = (BioseqPtr) seqentry->data.ptrvalue;
647
 
              ValNodeLink (&(bsp->descr),
648
 
                           AsnIoMemCopy ((Pointer) sourcedescr,
649
 
                                         (AsnReadFunc) SeqDescrAsnRead,
650
 
                                         (AsnWriteFunc) SeqDescrAsnWrite));
651
 
            } else if (seqentry->choice == 2) {
652
 
              bssp = (BioseqSetPtr) seqentry->data.ptrvalue;
653
 
              ValNodeLink (&(bssp->descr),
654
 
                           AsnIoMemCopy ((Pointer) sourcedescr,
655
 
                                         (AsnReadFunc) SeqDescrAsnRead,
656
 
                                         (AsnWriteFunc) SeqDescrAsnWrite));
657
 
            }
658
 
          }
659
 
          seqentry = seqentry->next;
660
 
        }
661
 
        bssp = (BioseqSetPtr) sep->data.ptrvalue;
662
 
        bssp->descr = SeqDescrFree (bssp->descr);
663
 
        return TRUE;
664
 
      }
665
 
    }
666
 
  }
667
 
  return FALSE;
 
826
  BioseqSetPtr     bssp;
 
827
  PropGenbankData  pdp;
 
828
 
 
829
  if (sep == NULL) return FALSE;
 
830
  if (! IS_Bioseq_set (sep)) return FALSE;
 
831
 
 
832
  bssp = (BioseqSetPtr) sep->data.ptrvalue;
 
833
  if (bssp == NULL) return FALSE;
 
834
  if (bssp->_class != BioseqseqSet_class_genbank) return FALSE;
 
835
 
 
836
  MemSet ((Pointer) &pdp, 0, sizeof (PropGenbankData));
 
837
  pdp.ask = ask;
 
838
  pdp.asked = FALSE;
 
839
  pdp.bail = FALSE;
 
840
  pdp.changed = FALSE;
 
841
 
 
842
  DoPropagateFromGenBankBioseqSet (bssp, (Pointer) &pdp);
 
843
 
 
844
  return pdp.changed;
668
845
}
669
846
 
670
847
static void ForcePropagate (IteM i)
969
1146
      EntryCheckGBBlock (sep);
970
1147
      GetRidOfEmptyFeatsDescStrings (0, sep);
971
1148
      GetRidOfLocusInSeqIds (0, sep);
972
 
      if (OkayToWriteTheEntity (bfp->input_entityID, bfp->form)) {
 
1149
      if (OkayToWriteTheEntity (bfp->input_entityID, bfp->form, FALSE) == eOkToWriteEntity_Continue) {
973
1150
        /*SetChecklistValue (checklistForm, 7);*/
974
1151
        path [0] = '\0';
975
1152
        StringNCpy_0 (path, bfp->filepath, sizeof (path));
1241
1418
}
1242
1419
#endif
1243
1420
 
 
1421
static void LaunchValidatorForDone (BaseFormPtr bfp, SeqEntryPtr sep, FormActnFunc revalProc, FormActnFunc continueProc);
 
1422
static Boolean SmallInferenceAccnVer (ForM f);
 
1423
static void ValSeqEntryFormExEx (ForM f, Boolean doAligns, Int2 limit, Boolean inferenceAccnCheck, FormActnFunc revalProc, FormActnFunc doneProc);
 
1424
 
1244
1425
#ifdef USE_SMARTNET
1245
1426
static Boolean LIBCALLBACK AllGenBankOrRefSeq (BioseqPtr bsp, SeqMgrBioseqContextPtr bcontext)
1246
1427
 
1314
1495
  return FALSE;
1315
1496
}
1316
1497
 
1317
 
static void SmartnetDoneFunc (BaseFormPtr bfp)
 
1498
static void SmartnetDoneFuncEx (BaseFormPtr bfp, Boolean validate);
 
1499
static void SmartnetDoneNoValidateFunc (ForM f);
 
1500
 
 
1501
static void SmartnetDoneValidateFunc (ForM f)
 
1502
{
 
1503
  Boolean  inferenceAccnCheck;
 
1504
 
 
1505
  inferenceAccnCheck = SmallInferenceAccnVer (f);
 
1506
  ValSeqEntryFormExEx (f, TRUE, VALIDATE_ALL, inferenceAccnCheck, SmartnetDoneValidateFunc, SmartnetDoneNoValidateFunc);
 
1507
}
 
1508
 
 
1509
static void SmartnetDoneNoValidateFunc (ForM f)
 
1510
{
 
1511
  BaseFormPtr bfp;
 
1512
 
 
1513
  bfp = (BaseFormPtr) GetObjectExtra (f);
 
1514
  if (bfp == NULL) return;
 
1515
  SmartnetDoneFuncEx (bfp, FALSE);
 
1516
}
 
1517
 
 
1518
 
 
1519
static void SmartnetDoneFuncEx (BaseFormPtr bfp, Boolean validate)
1318
1520
 
1319
1521
{
1320
1522
    MsgAnswer     ans;
1331
1533
 
1332
1534
    Boolean       resetUpdateDate = TRUE;
1333
1535
    ValNodePtr    vnp;
 
1536
    EOkToWriteEntity continue_cancel_validate;
1334
1537
 
1335
1538
    if(bfp != NULL) {
1336
1539
        f = bfp->form;
1392
1595
            update = TRUE; /* because of NormalizeDescriptorOrder */
1393
1596
            SeqMgrClearFeatureIndexes (bfp->input_entityID, NULL);
1394
1597
 
1395
 
            if (! OkayToWriteTheEntity (bfp->input_entityID, f)) {
1396
 
                if (update && bfp != NULL) {
1397
 
                    ObjMgrSendMsg (OM_MSG_UPDATE, bfp->input_entityID, 0, 0);
1398
 
                }
1399
 
                return;
 
1598
            if (validate) {
 
1599
              continue_cancel_validate = OkayToWriteTheEntity (bfp->input_entityID, f, TRUE);
 
1600
              if (continue_cancel_validate == eOkToWriteEntity_Cancel) {
 
1601
                  if (update && bfp != NULL) {
 
1602
                      ObjMgrSendMsg (OM_MSG_UPDATE, bfp->input_entityID, 0, 0);
 
1603
                  }
 
1604
                  return;
 
1605
              } else if (continue_cancel_validate == eOkToWriteEntity_Validate) {
 
1606
                  /* launch validator */
 
1607
                  LaunchValidatorForDone (bfp, sep, SmartnetDoneValidateFunc, SmartnetDoneNoValidateFunc);
 
1608
                  return;
 
1609
              }
1400
1610
            }
1401
1611
            /* ans = Message (MSG_YN, "Reset Update Date?"); */
1402
1612
            ans = ANS_YES;
1461
1671
    }
1462
1672
}
1463
1673
 
 
1674
 
 
1675
static void SmartnetDoneFunc (BaseFormPtr bfp)
 
1676
{
 
1677
  SmartnetDoneFuncEx (bfp, TRUE);
 
1678
}
 
1679
 
 
1680
 
1464
1681
static void SmartnetDoneProc (IteM i)
1465
1682
 
1466
1683
{
1471
1688
}
1472
1689
#endif
1473
1690
 
1474
 
static void SubtoolDoneProc (IteM i)
1475
 
 
 
1691
 
 
1692
static void SubtoolDoneFuncEx (ForM f, Boolean validate);
 
1693
static void SubtoolDoneNoValidateFunc (ForM f);
 
1694
 
 
1695
static void SubtoolDoneValidateFunc (ForM f)
 
1696
{
 
1697
  Boolean  inferenceAccnCheck;
 
1698
 
 
1699
  inferenceAccnCheck = SmallInferenceAccnVer (f);
 
1700
  ValSeqEntryFormExEx (f, TRUE, VALIDATE_ALL, inferenceAccnCheck, SubtoolDoneValidateFunc, SubtoolDoneNoValidateFunc);
 
1701
}
 
1702
 
 
1703
 
 
1704
static void SubtoolDoneNoValidateFunc (ForM f)
 
1705
{
 
1706
        SubtoolDoneFuncEx (f, FALSE);
 
1707
}
 
1708
 
 
1709
 
 
1710
static void SubtoolDoneFuncEx (ForM form, Boolean validate)
1476
1711
{
1477
1712
  MsgAnswer    ans;
1478
1713
  BaseFormPtr  bfp;
1481
1716
  ValNodePtr   sdp;
1482
1717
  SeqEntryPtr  sep;
1483
1718
  Boolean      update;
 
1719
  EOkToWriteEntity continue_review_cancel;
1484
1720
 
1485
1721
  if (subtoolEntityID > 0) {
1486
1722
    sep = GetTopSeqEntryForEntityID (subtoolEntityID);
1504
1740
      NormalizeDescriptorOrder (sep);
1505
1741
      update = TRUE; /* because of NormalizeDescriptorOrder */
1506
1742
      f = NULL;
1507
 
      bfp = (BaseFormPtr) GetObjectExtra (i);
 
1743
      bfp = (BaseFormPtr) GetObjectExtra (form);
1508
1744
      if (bfp != NULL) {
1509
1745
        f = bfp->form;
1510
1746
      }
1511
1747
      SeqMgrClearFeatureIndexes (bfp->input_entityID, NULL);
1512
 
      if (! OkayToWriteTheEntity (subtoolEntityID, f)) {
1513
 
        if (update && bfp != NULL) {
1514
 
          ObjMgrSendMsg (OM_MSG_UPDATE, bfp->input_entityID, 0, 0);
 
1748
      if (validate) {
 
1749
        continue_review_cancel = OkayToWriteTheEntity (subtoolEntityID, f, validate);
 
1750
        if (continue_review_cancel == eOkToWriteEntity_Cancel) {
 
1751
          if (update && bfp != NULL) {
 
1752
            ObjMgrSendMsg (OM_MSG_UPDATE, bfp->input_entityID, 0, 0);
 
1753
          }
 
1754
          return;
 
1755
        } else if (continue_review_cancel == eOkToWriteEntity_Validate) {
 
1756
          /* launch validator */
 
1757
          LaunchValidatorForDone (bfp, sep, SubtoolDoneValidateFunc, SubtoolDoneNoValidateFunc);
 
1758
          return;
1515
1759
        }
1516
 
        return;
1517
1760
      }
1518
1761
      /* ans = Message (MSG_YN, "Reset Update Date?"); */
1519
1762
      ans = ANS_YES;
1545
1788
  }
1546
1789
  QuitProgram ();
1547
1790
}
 
1791
 
 
1792
 
 
1793
static void SubtoolDoneProc (IteM i)
 
1794
 
 
1795
{
 
1796
  BaseFormPtr  bfp;
 
1797
 
 
1798
  bfp = (BaseFormPtr) GetObjectExtra (i);
 
1799
  if (bfp != NULL) {
 
1800
    SubtoolDoneFuncEx (bfp->form, TRUE);
 
1801
  }
 
1802
}
1548
1803
#endif
1549
1804
 
1550
1805
static Boolean ReviewErrorsForValidationFailure (void)
1590
1845
  }
1591
1846
}
1592
1847
 
 
1848
 
 
1849
static void LaunchValidatorForDone (BaseFormPtr bfp, SeqEntryPtr sep, FormActnFunc revalProc, FormActnFunc continueProc)
 
1850
{
 
1851
  ValidStructPtr  vsp;
 
1852
  Int2            verbosity = 2;
 
1853
  Char            buf [32];
 
1854
  Boolean         allRawOrSeg = TRUE;
 
1855
  ErrHookProc     oldErrHook;
 
1856
  ErrSev          oldErrSev;
 
1857
  Int2            errors;
 
1858
  Int2            j;
 
1859
 
 
1860
  WatchCursor ();
 
1861
  Update ();
 
1862
  vsp = ValidStructNew ();
 
1863
  if (vsp != NULL) {
 
1864
    /*SetChecklistValue (checklistForm, 6);*/
 
1865
 
 
1866
    verbosity = 2;
 
1867
    if (GetSequinAppParam ("SETTINGS", "VALIDATEVERBOSITY", NULL, buf, sizeof (buf))) {
 
1868
      if (! StrToInt (buf, &verbosity)) {
 
1869
        verbosity = 2;
 
1870
      }
 
1871
    }
 
1872
 
 
1873
    CreateValidateWindowExEx (ValidNotify, "Sequin Validation Errors",
 
1874
                            programFont, SEV_INFO, verbosity, bfp, revalProc, continueProc, TRUE);
 
1875
    ClearValidateWindow ();
 
1876
    SeqEntryExplore (sep, (Pointer) (&allRawOrSeg), CheckForCookedBioseqs);
 
1877
    if (allRawOrSeg) {
 
1878
      vsp->useSeqMgrIndexes = TRUE;
 
1879
    }
 
1880
    HideValidateDoc ();
 
1881
    vsp->suppressContext = ShouldSetSuppressContext ();
 
1882
    vsp->justShowAccession = ShouldSetJustShowAccession ();
 
1883
    oldErrHook = ErrSetHandler (ValidErrHook);
 
1884
    oldErrSev = ErrSetMessageLevel (SEV_NONE);
 
1885
    vsp->validateAlignments = TRUE;
 
1886
    vsp->alignFindRemoteBsp = TRUE;
 
1887
    vsp->doSeqHistAssembly = FALSE;
 
1888
    for (j = 0; j < 6; j++) {
 
1889
      vsp->errors [j] = 0;
 
1890
    }
 
1891
    vsp->errfunc = ValidErrCallback;
 
1892
    ValidateSeqEntry (sep, vsp);
 
1893
    if (indexerVersion && useEntrez) {
 
1894
      TaxonValidate (sep, vsp);
 
1895
    }
 
1896
    ErrSetMessageLevel (oldErrSev);
 
1897
    ErrSetHandler (oldErrHook);
 
1898
    ErrClear ();
 
1899
    ShowValidateDoc ();
 
1900
    errors = 0;
 
1901
    for (j = 0; j < 6; j++) {
 
1902
      errors += vsp->errors [j];
 
1903
    }
 
1904
    if (errors == 0) {
 
1905
      ArrowCursor ();
 
1906
      Message (MSG_OK, "Validation test succeeded.");
 
1907
      FreeValidateWindow ();
 
1908
    } else {
 
1909
      RepopulateValidateFilter ();
 
1910
    }
 
1911
    ValidStructFree (vsp);
 
1912
    /*SetChecklistValue (checklistForm, 5);*/
 
1913
  }
 
1914
  ArrowCursor ();
 
1915
  Update ();
 
1916
}
 
1917
 
 
1918
 
1593
1919
static void ProcessDoneButton (ForM f)
1594
1920
 
1595
1921
{
1596
1922
  Boolean         allRawOrSeg = TRUE;
1597
1923
  BaseFormPtr     bfp;
1598
 
  Char            buf [32];
1599
1924
  Int2            errors;
1600
1925
  Int2            j;
1601
 
  ErrHookProc     oldErrHook;
1602
1926
  ErrSev          oldErrSev;
1603
1927
  SeqEntryPtr     sep;
1604
1928
  CharPtr         str;
1605
 
  Int2            verbosity;
1606
1929
  ValidStructPtr  vsp;
1607
1930
  CharPtr         fmt_no_file = "Submission is now written.  Please e-mail to %s.%s";
1608
1931
  CharPtr         missing_annot = "  Please include a brief summary of your submission within your correspondence.";
1659
1982
      ArrowCursor ();
1660
1983
      Update ();
1661
1984
      if (ReviewErrorsForValidationFailure ()) {
1662
 
        WatchCursor ();
1663
 
        Update ();
1664
 
        vsp = ValidStructNew ();
1665
 
        if (vsp != NULL) {
1666
 
          /*SetChecklistValue (checklistForm, 6);*/
1667
 
 
1668
 
          verbosity = 2;
1669
 
          if (GetSequinAppParam ("SETTINGS", "VALIDATEVERBOSITY", NULL, buf, sizeof (buf))) {
1670
 
            if (! StrToInt (buf, &verbosity)) {
1671
 
              verbosity = 2;
1672
 
            }
1673
 
          }
1674
 
 
1675
 
          CreateValidateWindowEx (ValidNotify, "Sequin Validation Errors",
1676
 
                                  programFont, SEV_INFO, verbosity, bfp, ProcessDoneButton, TRUE);
1677
 
          ClearValidateWindow ();
1678
 
          SeqEntryExplore (sep, (Pointer) (&allRawOrSeg), CheckForCookedBioseqs);
1679
 
          if (allRawOrSeg) {
1680
 
            vsp->useSeqMgrIndexes = TRUE;
1681
 
          }
1682
 
          HideValidateDoc ();
1683
 
          vsp->suppressContext = ShouldSetSuppressContext ();
1684
 
          vsp->justShowAccession = ShouldSetJustShowAccession ();
1685
 
          oldErrHook = ErrSetHandler (ValidErrHook);
1686
 
          oldErrSev = ErrSetMessageLevel (SEV_NONE);
1687
 
          vsp->validateAlignments = TRUE;
1688
 
          vsp->alignFindRemoteBsp = TRUE;
1689
 
          vsp->doSeqHistAssembly = FALSE;
1690
 
          for (j = 0; j < 6; j++) {
1691
 
            vsp->errors [j] = 0;
1692
 
          }
1693
 
          vsp->errfunc = ValidErrCallback;
1694
 
          ValidateSeqEntry (sep, vsp);
1695
 
          if (indexerVersion && useEntrez) {
1696
 
            TaxonValidate (sep, vsp);
1697
 
          }
1698
 
          ErrSetMessageLevel (oldErrSev);
1699
 
          ErrSetHandler (oldErrHook);
1700
 
          ErrClear ();
1701
 
          ShowValidateDoc ();
1702
 
          errors = 0;
1703
 
          for (j = 0; j < 6; j++) {
1704
 
            errors += vsp->errors [j];
1705
 
          }
1706
 
          if (errors == 0) {
1707
 
            ArrowCursor ();
1708
 
            Message (MSG_OK, "Validation test succeeded.");
1709
 
            FreeValidateWindow ();
1710
 
          } else {
1711
 
            RepopulateValidateFilter ();
1712
 
          }
1713
 
          ValidStructFree (vsp);
1714
 
          /*SetChecklistValue (checklistForm, 5);*/
1715
 
        }
1716
 
        ArrowCursor ();
1717
 
        Update ();
 
1985
        LaunchValidatorForDone (bfp, sep, ProcessDoneButton, NULL);
1718
1986
        return;
1719
1987
      }
1720
1988
    }
2191
2459
  ReportBadSpecificHostValues (sep, vsp);
2192
2460
}
2193
2461
 
2194
 
static void ValSeqEntryFormEx (ForM f, Boolean doAligns, Int2 limit, Boolean inferenceAccnCheck)
 
2462
static void ValSeqEntryFormExEx (ForM f, Boolean doAligns, Int2 limit, Boolean inferenceAccnCheck, FormActnFunc revalProc, FormActnFunc doneProc)
2195
2463
 
2196
2464
{
2197
2465
  Boolean         allRawOrSeg = TRUE;
2229
2497
          }
2230
2498
        }
2231
2499
 
2232
 
        validatorWindow = CreateValidateWindowEx (ValidNotify, "Sequin Validation Errors",
 
2500
        validatorWindow = CreateValidateWindowExExEx (ValidNotify, "Sequin Validation Errors",
2233
2501
                                                  programFont, SEV_INFO, verbosity, bfp,
2234
 
                                                  ValSeqEntryForm, TRUE);
 
2502
                                                  revalProc, doneProc, 
 
2503
                                                  doneProc == NULL && OkToSequester () ? SequesterSequenceList : NULL,
 
2504
                                                  TRUE);
2235
2505
        ClearValidateWindow ();
2236
2506
        SeqEntryExplore (sep, (Pointer) (&allRawOrSeg), CheckForCookedBioseqs);
2237
2507
        if (allRawOrSeg) {
2302
2572
  }
2303
2573
}
2304
2574
 
 
2575
 
 
2576
static void ValSeqEntryFormEx (ForM f, Boolean doAligns, Int2 limit, Boolean inferenceAccnCheck)
 
2577
 
 
2578
{
 
2579
  ValSeqEntryFormExEx (f, doAligns, limit, inferenceAccnCheck, ValSeqEntryForm, NULL);
 
2580
}
 
2581
 
2305
2582
static void CountInfAccnVer (SeqFeatPtr sfp, Pointer userdata)
2306
2583
 
2307
2584
{
2969
3246
              processonenuc = FALSE;
2970
3247
            } else if (bssp->_class == 0) {
2971
3248
              processonenuc = FALSE;
 
3249
            } else if (bssp->_class == 255) {
 
3250
              processonenuc = FALSE;
2972
3251
            }
2973
3252
          }
2974
3253
        }
4936
5215
                   (HANDLE) newDescMenu,
4937
5216
                   (HANDLE) newFeatMenu,
4938
5217
                   (HANDLE) advTableMenu,
4939
 
                   (HANDLE) sucMenu,
 
5218
                   (HANDLE) sucItem,
4940
5219
                   (HANDLE) newPubMenu,
4941
5220
                   (HANDLE) batchApplyMenu,
4942
5221
                   (HANDLE) batchEditMenu,
5217
5496
                   (HANDLE) newDescMenu,
5218
5497
                   (HANDLE) newFeatMenu,
5219
5498
                   (HANDLE) advTableMenu,
5220
 
                   (HANDLE) sucMenu,
 
5499
                   (HANDLE) sucItem,
5221
5500
                   (HANDLE) newPubMenu,
5222
5501
                   (HANDLE) batchApplyMenu,
5223
5502
                   (HANDLE) batchEditMenu,
9268
9547
  /*
9269
9548
  submitItem = CommandItem (m, "Submit to NCBI", SubmitToNCBI);
9270
9549
  */
 
9550
  /*
 
9551
  SeparatorItem (m);
 
9552
  CommandItem (m, "Propagate Top Descriptors", ForcePropagate);
 
9553
  */
9271
9554
  SeparatorItem (m);
9272
9555
  printItem = FormCommandItem (m, "Print", NULL, VIB_MSG_PRINT);
9273
9556
  SeparatorItem (m);
9510
9793
  CommandItem (newFeatMenu, "Generate Definition Line", AutoDef);
9511
9794
  advTableMenu = SubMenu (newFeatMenu, "Advanced Table Readers");
9512
9795
  CommandItem (advTableMenu, "Load Structured Comments from Table", SubmitterCreateStructuredComments);
9513
 
  sucMenu = CommandItem (newFeatMenu, "Sort Unique Count By Group", SUCSubmitterProc);
 
9796
  sucItem = CommandItem (newFeatMenu, "Sort Unique Count By Group", SUCSubmitterProc);
9514
9797
}
9515
9798
#endif
9516
9799