~ubuntu-branches/ubuntu/raring/ncbi-tools6/raring

« back to all changes in this revision

Viewing changes to desktop/vsmutil.c

  • Committer: Package Import Robot
  • Author(s): Aaron M. Ucko
  • Date: 2011-09-05 18:55:02 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: package-import@ubuntu.com-20110905185502-iuvmoe65ytljhckn
Tags: 6.1.20110713-1
* New upstream release.
* debian/*.symbols: update accordingly.
* make/makeshlb.unx: link libcn3dOGL.so against -lm for sqrt.
* doc/man/*.1: update for new release.
* debian/rules:
  - (VIB): add asnmacro, as upstream takes care to publish binaries thereof.
  - Retire obsolete multiarch-unaware checks for libpthread.
  - Fully modernize Debhelper usage; in particular, transition to overrides.
* debian/compat: advance to 9 per rules modernization.
* debian/ncbi-tools-bin.install: add asnmacro.
* make/makenet.unx: link asnmacro only against libraries it directly needs.
* doc/man/asnmacro.1: give asnmacro a man page.
* doc/man/Psequin.1: list it in SEE ALSO.
* network/id1arch/idfetch.c: revert redundant change (from #295110).
* Convert to multiarch.
  - debian/rules: Install libraries (and ncbithr.o) to multiarch directories.
  - debian/lib*.install: match multiarch library paths.
  - debian/control:
    + Build-Depends: debhelper (>= 8.1.3~), implying a recent dpkg-dev.
    + Set Multi-Arch: as appropriate across the board, and specify
      Pre-Depends: ${misc:Pre-Depends} for runtime libraries.
* debian/*.lintian-overrides: drop leading slashes for Lintian 2.5.x.
* debian/control: Standards-Version: 3.9.2 (already compliant).

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
*
30
30
* Version Creation Date:   3/3/95
31
31
*
32
 
* $Revision: 6.74 $
 
32
* $Revision: 6.76 $
33
33
*
34
34
* File Description: 
35
35
*
55
55
#include <valid.h>
56
56
#include <subutil.h>
57
57
 
 
58
#define NLM_GENERATED_CODE_PROTO
 
59
#include <objmacro.h>
 
60
#include <macroapi.h>
 
61
 
58
62
typedef struct errfltrdata {
59
63
  ErrSev         sev;
60
64
  int            errcode;
884
888
{
885
889
  SeqIdPtr  sip = NULL;
886
890
  BioseqPtr bsp;
887
 
  CharPtr   ec_number = NULL, tmp;
 
891
  CharPtr   ec_number = NULL, tmp, prot_name = NULL;
888
892
  GBQualPtr gbq;
889
893
  ProtRefPtr prp;
890
894
  ValNodePtr vnp;
893
897
  GeneRefPtr grp;
894
898
  SeqMgrFeatContext fcontext;
895
899
  CharPtr           report_str = NULL;
 
900
  CharPtr           report_fmt = "%s\t%s\t%s\t%s\n";
896
901
  Int4              report_len;
897
902
  Char              seqid [128];
898
903
 
899
904
  if (sfp == NULL) return NULL;
900
 
  /* want: accession number for sequence, ec number, locus tag */
 
905
  /* want: accession number for sequence, ec number, locus tag, protein name */
901
906
 
902
907
  /* find accession number */
903
908
  if (sfp->idx.subtype == FEATDEF_PROT) {
950
955
        ec_number = tmp;
951
956
      }
952
957
    }
 
958
    if (prp->name != NULL) {
 
959
      prot_name = prp->name->data.ptrvalue;
 
960
    }
953
961
  }
954
962
 
955
963
  if (StringHasNoText (ec_number)) {
971
979
    grp = NULL;
972
980
  }
973
981
  
974
 
  report_len = StringLen (seqid) + StringLen (ec_number) + 4;
 
982
  report_len = StringLen (seqid) + StringLen (ec_number) + StringLen (report_fmt);
975
983
  if (grp != NULL) {
976
984
    report_len += StringLen (grp->locus_tag);
977
985
  }
 
986
  if (prot_name != NULL) {
 
987
    report_len += StringLen (prot_name);
 
988
  }
978
989
  report_str = (CharPtr) MemNew (sizeof (Char) * report_len);
979
 
  sprintf (report_str, "%s\t%s\t%s\n", seqid, ec_number, (grp != NULL && grp->locus_tag != NULL) ? grp->locus_tag : "");
 
990
  sprintf (report_str, report_fmt, seqid, ec_number, 
 
991
          (grp != NULL && grp->locus_tag != NULL) ? grp->locus_tag : "",
 
992
          prot_name == NULL ? "" : prot_name);
980
993
  ec_number = MemFree (ec_number);
981
994
  return report_str;
982
995
}
1551
1564
}
1552
1565
 
1553
1566
 
 
1567
static Boolean MakeFieldReports (ValNodePtr report_list, ValNodePtr field_list, FILE *fp)
 
1568
{
 
1569
  ValNodePtr item_vnp, field_vnp;
 
1570
  CharPtr    cp;
 
1571
  Boolean    found_any = FALSE;
 
1572
  CharPtr    label;
 
1573
 
 
1574
  if (report_list == NULL || fp == NULL) return FALSE;
 
1575
 
 
1576
  for (item_vnp = report_list; item_vnp != NULL; item_vnp = item_vnp->next)
 
1577
  {
 
1578
    cp = GetDiscrepancyItemText (item_vnp);
 
1579
    if (cp != NULL)
 
1580
    {
 
1581
      label = GetParentLabelForDiscrepancyItem (item_vnp);
 
1582
      if (label != NULL) {
 
1583
          fprintf (fp, "%s:", label);
 
1584
          label = MemFree (label);
 
1585
      }
 
1586
      fprintf (fp, "%s", cp);
 
1587
      found_any = TRUE;
 
1588
      cp = MemFree (cp);
 
1589
    }
 
1590
    for (field_vnp = field_list; field_vnp != NULL; field_vnp = field_vnp->next) {
 
1591
      cp = GetFieldValueForObject (item_vnp->choice, item_vnp->data.ptrvalue, field_vnp, NULL);
 
1592
      fprintf (fp, "\t%s", cp == NULL ? "" : cp);
 
1593
      cp = MemFree (cp);
 
1594
    }
 
1595
    fprintf (fp, "\n");
 
1596
  }
 
1597
  return found_any;
 
1598
}
 
1599
 
 
1600
 
 
1601
static Boolean MakeBadInstCodeReport (ValNodePtr item_list, FILE *fp)
 
1602
{
 
1603
  ValNodePtr   item_vnp;
 
1604
  BioSourcePtr biop;
 
1605
  OrgModPtr    mod;
 
1606
  CharPtr    cp;
 
1607
  Boolean    found_any = FALSE;
 
1608
  CharPtr    label;
 
1609
 
 
1610
  if (item_list == NULL || fp == NULL) return FALSE;
 
1611
 
 
1612
  for (item_vnp = item_list; item_vnp != NULL; item_vnp = item_vnp->next)
 
1613
  {
 
1614
    cp = GetDiscrepancyItemText (item_vnp);
 
1615
    if (cp != NULL)
 
1616
    {
 
1617
      /* get rid of trailing carriage return */
 
1618
      *(cp + StringLen (cp) - 1) = 0;
 
1619
      label = GetParentLabelForDiscrepancyItem (item_vnp);
 
1620
      if (label != NULL) 
 
1621
      {
 
1622
        fprintf (fp, "%s:", label);
 
1623
        label = MemFree (label);
 
1624
      }
 
1625
      fprintf (fp, "%s", cp);
 
1626
      found_any = TRUE;
 
1627
      cp = MemFree (cp);
 
1628
    }
 
1629
    biop = GetBioSourceFromObject (item_vnp->choice, item_vnp->data.ptrvalue);
 
1630
    if (biop != NULL && biop->org != NULL && biop->org->orgname != NULL) {
 
1631
      for (mod = biop->org->orgname->mod; mod != NULL; mod = mod->next) {
 
1632
        if (mod->subtype == ORGMOD_culture_collection 
 
1633
            || mod->subtype == ORGMOD_bio_material 
 
1634
            || mod->subtype == ORGMOD_specimen_voucher) {
 
1635
          label = StringSave (mod->subname);
 
1636
          cp = StringChr (label, ':');
 
1637
          if (cp != NULL) {
 
1638
            *cp = 0;
 
1639
          }
 
1640
          fprintf (fp, "\t%s", label == NULL ? "" : label);
 
1641
          label = MemFree (label);
 
1642
        }
 
1643
      }
 
1644
    }
 
1645
    fprintf (fp, "\n");
 
1646
  }
 
1647
  return found_any;
 
1648
}
 
1649
 
 
1650
 
 
1651
static Boolean MakeBadECNumberReport (ValNodePtr ecnumber_list, FILE *fp)
 
1652
{
 
1653
  Boolean found_any = FALSE;
 
1654
  CharPtr cp;
 
1655
  ValNodePtr vnp;
 
1656
 
 
1657
  if (ecnumber_list == NULL || fp == NULL) {
 
1658
    return FALSE;
 
1659
  }
 
1660
 
 
1661
  fprintf (fp, "EC Number Errors\n");
 
1662
  for (vnp = ecnumber_list; vnp != NULL; vnp = vnp->next) {
 
1663
    cp = GetEcNumberReport (vnp->data.ptrvalue);
 
1664
    if (cp != NULL) {
 
1665
      fprintf (fp, "%s", cp);
 
1666
      found_any = TRUE;
 
1667
      cp = MemFree (cp);
 
1668
    }
 
1669
  }
 
1670
  fprintf (fp, "\n");
 
1671
  return found_any;
 
1672
}
 
1673
 
 
1674
 
1554
1675
static void MakeValidatorReport (ButtoN b)
1555
1676
{
1556
1677
  ValidExtraPtr  vep;
1564
1685
  ValNodePtr     consensus_splice_list = NULL;
1565
1686
  ValNodePtr     ecnumber_list = NULL;
1566
1687
  ValNodePtr     specific_host_list = NULL;
 
1688
  ValNodePtr     bad_inst_code = NULL;
1567
1689
  SeqFeatPtr     sfp;
1568
1690
  SeqDescrPtr    sdp;
1569
1691
  BioseqPtr      bsp;
1643
1765
              ValNodeAddPointer (&specific_host_list, OBJ_SEQFEAT, sfp);
1644
1766
            }
1645
1767
          }
 
1768
        } else if (eip->errcode == 2 && eip->subcode == 53) {
 
1769
          if (eip->itemtype == OBJ_SEQDESC) {
 
1770
            sdp = SeqMgrGetDesiredDescriptor (eip->entityID, NULL, eip->itemID, 0, NULL, &dcontext);
 
1771
            if (sdp != NULL) {
 
1772
              ValNodeAddPointer (&bad_inst_code, OBJ_SEQDESC, sdp);
 
1773
            }
 
1774
          } else if (eip->itemtype == OBJ_SEQFEAT) {
 
1775
            sfp = SeqMgrGetDesiredFeature (eip->entityID, NULL, eip->itemID, 0, NULL, &fcontext);
 
1776
            if (sfp != NULL) {
 
1777
              ValNodeAddPointer (&bad_inst_code, OBJ_SEQFEAT, sfp);
 
1778
            }
 
1779
          }
1646
1780
        } else if (eip->itemtype == OBJ_SEQFEAT) {
1647
1781
          sfp = SeqMgrGetDesiredFeature (eip->entityID, NULL, eip->itemID, 0, NULL, &fcontext);
1648
1782
          if (sfp != NULL) {
1674
1808
  }
1675
1809
 
1676
1810
  if (ecnumber_list != NULL) {
1677
 
    fprintf (fp, "EC Number Errors\n");
1678
 
    for (vnp = ecnumber_list; vnp != NULL; vnp = vnp->next) {
1679
 
      cp = GetEcNumberReport (vnp->data.ptrvalue);
1680
 
      if (cp != NULL) {
1681
 
        fprintf (fp, "%s", cp);
1682
 
        found_any = TRUE;
1683
 
        cp = MemFree (cp);
1684
 
      }
1685
 
    }
1686
 
    fprintf (fp, "\n");
 
1811
    found_any |= MakeBadECNumberReport(ecnumber_list, fp);
1687
1812
    ecnumber_list = ValNodeFree (ecnumber_list);
1688
1813
  }
1689
1814
 
1693
1818
    found_any = TRUE;
1694
1819
  }
1695
1820
 
 
1821
  if (bad_inst_code != NULL) {
 
1822
    fprintf (fp, "Bad Institution Codes\n");
 
1823
    found_any |= MakeBadInstCodeReport(bad_inst_code, fp);
 
1824
  }
 
1825
 
1696
1826
  found_any |= MakeStandardReports (chosen, report_lists, fp);
1697
1827
 
1698
1828
  for (pos = 0; pos < num_reports; pos++) {