1 /* biosrc.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: biosrc.c
27 *
28 * Author: Jonathan Kans
29 *
30 * Version Creation Date: 1/22/95
31 *
32 * $Revision: 6.110 $
33 *
34 * File Description:
35 *
36 * Modifications:
37 * --------------------------------------------------------------------------
38 * Date Name Description of modification
39 * ------- ---------- -----------------------------------------------------
40 *
41 *
42 * ==========================================================================
43 */
44
45 #include <biosrc.h>
46 #include <document.h>
47 #include <gather.h>
48 #include <subutil.h>
49 #include <explore.h>
50 #define NLM_GENERATED_CODE_PROTO
51 #include <objmacro.h>
52 #include <macroapi.h>
53
54
55 extern EnumFieldAssoc biosource_genome_simple_alist [];
ENUM_ALIST(biosource_genome_simple_alist)56 ENUM_ALIST(biosource_genome_simple_alist)
57 {" ", 0},
58 {"Genomic", 1},
59 {"Chloroplast", 2},
60 {"Kinetoplast", 4},
61 {"Mitochondrion", 5},
62 {"Plastid", 6},
63 {"Macronuclear", 7},
64 {"Extrachromosomal", 8},
65 {"Plasmid", 9},
66 /*
67 {"Transposon", 10},
68 {"Insertion Sequence", 11},
69 */
70 {"Cyanelle", 12},
71 {"Proviral", 13},
72 {"Virion", 14},
73 {"Nucleomorph", 15},
74 {"Apicoplast", 16},
75 {"Leucoplast", 17},
76 {"Proplastid", 18},
77 {"Endogenous-virus", 19},
78 {"Hydrogenosome", 20},
79 {"Chromosome", 21},
80 {"Chromatophore", 22},
81 END_ENUM_ALIST
82
83
84 extern EnumFieldAssoc biosource_origin_alist [];
ENUM_ALIST(biosource_origin_alist)85 ENUM_ALIST(biosource_origin_alist)
86 {" ", 0},
87 {"Natural", 1},
88 {"Natural Mutant", 2},
89 {"Mutant", 3},
90 {"Artificial", 4},
91 {"Synthetic", 5},
92 {"Other", 255},
93 END_ENUM_ALIST
94
95 Int2 numGeneticCodes = 0;
96 Int2 gcIdToIndex [NUM_GENETIC_CODES];
97 Uint1 gcIndexToId [NUM_GENETIC_CODES];
98 CharPtr gcNames [NUM_GENETIC_CODES];
99
100 static CharPtr orgTxtPtr = NULL;
101 static CharPtr PNTR orgStrIdx = NULL;
102 static Int2 orgNum = 0;
103
104 #define ORGANISM_PAGE 0
105 #define MODIFIERS_PAGE 1
106 #define MISCELLANEOUS_PAGE 2
107 #define COMMON_PAGE 3
108 #define LOCATION_PAGE 4
109
110 #define NUM_PAGES 8
111
112 typedef struct genbiopage {
113 DIALOG_MESSAGE_BLOCK
114 TexT taxName;
115 Handle commonName;
116 ButtoN disable_strain_forwarding;
117 Boolean typedSciName;
118 Boolean typedComName;
119 Int2 selectedOrg;
120 Int2 clickedOrg;
121 DoC orglist;
122 Int2 nuclGC;
123 Int2 mitoGC;
124 Int2 pstdGC;
125 Int4 taxID;
126 DialoG genome;
127 PopuP origin;
128 ButtoN is_focus;
129 PopuP simplecode;
130 PopuP gcode;
131 PopuP mgcode;
132 PopuP pgcode;
133 TexT lineage;
134 TexT gbDiv;
135 DialoG db;
136 DialoG syn;
137 DialoG mod;
138 GrouP orgGrp [5];
139 GrouP modGrp [5];
140 GrouP miscGrp [5];
141 PrompT gbacr;
142 PrompT gbana;
143 PrompT gbsyn;
144 PrompT tymat;
145
146 DialoG subsrc_val_dlg;
147 DialoG orgmod_val_dlg;
148 ButtoN pcr_primer_btn;
149 GrouP pcr_primer_grp;
150 DialoG pcr_primer_dlg;
151
152 CharPtr origTaxName;
153 Boolean stripOldName;
154 // EnumFieldAssoc PNTR genomeAlist;
155 Uint1 orgname_choice;
156 Pointer orgname_data;
157 EnumFieldAssocPtr orgmod_alists [2];
158 EnumFieldAssocPtr subsource_alists [2];
159 } GenBioPage, PNTR GenBioPagePtr;
160
161 typedef struct genbioform {
162 FEATURE_FORM_BLOCK
163 SeqEntryPtr sep;
164 GrouP pages [NUM_PAGES];
165 DialoG foldertabs;
166 Int2 currentPage;
167
168 LookupTaxonomyProc lookupTaxonomy;
169 } GenBioForm, PNTR GenBioFormPtr;
170
171 #ifndef WIN16
172 static CharPtr taxlistMemStrs [] = {
173 "15\n",
174 "Acanthamoeba castellanii\t\t1\t4\tINV\t5755\n",
175 "Acanthoscurria gomesiana\t\t1\t5\tINV\t115339\n",
176 "Acetabularia acetabulum\t\t6\t1\tPLN\t35845\n",
177 "Acipenser sinensis\tChinese sturgeon\t1\t2\tVRT\t61970\n",
178 "Acipenser transmontanus\twhite sturgeon\t1\t2\tVRT\t7904\n",
179 "Acorus americanus\t\t1\t1\tPLN\t263995\n",
180 "Acropora millepora\t\t1\t4\tINV\t45264\n",
181 "Acropora palmata\t\t1\t4\tINV\t6131\n",
182 "Acyrthosiphon pisum\tpea aphid\t1\t5\tINV\t7029\n",
183 "Adiantum capillus-veneris\t\t1\t1\tPLN\t13818\n",
184 "Aedes aegypti\tyellow fever mosquito\t1\t5\tINV\t7159\n",
185 "Aegilops speltoides\t\t1\t1\tPLN\t4573\n",
186 "Aegilops tauschii\t\t1\t1\tPLN\t37682\n",
187 "Agrostis capillaris\t\t1\t1\tPLN\t204232\n",
188 "Agrostis stolonifera\t\t1\t1\tPLN\t63632\n",
189 "Ajellomyces capsulatus\t\t1\t4\tPLN\t5037\n",
190 "Ajellomyces capsulatus NAm1\t\t1\t4\tPLN\t339724\n",
191 "Alexandrium tamarense\t\t1\t4\tPLN\t2926\n",
192 "Alligator mississippiensis\tAmerican alligator\t1\t2\tVRT\t8496\n",
193 "Allium cepa\tonion\t1\t1\tPLN\t4679\n",
194 "Allomyces macrogynus\t\t1\t4\tPLN\t28583\n",
195 "Alternaria brassicicola\t\t1\t4\tPLN\t29001\n",
196 "Amblyomma americanum\tlone star tick\t1\t5\tINV\t6943\n",
197 "Amblyomma variegatum\t\t1\t5\tINV\t34610\n",
198 "Amborella trichopoda\t\t1\t1\tPLN\t13333\n",
199 "Ambystoma mexicanum\taxolotl\t1\t2\tVRT\t8296\n",
200 "Ambystoma ordinarium\tPuerto Hondo stream salamander\t1\t2\tVRT\t288796\n",
201 "Ambystoma tigrinum tigrinum\tEastern tiger salamander\t1\t2\tVRT\t43116\n",
202 "Amoebidium parasiticum\t\t1\t4\tINV\t4881\n",
203 "Amorphotheca resinae\tcreosote fungus\t1\t4\tPLN\t5101\n",
204 "Amphidinium carterae\t\t1\t4\tPLN\t2961\n",
205 "Ananas comosus\tpineapple\t1\t1\tPLN\t4615\n",
206 "Anas platyrhynchos\t\t1\t2\tVRT\t8839\n",
207 "Ancylostoma caninum\tdog hookworm\t1\t5\tINV\t29170\n",
208 "Ancylostoma ceylanicum\t\t1\t5\tINV\t53326\n",
209 "Anolis carolinensis\tgreen anole\t1\t2\tVRT\t28377\n",
210 "Anolis sagrei\tbrown anole\t1\t2\tVRT\t38937\n",
211 "Anopheles albimanus\t\t1\t5\tINV\t7167\n",
212 "Anopheles funestus\tAfrican malaria mosquito\t1\t5\tINV\t62324\n",
213 "Anopheles gambiae\tAfrican malaria mosquito\t1\t5\tINV\t7165\n",
214 "Anopheles gambiae str. PEST\t\t1\t5\tINV\t180454\n",
215 "Antheraea mylitta\t\t1\t5\tINV\t34739\n",
216 "Antirrhinum majus\tsnapdragon\t1\t1\tPLN\t4151\n",
217 "Antonospora locustae\t\t1\t1\tINV\t278021\n",
218 "Antrodia cinnamomea\t\t1\t4\tPLN\t279009\n",
219 "Aphanomyces cochlioides\t\t1\t1\tPLN\t112091\n",
220 "Aphis gossypii\tcotton aphid\t1\t5\tINV\t80765\n",
221 "Apis mellifera\thoney bee\t1\t5\tINV\t7460\n",
222 "Aplysia californica\tCalifornia sea hare\t1\t5\tINV\t6500\n",
223 "Aquilegia formosa\t\t1\t1\tPLN\t223430\n",
224 "Arabidopsis lyrata subsp. petraea\t\t1\t1\tPLN\t59691\n",
225 "Arabidopsis thaliana\tthale cress\t1\t1\tPLN\t3702\n",
226 "Arachis batizocoi\t\t1\t1\tPLN\t108210\n",
227 "Arachis duranensis\t\t1\t1\tPLN\t130453\n",
228 "Arachis hypogaea\tpeanut\t1\t1\tPLN\t3818\n",
229 "Arachis stenosperma\t\t1\t1\tPLN\t217475\n",
230 "Argas monolakensis\t\t1\t5\tINV\t34602\n",
231 "Argopecten irradians\t\t1\t5\tINV\t31199\n",
232 "Ascaris suum\tpig roundworm\t1\t5\tINV\t6253\n",
233 "Ascosphaera apis USDA-ARSEF 7405\t\t1\t4\tPLN\t392613\n",
234 "Ashbya gossypii ATCC 10895\t\t1\t3\tPLN\t284811\n",
235 "Asparagus officinalis\tgarden asparagus\t1\t1\tPLN\t4686\n",
236 "Aspergillus clavatus NRRL 1\t\t1\t4\tPLN\t344612\n",
237 "Aspergillus flavus\t\t1\t4\tPLN\t5059\n",
238 "Aspergillus flavus NRRL3357\t\t1\t4\tPLN\t332952\n",
239 "Aspergillus fumigatus Af293\t\t1\t4\tPLN\t330879\n",
240 "Aspergillus nidulans FGSC A4\t\t1\t4\tPLN\t227321\n",
241 "Aspergillus niger\t\t1\t4\tPLN\t5061\n",
242 "Aspergillus niger CBS 513.88\t\t1\t4\tPLN\t425011\n",
243 "Aspergillus oryzae\t\t1\t4\tPLN\t5062\n",
244 "Aspergillus terreus NIH2624\t\t1\t4\tPLN\t341663\n",
245 "Astatotilapia burtoni\t\t1\t2\tVRT\t8153\n",
246 "Aureobasidium pullulans\t\t1\t4\tPLN\t5580\n",
247 "Avena sativa\toat\t1\t1\tPLN\t4498\n",
248 "Babesia bovis\t\t1\t4\tINV\t5865\n",
249 "Bacillus cereus\t\t11\t0\tBCT\t1396\n",
250 "Bacillus clausii\t\t11\t0\tBCT\t79880\n",
251 "Bacillus licheniformis\t\t11\t0\tBCT\t1402\n",
252 "Bacillus subtilis\t\t11\t0\tBCT\t1423\n",
253 "Bemisia tabaci\t\t1\t5\tINV\t7038\n",
254 "Beta vulgaris\t\t1\t1\tPLN\t161934\n",
255 "Betula pendula\tEuropean white birch\t1\t1\tPLN\t3505\n",
256 "Bicyclus anynana\tsquinting bush brown\t1\t5\tINV\t110368\n",
257 "Bigelowiella natans\t\t1\t1\tINV\t227086\n",
258 "Biomphalaria glabrata\t\t1\t5\tINV\t6526\n",
259 "Blastocladiella emersonii\t\t1\t4\tPLN\t4808\n",
260 "Blastocystis hominis\t\t1\t1\tPLN\t12968\n",
261 "Blumeria graminis f. sp. hordei\t\t1\t4\tPLN\t62688\n",
262 "Boechera stricta\t\t1\t1\tPLN\t72658\n",
263 "Bombyx mori\tdomestic silkworm\t1\t5\tINV\t7091\n",
264 "Borrelia burgdorferi\tLyme disease spirochete\t11\t0\tBCT\t139\n",
265 "Bos indicus\t\t1\t2\tMAM\t9915\n",
266 "Bos taurus\tcattle\t1\t2\tMAM\t9913\n",
267 "Botryotinia fuckeliana\t\t1\t4\tPLN\t40559\n",
268 "Botryotinia fuckeliana B05.10\t\t1\t4\tPLN\t332648\n",
269 "Brachionus plicatilis\t\t1\t5\tINV\t10195\n",
270 "Brachypodium distachyon\t\t1\t1\tPLN\t15368\n",
271 "Bradyrhizobium japonicum\t\t11\t0\tBCT\t375\n",
272 "Branchiostoma floridae\tFlorida lancelet\t1\t5\tINV\t7739\n",
273 "Brassica carinata\t\t1\t1\tPLN\t52824\n",
274 "Brassica napus\trape\t1\t1\tPLN\t3708\n",
275 "Brassica oleracea\t\t1\t1\tPLN\t3712\n",
276 "Brassica oleracea var. alboglabra\tChinese kale\t1\t1\tPLN\t3714\n",
277 "Brassica oleracea var. italica\tasparagus broccoli\t1\t1\tPLN\t36774\n",
278 "Brassica rapa\t\t1\t1\tPLN\t3711\n",
279 "Brassica rapa subsp. pekinensis\t\t1\t1\tPLN\t51351\n",
280 "Brucella abortus\t\t11\t0\tBCT\t235\n",
281 "Brugia malayi\t\t1\t5\tINV\t6279\n",
282 "Bruguiera gymnorhiza\t\t1\t1\tPLN\t39984\n",
283 "Bubalus bubalis\twater buffalo\t1\t2\tMAM\t89462\n",
284 "Burkholderia pseudomallei 112\t\t11\t0\tBCT\t441154\n",
285 "Burkholderia pseudomallei 14\t\t11\t0\tBCT\t441160\n",
286 "Burkholderia pseudomallei 381\t\t11\t0\tBCT\t441157\n",
287 "Burkholderia pseudomallei 7894\t\t11\t0\tBCT\t441156\n",
288 "Burkholderia pseudomallei 9\t\t11\t0\tBCT\t441158\n",
289 "Burkholderia pseudomallei 91\t\t11\t0\tBCT\t441159\n",
290 "Burkholderia pseudomallei B7210\t\t11\t0\tBCT\t441155\n",
291 "Burkholderia pseudomallei DM98\t\t11\t0\tBCT\t441161\n",
292 "Bursaphelenchus mucronatus\t\t1\t5\tINV\t6325\n",
293 "Bursaphelenchus xylophilus\t\t1\t5\tINV\t6326\n",
294 "Caenorhabditis brenneri\t\t1\t5\tINV\t135651\n",
295 "Caenorhabditis briggsae\t\t1\t5\tINV\t6238\n",
296 "Caenorhabditis briggsae AF16\t\t1\t5\tINV\t473542\n",
297 "Caenorhabditis elegans\t\t1\t5\tINV\t6239\n",
298 "Caenorhabditis remanei\t\t1\t5\tINV\t31234\n",
299 "Calanus finmarchicus\t\t1\t5\tINV\t6837\n",
300 "Callinectes sapidus\tblue crab\t1\t5\tINV\t6763\n",
301 "Callithrix jacchus\twhite-tufted-ear marmoset\t1\t2\tPRI\t9483\n",
302 "Callorhinchus milii\telephantfish\t1\t2\tVRT\t7868\n",
303 "Camellia sinensis\t\t1\t1\tPLN\t4442\n",
304 "Candida albicans\t\t12\t4\tPLN\t5476\n",
305 "Candida albicans SC5314\t\t12\t4\tPLN\t237561\n",
306 "Candida glabrata\t\t1\t3\tPLN\t5478\n",
307 "Candida glabrata CBS 138\t\t1\t3\tPLN\t284593\n",
308 "Candida parapsilosis\t\t12\t4\tPLN\t5480\n",
309 "Candida tropicalis\t\t12\t3\tPLN\t5482\n",
310 "candidate division TM7 single-cell isolate TM7a\t\t11\t0\tBCT\t447454\n",
311 "Canis latrans\tcoyote\t1\t2\tMAM\t9614\n",
312 "Canis lupus\tgray wolf\t1\t2\tMAM\t9612\n",
313 "Canis lupus familiaris\tdog\t1\t2\tMAM\t9615\n",
314 "Cannabis sativa\themp\t1\t1\tPLN\t3483\n",
315 "Capra hircus\tgoat\t1\t2\tMAM\t9925\n",
316 "Capsaspora owczarzaki\t\t1\t1\tINV\t192875\n",
317 "Capsicum annuum\t\t1\t1\tPLN\t4072\n",
318 "Carcinus maenas\tgreen crab\t1\t5\tINV\t6759\n",
319 "Carica papaya\tpapaya\t1\t1\tPLN\t3649\n",
320 "Carthamus tinctorius\tsafflower\t1\t1\tPLN\t4222\n",
321 "Catharanthus roseus\tMadagascar periwinkle\t1\t1\tPLN\t4058\n",
322 "Cavia porcellus\tdomestic guinea pig\t1\t2\tROD\t10141\n",
323 "Celuca pugilator\tAtlantic sand fiddler crab\t1\t5\tINV\t6772\n",
324 "Cenchrus ciliaris\t\t1\t1\tPLN\t35872\n",
325 "Centaurea maculosa\t\t1\t1\tPLN\t215693\n",
326 "Centaurea solstitialis\t\t1\t1\tPLN\t347529\n",
327 "Ceratodon purpureus\t\t1\t1\tPLN\t3225\n",
328 "Ceratopteris richardii\t\t1\t1\tPLN\t49495\n",
329 "Cercomonas longicauda\t\t1\t1\tINV\t100933\n",
330 "Chaetomium cupreum\t\t1\t4\tPLN\t155874\n",
331 "Chaetomium globosum CBS 148.51\t\t1\t4\tPLN\t306901\n",
332 "Chamaecyparis obtusa\t\t1\t1\tPLN\t13415\n",
333 "Chironomus tentans\t\t1\t5\tINV\t7153\n",
334 "Chlamydia trachomatis\t\t11\t0\tBCT\t813\n",
335 "Chlamydomonas incerta\t\t1\t1\tPLN\t51695\n",
336 "Chlamydomonas reinhardtii\t\t1\t1\tPLN\t3055\n",
337 "Chlamys farreri\t\t1\t5\tINV\t202578\n",
338 "Chlorocebus aethiops\tAfrican green monkey\t1\t2\tPRI\t9534\n",
339 "Chondrus crispus\tcarragheen\t1\t4\tPLN\t2769\n",
340 "Chrysemys picta\t\t1\t2\tVRT\t8479\n",
341 "Cicer arietinum\tchickpea\t1\t1\tPLN\t3827\n",
342 "Cichorium endivia\t\t1\t1\tPLN\t114280\n",
343 "Cichorium intybus\tchicory\t1\t1\tPLN\t13427\n",
344 "Ciona intestinalis\t\t1\t13\tINV\t7719\n",
345 "Ciona savignyi\t\t1\t13\tINV\t51511\n",
346 "Citrus aurantium\t\t1\t1\tPLN\t43166\n",
347 "Citrus clementina\t\t1\t1\tPLN\t85681\n",
348 "Citrus reshni\t\t1\t1\tPLN\t171252\n",
349 "Citrus reticulata\t\t1\t1\tPLN\t85571\n",
350 "Citrus sinensis\t\t1\t1\tPLN\t2711\n",
351 "Citrus unshiu\t\t1\t1\tPLN\t55188\n",
352 "Cleome hassleriana\t\t1\t1\tPLN\t28532\n",
353 "Clonorchis sinensis\t\t1\t9\tINV\t79923\n",
354 "Closterium peracerosum-strigosum-littorale complex\t\t1\t1\tPLN\t34146\n",
355 "Coccidioides immitis H538.4\t\t1\t4\tPLN\t396776\n",
356 "Coccidioides immitis RMSCC 3703\t\t1\t4\tPLN\t454286\n",
357 "Coccidioides immitis RS\t\t1\t4\tPLN\t246410\n",
358 "Coccidioides posadasii\t\t1\t4\tPLN\t199306\n",
359 "Coccidioides posadasii str. Silveira\t\t1\t4\tPLN\t443226\n",
360 "Coffea arabica\tcoffee\t1\t1\tPLN\t13443\n",
361 "Coffea canephora\t\t1\t1\tPLN\t49390\n",
362 "Coprinopsis cinerea\t\t1\t4\tPLN\t5346\n",
363 "Cordyceps bassiana\t\t1\t4\tPLN\t176275\n",
364 "Coregonus clupeaformis\tlake whitefish\t1\t2\tVRT\t59861\n",
365 "Corynascus heterothallicus\t\t1\t4\tPLN\t78579\n",
366 "Corynebacterium glutamicum\t\t11\t0\tBCT\t1718\n",
367 "Crassostrea gigas\tPacific oyster\t1\t5\tINV\t29159\n",
368 "Crassostrea virginica\teastern oyster\t1\t5\tINV\t6565\n",
369 "Cricetulus griseus\tChinese hamster\t1\t2\tROD\t10029\n",
370 "Crocus sativus\t\t1\t1\tPLN\t82528\n",
371 "Cryphonectria parasitica\t\t1\t4\tPLN\t5116\n",
372 "Cryptococcus laurentii\t\t1\t4\tPLN\t5418\n",
373 "Cryptococcus neoformans var. neoformans\t\t1\t4\tPLN\t40410\n",
374 "Cryptococcus neoformans var. neoformans B-3501A\t\t1\t4\tPLN\t283643\n",
375 "Cryptococcus neoformans var. neoformans JEC21\t\t1\t4\tPLN\t214684\n",
376 "Cryptomeria japonica\tJapanese cedar\t1\t1\tPLN\t3369\n",
377 "Cryptosporidium hominis TU502\t\t1\t4\tINV\t353151\n",
378 "Cryptosporidium parvum\t\t1\t4\tINV\t5807\n",
379 "Cryptosporidium parvum Iowa II\t\t1\t4\tINV\t353152\n",
380 "Ctenocephalides felis\tcat flea\t1\t5\tINV\t7515\n",
381 "Cucumis melo\tmuskmelon\t1\t1\tPLN\t3656\n",
382 "Cucumis melo subsp. agrestis\t\t1\t1\tPLN\t217619\n",
383 "Cucumis melo subsp. melo\t\t1\t1\tPLN\t412675\n",
384 "Cucumis sativus\tcucumber\t1\t1\tPLN\t3659\n",
385 "Culex pipiens quinquefasciatus\tsouthern house mosquito\t1\t5\tINV\t7176\n",
386 "Culicoides sonorensis\t\t1\t5\tINV\t179676\n",
387 "Cunninghamella elegans\t\t1\t4\tPLN\t4853\n",
388 "Curcuma longa\t\t1\t1\tPLN\t136217\n",
389 "Cyamopsis tetragonoloba\tguar\t1\t1\tPLN\t3832\n",
390 "Cyanidioschyzon merolae strain 10D\t\t1\t1\tPLN\t280699\n",
391 "Cyanophora paradoxa\t\t1\t1\tPLN\t2762\n",
392 "Cycas rumphii\t\t1\t1\tPLN\t58031\n",
393 "Cynodon dactylon\tBermuda grass\t1\t1\tPLN\t28909\n",
394 "Cyprinus carpio\tcommon carp\t1\t2\tVRT\t7962\n",
395 "Danio rerio\tzebrafish\t1\t2\tVRT\t7955\n",
396 "Daphnia magna\t\t1\t5\tINV\t35525\n",
397 "Dasypus novemcinctus\tnine-banded armadillo\t1\t2\tMAM\t9361\n",
398 "Debaryomyces hansenii CBS767\t\t1\t3\tPLN\t284592\n",
399 "Debaryomyces hansenii var. hansenii\t\t1\t3\tPLN\t58641\n",
400 "Deinagkistrodon acutus\t\t1\t2\tVRT\t36307\n",
401 "Dekkera bruxellensis\t\t1\t4\tPLN\t5007\n",
402 "Diabrotica virgifera virgifera\twestern corn rootworm\t1\t5\tINV\t50390\n",
403 "Diaphorina citri\tAsian citrus psyllid\t1\t5\tINV\t121845\n",
404 "Diaprepes abbreviatus\tDiaprepes root weevil\t1\t5\tINV\t13040\n",
405 "Dicentrarchus labrax\tEuropean sea bass\t1\t2\tVRT\t13489\n",
406 "Dictyocaulus viviparus\tbovine lungworm\t1\t5\tINV\t29172\n",
407 "Dictyostelium discoideum\t\t1\t1\tINV\t44689\n",
408 "Dictyostelium discoideum AX4\t\t1\t1\tINV\t352472\n",
409 "Diplonema papillatum\t\t1\t4\tINV\t91374\n",
410 "Dirofilaria immitis\tdog heartworm nematode\t1\t5\tINV\t6287\n",
411 "Drosophila ananassae\t\t1\t5\tINV\t7217\n",
412 "Drosophila auraria\t\t1\t5\tINV\t47315\n",
413 "Drosophila erecta\t\t1\t5\tINV\t7220\n",
414 "Drosophila grimshawi\t\t1\t5\tINV\t7222\n",
415 "Drosophila melanogaster\tfruit fly\t1\t5\tINV\t7227\n",
416 "Drosophila mojavensis\t\t1\t5\tINV\t7230\n",
417 "Drosophila persimilis\t\t1\t5\tINV\t7234\n",
418 "Drosophila pseudoobscura\t\t1\t5\tINV\t7237\n",
419 "Drosophila sechellia\t\t1\t5\tINV\t7238\n",
420 "Drosophila simulans\t\t1\t5\tINV\t7240\n",
421 "Drosophila virilis\t\t1\t5\tINV\t7244\n",
422 "Drosophila willistoni\t\t1\t5\tINV\t7260\n",
423 "Drosophila yakuba\t\t1\t5\tINV\t7245\n",
424 "Dugesia japonica\t\t1\t9\tINV\t6161\n",
425 "Dugesia ryukyuensis\t\t1\t9\tINV\t79738\n",
426 "Dunaliella salina\t\t1\t1\tPLN\t3046\n",
427 "Echinococcus granulosus\t\t1\t9\tINV\t6210\n",
428 "Echinops telfairi\tsmall Madagascar hedgehog\t1\t2\tMAM\t9371\n",
429 "Eimeria tenella\t\t1\t4\tINV\t5802\n",
430 "Eisenia fetida\tcommon brandling worm\t1\t5\tINV\t6396\n",
431 "Elaeis guineensis\tAfrican oil palm\t1\t1\tPLN\t51953\n",
432 "Elaeis oleifera\t\t1\t1\tPLN\t80265\n",
433 "Emericella nidulans\t\t1\t4\tPLN\t162425\n",
434 "Emiliania huxleyi\t\t1\t4\tPLN\t2903\n",
435 "Endoriftia persephone 'Hot96_1+Hot96_2'\t\t11\t0\tBCT\t394104\n",
436 "Entamoeba dispar\t\t1\t1\tINV\t46681\n",
437 "Entamoeba dispar SAW760\t\t1\t1\tINV\t370354\n",
438 "Entamoeba histolytica\t\t1\t1\tINV\t5759\n",
439 "Entamoeba histolytica HM-1:IMSS\t\t1\t1\tINV\t294381\n",
440 "Entamoeba invadens\t\t1\t1\tINV\t33085\n",
441 "Entamoeba invadens IP1\t\t1\t1\tINV\t370355\n",
442 "Entamoeba moshkovskii FIC\t\t1\t1\tINV\t434306\n",
443 "Entamoeba terrapinae\t\t1\t1\tINV\t110771\n",
444 "Epiphyas postvittana\t\t1\t5\tINV\t65032\n",
445 "Eptatretus burgeri\tinshore hagfish\t1\t2\tVRT\t7764\n",
446 "Equus caballus\thorse\t1\t2\tMAM\t9796\n",
447 "Eragrostis tef\t\t1\t1\tPLN\t110835\n",
448 "Erinaceus europaeus\twestern European hedgehog\t1\t2\tMAM\t9365\n",
449 "Escherichia coli\t\t11\t0\tBCT\t562\n",
450 "Eschscholzia californica\tCalifornia poppy\t1\t1\tPLN\t3467\n",
451 "Esox lucius\tnorthern pike\t1\t2\tVRT\t8010\n",
452 "Eubalaena glacialis\tNorth Atlantic right whale\t1\t2\tMAM\t27606\n",
453 "Eucalyptus camaldulensis\tMurray red gum\t1\t1\tPLN\t34316\n",
454 "Eucalyptus globulus subsp. bicostata\t\t1\t1\tPLN\t71272\n",
455 "Eucalyptus grandis\t\t1\t1\tPLN\t71139\n",
456 "Eucalyptus gunnii\tcider tree\t1\t1\tPLN\t3933\n",
457 "Euglena gracilis\t\t1\t4\tPLN\t3039\n",
458 "Euglena longa\t\t1\t4\tPLN\t3037\n",
459 "Euphorbia esula\tleafy spurge\t1\t1\tPLN\t3993\n",
460 "Euphorbia tirucalli\t\t1\t1\tPLN\t142860\n",
461 "Euprymna scolopes\t\t1\t5\tINV\t6613\n",
462 "Felis catus\tdomestic cat\t1\t2\tMAM\t9685\n",
463 "Fenneropenaeus chinensis\t\t1\t5\tINV\t139456\n",
464 "Festuca arundinacea\t\t1\t1\tPLN\t4606\n",
465 "Folsomia candida\t\t1\t5\tINV\t158441\n",
466 "fossil metagenome\t\t11\t2\tENV\t444079\n",
467 "Fragaria vesca\t\t1\t1\tPLN\t57918\n",
468 "Fragaria vesca subsp. vesca\t\t1\t1\tPLN\t101020\n",
469 "Fragilariopsis cylindrus\t\t1\t1\tPLN\t186039\n",
470 "Fundulus heteroclitus\tkillifish\t1\t2\tVRT\t8078\n",
471 "Fusarium oxysporum f. sp. cucumerinum\t\t1\t4\tPLN\t5508\n",
472 "Fusarium oxysporum f. sp. melonis\t\t1\t4\tPLN\t61369\n",
473 "Fusarium solani\t\t1\t4\tPLN\t169388\n",
474 "Fusarium sporotrichioides\t\t1\t4\tPLN\t5514\n",
475 "Fusarium virguliforme\t\t1\t4\tPLN\t232082\n",
476 "Gadus morhua\tAtlantic cod\t1\t2\tVRT\t8049\n",
477 "Gallus gallus\tchicken\t1\t2\tVRT\t9031\n",
478 "Gammarus pulex\t\t1\t5\tINV\t52641\n",
479 "Gasterosteus aculeatus\tthree-spined stickleback\t1\t2\tVRT\t69293\n",
480 "GB virus C\t\t1\t0\tVRL\t54290\n",
481 "Gekko japonicus\t\t1\t2\tVRT\t146911\n",
482 "Gene trapping vector VICTR75\t\t11\t0\tSYN\t447634\n",
483 "Gene trapping vector VICTR76\t\t11\t0\tSYN\t447635\n",
484 "Geomyces pannorum\t\t1\t4\tPLN\t79858\n",
485 "Gerbera hybrid cv. 'Terra Regina'\t\t1\t1\tPLN\t226891\n",
486 "Giardia intestinalis\t\t1\t0\tINV\t5741\n",
487 "Giardia lamblia ATCC 50803\t\t1\t0\tINV\t184922\n",
488 "Gibberella moniliformis\t\t1\t4\tPLN\t117187\n",
489 "Gibberella zeae\t\t1\t4\tPLN\t5518\n",
490 "Gibberella zeae PH-1\t\t1\t4\tPLN\t229533\n",
491 "Gillichthys mirabilis\tlong-jawed mudsucker\t1\t2\tVRT\t8222\n",
492 "Ginkgo biloba\tmaidenhair tree\t1\t1\tPLN\t3311\n",
493 "Glaucocystis nostochinearum\t\t1\t1\tPLN\t38271\n",
494 "Globodera pallida\t\t1\t5\tINV\t36090\n",
495 "Globodera rostochiensis\t\t1\t5\tINV\t31243\n",
496 "Gloeophyllum trabeum\t\t1\t4\tPLN\t104355\n",
497 "Glomus intraradices\t\t1\t4\tPLN\t4876\n",
498 "Glossina morsitans morsitans\t\t1\t5\tINV\t37546\n",
499 "Glycine max\tsoybean\t1\t1\tPLN\t3847\n",
500 "Glycine soja\t\t1\t1\tPLN\t3848\n",
501 "Glycyphagus domesticus\t\t1\t5\tINV\t105145\n",
502 "Gnetum gnemon\t\t1\t1\tPLN\t3382\n",
503 "Gobiocypris rarus\t\t1\t2\tVRT\t143606\n",
504 "Gorilla gorilla\tgorilla\t1\t2\tPRI\t9593\n",
505 "Gossypium arboreum\t\t1\t1\tPLN\t29729\n",
506 "Gossypium exiguum\t\t1\t1\tPLN\t47626\n",
507 "Gossypium herbaceum\t\t1\t1\tPLN\t34274\n",
508 "Gossypium hirsutum\tupland cotton\t1\t1\tPLN\t3635\n",
509 "Gossypium raimondii\t\t1\t1\tPLN\t29730\n",
510 "Gracilaria changii\t\t1\t4\tPLN\t172969\n",
511 "Graphocephala atropunctata\t\t1\t5\tINV\t36148\n",
512 "Grosmannia clavigera\t\t1\t4\tPLN\t226899\n",
513 "Gryllus bimaculatus\ttwo-spotted cricket\t1\t5\tINV\t6999\n",
514 "Guillardia theta\t\t1\t1\tPLN\t55529\n",
515 "Haemonchus contortus\t\t1\t5\tINV\t6289\n",
516 "Haemophilus influenzae\t\t11\t0\tBCT\t727\n",
517 "Halocynthia roretzi\t\t1\t13\tINV\t7729\n",
518 "Hartmannella vermiformis\t\t1\t1\tINV\t5778\n",
519 "Hebeloma cylindrosporum\t\t1\t4\tPLN\t76867\n",
520 "Hedyotis centranthoides\t\t1\t1\tPLN\t219666\n",
521 "Hedyotis terminalis\t\t1\t1\tPLN\t219667\n",
522 "Helianthus annuus\tcommon sunflower\t1\t1\tPLN\t4232\n",
523 "Helianthus argophyllus\t\t1\t1\tPLN\t73275\n",
524 "Helianthus ciliaris\t\t1\t1\tPLN\t73280\n",
525 "Helianthus exilis\t\t1\t1\tPLN\t400408\n",
526 "Helianthus paradoxus\t\t1\t1\tPLN\t73304\n",
527 "Helianthus petiolaris\t\t1\t1\tPLN\t4234\n",
528 "Helianthus tuberosus\t\t1\t1\tPLN\t4233\n",
529 "Helicobacter pylori\t\t11\t0\tBCT\t210\n",
530 "Heliconius erato\tcrimson-patched longwing\t1\t5\tINV\t33431\n",
531 "Heliconius melpomene\t\t1\t5\tINV\t34740\n",
532 "Hemicentrotus pulcherrimus\t\t1\t9\tINV\t7650\n",
533 "Hepatitis A virus\t\t1\t0\tVRL\t12092\n",
534 "Hepatitis B virus\t\t1\t0\tVRL\t10407\n",
535 "Hepatitis C virus\t\t1\t0\tVRL\t11103\n",
536 "Hepatitis C virus subtype 1a\t\t1\t0\tVRL\t31646\n",
537 "Hepatitis C virus subtype 1b\t\t1\t0\tVRL\t31647\n",
538 "Heterocapsa triquetra\t\t1\t4\tPLN\t66468\n",
539 "Heterodera glycines\t\t1\t5\tINV\t51029\n",
540 "Heterodera schachtii\t\t1\t5\tINV\t97005\n",
541 "Heterorhabditis bacteriophora\t\t1\t5\tINV\t37862\n",
542 "Hevea brasiliensis\t\t1\t1\tPLN\t3981\n",
543 "Hippoglossus hippoglossus\tAtlantic halibut\t1\t2\tVRT\t8267\n",
544 "Histiona aroides\t\t1\t1\tINV\t392300\n",
545 "Holothuria glaberrima\t\t1\t9\tINV\t31192\n",
546 "Homalodisca coagulata\tglassy-winged sharpshooter\t1\t5\tINV\t197043\n",
547 "Homarus americanus\tAmerican lobster\t1\t5\tINV\t6706\n",
548 "Homo sapiens\thuman\t1\t2\tPRI\t9606\n",
549 "Hordeum vulgare\t\t1\t1\tPLN\t4513\n",
550 "Hordeum vulgare subsp. spontaneum\t\t1\t1\tPLN\t77009\n",
551 "Hordeum vulgare subsp. vulgare\tdomesticated barley\t1\t1\tPLN\t112509\n",
552 "Human herpesvirus 5\tHuman cytomegalovirus\t1\t0\tVRL\t10359\n",
553 "Human immunodeficiency virus 1\t\t1\t0\tVRL\t11676\n",
554 "Human immunodeficiency virus 2\t\t1\t0\tVRL\t11709\n",
555 "Human metapneumovirus\t\t1\t0\tVRL\t162145\n",
556 "Human T-lymphotropic virus 1\t\t1\t0\tVRL\t11908\n",
557 "Humulus lupulus\tEuropean hop\t1\t1\tPLN\t3486\n",
558 "Hydra magnipapillata\t\t1\t4\tINV\t6085\n",
559 "Hydra vulgaris\t\t1\t4\tINV\t6087\n",
560 "Hydractinia echinata\t\t1\t4\tINV\t35630\n",
561 "Hyperamoeba dachnaya\t\t1\t1\tINV\t181200\n",
562 "Hypocrea jecorina\t\t1\t4\tPLN\t51453\n",
563 "Hypocrea lixii\t\t1\t4\tPLN\t5544\n",
564 "Hypocrea virens\t\t1\t4\tPLN\t29875\n",
565 "Hypsibius dujardini\t\t1\t5\tINV\t232323\n",
566 "Ichthyophthirius multifiliis\t\t6\t4\tINV\t5932\n",
567 "Ictalurus furcatus\tblue catfish\t1\t2\tVRT\t66913\n",
568 "Ictalurus punctatus\tchannel catfish\t1\t2\tVRT\t7998\n",
569 "Idiosepius paradoxus\t\t1\t5\tINV\t294707\n",
570 "Ipomoea batatas\tsweet potato\t1\t1\tPLN\t4120\n",
571 "Ipomoea nil\tJapanese morning glory\t1\t1\tPLN\t35883\n",
572 "Isochrysis galbana\t\t1\t1\tPLN\t37099\n",
573 "Ixodes scapularis\tblack-legged tick\t1\t5\tINV\t6945\n",
574 "Jakoba bahamiensis\t\t1\t1\tINV\t221721\n",
575 "Jakoba libera\t\t1\t1\tINV\t143017\n",
576 "Juglans regia\tEnglish walnut\t1\t1\tPLN\t51240\n",
577 "Karenia brevis\t\t1\t4\tPLN\t156230\n",
578 "Karlodinium micrum\t\t1\t4\tPLN\t342587\n",
579 "Kazachstania exigua\t\t1\t3\tPLN\t34358\n",
580 "Kazachstania unispora\t\t1\t3\tPLN\t27294\n",
581 "Kluyveromyces lactis\t\t1\t4\tPLN\t28985\n",
582 "Kluyveromyces lactis NRRL Y-1140\t\t1\t4\tPLN\t284590\n",
583 "Kluyveromyces marxianus\t\t1\t3\tPLN\t4911\n",
584 "Kluyveromyces thermotolerans\t\t1\t3\tPLN\t4916\n",
585 "Laccaria bicolor\t\t1\t4\tPLN\t29883\n",
586 "Lachancea kluyveri\t\t1\t3\tPLN\t4934\n",
587 "Lactuca perennis\t\t1\t1\tPLN\t43195\n",
588 "Lactuca saligna\t\t1\t1\tPLN\t75948\n",
589 "Lactuca sativa\t\t1\t1\tPLN\t4236\n",
590 "Lactuca serriola\t\t1\t1\tPLN\t75943\n",
591 "Lactuca virosa\t\t1\t1\tPLN\t75947\n",
592 "Lama pacos\talpaca\t1\t2\tMAM\t30538\n",
593 "Laminaria digitata\t\t1\t1\tPLN\t80365\n",
594 "Laupala kohalensis\t\t1\t5\tINV\t109027\n",
595 "Lawsonia intracellularis\t\t11\t0\tBCT\t29546\n",
596 "Leishmania braziliensis\t\t1\t4\tINV\t5660\n",
597 "Leishmania donovani chagasi\t\t1\t4\tINV\t44271\n",
598 "Leishmania infantum JPCM5\t\t1\t4\tINV\t435258\n",
599 "Leishmania major\t\t1\t4\tINV\t5664\n",
600 "Leishmania major strain Friedlin\t\t1\t4\tINV\t347515\n",
601 "Lentinula edodes\tshiitake mushroom\t1\t4\tPLN\t5353\n",
602 "Lepeophtheirus salmonis\tsalmon louse\t1\t5\tINV\t72036\n",
603 "Leptinotarsa decemlineata\tColorado potato beetle\t1\t5\tINV\t7539\n",
604 "Leucoraja erinacea\tlittle skate\t1\t2\tVRT\t7782\n",
605 "Leucosporidium scottii\t\t1\t4\tPLN\t5278\n",
606 "Limnanthes alba subsp. versicolor\t\t1\t1\tPLN\t377281\n",
607 "Limonium bicolor\t\t1\t1\tPLN\t293754\n",
608 "Lingulodinium polyedrum\t\t1\t4\tPLN\t160621\n",
609 "Linum usitatissimum\tflax\t1\t1\tPLN\t4006\n",
610 "Liriodendron tulipifera\t\t1\t1\tPLN\t3415\n",
611 "Listeria monocytogenes\t\t11\t0\tBCT\t1639\n",
612 "Listeria monocytogenes FSL F2-515\t\t11\t0\tBCT\t393116\n",
613 "Listeria monocytogenes FSL J1-208\t\t11\t0\tBCT\t393119\n",
614 "Lithognathus mormyrus\t\t1\t2\tVRT\t50591\n",
615 "Litomosoides sigmodontis\t\t1\t5\tINV\t42156\n",
616 "Litopenaeus vannamei\tPacific white shrimp\t1\t5\tINV\t6689\n",
617 "Locusta migratoria\tmigratory locust\t1\t5\tINV\t7004\n",
618 "Lodderomyces elongisporus NRRL YB-4239\t\t1\t3\tPLN\t379508\n",
619 "Lolium multiflorum\tItalian ryegrass\t1\t1\tPLN\t4521\n",
620 "Lolium temulentum\t\t1\t1\tPLN\t34176\n",
621 "Lotus japonicus\t\t1\t1\tPLN\t34305\n",
622 "Loxodonta africana\tAfrican savanna elephant\t1\t2\tMAM\t9785\n",
623 "Lumbricus rubellus\thumus earthworm\t1\t5\tINV\t35632\n",
624 "Lupinus albus\twhite lupine\t1\t1\tPLN\t3870\n",
625 "Lutzomyia longipalpis\t\t1\t5\tINV\t7200\n",
626 "Lycoris longituba\t\t1\t1\tPLN\t272140\n",
627 "Lysiphlebus testaceipes\t\t1\t5\tINV\t77504\n",
628 "Macaca fascicularis\tcrab-eating macaque\t1\t2\tPRI\t9541\n",
629 "Macaca mulatta\trhesus monkey\t1\t2\tPRI\t9544\n",
630 "Macaca nemestrina\tpig-tailed macaque\t1\t2\tPRI\t9545\n",
631 "Maconellicoccus hirsutus\thibiscus mealybug\t1\t5\tINV\t177089\n",
632 "Macropus eugenii\ttammar wallaby\t1\t2\tMAM\t9315\n",
633 "Macrostomum lignano\t\t1\t9\tINV\t282301\n",
634 "Magnaporthe grisea\t\t1\t4\tPLN\t148305\n",
635 "Magnaporthe grisea 70-15\t\t1\t4\tPLN\t242507\n",
636 "Magnetospirillum magnetotacticum MS-1\t\t11\t0\tBCT\t272627\n",
637 "Malawimonas californiana\t\t1\t1\tINV\t221722\n",
638 "Malawimonas jakobiformis\t\t1\t1\tINV\t136089\n",
639 "Manduca sexta\ttobacco hornworm\t1\t5\tINV\t7130\n",
640 "Manihot esculenta\tcassava\t1\t1\tPLN\t3983\n",
641 "Marchantia polymorpha\tliverwort\t1\t1\tPLN\t3197\n",
642 "marine metagenome\t\t11\t2\tENV\t408172\n",
643 "Marsupenaeus japonicus\t\t1\t5\tINV\t27405\n",
644 "Mastigamoeba balamuthi\t\t1\t1\tINV\t108607\n",
645 "Measles virus\t\t1\t0\tVRL\t11234\n",
646 "Medicago sativa\t\t1\t1\tPLN\t3879\n",
647 "Medicago truncatula\tbarrel medic\t1\t1\tPLN\t3880\n",
648 "Meleagris gallopavo\tturkey\t1\t2\tVRT\t9103\n",
649 "Meloidogyne arenaria\t\t1\t5\tINV\t6304\n",
650 "Meloidogyne chitwoodi\t\t1\t5\tINV\t59747\n",
651 "Meloidogyne hapla\t\t1\t5\tINV\t6305\n",
652 "Meloidogyne incognita\tsouthern root-knot nematode\t1\t5\tINV\t6306\n",
653 "Meloidogyne javanica\troot-knot nematode\t1\t5\tINV\t6303\n",
654 "Meloidogyne paranaensis\t\t1\t5\tINV\t189293\n",
655 "Mesembryanthemum crystallinum\tcommon iceplant\t1\t1\tPLN\t3544\n",
656 "Mesocricetus auratus\tgolden hamster\t1\t2\tROD\t10036\n",
657 "Mesostigma viride\t\t1\t1\tPLN\t41882\n",
658 "metagenome sequence\t\t11\t2\tENV\t256318\n",
659 "Metarhizium anisopliae\t\t1\t4\tPLN\t5530\n",
660 "Microbotryum violaceum\t\t1\t4\tPLN\t5272\n",
661 "Microcebus murinus\tgray mouse lemur\t1\t2\tPRI\t30608\n",
662 "Mimulus guttatus\tspotted monkey flower\t1\t1\tPLN\t4155\n",
663 "Mimulus lewisii\t\t1\t1\tPLN\t69919\n",
664 "Misgurnus anguillicaudatus\toriental weatherfish\t1\t2\tVRT\t75329\n",
665 "Molgula tectiformis\t\t1\t13\tINV\t30286\n",
666 "Monacrosporium haptotylum\t\t1\t4\tPLN\t74495\n",
667 "Monodelphis domestica\tgray short-tailed opossum\t1\t2\tMAM\t13616\n",
668 "Monosiga ovata\t\t1\t1\tINV\t81526\n",
669 "mouse gut metagenome\t\t11\t2\tENV\t410661\n",
670 "Mus musculus\thouse mouse\t1\t2\tROD\t10090\n",
671 "Mus musculus domesticus\twestern European house mouse\t1\t2\tROD\t10092\n",
672 "Mus musculus molossinus\tJapanese wild mouse\t1\t2\tROD\t57486\n",
673 "Musa acuminata\tdessert banana\t1\t1\tPLN\t4641\n",
674 "Mycobacterium tuberculosis\t\t11\t0\tBCT\t1773\n",
675 "Mycosphaerella graminicola\t\t1\t4\tPLN\t54734\n",
676 "Myotis lucifugus\tlittle brown bat\t1\t2\tMAM\t59463\n",
677 "Mytilus californianus\tCalifornia mussel\t1\t5\tINV\t6549\n",
678 "Mytilus galloprovincialis\tMediterranean mussel\t1\t5\tINV\t29158\n",
679 "Myzus persicae\tgreen peach aphid\t1\t5\tINV\t13164\n",
680 "Nakaseomyces delphensis\t\t1\t3\tPLN\t51657\n",
681 "Nasonia giraulti\t\t1\t5\tINV\t7426\n",
682 "Nasonia vitripennis\tjewel wasp\t1\t5\tINV\t7425\n",
683 "Necator americanus\t\t1\t5\tINV\t51031\n",
684 "Neisseria gonorrhoeae\t\t11\t0\tBCT\t485\n",
685 "Neisseria meningitidis\t\t11\t0\tBCT\t487\n",
686 "Nelumbo nucifera\t\t1\t1\tPLN\t4432\n",
687 "Nematostella vectensis\tstarlet sea anemone\t1\t4\tINV\t45351\n",
688 "Neosartorya fischeri NRRL 181\t\t1\t4\tPLN\t331117\n",
689 "Neospora caninum\t\t1\t4\tINV\t29176\n",
690 "Neovison vison\t\t1\t2\tMAM\t452646\n",
691 "Neurospora crassa\t\t1\t4\tPLN\t5141\n",
692 "Neurospora crassa OR74A\t\t1\t4\tPLN\t367110\n",
693 "Newcastle disease virus\t\t1\t0\tVRL\t11176\n",
694 "Nicotiana benthamiana\t\t1\t1\tPLN\t4100\n",
695 "Nicotiana sylvestris\twood tobacco\t1\t1\tPLN\t4096\n",
696 "Nicotiana tabacum\tcommon tobacco\t1\t1\tPLN\t4097\n",
697 "Nippostrongylus brasiliensis\t\t1\t5\tINV\t27835\n",
698 "Nuphar advena\t\t1\t1\tPLN\t77108\n",
699 "Ochotona princeps\tAmerican pika\t1\t2\tMAM\t9978\n",
700 "Ocimum basilicum\tsweet basil\t1\t1\tPLN\t39350\n",
701 "Onchocerca volvulus\t\t1\t5\tINV\t6282\n",
702 "Oncometopia nigricans\t\t1\t5\tINV\t266772\n",
703 "Oncorhynchus mykiss\trainbow trout\t1\t2\tVRT\t8022\n",
704 "Oncorhynchus nerka\tsockeye salmon\t1\t2\tVRT\t8023\n",
705 "Oncorhynchus tshawytscha\tChinook salmon\t1\t2\tVRT\t74940\n",
706 "Ophiostoma piliferum\t\t1\t4\tPLN\t38032\n",
707 "Opisthorchis viverrini\t\t1\t9\tINV\t6198\n",
708 "Oreochromis niloticus\tNile tilapia\t1\t2\tVRT\t8128\n",
709 "Ornithorhynchus anatinus\tplatypus\t1\t2\tMAM\t9258\n",
710 "Oryctolagus cuniculus\trabbit\t1\t2\tMAM\t9986\n",
711 "Oryza alta\t\t1\t1\tPLN\t52545\n",
712 "Oryza australiensis\t\t1\t1\tPLN\t4532\n",
713 "Oryza brachyantha\t\t1\t1\tPLN\t4533\n",
714 "Oryza coarctata\t\t1\t1\tPLN\t77588\n",
715 "Oryza glaberrima\tAfrican rice\t1\t1\tPLN\t4538\n",
716 "Oryza granulata\t\t1\t1\tPLN\t110450\n",
717 "Oryza minuta\t\t1\t1\tPLN\t63629\n",
718 "Oryza nivara\t\t1\t1\tPLN\t4536\n",
719 "Oryza officinalis\t\t1\t1\tPLN\t4535\n",
720 "Oryza punctata\t\t1\t1\tPLN\t4537\n",
721 "Oryza ridleyi\t\t1\t1\tPLN\t83308\n",
722 "Oryza rufipogon\t\t1\t1\tPLN\t4529\n",
723 "Oryza sativa\trice\t1\t1\tPLN\t4530\n",
724 "Oryza sativa Indica Group\t\t1\t1\tPLN\t39946\n",
725 "Oryza sativa Japonica Group\t\t1\t1\tPLN\t39947\n",
726 "Oryzias latipes\tJapanese medaka\t1\t2\tVRT\t8090\n",
727 "Oscarella carmela\t\t1\t4\tINV\t386100\n",
728 "Osmerus mordax\trainbow smelt\t1\t2\tVRT\t8014\n",
729 "Ostertagia ostertagi\t\t1\t5\tINV\t6317\n",
730 "Ostreococcus lucimarinus CCE9901\t\t1\t1\tPLN\t436017\n",
731 "Otolemur garnettii\tsmall-eared galago\t1\t2\tPRI\t30611\n",
732 "Ovis aries\tsheep\t1\t2\tMAM\t9940\n",
733 "Pan paniscus\tpygmy chimpanzee\t1\t2\tPRI\t9597\n",
734 "Pan troglodytes\tchimpanzee\t1\t2\tPRI\t9598\n",
735 "Pan troglodytes troglodytes\t\t1\t2\tPRI\t37011\n",
736 "Pan troglodytes verus\t\t1\t2\tPRI\t37012\n",
737 "Panax ginseng\t\t1\t1\tPLN\t4054\n",
738 "Panicum virgatum\tswitchgrass\t1\t1\tPLN\t38727\n",
739 "Paracentrotus lividus\tcommon urchin\t1\t9\tINV\t7656\n",
740 "Paracoccidioides brasiliensis\t\t1\t4\tPLN\t121759\n",
741 "Paralabidochromis chilotes\t\t1\t2\tVRT\t77306\n",
742 "Paralichthys olivaceus\tbastard halibut\t1\t2\tVRT\t8255\n",
743 "Paramecium tetraurelia\t\t6\t4\tINV\t5888\n",
744 "Parastrongyloides trichosuri\t\t1\t5\tINV\t131310\n",
745 "Pasteuria penetrans\t\t11\t0\tBCT\t86005\n",
746 "Patiria pectinifera\t\t1\t9\tINV\t7594\n",
747 "Pavlova lutheri\t\t1\t1\tPLN\t2832\n",
748 "Paxillus involutus\t\t1\t4\tPLN\t71150\n",
749 "Pediculus humanus capitis\thuman head louse\t1\t5\tINV\t121226\n",
750 "Pediculus humanus corporis\thuman body louse\t1\t5\tINV\t121224\n",
751 "Penaeus monodon\tblack tiger shrimp\t1\t5\tINV\t6687\n",
752 "Penicillium marneffei\t\t1\t4\tPLN\t37727\n",
753 "Pennisetum glaucum\t\t1\t1\tPLN\t4543\n",
754 "Perkinsus marinus ATCC 50983\t\t1\t4\tINV\t423536\n",
755 "Peromyscus maniculatus bairdii\tprairie deer mouse\t1\t2\tROD\t230844\n",
756 "Persea americana\tavocado\t1\t1\tPLN\t3435\n",
757 "Petromyzon marinus\tsea lamprey\t1\t2\tVRT\t7757\n",
758 "Phaeodactylum tricornutum\t\t1\t1\tPLN\t2850\n",
759 "Phaeosphaeria nodorum SN15\t\t1\t4\tPLN\t321614\n",
760 "Phakopsora pachyrhizi\t\t1\t4\tPLN\t170000\n",
761 "Phalaenopsis equestris\t\t1\t1\tPLN\t78828\n",
762 "Phalaenopsis violacea\t\t1\t1\tPLN\t86509\n",
763 "Phanerochaete chrysosporium\t\t1\t4\tPLN\t5306\n",
764 "Phaseolus coccineus\t\t1\t1\tPLN\t3886\n",
765 "Phaseolus vulgaris\t\t1\t1\tPLN\t3885\n",
766 "Phlebotomus papatasi\t\t1\t5\tINV\t29031\n",
767 "Photorhabdus luminescens\t\t11\t0\tBCT\t29488\n",
768 "Physarum polycephalum\tslime mold\t1\t1\tINV\t5791\n",
769 "Physcomitrella patens\t\t1\t1\tPLN\t3218\n",
770 "Physcomitrella patens subsp. patens\t\t1\t1\tPLN\t145481\n",
771 "Phytophthora brassicae\t\t1\t1\tPLN\t187813\n",
772 "Phytophthora infestans\tpotato late blight agent\t1\t1\tPLN\t4787\n",
773 "Phytophthora infestans T30-4\t\t1\t1\tPLN\t403677\n",
774 "Phytophthora parasitica\t\t1\t1\tPLN\t4792\n",
775 "Phytophthora ramorum\tSudden oak death agent\t1\t1\tPLN\t164328\n",
776 "Phytophthora sojae\t\t1\t1\tPLN\t67593\n",
777 "Picea abies\tNorway spruce\t1\t1\tPLN\t3329\n",
778 "Picea glauca\twhite spruce\t1\t1\tPLN\t3330\n",
779 "Picea sitchensis\tSitka spruce\t1\t1\tPLN\t3332\n",
780 "Pichia angusta\t\t1\t3\tPLN\t4905\n",
781 "Pichia farinosa\t\t1\t3\tPLN\t4920\n",
782 "Pichia guilliermondii ATCC 6260\t\t1\t3\tPLN\t294746\n",
783 "Pichia stipitis CBS 6054\t\t12\t3\tPLN\t322104\n",
784 "Pimephales promelas\t\t1\t2\tVRT\t90988\n",
785 "Pinus pinaster\t\t1\t1\tPLN\t71647\n",
786 "Pinus taeda\tloblolly pine\t1\t1\tPLN\t3352\n",
787 "Pisum sativum\tpea\t1\t1\tPLN\t3888\n",
788 "Plasmodium berghei\t\t1\t4\tINV\t5821\n",
789 "Plasmodium berghei strain ANKA\t\t1\t4\tINV\t5823\n",
790 "Plasmodium chabaudi\t\t1\t4\tINV\t5825\n",
791 "Plasmodium chabaudi chabaudi\t\t1\t4\tINV\t31271\n",
792 "Plasmodium falciparum\tmalaria parasite P. falciparum\t1\t4\tINV\t5833\n",
793 "Plasmodium falciparum 3D7\t\t1\t4\tINV\t36329\n",
794 "Plasmodium falciparum Dd2\t\t1\t4\tINV\t57267\n",
795 "Plasmodium falciparum HB3\t\t1\t4\tINV\t137071\n",
796 "Plasmodium vivax\tmalaria parasite P. vivax\t1\t4\tINV\t5855\n",
797 "Plasmodium yoelii\t\t1\t4\tINV\t5861\n",
798 "Plasmodium yoelii yoelii\t\t1\t4\tINV\t73239\n",
799 "Plasmodium yoelii yoelii str. 17XNL\t\t1\t4\tINV\t352914\n",
800 "Platichthys flesus\tEuropean flounder\t1\t2\tVRT\t8260\n",
801 "Plodia interpunctella\tIndianmeal moth\t1\t5\tINV\t58824\n",
802 "Pneumocystis carinii\t\t1\t4\tPLN\t4754\n",
803 "Podocoryne carnea\t\t1\t4\tINV\t6096\n",
804 "Poecilia reticulata\tguppy\t1\t2\tVRT\t8081\n",
805 "Polygonatum sibiricum\t\t1\t1\tPLN\t261423\n",
806 "Polysphondylium pallidum\t\t1\t1\tINV\t13642\n",
807 "Polytomella parva\t\t1\t1\tPLN\t51329\n",
808 "Poncirus trifoliata\t\t1\t1\tPLN\t37690\n",
809 "Pongo pygmaeus\torangutan\t1\t2\tPRI\t9600\n",
810 "Populus deltoides\t\t1\t1\tPLN\t3696\n",
811 "Populus euphratica\t\t1\t1\tPLN\t75702\n",
812 "Populus nigra\t\t1\t1\tPLN\t3691\n",
813 "Populus tremula\t\t1\t1\tPLN\t113636\n",
814 "Populus tremuloides\tquaking aspen\t1\t1\tPLN\t3693\n",
815 "Populus trichocarpa\t\t1\t1\tPLN\t3694\n",
816 "Porcine respiratory and reproductive syndrome virus\t\t1\t0\tVRL\t28344\n",
817 "Porphyra haitanensis\t\t1\t4\tPLN\t76159\n",
818 "Porphyra yezoensis\t\t1\t4\tPLN\t2788\n",
819 "Pratylenchus vulnus\t\t1\t5\tINV\t45931\n",
820 "Pristionchus pacificus\t\t1\t5\tINV\t54126\n",
821 "Prototheca wickerhamii\t\t1\t1\tPLN\t3111\n",
822 "Prunus armeniaca\tapricot\t1\t1\tPLN\t36596\n",
823 "Prunus dulcis\talmond\t1\t1\tPLN\t3755\n",
824 "Prunus persica\tpeach\t1\t1\tPLN\t3760\n",
825 "Prymnesium parvum\t\t1\t1\tPLN\t97485\n",
826 "Pseudomonas aeruginosa\t\t11\t0\tBCT\t287\n",
827 "Pseudotsuga menziesii\tDouglas-fir\t1\t1\tPLN\t3357\n",
828 "Pseudotsuga menziesii var. menziesii\t\t1\t1\tPLN\t278161\n",
829 "Psychroflexus torquis ATCC 700755\t\t11\t0\tBCT\t313595\n",
830 "Puccinellia tenuiflora\t\t1\t1\tPLN\t240906\n",
831 "Puccinia graminis f. sp. tritici CRL 75-36-700-3\t\t1\t4\tPLN\t418459\n",
832 "Puccinia triticina\t\t1\t4\tPLN\t208348\n",
833 "Pythium ultimum DAOM BR144\t\t1\t1\tPLN\t431595\n",
834 "Rabies virus\t\t1\t0\tVRL\t11292\n",
835 "Raphanus raphanistrum subsp. landra\t\t1\t1\tPLN\t328428\n",
836 "Raphanus raphanistrum subsp. maritimus\t\t1\t1\tPLN\t457179\n",
837 "Raphanus raphanistrum subsp. raphanistrum\t\t1\t1\tPLN\t109997\n",
838 "Raphanus sativus\tradish\t1\t1\tPLN\t3726\n",
839 "Raphanus sativus var. oleiformis\t\t1\t1\tPLN\t463157\n",
840 "Rattus norvegicus\tNorway rat\t1\t2\tROD\t10116\n",
841 "Reclinomonas americana\t\t1\t1\tINV\t48483\n",
842 "Rhipicephalus appendiculatus\t\t1\t5\tINV\t34631\n",
843 "Rhipicephalus microplus\tsouthern cattle tick\t1\t5\tINV\t6941\n",
844 "Rhizopus oryzae\t\t1\t1\tPLN\t64495\n",
845 "Rhodnius prolixus\t\t1\t5\tINV\t13249\n",
846 "Rhynchosciara americana\t\t1\t5\tINV\t7186\n",
847 "Ricinus communis\tcastor bean\t1\t1\tPLN\t3988\n",
848 "Robinia pseudoacacia\t\t1\t1\tPLN\t35938\n",
849 "Rosa hybrid cultivar\t\t1\t1\tPLN\t128735\n",
850 "Rutilus rutilus\troach minnow\t1\t2\tVRT\t48668\n",
851 "Saccharomyces castellii\t\t1\t3\tPLN\t27288\n",
852 "Saccharomyces cerevisiae\tbaker's yeast\t1\t3\tPLN\t4932\n",
853 "Saccharomyces mikatae IFO 1815\t\t1\t3\tPLN\t226126\n",
854 "Saccharomyces pastorianus\t\t1\t3\tPLN\t27292\n",
855 "Saccharomyces servazzii\t\t1\t3\tPLN\t27293\n",
856 "Saccharomyces uvarum\t\t1\t3\tPLN\t230603\n",
857 "Saccharum hybrid cultivar\t\t1\t1\tPLN\t128810\n",
858 "Saccharum officinarum\t\t1\t1\tPLN\t4547\n",
859 "Saccoglossus kowalevskii\t\t1\t9\tINV\t10224\n",
860 "Saitoella complicata\t\t1\t4\tPLN\t5606\n",
861 "Salmo salar\tAtlantic salmon\t1\t2\tVRT\t8030\n",
862 "Salvelinus fontinalis\tbrook trout\t1\t2\tVRT\t8038\n",
863 "Salvia miltiorrhiza\t\t1\t1\tPLN\t226208\n",
864 "Sarcocystis falcatula\t\t1\t4\tINV\t32593\n",
865 "Sarcocystis neurona\t\t1\t4\tINV\t42890\n",
866 "Saruma henryi\t\t1\t1\tPLN\t13258\n",
867 "Sawyeria marylandensis\t\t1\t1\tINV\t194530\n",
868 "Scenedesmus obliquus\t\t1\t22\tPLN\t3088\n",
869 "Schistosoma japonicum\t\t1\t9\tINV\t6182\n",
870 "Schistosoma mansoni\t\t1\t9\tINV\t6183\n",
871 "Schizosaccharomyces pombe\tfission yeast\t1\t4\tPLN\t4896\n",
872 "Schizosaccharomyces pombe 972h-\t\t1\t4\tPLN\t284812\n",
873 "Schmidtea mediterranea\t\t1\t9\tINV\t79327\n",
874 "Sclerotinia sclerotiorum\t\t1\t4\tPLN\t5180\n",
875 "Sclerotinia sclerotiorum 1980\t\t1\t4\tPLN\t325569\n",
876 "Sebastes rastrelliger\tgrass rockfish\t1\t2\tVRT\t72095\n",
877 "Secale cereale\trye\t1\t1\tPLN\t4550\n",
878 "Seculamonas ecuadoriensis\t\t1\t1\tINV\t221724\n",
879 "Selaginella lepidophylla\t\t1\t1\tPLN\t59777\n",
880 "Sesamum indicum\tsesame\t1\t1\tPLN\t4182\n",
881 "Simian immunodeficiency virus\t\t1\t0\tVRL\t11723\n",
882 "Solanum chacoense\tChaco potato\t1\t1\tPLN\t4108\n",
883 "Solanum habrochaites\t\t1\t1\tPLN\t62890\n",
884 "Solanum lycopersicum\t\t1\t1\tPLN\t4081\n",
885 "Solanum pennellii\t\t1\t1\tPLN\t28526\n",
886 "Solanum tuberosum\tpotato\t1\t1\tPLN\t4113\n",
887 "Solenopsis invicta\tred fire ant\t1\t5\tINV\t13686\n",
888 "Sorex araneus\tEuropean shrew\t1\t2\tMAM\t42254\n",
889 "Sorghum bicolor\tsorghum\t1\t1\tPLN\t4558\n",
890 "Sorghum propinquum\t\t1\t1\tPLN\t132711\n",
891 "Sparus aurata\tgilthead seabream\t1\t2\tVRT\t8175\n",
892 "Spermophilus lateralis\tgolden-mantled ground squirrel\t1\t2\tROD\t76772\n",
893 "Spermophilus tridecemlineatus\tthirteen-lined ground squirrel\t1\t2\tROD\t43179\n",
894 "Sphaeroforma arctica\t\t1\t1\tINV\t72019\n",
895 "Spironucleus barkhanus\t\t6\t0\tINV\t103874\n",
896 "Spizellomyces punctatus\t\t1\t16\tPLN\t109760\n",
897 "Spodoptera frugiperda\tfall armyworm\t1\t5\tINV\t7108\n",
898 "Squalus acanthias\tspiny dogfish\t1\t2\tVRT\t7797\n",
899 "Stachyamoeba lipophora\t\t1\t1\tINV\t463046\n",
900 "Staphylococcus aureus\t\t11\t0\tBCT\t1280\n",
901 "Staphylococcus epidermidis\t\t11\t0\tBCT\t1282\n",
902 "Sterkiella histriomuscorum\t\t6\t4\tINV\t94289\n",
903 "Stevia rebaudiana\t\t1\t1\tPLN\t55670\n",
904 "Streblomastix strix\t\t6\t1\tINV\t222440\n",
905 "Streptococcus agalactiae\t\t11\t0\tBCT\t1311\n",
906 "Streptococcus pneumoniae\t\t11\t0\tBCT\t1313\n",
907 "Streptococcus pyogenes\t\t11\t0\tBCT\t1314\n",
908 "Strongylocentrotus purpuratus\t\t1\t9\tINV\t7668\n",
909 "Strongyloides ratti\t\t1\t5\tINV\t34506\n",
910 "Strongyloides stercoralis\t\t1\t5\tINV\t6248\n",
911 "Suidasia medanensis\t\t1\t5\tINV\t223625\n",
912 "Sus scrofa\tpig\t1\t2\tMAM\t9823\n",
913 "Taenia solium\tpork tapeworm\t1\t9\tINV\t6204\n",
914 "Taeniopygia guttata\t\t1\t2\tVRT\t59729\n",
915 "Taiwania cryptomerioides\t\t1\t1\tPLN\t50187\n",
916 "Takifugu rubripes\ttorafugu\t1\t2\tVRT\t31033\n",
917 "Tamarix androssowii\t\t1\t1\tPLN\t189785\n",
918 "Tamarix hispida\t\t1\t1\tPLN\t189793\n",
919 "Taphrina deformans\tpeach leaf curl fungus\t1\t4\tPLN\t5011\n",
920 "Taraxacum kok-saghyz\t\t1\t1\tPLN\t333970\n",
921 "Taraxacum officinale\t\t1\t1\tPLN\t50225\n",
922 "Teladorsagia circumcincta\t\t1\t5\tINV\t45464\n",
923 "Tetrahymena thermophila\t\t6\t4\tINV\t5911\n",
924 "Tetrahymena thermophila SB210\t\t6\t4\tINV\t312017\n",
925 "Tetraodon nigroviridis\t\t1\t2\tVRT\t99883\n",
926 "Thalassiosira pseudonana CCMP1335\t\t1\t4\tPLN\t296543\n",
927 "Theileria annulata\t\t1\t4\tINV\t5874\n",
928 "Theileria annulata strain Ankara\t\t1\t4\tINV\t353154\n",
929 "Theileria parva\t\t1\t4\tINV\t5875\n",
930 "Theileria parva strain Muguga\t\t1\t4\tINV\t333668\n",
931 "Thellungiella halophila\t\t1\t1\tPLN\t98038\n",
932 "Thellungiella salsuginea\t\t1\t1\tPLN\t72664\n",
933 "Theobroma cacao\tcacao\t1\t1\tPLN\t3641\n",
934 "Thermomyces lanuginosus\t\t1\t4\tPLN\t5541\n",
935 "Thlaspi caerulescens\t\t1\t1\tPLN\t107243\n",
936 "Thunnus thynnus\tbluefin tuna\t1\t2\tVRT\t8237\n",
937 "Thymallus arcticus\tArctic grayling\t1\t2\tVRT\t70285\n",
938 "Torque teno virus\t\t1\t0\tVRL\t68887\n",
939 "Tortula ruralis\t\t1\t1\tPLN\t38588\n",
940 "Toxocara canis\t\t1\t5\tINV\t6265\n",
941 "Toxoplasma gondii\t\t1\t4\tINV\t5811\n",
942 "Toxoplasma gondii RH\t\t1\t4\tINV\t383379\n",
943 "Toxoptera citricida\tbrown citrus aphid\t1\t5\tINV\t223852\n",
944 "Trametes versicolor\t\t1\t4\tPLN\t5325\n",
945 "Tribolium castaneum\tred flour beetle\t1\t5\tINV\t7070\n",
946 "Trichinella spiralis\t\t1\t5\tINV\t6334\n",
947 "Trichoderma reesei QM6a\t\t1\t4\tPLN\t431241\n",
948 "Trichomonas vaginalis\t\t1\t0\tINV\t5722\n",
949 "Trichomonas vaginalis G3\t\t1\t0\tINV\t412133\n",
950 "Trichophyton rubrum\t\t1\t4\tPLN\t5551\n",
951 "Trichosurus vulpecula\tsilver-gray brushtail possum\t1\t2\tMAM\t9337\n",
952 "Trichuris muris\t\t1\t5\tINV\t70415\n",
953 "Trichuris vulpis\t\t1\t5\tINV\t219738\n",
954 "Trifolium pratense\t\t1\t1\tPLN\t57577\n",
955 "Trifolium repens\twhite clover\t1\t1\tPLN\t3899\n",
956 "Trimastix pyriformis\t\t1\t1\tINV\t342808\n",
957 "Triphysaria versicolor\t\t1\t1\tPLN\t64093\n",
958 "Triticum aestivum\tbread wheat\t1\t1\tPLN\t4565\n",
959 "Triticum monococcum\t\t1\t1\tPLN\t4568\n",
960 "Triticum turgidum subsp. durum\tdurum wheat\t1\t1\tPLN\t4567\n",
961 "Tritrichomonas foetus\t\t1\t0\tINV\t5724\n",
962 "Trypanosoma brucei\t\t1\t4\tINV\t5691\n",
963 "Trypanosoma brucei rhodesiense\t\t1\t4\tINV\t31286\n",
964 "Trypanosoma brucei TREU927\t\t1\t4\tINV\t185431\n",
965 "Trypanosoma cruzi\t\t1\t4\tINV\t5693\n",
966 "Trypanosoma cruzi strain CL Brener\t\t1\t4\tINV\t353153\n",
967 "Tuber borchii\twhitish truffle\t1\t4\tPLN\t42251\n",
968 "Tupaia belangeri\tnorthern tree shrew\t1\t2\tMAM\t37347\n",
969 "Tursiops truncatus\tbottlenosed dolphin\t1\t2\tMAM\t9739\n",
970 "uncultured archaeon\t\t11\t0\tENV\t115547\n",
971 "uncultured bacterium\t\t11\t0\tENV\t77133\n",
972 "uncultured eukaryote\t\t1\t1\tENV\t100272\n",
973 "uncultured fungus\t\t1\t4\tENV\t175245\n",
974 "uncultured marine virus\t\t1\t0\tENV\t186617\n",
975 "uncultured organism\t\t11\t2\tENV\t155900\n",
976 "uncultured prokaryote\t\t11\t0\tENV\t198431\n",
977 "Uromyces appendiculatus\t\t1\t4\tPLN\t5264\n",
978 "Ustilago maydis\t\t1\t4\tPLN\t5270\n",
979 "Ustilago maydis 521\t\t1\t4\tPLN\t237631\n",
980 "Vaccinium corymbosum\t\t1\t1\tPLN\t69266\n",
981 "Vanderwaltozyma polyspora DSM 70294\t\t1\t3\tPLN\t436907\n",
982 "Verticillium dahliae\t\t1\t4\tPLN\t27337\n",
983 "Vibrio parahaemolyticus AQ3810\t\t11\t0\tBCT\t419109\n",
984 "Vigna unguiculata\tcowpea\t1\t1\tPLN\t3917\n",
985 "Vitis hybrid cultivar\t\t1\t1\tPLN\t241073\n",
986 "Vitis shuttleworthii\t\t1\t1\tPLN\t246827\n",
987 "Vitis vinifera\t\t1\t1\tPLN\t29760\n",
988 "Welwitschia mirabilis\t\t1\t1\tPLN\t3377\n",
989 "Wuchereria bancrofti\t\t1\t5\tINV\t6293\n",
990 "Xenopus laevis\tAfrican clawed frog\t1\t2\tVRT\t8355\n",
991 "Xenopus tropicalis\twestern clawed frog\t1\t2\tVRT\t8364\n",
992 "Xiphinema index\t\t1\t5\tINV\t46003\n",
993 "Yarrowia lipolytica\t\t1\t3\tPLN\t4952\n",
994 "Yarrowia lipolytica CLIB122\t\t1\t3\tPLN\t284591\n",
995 "Zamia fischeri\t\t1\t1\tPLN\t34342\n",
996 "Zantedeschia aethiopica\t\t1\t1\tPLN\t69721\n",
997 "Zea mays\t\t1\t1\tPLN\t4577\n",
998 "Zea mays subsp. mays\tmaize\t1\t1\tPLN\t381124\n",
999 "Zea mays subsp. parviglumis\t\t1\t1\tPLN\t76912\n",
1000 "Zingiber officinale\t\t1\t1\tPLN\t94328\n",
1001 "Zinnia elegans\t\t1\t1\tPLN\t34245\n",
1002 "Zostera marina\t\t1\t1\tPLN\t29655\n",
1003 "Zygosaccharomyces rouxii\t\t1\t3\tPLN\t4956\n",
1004 NULL
1005 };
1006 #endif
1007
LoadOrganismTable(void)1008 extern Boolean LoadOrganismTable (void)
1009
1010 {
1011 Char ch;
1012 FILE *f;
1013 Boolean failed;
1014 Char first [16];
1015 Int2 idx;
1016 CharPtr lst;
1017 Int8 len;
1018 Int2 num;
1019 CharPtr ptr = NULL;
1020 Char str [PATH_MAX];
1021 CharPtr tmp;
1022 Int2 version;
1023 #ifdef WIN_MAC
1024 CharPtr p;
1025 #endif
1026 #if (defined(OS_DOS) || defined (OS_NT))
1027 CharPtr p;
1028 CharPtr q;
1029 #endif
1030
1031 orgTxtPtr = NULL;
1032 orgStrIdx = NULL;
1033 orgNum = 0;
1034 failed = TRUE;
1035 ProgramPath (str, sizeof (str));
1036 tmp = StringRChr (str, DIRDELIMCHR);
1037 if (tmp != NULL) {
1038 *tmp = '\0';
1039 FileBuildPath (str, NULL, "taxlist.txt");
1040 len = FileLength (str);
1041 f = FileOpen (str, "r");
1042 if (f == NULL) {
1043 if (GetAppParam ("NCBI", "NCBI", "DATA", "", str, sizeof (str))) {
1044 FileBuildPath (str, NULL, "taxlist.txt");
1045 len = FileLength (str);
1046 f = FileOpen (str, "r");
1047 }
1048 }
1049 if (f != NULL) {
1050 ptr = MemNew ((size_t) (len + 5));
1051 if (ptr != NULL) {
1052 FileRead (ptr, (size_t) len, 1, f);
1053 #if (defined(OS_DOS) || defined (OS_NT))
1054 p = ptr;
1055 q = ptr;
1056 while (*p) {
1057 if (*p == '\r') {
1058 p++;
1059 } else {
1060 *q = *p;
1061 p++;
1062 q++;
1063 }
1064 }
1065 *q = '\0';
1066 #endif
1067 #ifdef WIN_MAC
1068 p = ptr;
1069 while (*p) {
1070 if (*p == '\r') {
1071 *p = '\n';
1072 }
1073 p++;
1074 }
1075 #endif
1076 }
1077 FileClose (f);
1078 }
1079 }
1080 if (ptr == NULL) {
1081 #ifndef WIN16
1082 idx = 0;
1083 len = 0;
1084 tmp = taxlistMemStrs [idx];
1085 while (tmp != NULL) {
1086 len += StringLen (tmp);
1087 idx++;
1088 tmp = taxlistMemStrs [idx];
1089 }
1090 ptr = MemNew ((size_t) (len + 5));
1091 if (ptr != NULL) {
1092 lst = ptr;
1093 idx = 0;
1094 tmp = taxlistMemStrs [idx];
1095 while (tmp != NULL) {
1096 lst = StringMove (lst, tmp);
1097 idx++;
1098 tmp = taxlistMemStrs [idx];
1099 }
1100 }
1101 #endif
1102 }
1103 if (ptr != NULL) {
1104 orgTxtPtr = ptr;
1105 tmp = ptr;
1106 ch = *tmp;
1107 while (ch != '\0' && ch != '\n') {
1108 tmp++;
1109 ch = *tmp;
1110 }
1111 *tmp = '\0';
1112 StringNCpy_0 (first, ptr, sizeof (first) - 1);
1113 *tmp = ch;
1114 if (StrToInt (first, &version)) {
1115 tmp++;
1116 ptr = tmp;
1117 }
1118 num = 0;
1119 tmp = ptr;
1120 ch = *tmp;
1121 while (ch != '\0') {
1122 if (ch == '\n') {
1123 num++;
1124 }
1125 tmp++;
1126 ch = *tmp;
1127 }
1128 orgStrIdx = MemNew (sizeof (CharPtr) * (size_t) (num + 3));
1129 if (orgStrIdx != NULL) {
1130 idx = 0;
1131 tmp = ptr;
1132 ch = *tmp;
1133 orgStrIdx [idx] = tmp;
1134 while (ch != '\0') {
1135 if (ch == '\n') {
1136 idx++;
1137 tmp++;
1138 ch = *tmp;
1139 orgStrIdx [idx] = tmp;
1140 } else {
1141 tmp++;
1142 ch = *tmp;
1143 }
1144 }
1145 orgNum = num;
1146 failed = FALSE;
1147 }
1148 }
1149 if (failed) {
1150 orgTxtPtr = MemFree (orgTxtPtr);
1151 orgStrIdx = MemFree (orgStrIdx);
1152 return FALSE;
1153 } else {
1154 return TRUE;
1155 }
1156 }
1157
FreeOrganismTable(void)1158 extern void FreeOrganismTable (void)
1159
1160 {
1161 orgTxtPtr = MemFree (orgTxtPtr);
1162 orgStrIdx = MemFree (orgStrIdx);
1163 }
1164
SetupGeneticCodes(void)1165 extern void SetupGeneticCodes (void)
1166
1167 {
1168 Char ch;
1169 GeneticCodePtr codes;
1170 GeneticCodePtr gcp;
1171 Int2 i;
1172 Int4 id;
1173 Int2 j;
1174 Int2 index;
1175 Char name [64];
1176 CharPtr ptr;
1177 Char str [256];
1178 ValNodePtr tmp;
1179
1180 numGeneticCodes = 0;
1181 for (i = 0; i < NUM_GENETIC_CODES; i++) {
1182 gcIndexToId [i] = 0;
1183 gcIdToIndex [i] = 1;
1184 gcNames [i] = NULL;
1185 }
1186 index = 1;
1187 codes = GeneticCodeTableLoad ();
1188 if (codes != NULL) {
1189 for (gcp = codes; gcp != NULL; gcp = gcp->next) {
1190 id = 0;
1191 str [0] = '\0';
1192 for (tmp = (ValNodePtr) gcp->data.ptrvalue; tmp != NULL; tmp = tmp->next) {
1193 switch (tmp->choice) {
1194 case 1 :
1195 if (StringLen (str) < 1) {
1196 StringNCpy_0 (str, (CharPtr) tmp->data.ptrvalue, sizeof (str));
1197 ptr = str;
1198 ch = *ptr;
1199 while (ch != '\0') {
1200 if (ch == '/') {
1201 *ptr = '-';
1202 }
1203 ptr++;
1204 ch = *ptr;
1205 }
1206 }
1207 break;
1208 case 2 :
1209 id = tmp->data.intvalue;
1210 break;
1211 default :
1212 break;
1213 }
1214 }
1215 if (id != 7 && id != 8) {
1216 if (id > 0 /* && id < 30 */ ) {
1217 i = 0;
1218 if (StringLen (str + i) > 0 && index < NUM_GENETIC_CODES - 1) {
1219 ch = str [i];
1220 while (ch == ' ' || ch == ';') {
1221 i++;
1222 ch = str [i];
1223 }
1224 j = 0;
1225 ch = str [i + j];
1226 while (ch != '\0' && ch != ';') {
1227 name [j] = ch;
1228 j++;
1229 ch = str [i + j];
1230 }
1231 name [j] = '\0';
1232 i += j;
1233 index++;
1234 if (ch == ';') {
1235 StringCat (name, ", etc.");
1236 }
1237 gcIndexToId [index] = id;
1238 gcIdToIndex [id] = index;
1239 gcNames [index] = StringSave (name);
1240 }
1241 }
1242 }
1243 }
1244 }
1245 numGeneticCodes = index;
1246 }
1247
FreeGeneticCodes(void)1248 extern void FreeGeneticCodes (void)
1249
1250 {
1251 Int2 i;
1252
1253 for (i = 0; i < NUM_GENETIC_CODES; i++) {
1254 gcNames [i] = MemFree (gcNames [i]);
1255 }
1256 }
1257
GetGeneticCodeValNodeList(void)1258 extern ValNodePtr GetGeneticCodeValNodeList (void)
1259 {
1260 ValNodePtr gencodelist = NULL;
1261 Int4 index;
1262
1263 for (index = 0; index <= numGeneticCodes; index++)
1264 {
1265 if (StringHasNoText (gcNames[index]))
1266 {
1267 continue;
1268 }
1269 ValNodeAddPointer (&gencodelist, gcIndexToId [index], StringSave (gcNames[index]));
1270 }
1271 return gencodelist;
1272 }
1273
CopyField(CharPtr str,size_t max,CharPtr source,Int2 col)1274 static void CopyField (CharPtr str, size_t max, CharPtr source, Int2 col)
1275
1276 {
1277 Char ch;
1278 size_t count;
1279 CharPtr ptr;
1280
1281 if (str != NULL && max > 0 && source != NULL) {
1282 MemSet (str, 0, max);
1283 ptr = source;
1284 ch = *ptr;
1285 while (col > 1 && ch != '\n' && ch != '\0') {
1286 while (ch != '\t' && ch != '\n' && ch != '\0') {
1287 ptr++;
1288 ch = *ptr;
1289 }
1290 if (ch == '\t') {
1291 ptr++;
1292 ch = *ptr;
1293 }
1294 col--;
1295 }
1296 count = 0;
1297 ch = ptr [count];
1298 while (ch != '\t' && ch != '\n' && ch != '\0') {
1299 count++;
1300 ch = ptr [count];
1301 }
1302 max = MIN (max, count);
1303 StringNCpy (str, ptr, max); /* remains StringNCpy, not _0 */
1304 }
1305 }
1306
CopyStrFromTaxPtr(CharPtr str,size_t max,Int2 row,Int2 col)1307 static void CopyStrFromTaxPtr (CharPtr str, size_t max, Int2 row, Int2 col)
1308
1309 {
1310 CharPtr source;
1311
1312 if (str != NULL && max > 0) {
1313 MemSet (str, 0, max);
1314 if (orgTxtPtr != NULL && orgStrIdx != NULL && row > 0) {
1315 source = orgStrIdx [row - 1];
1316 CopyField (str, max, source, col);
1317 }
1318 }
1319 }
1320
FindTaxText(CharPtr text,Int2 num)1321 static Int2 FindTaxText (CharPtr text, Int2 num)
1322
1323 {
1324 Int2 compare;
1325 Int2 left;
1326 Int2 mid;
1327 Int2 right;
1328 Char str [256];
1329
1330 mid = 0;
1331 if (text != NULL && num > 0) {
1332 left = 1;
1333 right = num;
1334 while (left <= right) {
1335 mid = (left + right) / 2;
1336 CopyStrFromTaxPtr (str, sizeof (str) - 2, mid, 1);
1337 compare = StringICmp (text, str);
1338 if (compare <= 0) {
1339 right = mid - 1;
1340 }
1341 if (compare >= 0) {
1342 left = mid + 1;
1343 }
1344 }
1345 if (left <= right + 1) {
1346 CopyStrFromTaxPtr (str, sizeof (str) - 2, mid, 1);
1347 str [StringLen (text)] = '\0';
1348 compare = StringICmp (text, str);
1349 if (compare > 0) {
1350 mid++;
1351 if (mid <= num) {
1352 CopyStrFromTaxPtr (str, sizeof (str) - 2, mid, 1);
1353 str [StringLen (text)] = '\0';
1354 compare = StringICmp (text, str);
1355 if (compare > 0) {
1356 mid = 0;
1357 }
1358 }
1359 }
1360 }
1361 }
1362 return mid;
1363 }
1364
BioSourceDialogToGenBankDivision(DialoG d,CharPtr div,size_t maxsize)1365 extern Boolean BioSourceDialogToGenBankDivision (DialoG d, CharPtr div, size_t maxsize)
1366
1367 {
1368 GenBioPagePtr gbp;
1369
1370 if (div == NULL || maxsize < 1) return FALSE;
1371 div [0] = '\0';
1372 gbp = (GenBioPagePtr) GetObjectExtra (d);
1373 if (gbp != NULL) {
1374 GetTitle (gbp->gbDiv, div, maxsize);
1375 if (! StringHasNoText (div)) return TRUE;
1376 }
1377 return FALSE;
1378 }
1379
PopulateGeneticCodePopup(PopuP gc)1380 NLM_EXTERN void PopulateGeneticCodePopup (PopuP gc)
1381
1382 {
1383 Int2 i;
1384
1385 if (gc != NULL) {
1386 PopupItem (gc, " ");
1387 for (i = 1; i <= numGeneticCodes; i++) {
1388 PopupItem (gc, gcNames [i]);
1389 }
1390 }
1391 }
1392
ChangeGencodePopups(GenBioPagePtr gbp)1393 static void ChangeGencodePopups (GenBioPagePtr gbp)
1394
1395 {
1396 UIEnum genome;
1397 ValNodePtr vnp;
1398
1399 if (gbp != NULL) {
1400 if (gbp->simplecode != NULL) {
1401 vnp = DialogToPointer (gbp->genome);
1402 if (vnp != NULL) {
1403 genome = GenomeFromSrcLoc (vnp->choice);
1404 vnp = ValNodeFreeData (vnp);
1405 if (genome == 4 || genome == 5) {
1406 SafeSetValue (gbp->simplecode, gcIdToIndex [gbp->mitoGC]);
1407 } else if (genome == GENOME_chloroplast ||
1408 genome == GENOME_chromoplast ||
1409 genome == GENOME_plastid ||
1410 genome == GENOME_cyanelle ||
1411 genome == GENOME_apicoplast ||
1412 genome == GENOME_leucoplast ||
1413 genome == GENOME_proplastid ||
1414 genome == GENOME_chromatophore) {
1415 if (gbp->pstdGC > 0) {
1416 SafeSetValue (gbp->simplecode, gcIdToIndex [gbp->pstdGC]);
1417 } else {
1418 SafeSetValue (gbp->simplecode, gcIdToIndex [11]);
1419 }
1420 } else {
1421 SafeSetValue (gbp->simplecode, gcIdToIndex [gbp->nuclGC]);
1422 }
1423 }
1424 SafeSetValue (gbp->gcode, gcIdToIndex [gbp->nuclGC]);
1425 SafeSetValue (gbp->mgcode, gcIdToIndex [gbp->mitoGC]);
1426 SafeSetValue (gbp->pgcode, gcIdToIndex [gbp->pstdGC]);
1427 } else {
1428 SafeSetValue (gbp->gcode, gcIdToIndex [gbp->nuclGC]);
1429 SafeSetValue (gbp->mgcode, gcIdToIndex [gbp->mitoGC]);
1430 SafeSetValue (gbp->pgcode, gcIdToIndex [gbp->pstdGC]);
1431 }
1432 }
1433 }
1434
SetCodes(GenBioPagePtr gbp,Int2 row,Boolean changepopups)1435 static void SetCodes (GenBioPagePtr gbp, Int2 row, Boolean changepopups)
1436
1437 {
1438 Char str [256];
1439
1440 if (gbp != NULL && row > 0) {
1441 CopyStrFromTaxPtr (str, sizeof (str) - 2, row, 3);
1442 StrToInt (str, &gbp->nuclGC);
1443 CopyStrFromTaxPtr (str, sizeof (str) - 2, row, 4);
1444 StrToInt (str, &gbp->mitoGC);
1445 gbp->pstdGC = 0;
1446 CopyStrFromTaxPtr (str, sizeof (str) - 2, row, 5);
1447 SafeSetTitle (gbp->gbDiv, str);
1448 CopyStrFromTaxPtr (str, sizeof (str) - 2, row, 6);
1449 StrToLong (str, &gbp->taxID);
1450 if (changepopups) {
1451 ChangeGencodePopups (gbp);
1452 }
1453 }
1454 }
1455
1456 extern void SetGenome (PopuP p);
SetGenome(PopuP p)1457 void SetGenome (PopuP p)
1458
1459 {
1460 GenBioPagePtr gbp;
1461
1462 gbp = (GenBioPagePtr) GetObjectExtra (p);
1463 if (gbp != NULL) {
1464 ChangeGencodePopups (gbp);
1465 }
1466 }
1467
AutoScrollTax(GenBioPagePtr gbp,TexT t,Boolean isSciName,Boolean setText,Boolean changepopups)1468 static void AutoScrollTax (GenBioPagePtr gbp, TexT t, Boolean isSciName,
1469 Boolean setText, Boolean changepopups)
1470
1471 {
1472 Int2 num;
1473 Int2 oldOrg;
1474 Int2 row;
1475 Char str [256];
1476 Char txt [256];
1477
1478 if (gbp != NULL && t != NULL) {
1479 gbp->nuclGC = 0;
1480 gbp->mitoGC = 0;
1481 gbp->pstdGC = 0;
1482 gbp->taxID = 0;
1483 SafeSetTitle (gbp->gbDiv, "");
1484 GetTitle (t, str, sizeof (str) - 2);
1485 if (str [0] == '\0') {
1486 if (isSciName) {
1487 gbp->typedSciName = FALSE;
1488 } else {
1489 gbp->typedComName = FALSE;
1490 }
1491 }
1492 num = 0;
1493 oldOrg = gbp->selectedOrg;
1494 GetItemParams (gbp->orglist, 1, NULL, &num, NULL, NULL, NULL);
1495 if (num > 0) {
1496 row = FindTaxText (str, num);
1497 if (row > 0 && row <= num) {
1498 if (! RowIsVisible (gbp->orglist, 1, row, NULL, NULL)) {
1499 SetOffset (gbp->orglist, 0, row - 1);
1500 }
1501 CopyStrFromTaxPtr (txt, sizeof (txt) - 2, row, 1);
1502 if (StringICmp (txt, str) != 0) {
1503 if (setText) {
1504 if (isSciName) {
1505 if (! gbp->typedComName) {
1506 SafeSetTitle (gbp->commonName, "");
1507 }
1508 } else {
1509 if (! gbp->typedSciName) {
1510 /*
1511 SafeSetTitle (gbp->taxName, "");
1512 */
1513 }
1514 }
1515 }
1516 gbp->selectedOrg = 0;
1517 InvalDocRows (gbp->orglist, 1, oldOrg, oldOrg);
1518 if (changepopups) {
1519 ChangeGencodePopups (gbp);
1520 }
1521 return;
1522 }
1523 if (isSciName) {
1524 CopyStrFromTaxPtr (str, sizeof (str) - 2, row, 2);
1525 if (! gbp->typedComName) {
1526 if (setText) {
1527 SafeSetTitle (gbp->commonName, str);
1528 }
1529 } else {
1530 GetTitle (gbp->commonName, txt, sizeof (txt));
1531 if (StringICmp (txt, str) != 0) {
1532 if (changepopups) {
1533 ChangeGencodePopups (gbp);
1534 }
1535 return;
1536 }
1537 }
1538 } else {
1539 if (changepopups) {
1540 ChangeGencodePopups (gbp);
1541 }
1542 return;
1543 }
1544 SetCodes (gbp, row, changepopups);
1545 if (oldOrg != row) {
1546 gbp->selectedOrg = 0;
1547 InvalDocRows (gbp->orglist, 1, oldOrg, oldOrg);
1548 gbp->selectedOrg = row;
1549 InvalDocRows (gbp->orglist, 1, row, row);
1550 }
1551 }
1552 }
1553 }
1554 }
1555
1556 static void FreeGenBioOrgNameData (GenBioPagePtr gbp);
1557
TaxNameText(TexT t)1558 static void TaxNameText (TexT t)
1559
1560 {
1561 DbtagPtr dbt;
1562 GenBioPagePtr gbp;
1563 ValNodePtr head;
1564 ValNodePtr nextvnp;
1565 ValNodePtr PNTR prevvnp;
1566 ValNodePtr vnp;
1567
1568 gbp = (GenBioPagePtr) GetObjectExtra (t);
1569 if (gbp != NULL) {
1570 gbp->typedSciName = TRUE;
1571 AutoScrollTax (gbp, t, TRUE, TRUE, TRUE);
1572 SafeSetTitle (gbp->lineage, "");
1573 SafeSetTitle (gbp->gbDiv, "");
1574 head = DialogToPointer (gbp->db);
1575 if (head != NULL) {
1576 prevvnp = &head;
1577 vnp = head;
1578 while (vnp != NULL) {
1579 nextvnp = vnp->next;
1580 dbt = (DbtagPtr) vnp->data.ptrvalue;
1581 if (dbt != NULL) {
1582 if (StringICmp (dbt->db, "taxon") == 0) {
1583 *prevvnp = vnp->next;
1584 vnp->next = NULL;
1585 DbtagFree (dbt);
1586 ValNodeFree (vnp);
1587 FreeGenBioOrgNameData (gbp);
1588 } else {
1589 prevvnp = (ValNodePtr PNTR) &(vnp->next);
1590 }
1591 }
1592 vnp = nextvnp;
1593 }
1594 PointerToDialog (gbp->db, head);
1595 }
1596 }
1597 }
1598
CommonNameText(TexT t)1599 static void CommonNameText (TexT t)
1600
1601 {
1602 GenBioPagePtr gbp;
1603
1604 gbp = (GenBioPagePtr) GetObjectExtra (t);
1605 if (gbp != NULL) {
1606 /*
1607 gbp->typedComName = TRUE;
1608 AutoScrollTax (gbp, t, FALSE, TRUE, TRUE);
1609 */
1610 }
1611 }
1612
ClickTaxName(DoC d,PoinT pt)1613 static void ClickTaxName (DoC d, PoinT pt)
1614
1615 {
1616 GenBioPagePtr gbp;
1617 Int2 item;
1618 Int2 oldOrg;
1619 Int2 row;
1620
1621 gbp = (GenBioPagePtr) GetObjectExtra (d);
1622 if (gbp != NULL) {
1623 MapDocPoint (d, pt, &item, &row, NULL, NULL);
1624 if (item > 0 && row > 0) {
1625 gbp->clickedOrg = row;
1626 oldOrg = gbp->selectedOrg;
1627 if (gbp->selectedOrg != row) {
1628 gbp->selectedOrg = 0;
1629 InvalDocRows (d, 1, oldOrg, oldOrg);
1630 gbp->selectedOrg = row;
1631 InvalDocRows (d, 1, row, row);
1632 }
1633 }
1634 }
1635 }
1636
ReleaseTaxName(DoC d,PoinT pt)1637 static void ReleaseTaxName (DoC d, PoinT pt)
1638
1639 {
1640 GenBioPagePtr gbp;
1641 Int2 item;
1642 Int2 row;
1643 Char str [256];
1644 CharPtr taxname;
1645
1646 gbp = (GenBioPagePtr) GetObjectExtra (d);
1647 if (gbp == NULL) {
1648 return;
1649 }
1650 if (!TextHasNoText (gbp->taxName) || !TextHasNoText (gbp->commonName)) {
1651 if (ANS_CANCEL == Message (MSG_OKC, "Are you sure you want to overwrite the existing scientific name and/or common name?")) {
1652 taxname = SaveStringFromText (gbp->taxName);
1653 if (!StringHasNoText (taxname)) {
1654 SetBioSourceDialogTaxName (gbp->dialog, taxname);
1655 }
1656 taxname = MemFree (taxname);
1657 return;
1658 }
1659 }
1660
1661 if (gbp != NULL) {
1662 gbp->nuclGC = 0;
1663 gbp->mitoGC = 0;
1664 gbp->pstdGC = 0;
1665 gbp->taxID = 0;
1666 SafeSetTitle (gbp->gbDiv, "");
1667 MapDocPoint (d, pt, &item, &row, NULL, NULL);
1668 if (item > 0 && row > 0 && row == gbp->clickedOrg) {
1669 ResetClip ();
1670 if (row == gbp->clickedOrg) {
1671 CopyStrFromTaxPtr (str, sizeof (str) - 2, row, 1);
1672 SafeSetTitle (gbp->taxName, str);
1673 CopyStrFromTaxPtr (str, sizeof (str) - 2, row, 2);
1674 SafeSetTitle (gbp->commonName, str);
1675 Select (gbp->taxName);
1676 TaxNameText (gbp->taxName);
1677 SetCodes (gbp, row, TRUE);
1678 }
1679 }
1680 }
1681 }
1682
SetBioSourceDialogTaxName(DialoG d,CharPtr taxname)1683 extern Boolean SetBioSourceDialogTaxName (DialoG d, CharPtr taxname)
1684
1685 {
1686 GenBioPagePtr gbp;
1687 Int2 num;
1688 Int2 oldOrg;
1689 Int2 row;
1690 Char str [256];
1691
1692 gbp = (GenBioPagePtr) GetObjectExtra (d);
1693 if (gbp == NULL) return FALSE;
1694 num = 0;
1695 oldOrg = gbp->selectedOrg;
1696 GetItemParams (gbp->orglist, 1, NULL, &num, NULL, NULL, NULL);
1697 if (num > 0) {
1698 row = FindTaxText (taxname, num);
1699 if (row > 0 && row <= num) {
1700 if (! RowIsVisible (gbp->orglist, 1, row, NULL, NULL)) {
1701 SetOffset (gbp->orglist, 0, row - 1);
1702 }
1703 CopyStrFromTaxPtr (str, sizeof (str) - 2, row, 1);
1704 if (StringICmp (str, taxname) != 0) {
1705 SafeSetTitle (gbp->commonName, "");
1706 SafeSetTitle (gbp->taxName, taxname);
1707 gbp->selectedOrg = 0;
1708 InvalDocRows (gbp->orglist, 1, oldOrg, oldOrg);
1709 ChangeGencodePopups (gbp);
1710 return TRUE;
1711 }
1712 CopyStrFromTaxPtr (str, sizeof (str) - 2, row, 1);
1713 SafeSetTitle (gbp->taxName, str);
1714 CopyStrFromTaxPtr (str, sizeof (str) - 2, row, 2);
1715 SafeSetTitle (gbp->commonName, str);
1716 Select (gbp->taxName);
1717 SetCodes (gbp, row, TRUE);
1718 gbp->selectedOrg = row;
1719 InvalDocRows (gbp->orglist, 1, oldOrg, oldOrg);
1720 InvalDocRows (gbp->orglist, 1, row, row);
1721 return TRUE;
1722 }
1723 else
1724 {
1725 SafeSetTitle (gbp->taxName, taxname);
1726 SafeSetTitle (gbp->commonName, "");
1727 gbp->selectedOrg = 0;
1728 InvalDocRows (gbp->orglist, 1, oldOrg, oldOrg);
1729 ChangeGencodePopups (gbp);
1730 }
1731 }
1732 return FALSE;
1733 }
1734
HighlightTaxName(DoC d,Int2 item,Int2 row,Int2 col)1735 static Boolean HighlightTaxName (DoC d, Int2 item, Int2 row, Int2 col)
1736
1737 {
1738 GenBioPagePtr gbp;
1739
1740 gbp = (GenBioPagePtr) GetObjectExtra (d);
1741 if (gbp != NULL) {
1742 return (Boolean) (row == gbp->selectedOrg);
1743 } else {
1744 return FALSE;
1745 }
1746 }
1747
1748 static ParData orgListPar = {FALSE, FALSE, FALSE, FALSE, FALSE, 0, 0};
1749 static ColData orgListCol [] = {
1750 {0, 0, 80, 0, NULL, 'l', FALSE, FALSE, FALSE, FALSE, FALSE},
1751 {0, 0, 0, 0, NULL, 'l', FALSE, FALSE, FALSE, FALSE, FALSE},
1752 {0, 0, 0, 0, NULL, 'l', FALSE, FALSE, FALSE, FALSE, FALSE},
1753 {0, 0, 0, 0, NULL, 'l', FALSE, FALSE, FALSE, FALSE, FALSE},
1754 {0, 0, 0, 0, NULL, 'l', FALSE, FALSE, FALSE, FALSE, FALSE},
1755 {0, 0, 0, 0, NULL, 'l', FALSE, FALSE, FALSE, FALSE, FALSE},
1756 {0, 0, 0, 0, NULL, 'l', FALSE, FALSE, FALSE, FALSE, FALSE},
1757 {0, 0, 0, 0, NULL, 'l', FALSE, FALSE, FALSE, FALSE, TRUE}};
1758
AllButFirstLinePrtProc(DoC d,Int2 item,Pointer ptr)1759 static CharPtr AllButFirstLinePrtProc (DoC d, Int2 item, Pointer ptr)
1760
1761 {
1762 Char ch;
1763 CharPtr tmp;
1764
1765 if (ptr != NULL) {
1766 tmp = (CharPtr) ptr;
1767 ch = *tmp;
1768 while (ch != '\0' && ch != '\n') {
1769 tmp++;
1770 ch = *tmp;
1771 }
1772 if (ch != '\0') {
1773 tmp++;
1774 return StringSave (tmp);
1775 } else {
1776 return NULL;
1777 }
1778 } else {
1779 return NULL;
1780 }
1781 }
1782
1783
1784 static Char useGenomicText [] = "\
1785 (Use 'Genomic' for a sequence encoded by a nuclear gene.)\n";
1786
MakeOrgNameDataCopy(OrgNamePtr onp,Uint1Ptr orgname_choiceP)1787 static Pointer MakeOrgNameDataCopy (OrgNamePtr onp, Uint1Ptr orgname_choiceP)
1788 {
1789 OrgNamePtr onp_copy;
1790 Pointer retval;
1791
1792 if (orgname_choiceP != NULL) {
1793 *orgname_choiceP = 0;
1794 }
1795
1796 if (onp == NULL) return NULL;
1797
1798 onp_copy = (OrgNamePtr) AsnIoMemCopy (onp, (AsnReadFunc) OrgNameAsnRead, (AsnWriteFunc) OrgNameAsnWrite);
1799 if (onp_copy == NULL) return NULL;
1800
1801 retval = onp_copy->data;
1802 if (orgname_choiceP != NULL) {
1803 *orgname_choiceP = onp_copy->choice;
1804 }
1805 onp_copy->data = NULL;
1806 onp_copy->choice = 0;
1807 OrgNameFree (onp_copy);
1808 return retval;
1809 }
1810
FreeGenBioOrgNameData(GenBioPagePtr gbp)1811 static void FreeGenBioOrgNameData (GenBioPagePtr gbp)
1812 {
1813 OrgNamePtr onp;
1814
1815 if (gbp != NULL) {
1816 if (gbp->orgname_choice != 0) {
1817 onp = OrgNameNew ();
1818 if (onp != NULL) {
1819 onp->choice = gbp->orgname_choice;
1820 onp->data = gbp->orgname_data;
1821 OrgNameFree (onp);
1822 gbp->orgname_choice = 0;
1823 gbp->orgname_data = NULL;
1824 }
1825 }
1826 }
1827 }
1828
1829
1830 const CharPtr kDisableStrainForwardAttrib = "nomodforward";
1831
IsStrainForwardingDisabled(BioSourcePtr biop)1832 static Boolean IsStrainForwardingDisabled(BioSourcePtr biop)
1833 {
1834 Boolean rval = FALSE;
1835 if (biop == NULL || biop->org == NULL || biop->org->orgname == NULL) {
1836 return FALSE;
1837 }
1838 if (StringISearch(biop->org->orgname->attrib, kDisableStrainForwardAttrib) != NULL) {
1839 rval = TRUE;
1840 }
1841
1842 return rval;
1843 }
1844
1845
DisableStrainForwarding(BioSourcePtr biop,Boolean val)1846 NLM_EXTERN void DisableStrainForwarding(BioSourcePtr biop, Boolean val)
1847 {
1848 CharPtr cp;
1849 Int4 len;
1850
1851 if (biop == NULL) {
1852 return;
1853 }
1854 if (biop->org == NULL) {
1855 if (val) {
1856 biop->org = OrgRefNew();
1857 } else {
1858 return;
1859 }
1860 }
1861 if (biop->org->orgname == NULL) {
1862 if (val) {
1863 biop->org->orgname = OrgNameNew();
1864 } else {
1865 return;
1866 }
1867 }
1868 if ((cp = StringISearch(biop->org->orgname->attrib, kDisableStrainForwardAttrib)) == NULL) {
1869 if (val) {
1870 SetStringValue (&(biop->org->orgname->attrib), kDisableStrainForwardAttrib, ExistingTextOption_append_semi);
1871 }
1872 } else {
1873 if (!val) {
1874 len = StringLen (kDisableStrainForwardAttrib);
1875 StringCpy(cp, cp + len);
1876 if (StringHasNoText(biop->org->orgname->attrib)) {
1877 biop->org->orgname->attrib = MemFree (biop->org->orgname->attrib);
1878 }
1879 }
1880 }
1881
1882 }
1883
1884
BioSourcePtrToGenBioPage(DialoG d,Pointer data)1885 static void BioSourcePtrToGenBioPage (DialoG d, Pointer data)
1886
1887 {
1888 BioSourcePtr biop;
1889 GenBioPagePtr gbp;
1890 UIEnum genome;
1891 OrgModPtr mod;
1892 OrgNamePtr onp;
1893 OrgRefPtr orp;
1894 WindoW tempPort;
1895 ValNode vn;
1896 ValNodePtr vnp;
1897
1898 gbp = (GenBioPagePtr) GetObjectExtra (d);
1899 biop = (BioSourcePtr) data;
1900 if (gbp != NULL) {
1901 orp = NULL;
1902 onp = NULL;
1903 tempPort = SavePort (gbp->taxName);
1904 SafeSetTitle (gbp->taxName, "");
1905 SafeSetTitle (gbp->commonName, "");
1906 gbp->typedSciName = FALSE;
1907 gbp->typedComName = FALSE;
1908 gbp->selectedOrg = 0;
1909 gbp->clickedOrg = 0;
1910 gbp->nuclGC = 0;
1911 gbp->mitoGC = 0;
1912 gbp->pstdGC = 0;
1913 gbp->taxID = 0;
1914 SafeSetTitle (gbp->gbDiv, "");
1915 SafeSetValue (gbp->genome, 2);
1916 SafeSetValue (gbp->origin, 1);
1917 SafeSetStatus (gbp->is_focus, FALSE);
1918 SafeSetValue (gbp->gcode, 1);
1919 SafeSetValue (gbp->mgcode, 1);
1920 SafeSetValue (gbp->pgcode, 1);
1921 SafeSetValue (gbp->simplecode, 1);
1922 SafeSetTitle (gbp->gbacr, "");
1923 SafeSetTitle (gbp->gbana, "");
1924 SafeSetTitle (gbp->gbsyn, "");
1925 SafeSetTitle (gbp->tymat, "");
1926 SafeSetTitle (gbp->lineage, "");
1927 PointerToDialog (gbp->db, NULL);
1928 PointerToDialog (gbp->syn, NULL);
1929 PointerToDialog (gbp->mod, NULL);
1930 PointerToDialog (gbp->subsrc_val_dlg, NULL);
1931 PointerToDialog (gbp->orgmod_val_dlg, NULL);
1932 PointerToDialog (gbp->pcr_primer_dlg, NULL);
1933
1934 if (biop != NULL) {
1935 vn.choice = SrcLocFromGenome (biop->genome);
1936 vn.data.ptrvalue = NULL;
1937 vn.next = NULL;
1938 PointerToDialog (gbp->genome, &vn);
1939 SetEnumPopup (gbp->origin, biosource_origin_alist, (UIEnum) biop->origin);
1940 SafeSetStatus (gbp->is_focus, biop->is_focus);
1941 if (biop->is_focus) {
1942 SafeEnable (gbp->is_focus);
1943 }
1944 orp = biop->org;
1945 if (orp != NULL) {
1946 gbp->origTaxName = StringSave (orp->taxname);
1947 SafeSetTitle (gbp->taxName, orp->taxname);
1948 SafeSetTitle (gbp->commonName, orp->common);
1949 PointerToDialog (gbp->db, orp->db);
1950 PointerToDialog (gbp->syn, orp->syn);
1951 PointerToDialog (gbp->mod, orp->mod);
1952 onp = orp->orgname;
1953 if (onp != NULL) {
1954 /* store orgname data for unaltered retrieval later */
1955 gbp->orgname_choice = 0;
1956 gbp->orgname_data = MakeOrgNameDataCopy(onp, &gbp->orgname_choice);
1957
1958 SafeSetTitle (gbp->lineage, onp->lineage);
1959 PointerToDialog (gbp->orgmod_val_dlg, onp->mod);
1960 mod = onp->mod;
1961 while (mod != NULL) {
1962 switch (mod->subtype) {
1963 case 32 :
1964 SetTitle (gbp->gbacr, mod->subname);
1965 break;
1966 case 33 :
1967 SetTitle (gbp->gbana, mod->subname);
1968 break;
1969 case 34 :
1970 SetTitle (gbp->gbsyn, mod->subname);
1971 break;
1972 case 38 :
1973 SetTitle (gbp->tymat, mod->subname);
1974 break;
1975 default :
1976 break;
1977 }
1978 mod = mod->next;
1979 }
1980 }
1981 }
1982 if (IsStrainForwardingDisabled(biop)) {
1983 SafeSetStatus(gbp->disable_strain_forwarding, TRUE);
1984 Show(gbp->disable_strain_forwarding);
1985 } else {
1986 SafeSetStatus(gbp->disable_strain_forwarding, FALSE);
1987 Hide(gbp->disable_strain_forwarding);
1988 }
1989
1990 PointerToDialog (gbp->subsrc_val_dlg, biop->subtype);
1991 if (biop->pcr_primers != NULL) {
1992 SetStatus (gbp->pcr_primer_btn, TRUE);
1993 PointerToDialog (gbp->pcr_primer_dlg, biop->pcr_primers);
1994 Show (gbp->pcr_primer_grp);
1995 }
1996 }
1997 if (orp != NULL) {
1998 if (! TextHasNoText (gbp->taxName)) {
1999 AutoScrollTax (gbp, gbp->taxName, TRUE, FALSE, FALSE);
2000 /*
2001 } else if (! TextHasNoText (gbp->commonName)) {
2002 AutoScrollTax (gbp, gbp->commonName, FALSE, FALSE, FALSE);
2003 */
2004 SafeSetTitle (gbp->gbDiv, "");
2005 SafeSetValue (gbp->gcode, 1);
2006 SafeSetValue (gbp->mgcode, 1);
2007 SafeSetValue (gbp->pgcode, 1);
2008 SafeSetValue (gbp->simplecode, 1);
2009 }
2010 }
2011 if (onp != NULL) {
2012 SafeSetTitle (gbp->gbDiv, onp->div);
2013 if (onp->gcode > 0) {
2014 gbp->nuclGC = onp->gcode;
2015 }
2016 if (onp->mgcode > 0) {
2017 gbp->mitoGC = onp->mgcode;
2018 }
2019 if (onp->pgcode > 0) {
2020 gbp->pstdGC = onp->pgcode;
2021 }
2022 if (gbp->simplecode != NULL) {
2023 vnp = DialogToPointer (gbp->genome);
2024 if (vnp != NULL) {
2025 genome = GenomeFromSrcLoc (vnp->choice);
2026 vnp = ValNodeFreeData (vnp);
2027 if (genome == 4 || genome == 5) {
2028 SafeSetValue (gbp->simplecode, gcIdToIndex [onp->mgcode]);
2029 } else if (genome == GENOME_chloroplast ||
2030 genome == GENOME_chromoplast ||
2031 genome == GENOME_plastid ||
2032 genome == GENOME_cyanelle ||
2033 genome == GENOME_apicoplast ||
2034 genome == GENOME_leucoplast ||
2035 genome == GENOME_proplastid ||
2036 genome == GENOME_chromatophore) {
2037 SafeSetValue (gbp->simplecode, gcIdToIndex [11]);
2038 } else {
2039 SafeSetValue (gbp->simplecode, gcIdToIndex [onp->gcode]);
2040 }
2041 }
2042 SafeSetValue (gbp->gcode, gcIdToIndex [onp->gcode]);
2043 SafeSetValue (gbp->mgcode, gcIdToIndex [onp->mgcode]);
2044 SafeSetValue (gbp->pgcode, gcIdToIndex [onp->pgcode]);
2045 } else {
2046 SafeSetValue (gbp->gcode, gcIdToIndex [onp->gcode]);
2047 SafeSetValue (gbp->mgcode, gcIdToIndex [onp->mgcode]);
2048 SafeSetValue (gbp->pgcode, gcIdToIndex [onp->pgcode]);
2049 }
2050 }
2051 RestorePort (tempPort);
2052 }
2053 }
2054
2055
GenBioPageToBioSourcePtr(DialoG d)2056 static Pointer GenBioPageToBioSourcePtr (DialoG d)
2057
2058 {
2059 BioSourcePtr biop;
2060 Char buf [256];
2061 Char ch;
2062 CharPtr chptr;
2063 FILE *f;
2064 GenBioPagePtr gbp;
2065 UIEnum genome;
2066 Boolean goOn;
2067 OrgModPtr mod;
2068 OrgModPtr nextmod;
2069 OrgNamePtr onp;
2070 OrgRefPtr orp;
2071 OrgModPtr PNTR prevmod;
2072 CharPtr ptr;
2073 Char str [PATH_MAX];
2074 Int4 taxID;
2075 OrgModPtr tmpmod;
2076 SubSourcePtr tmpssp;
2077 UIEnum val;
2078
2079 Int2 num; /* contains number of items in gbp->orglist */
2080 Int4 row; /* contains closest row to match in gbp->orglist */
2081 Char txt [256]; /* holds tax name copied from gbp->orglist */
2082 ValNodePtr vnp;
2083
2084 biop = NULL;
2085 gbp = (GenBioPagePtr) GetObjectExtra (d);
2086 if (gbp != NULL) {
2087 biop = BioSourceNew ();
2088 if (biop != NULL) {
2089
2090 vnp = DialogToPointer (gbp->genome);
2091 if (vnp != NULL) {
2092 biop->genome = (Uint1) GenomeFromSrcLoc (vnp->choice);
2093 vnp = ValNodeFreeData (vnp);
2094 }
2095 if (GetEnumPopup (gbp->origin, biosource_origin_alist, &val)) {
2096 biop->origin = (Uint1) val;
2097 }
2098 biop->is_focus = GetStatus (gbp->is_focus);
2099 orp = OrgRefNew ();
2100 biop->org = orp;
2101 if (orp != NULL) {
2102 orp->taxname = SaveStringFromText (gbp->taxName);
2103
2104 /* make sure we use capitalization from list */
2105 if (gbp->orglist != NULL)
2106 {
2107 GetItemParams (gbp->orglist, 1, NULL, &num, NULL, NULL, NULL);
2108 if (num > 0) {
2109 row = FindTaxText (orp->taxname, num);
2110 if (row > 0 && row <= num) {
2111 CopyStrFromTaxPtr (txt, sizeof (txt) - 2, row, 1);
2112 if (StringICmp (txt, orp->taxname) == 0
2113 && StringCmp (txt, orp->taxname) != 0) {
2114 orp->taxname = MemFree (orp->taxname);
2115 orp->taxname = StringSave (txt);
2116 }
2117 }
2118 }
2119 }
2120
2121
2122 /*
2123 orp->common = SaveStringFromText (gbp->commonName);
2124 */
2125 GetTitle (gbp->commonName, str, sizeof (str) - 1);
2126 TrimSpacesAroundString (str);
2127 if (! StringHasNoText (str)) {
2128 orp->common = StringSave (str);
2129 }
2130 orp->db = DialogToPointer (gbp->db);
2131 orp->syn = DialogToPointer (gbp->syn);
2132 orp->mod = DialogToPointer (gbp->mod);
2133 onp = OrgNameNew ();
2134 orp->orgname = onp;
2135 if (onp != NULL) {
2136 /* retrieve unaltered orgname data */
2137 onp->choice = gbp->orgname_choice;
2138 onp->data = gbp->orgname_data;
2139 gbp->orgname_choice = 0;
2140 gbp->orgname_data = NULL;
2141
2142 if (gbp->simplecode != NULL) {
2143 vnp = DialogToPointer (gbp->genome);
2144 if (vnp != NULL) {
2145 genome = GenomeFromSrcLoc (vnp->choice);
2146 vnp = ValNodeFreeData (vnp);
2147 if (genome == 4 || genome == 5) {
2148 onp->mgcode = gcIndexToId [GetValue (gbp->simplecode)];
2149 onp->gcode = gcIndexToId [GetValue (gbp->gcode)];
2150 onp->pgcode = gcIndexToId [GetValue (gbp->pgcode)];
2151 } else {
2152 onp->gcode = gcIndexToId [GetValue (gbp->simplecode)];
2153 onp->mgcode = gcIndexToId [GetValue (gbp->mgcode)];
2154 onp->pgcode = gcIndexToId [GetValue (gbp->pgcode)];
2155 }
2156 }
2157 } else {
2158 onp->gcode = gcIndexToId [GetValue (gbp->gcode)];
2159 onp->mgcode = gcIndexToId [GetValue (gbp->mgcode)];
2160 onp->pgcode = gcIndexToId [GetValue (gbp->pgcode)];
2161 }
2162 if (! TextHasNoText (gbp->gbDiv)) {
2163 onp->div = SaveStringFromText (gbp->gbDiv);
2164 }
2165 if (gbp->lineage == NULL && gbp->taxID != 0) {
2166 ProgramPath (str, sizeof (str));
2167 ptr = StringRChr (str, DIRDELIMCHR);
2168 if (ptr != NULL) {
2169 *ptr = '\0';
2170 FileBuildPath (str, NULL, "lineages.txt");
2171 f = FileOpen (str, "r");
2172 if (f == NULL) {
2173 if (GetAppParam ("NCBI", "NCBI", "DATA", "", str, sizeof (str))) {
2174 FileBuildPath (str, NULL, "lineages.txt");
2175 f = FileOpen (str, "r");
2176 }
2177 }
2178 if (f != NULL) {
2179 if (FileGets (str, sizeof (str), f) != NULL) {
2180 goOn = (Boolean) (FileGets (str, sizeof (str), f) != NULL);
2181 while (goOn) {
2182 ptr = StringChr (str, '\t');
2183 if (ptr != NULL) {
2184 *ptr = '\0';
2185 if (StrToLong (str, &taxID) && taxID == gbp->taxID) {
2186 ptr++;
2187 chptr = ptr;
2188 ch = *chptr;
2189 while (ch != '\0' && ch != '\r' && ch != '\n') {
2190 chptr++;
2191 ch = *chptr;
2192 }
2193 *chptr = '\0';
2194 onp->lineage = StringSave (ptr);
2195 goOn = FALSE;
2196 }
2197 }
2198 goOn = (Boolean) (goOn && (FileGets (str, sizeof (str), f) != NULL));
2199 }
2200 }
2201 FileClose (f);
2202 }
2203 }
2204 } else if (! TextHasNoText (gbp->lineage)) {
2205 onp->lineage = SaveStringFromTextAndStripNewlines (gbp->lineage);
2206 }
2207 onp->mod = DialogToPointer (gbp->orgmod_val_dlg);
2208 GetTitle (gbp->gbacr, buf, sizeof (buf) - 1);
2209 if (! StringHasNoText (buf)) {
2210 mod = OrgModNew ();
2211 if (onp->mod == NULL) {
2212 onp->mod = mod;
2213 } else {
2214 tmpmod = onp->mod;
2215 while (tmpmod->next != NULL) {
2216 tmpmod = tmpmod->next;
2217 }
2218 tmpmod->next = mod;
2219 }
2220 if (mod != NULL) {
2221 mod->subtype = 32;
2222 mod->subname = StringSave (buf);
2223 }
2224 }
2225 GetTitle (gbp->gbana, buf, sizeof (buf) - 1);
2226 if (! StringHasNoText (buf)) {
2227 mod = OrgModNew ();
2228 if (onp->mod == NULL) {
2229 onp->mod = mod;
2230 } else {
2231 tmpmod = onp->mod;
2232 while (tmpmod->next != NULL) {
2233 tmpmod = tmpmod->next;
2234 }
2235 tmpmod->next = mod;
2236 }
2237 if (mod != NULL) {
2238 mod->subtype = 33;
2239 mod->subname = StringSave (buf);
2240 }
2241 }
2242 GetTitle (gbp->gbsyn, buf, sizeof (buf) - 1);
2243 if (! StringHasNoText (buf)) {
2244 mod = OrgModNew ();
2245 if (onp->mod == NULL) {
2246 onp->mod = mod;
2247 } else {
2248 tmpmod = onp->mod;
2249 while (tmpmod->next != NULL) {
2250 tmpmod = tmpmod->next;
2251 }
2252 tmpmod->next = mod;
2253 }
2254 if (mod != NULL) {
2255 mod->subtype = 34;
2256 mod->subname = StringSave (buf);
2257 }
2258 }
2259 GetTitle (gbp->tymat, buf, sizeof (buf) - 1);
2260 if (! StringHasNoText (buf)) {
2261 mod = OrgModNew ();
2262 if (onp->mod == NULL) {
2263 onp->mod = mod;
2264 } else {
2265 tmpmod = onp->mod;
2266 while (tmpmod->next != NULL) {
2267 tmpmod = tmpmod->next;
2268 }
2269 tmpmod->next = mod;
2270 }
2271 if (mod != NULL) {
2272 mod->subtype = 38;
2273 mod->subname = StringSave (buf);
2274 }
2275 }
2276 if (gbp->stripOldName && onp->mod != NULL) {
2277 prevmod = (OrgModPtr PNTR) &(onp->mod);
2278 tmpmod = onp->mod;
2279 while (tmpmod != NULL) {
2280 nextmod = tmpmod->next;
2281 if (tmpmod->subtype == 254) {
2282 *(prevmod) = tmpmod->next;
2283 tmpmod->next = NULL;
2284 OrgModFree (tmpmod);
2285 } else {
2286 prevmod = (OrgModPtr PNTR) &(tmpmod->next);
2287 }
2288 tmpmod = nextmod;
2289 }
2290 }
2291 if (onp->lineage == NULL && onp->mod == NULL &&
2292 onp->gcode == 0 && onp->mgcode == 0 && onp->pgcode == 0) {
2293 orp->orgname = OrgNameFree (orp->orgname);
2294 }
2295 }
2296 }
2297
2298 /* disable strain forwarding if requested */
2299 if (gbp->disable_strain_forwarding != NULL) {
2300 DisableStrainForwarding(biop, GetStatus(gbp->disable_strain_forwarding));
2301 }
2302
2303 biop->subtype = DialogToPointer (gbp->subsrc_val_dlg);
2304 if (GetStatus (gbp->pcr_primer_btn)) {
2305 biop->pcr_primers = DialogToPointer (gbp->pcr_primer_dlg);
2306 }
2307
2308 RemoveTextFromTextFreeSubSourceModifiers (biop, NULL);
2309
2310 /* if we find plasmid-name on a location that cannot have
2311 * plasmids, change the location to plasmid */
2312 if (biop->genome != GENOME_mitochondrion
2313 && biop->genome != GENOME_chloroplast
2314 && biop->genome != GENOME_kinetoplast
2315 && biop->genome != GENOME_chromoplast
2316 && biop->genome != GENOME_plastid
2317 && biop->genome != GENOME_apicoplast
2318 && biop->genome != GENOME_leucoplast
2319 && biop->genome != GENOME_proplastid
2320 && biop->genome != GENOME_chromatophore)
2321 {
2322 tmpssp = biop->subtype;
2323 while (tmpssp != NULL)
2324 {
2325 if (tmpssp->subtype == SUBSRC_plasmid_name) {
2326 biop->genome = GENOME_plasmid;
2327 break;
2328 }
2329 tmpssp = tmpssp->next;
2330 }
2331 }
2332
2333 if (orp != NULL) {
2334 if (orp->taxname == NULL && orp->common == NULL &&
2335 orp->mod == NULL && orp->db == NULL && orp->syn == NULL &&
2336 orp->orgname == NULL && biop->subtype == NULL) {
2337 biop = BioSourceFree (biop);
2338 }
2339 } else {
2340 biop = BioSourceFree (biop);
2341 }
2342 }
2343 }
2344 return (Pointer) biop;
2345 }
2346
TestGenBioDialog(DialoG d)2347 static ValNodePtr TestGenBioDialog (DialoG d)
2348
2349 {
2350 Char comm [64];
2351 GenBioPagePtr gbp;
2352 ValNodePtr head;
2353
2354 head = NULL;
2355 gbp = (GenBioPagePtr) GetObjectExtra (d);
2356 if (gbp != NULL) {
2357 GetTitle (gbp->commonName, comm, sizeof (comm) - 1);
2358 if (TextHasNoText (gbp->taxName) && StringHasNoText (comm) ) {
2359 head = AddStringToValNodeChain (head, "organism name", 1);
2360 }
2361 }
2362 return head;
2363 }
2364
BioSourceMessage(DialoG d,Int2 mssg)2365 static void BioSourceMessage (DialoG d, Int2 mssg)
2366
2367 {
2368 GenBioPagePtr gbp;
2369
2370 gbp = (GenBioPagePtr) GetObjectExtra (d);
2371 if (gbp != NULL) {
2372 switch (mssg) {
2373 case VIB_MSG_INIT :
2374 UpdateDocument (gbp->orglist, 0, 0);
2375 AdjustDocScroll (gbp->orglist);
2376 break;
2377 case VIB_MSG_ENTER :
2378 Select (gbp->taxName);
2379 break;
2380 default :
2381 break;
2382 }
2383 }
2384 }
2385
2386
2387 extern PopuP ReplaceBioSourceGencodePopup (DialoG d, PopuP gencode);
ReplaceBioSourceGencodePopup(DialoG d,PopuP gencode)2388 PopuP ReplaceBioSourceGencodePopup (DialoG d, PopuP gencode)
2389
2390 {
2391 GenBioPagePtr gbp;
2392 PopuP orig_gencode = NULL;
2393
2394 gbp = (GenBioPagePtr) GetObjectExtra (d);
2395 if (gbp != NULL) {
2396 orig_gencode = gbp->simplecode;
2397 gbp->simplecode = gencode;
2398 }
2399 return orig_gencode;
2400 }
2401
2402
GetLocListForBioSource(BioSourcePtr biop)2403 NLM_EXTERN ValNodePtr GetLocListForBioSource (BioSourcePtr biop)
2404 {
2405 ValNodePtr loc_list, vnp, vnp_prev = NULL, vnp_next;
2406 Boolean indexerVersion;
2407
2408 indexerVersion = (Boolean) (GetAppProperty ("InternalNcbiSequin") != NULL);
2409
2410 loc_list = GetLocationList (FALSE);
2411
2412 /* remove chromosome, transposon, insertion seq if not already on biosource */
2413
2414 vnp = loc_list;
2415 while (vnp != NULL) {
2416 vnp_next = vnp->next;
2417 if ((vnp->choice == Source_location_chromosome && !indexerVersion
2418 && (biop == NULL || biop->genome != GENOME_chromosome))
2419 || (vnp->choice == Source_location_virion
2420 && (biop == NULL || biop->genome != GENOME_virion))
2421 || (vnp->choice == Source_location_transposon
2422 && (biop == NULL || biop->genome != GENOME_transposon))
2423 || (vnp->choice == Source_location_insertion_seq
2424 && (biop == NULL || biop->genome != GENOME_insertion_seq))) {
2425 if (vnp_prev == NULL) {
2426 loc_list = vnp->next;
2427 } else {
2428 vnp_prev->next= vnp->next;
2429 }
2430 vnp->next = NULL;
2431 vnp = ValNodeFreeData (vnp);
2432 } else {
2433 vnp_prev = vnp;
2434 }
2435 vnp = vnp_next;
2436 }
2437 return loc_list;
2438 }
2439
2440
CreateSimpleBioSourceDialog(GrouP h,CharPtr title)2441 extern DialoG CreateSimpleBioSourceDialog (GrouP h, CharPtr title)
2442
2443 {
2444 GrouP f;
2445 GrouP g;
2446 GenBioPagePtr gbp;
2447 Int2 height;
2448 GrouP m;
2449 GrouP p;
2450 GrouP q;
2451 RecT r;
2452 GrouP s;
2453 GrouP x;
2454 ValNode vn;
2455 Boolean indexerVersion;
2456
2457 indexerVersion = (Boolean) (GetAppProperty ("InternalNcbiSequin") != NULL);
2458
2459 p = HiddenGroup (h, 1, 0, NULL);
2460 SetGroupSpacing (p, 10, 10);
2461
2462 gbp = (GenBioPagePtr) MemNew (sizeof (GenBioPage));
2463 if (gbp != NULL) {
2464
2465 SetObjectExtra (p, gbp, StdCleanupExtraProc);
2466 gbp->dialog = (DialoG) p;
2467 gbp->todialog = BioSourcePtrToGenBioPage;
2468 gbp->fromdialog = GenBioPageToBioSourcePtr;
2469 gbp->dialogmessage = BioSourceMessage;
2470 gbp->testdialog = TestGenBioDialog;
2471
2472 if (title != NULL && title [0] != '\0') {
2473 s = NormalGroup (p, 0, -2, title, systemFont, NULL);
2474 } else {
2475 s = HiddenGroup (p, 0, -2, NULL);
2476 }
2477 SetGroupSpacing (s, 10, 10);
2478
2479 m = HiddenGroup (s, 0, 0, NULL);
2480
2481 q = HiddenGroup (m, -1, 0, NULL);
2482 SetGroupSpacing (q, 10, 10);
2483
2484 gbp->origTaxName = NULL;
2485 gbp->stripOldName = FALSE;
2486
2487 g = HiddenGroup (q, 1, 0, NULL);
2488 /*
2489 StaticPrompt (g, "Organism", 0, 0, programFont, 'c');
2490 */
2491 f = HiddenGroup (g, 2, 0, NULL);
2492 StaticPrompt (f, "Scientific Name", 0, dialogTextHeight, programFont, 'l');
2493 gbp->taxName = DialogText (f, "", 20, TaxNameText);
2494 SetObjectExtra (gbp->taxName, gbp, NULL);
2495 StaticPrompt (f, "Common Name", 0, dialogTextHeight, programFont, 'l');
2496 /*
2497 gbp->commonName = DialogText (f, "", 10, CommonNameText);
2498 */
2499 gbp->commonName = (Handle) StaticPrompt (f, "", 10 * stdCharWidth, dialogTextHeight, systemFont, 'l');
2500 SetObjectExtra (gbp->commonName, gbp, NULL);
2501 StaticPrompt (f, "", 0, dialogTextHeight, programFont, 'l');
2502 f = HiddenGroup (g, 1, 0, NULL);
2503 SelectFont (programFont);
2504 height = LineHeight ();
2505 SelectFont (systemFont);
2506 gbp->orglist = DocumentPanel (f, stdCharWidth * 25, height * 6);
2507 SetObjectExtra (gbp->orglist, gbp, NULL);
2508 SetDocAutoAdjust (gbp->orglist, TRUE);
2509 orgListCol [0].pixWidth = screenRect.right - screenRect.left;
2510 AppendItem (gbp->orglist, AllButFirstLinePrtProc, orgTxtPtr, FALSE, orgNum,
2511 &orgListPar, orgListCol, programFont);
2512 SetDocAutoAdjust (gbp->orglist, TRUE);
2513 SetDocProcs (gbp->orglist, ClickTaxName, NULL, ReleaseTaxName, NULL);
2514 SetDocShade (gbp->orglist, NULL, NULL, HighlightTaxName, NULL);
2515
2516 gbp->disable_strain_forwarding = CheckBox (f, "Disable Strain Forwarding", NULL);
2517
2518 AlignObjects (ALIGN_RIGHT, (HANDLE) gbp->taxName, (HANDLE) gbp->commonName,
2519 (HANDLE) gbp->orglist, (HANDLE) gbp->disable_strain_forwarding, NULL);
2520
2521 g = HiddenGroup (q, -1, 0, NULL);
2522 f = HiddenGroup (g, 3, 0, NULL);
2523 StaticPrompt (f, "Location of Sequence",
2524 0, popupMenuHeight, programFont, 'l');
2525
2526 gbp->genome = ValNodeSelectionDialogExEx (f, GetLocListForBioSource (NULL), SHORT_SELECTION_LIST, ValNodeStringName,
2527 ValNodeSimpleDataFree, ValNodeStringCopy,
2528 ValNodeChoiceMatch, "location",
2529 NULL, NULL, FALSE, FALSE, TRUE, NULL);
2530 vn.choice = Source_location_genomic;
2531 vn.data.ptrvalue = NULL;
2532 vn.next = NULL;
2533 PointerToDialog (gbp->genome, &vn);
2534 ObjectRect (gbp->orglist, &r);
2535 MultiLinePrompt (g, useGenomicText, r.right - r.left - 2, programFont);
2536
2537 x = HiddenGroup (q, 0, 0, NULL);
2538
2539 f = HiddenGroup (x, 2, 0, NULL);
2540 StaticPrompt (f, "Genetic Code for Translation", 0, popupMenuHeight, programFont, 'l');
2541 gbp->simplecode = PopupList (f, TRUE, NULL);
2542 PopulateGeneticCodePopup (gbp->simplecode);
2543 SetValue (gbp->simplecode, 1);
2544 gbp->gbDiv = DialogText (x, "", 4, NULL);
2545 Hide (gbp->gbDiv);
2546
2547 /* superimpose two hidden genetic code controls to save both in resulting biosource */
2548
2549 gbp->gcode = PopupList (x, TRUE, NULL);
2550 PopulateGeneticCodePopup (gbp->gcode);
2551 SetValue (gbp->gcode, 1);
2552 gbp->mgcode = PopupList (x, TRUE, NULL);
2553 PopulateGeneticCodePopup (gbp->mgcode);
2554 SetValue (gbp->mgcode, 1);
2555 gbp->pgcode = PopupList (x, TRUE, NULL);
2556 PopulateGeneticCodePopup (gbp->pgcode);
2557 SetValue (gbp->pgcode, 1);
2558 Hide (gbp->gcode);
2559 Hide (gbp->mgcode);
2560 Hide (gbp->pgcode);
2561
2562 SelectFont (systemFont);
2563 }
2564
2565 return (DialoG) p;
2566 }
2567
OrgModPtrToOrgmodDialog(DialoG d,Pointer data)2568 static void OrgModPtrToOrgmodDialog (DialoG d, Pointer data)
2569
2570 {
2571 ValNodePtr head;
2572 Int2 j;
2573 size_t len;
2574 OrgModPtr list;
2575 CharPtr str;
2576 TagListPtr tlp;
2577 Char tmp [16];
2578 ValNodePtr vnp;
2579
2580 tlp = (TagListPtr) GetObjectExtra (d);
2581 list = (OrgModPtr) data;
2582 if (tlp != NULL) {
2583 head = NULL;
2584 while (list != NULL) {
2585 if (list->subname != NULL && list->subtype != 255 &&
2586 list->subtype != 32 && list->subtype != 33 && list->subtype != 34 && list->subtype != 38) {
2587 vnp = ValNodeNew (head);
2588 if (head == NULL) {
2589 head = vnp;
2590 }
2591 if (vnp != NULL) {
2592 sprintf (tmp, "%d", (int) list->subtype);
2593 len = StringLen (tmp) + StringLen (list->subname);
2594 str = MemNew (len + 4);
2595 if (str != NULL) {
2596 StringCpy (str, tmp);
2597 StringCat (str, "\t");
2598 StringCat (str, list->subname);
2599 StringCat (str, "\n");
2600 }
2601 vnp->data.ptrvalue = str;
2602 }
2603 }
2604 list = list->next;
2605 }
2606 SendMessageToDialog (tlp->dialog, VIB_MSG_RESET);
2607 tlp->vnp = head;
2608 SendMessageToDialog (tlp->dialog, VIB_MSG_REDRAW);
2609 for (j = 0, vnp = tlp->vnp; vnp != NULL; j++, vnp = vnp->next) {
2610 }
2611 tlp->max = MAX ((Int2) 0, (Int2) (j - tlp->rows + 1));
2612 CorrectBarMax (tlp->bar, tlp->max);
2613 CorrectBarPage (tlp->bar, tlp->rows - 1, tlp->rows - 1);
2614 }
2615 }
2616
OrgmodDialogToOrgModPtr(DialoG d)2617 static Pointer OrgmodDialogToOrgModPtr (DialoG d)
2618
2619 {
2620 Char ch;
2621 OrgModPtr head;
2622 Int2 j;
2623 Int2 len;
2624 OrgModPtr omp;
2625 OrgModPtr omplast;
2626 Boolean okay;
2627 CharPtr str;
2628 TagListPtr tlp;
2629 CharPtr tmp;
2630 int val;
2631 ValNodePtr vnp;
2632
2633 head = NULL;
2634 tlp = (TagListPtr) GetObjectExtra (d);
2635 if (tlp != NULL && tlp->vnp != NULL) {
2636 omp = NULL;
2637 omplast = NULL;
2638 for (vnp = tlp->vnp; vnp != NULL; vnp = vnp->next) {
2639 str = (CharPtr) vnp->data.ptrvalue;
2640 okay = FALSE;
2641 len = StringLen (str);
2642 for (j = 0; j < len; j++) {
2643 ch = str [j];
2644 if (ch != ' ' && ch != '\t' && ch != '\n') {
2645 okay = TRUE;
2646 }
2647 }
2648 if (okay) {
2649 tmp = ExtractTagListColumn ((CharPtr) vnp->data.ptrvalue, 0);
2650 if (tmp != NULL && sscanf (tmp, "%d", &val) == 1 && val != 0) {
2651 MemFree (tmp);
2652 tmp = ExtractTagListColumn ((CharPtr) vnp->data.ptrvalue, 1);
2653 if (! StringHasNoText (tmp)) {
2654 omp = OrgModNew ();
2655 if (omplast == NULL) {
2656 head = omp;
2657 } else {
2658 omplast->next = omp;
2659 }
2660 omplast = omp;
2661 if (omp != NULL) {
2662 omp->subtype = (Uint1) val;
2663 omp->subname = tmp;
2664 }
2665 } else {
2666 MemFree (tmp);
2667 }
2668 } else {
2669 MemFree (tmp);
2670 }
2671 }
2672 }
2673 }
2674 return (Pointer) head;
2675 }
2676
SubSourcePtrToSubsourceDialog(DialoG d,Pointer data)2677 static void SubSourcePtrToSubsourceDialog (DialoG d, Pointer data)
2678
2679 {
2680 ValNodePtr head;
2681 Int2 j;
2682 size_t len;
2683 SubSourcePtr list;
2684 CharPtr str;
2685 TagListPtr tlp;
2686 Char tmp [16];
2687 ValNodePtr vnp;
2688
2689 tlp = (TagListPtr) GetObjectExtra (d);
2690 list = (SubSourcePtr) data;
2691 if (tlp != NULL) {
2692 head = NULL;
2693 while (list != NULL) {
2694 if (list->name != NULL && list->subtype != 255) {
2695 vnp = ValNodeNew (head);
2696 if (head == NULL) {
2697 head = vnp;
2698 }
2699 if (vnp != NULL) {
2700 sprintf (tmp, "%d", (int) list->subtype);
2701 len = StringLen (tmp) + StringLen (list->name);
2702 str = MemNew (len + 4);
2703 if (str != NULL) {
2704 StringCpy (str, tmp);
2705 StringCat (str, "\t");
2706 StringCat (str, list->name);
2707 StringCat (str, "\n");
2708 }
2709 vnp->data.ptrvalue = str;
2710 }
2711 }
2712 list = list->next;
2713 }
2714 SendMessageToDialog (tlp->dialog, VIB_MSG_RESET);
2715 tlp->vnp = head;
2716 SendMessageToDialog (tlp->dialog, VIB_MSG_REDRAW);
2717 for (j = 0, vnp = tlp->vnp; vnp != NULL; j++, vnp = vnp->next) {
2718 }
2719 tlp->max = MAX ((Int2) 0, (Int2) (j - tlp->rows + 1));
2720 CorrectBarMax (tlp->bar, tlp->max);
2721 CorrectBarPage (tlp->bar, tlp->rows - 1, tlp->rows - 1);
2722 }
2723 }
2724
2725 typedef struct fixmodifiertextform
2726 {
2727 WindoW w;
2728 Boolean done;
2729 Boolean move_to_text;
2730 Boolean remove;
2731 Boolean do_all;
2732 } FixModifierTextFormData, PNTR FixModifierTextFormPtr;
2733
FixModifierTextMove(ButtoN b)2734 static void FixModifierTextMove (ButtoN b)
2735 {
2736 FixModifierTextFormPtr fp;
2737
2738 fp = (FixModifierTextFormPtr) GetObjectExtra (b);
2739 if (fp == NULL) return;
2740
2741 Remove (fp->w);
2742 fp->remove = FALSE;
2743 fp->move_to_text = TRUE;
2744 fp->do_all = FALSE;
2745 fp->done = TRUE;
2746 }
2747
FixModifierTextMoveAll(ButtoN b)2748 static void FixModifierTextMoveAll (ButtoN b)
2749 {
2750 FixModifierTextFormPtr fp;
2751
2752 fp = (FixModifierTextFormPtr) GetObjectExtra (b);
2753 if (fp == NULL) return;
2754
2755 Remove (fp->w);
2756 fp->remove = FALSE;
2757 fp->move_to_text = TRUE;
2758 fp->do_all = TRUE;
2759 fp->done = TRUE;
2760 }
2761
FixModifierTextRemove(ButtoN b)2762 static void FixModifierTextRemove (ButtoN b)
2763 {
2764 FixModifierTextFormPtr fp;
2765
2766 fp = (FixModifierTextFormPtr) GetObjectExtra (b);
2767 if (fp == NULL) return;
2768
2769 Remove (fp->w);
2770 fp->remove = TRUE;
2771 fp->move_to_text = FALSE;
2772 fp->do_all = FALSE;
2773 fp->done = TRUE;
2774 }
2775
FixModifierTextRemoveAll(ButtoN b)2776 static void FixModifierTextRemoveAll (ButtoN b)
2777 {
2778 FixModifierTextFormPtr fp;
2779
2780 fp = (FixModifierTextFormPtr) GetObjectExtra (b);
2781 if (fp == NULL) return;
2782
2783 Remove (fp->w);
2784 fp->remove = TRUE;
2785 fp->move_to_text = FALSE;
2786 fp->do_all = TRUE;
2787 fp->done = TRUE;
2788 }
2789
ModTextFixNew(void)2790 extern ModTextFixPtr ModTextFixNew (void)
2791 {
2792 ModTextFixPtr tfp;
2793
2794 tfp = (ModTextFixPtr) MemNew (sizeof (ModTextFixData));
2795 if (tfp == NULL) return NULL;
2796 tfp->remove_this = FALSE;
2797 tfp->move_this = FALSE;
2798 tfp->remove_all_germline = FALSE;
2799 tfp->remove_all_transgenic = FALSE;
2800 tfp->remove_all_environmental = FALSE;
2801 tfp->remove_all_rearranged = FALSE;
2802 tfp->remove_all_metagenomic = FALSE;
2803 tfp->move_all_germline = FALSE;
2804 tfp->move_all_transgenic = FALSE;
2805 tfp->move_all_environmental = FALSE;
2806 tfp->move_all_rearranged = FALSE;
2807 tfp->move_all_metagenomic = FALSE;
2808 return tfp;
2809 }
2810
2811 static void
GetModifierTextFix(ModTextFixPtr tfp,Uint1 subtype,CharPtr txt)2812 GetModifierTextFix (ModTextFixPtr tfp, Uint1 subtype, CharPtr txt)
2813 {
2814 GrouP g, c, t;
2815 ButtoN b;
2816 FixModifierTextFormData fd;
2817 CharPtr prompt_fmt = "You have text (%s) in %s modifier field.";
2818 CharPtr prompt_str = NULL;
2819
2820 if (tfp == NULL) return;
2821 switch (subtype)
2822 {
2823 case SUBSRC_rearranged:
2824 if (tfp->remove_all_rearranged)
2825 {
2826 tfp->remove_this = TRUE;
2827 tfp->move_this = FALSE;
2828 return;
2829 }
2830 else if (tfp->move_all_rearranged)
2831 {
2832 tfp->move_this = TRUE;
2833 tfp->remove_this = FALSE;
2834 return;
2835 }
2836 break;
2837 case SUBSRC_transgenic:
2838 if (tfp->remove_all_transgenic)
2839 {
2840 tfp->remove_this = TRUE;
2841 tfp->move_this = FALSE;
2842 return;
2843 }
2844 else if (tfp->move_all_transgenic)
2845 {
2846 tfp->move_this = TRUE;
2847 tfp->remove_this = FALSE;
2848 return;
2849 }
2850 break;
2851 case SUBSRC_germline:
2852 if (tfp->remove_all_germline)
2853 {
2854 tfp->remove_this = TRUE;
2855 tfp->move_this = FALSE;
2856 return;
2857 }
2858 else if (tfp->move_all_germline)
2859 {
2860 tfp->move_this = TRUE;
2861 tfp->remove_this = FALSE;
2862 return;
2863 }
2864 break;
2865 case SUBSRC_environmental_sample:
2866 if (tfp->remove_all_environmental)
2867 {
2868 tfp->remove_this = TRUE;
2869 tfp->move_this = FALSE;
2870 return;
2871 }
2872 else if (tfp->move_all_environmental)
2873 {
2874 tfp->move_this = TRUE;
2875 tfp->remove_this = FALSE;
2876 return;
2877 }
2878 break;
2879 case SUBSRC_metagenomic:
2880 if (tfp->remove_all_metagenomic)
2881 {
2882 tfp->remove_this = TRUE;
2883 tfp->move_this = FALSE;
2884 return;
2885 }
2886 else if (tfp->move_all_metagenomic)
2887 {
2888 tfp->move_this = TRUE;
2889 tfp->remove_this = FALSE;
2890 return;
2891 }
2892 break;
2893 default:
2894 break;
2895 }
2896
2897 fd.w = ModalWindow(-20, -13, -10, -10, NULL);
2898 g = HiddenGroup(fd.w, -1, 0, NULL);
2899
2900 prompt_str = (CharPtr) MemNew (sizeof (Char) * (StringLen (prompt_fmt) + StringLen (txt)
2901 + StringLen ("an environmental sample")));
2902 if (prompt_str == NULL) return;
2903 switch (subtype)
2904 {
2905 case SUBSRC_rearranged:
2906 sprintf (prompt_str, prompt_fmt, txt, "a rearranged");
2907 break;
2908 case SUBSRC_germline:
2909 sprintf (prompt_str, prompt_fmt, txt, "a germline");
2910 break;
2911 case SUBSRC_transgenic:
2912 sprintf (prompt_str, prompt_fmt, txt, "a transgenic");
2913 break;
2914 case SUBSRC_environmental_sample:
2915 sprintf (prompt_str, prompt_fmt, txt, "an environmental sample");
2916 break;
2917 case SUBSRC_metagenomic:
2918 sprintf (prompt_str, prompt_fmt, txt, "a metagenomic");
2919 break;
2920 }
2921
2922 t = HiddenGroup (g, 1, 0, NULL);
2923 StaticPrompt (t, prompt_str, 0, dialogTextHeight, programFont, 'l');
2924 StaticPrompt (t, "This text will never be displayed in your GenBank record.", 0, dialogTextHeight, programFont, 'l');
2925 StaticPrompt (t, "Do you want to move this text to a note or remove it?", 0, dialogTextHeight, programFont, 'l');
2926
2927 c = HiddenGroup (g, 4, 0, NULL);
2928 b = PushButton (c, "Move to note", FixModifierTextMove);
2929 SetObjectExtra (b, &fd, NULL);
2930 b = PushButton (c, "Move all to note", FixModifierTextMoveAll);
2931 SetObjectExtra (b, &fd, NULL);
2932 b = PushButton (c, "Remove", FixModifierTextRemove);
2933 SetObjectExtra (b, &fd, NULL);
2934 b = PushButton (c, "Remove all", FixModifierTextRemoveAll);
2935 SetObjectExtra (b, &fd, NULL);
2936 AlignObjects (ALIGN_CENTER, (HANDLE) t, (HANDLE) c, NULL);
2937
2938 Show(fd.w);
2939 Select (fd.w);
2940 fd.done = FALSE;
2941 while (!fd.done)
2942 {
2943 ProcessExternalEvent ();
2944 Update ();
2945 }
2946 ProcessAnEvent ();
2947
2948 if (fd.remove)
2949 {
2950 tfp->remove_this = TRUE;
2951 if (fd.do_all)
2952 {
2953 switch (subtype)
2954 {
2955 case SUBSRC_rearranged:
2956 tfp->remove_all_rearranged = TRUE;
2957 tfp->move_all_rearranged = FALSE;
2958 break;
2959 case SUBSRC_transgenic:
2960 tfp->remove_all_transgenic = TRUE;
2961 tfp->move_all_transgenic = FALSE;
2962 break;
2963 case SUBSRC_germline:
2964 tfp->remove_all_germline = TRUE;
2965 tfp->move_all_germline = FALSE;
2966 break;
2967 case SUBSRC_environmental_sample:
2968 tfp->remove_all_environmental = TRUE;
2969 tfp->move_all_environmental = FALSE;
2970 break;
2971 case SUBSRC_metagenomic:
2972 tfp->remove_all_metagenomic = TRUE;
2973 tfp->move_all_metagenomic = FALSE;
2974 break;
2975 }
2976 }
2977 }
2978 else if (fd.move_to_text)
2979 {
2980 tfp->move_this = TRUE;
2981 if (fd.do_all)
2982 {
2983 switch (subtype)
2984 {
2985 case SUBSRC_rearranged:
2986 tfp->remove_all_rearranged = FALSE;
2987 tfp->move_all_rearranged = TRUE;
2988 break;
2989 case SUBSRC_transgenic:
2990 tfp->remove_all_transgenic = FALSE;
2991 tfp->move_all_transgenic = TRUE;
2992 break;
2993 case SUBSRC_germline:
2994 tfp->remove_all_germline = FALSE;
2995 tfp->move_all_germline = TRUE;
2996 break;
2997 case SUBSRC_environmental_sample:
2998 tfp->remove_all_environmental = FALSE;
2999 tfp->move_all_environmental = TRUE;
3000 break;
3001 case SUBSRC_metagenomic:
3002 tfp->remove_all_metagenomic = FALSE;
3003 tfp->move_all_metagenomic = TRUE;
3004 break;
3005 }
3006 }
3007 }
3008 }
3009
RemoveTextFromTextFreeSubSourceModifiers(BioSourcePtr biop,Pointer userdata)3010 extern void RemoveTextFromTextFreeSubSourceModifiers (BioSourcePtr biop, Pointer userdata)
3011 {
3012 SubSourcePtr ssp;
3013 SubSourcePtr note_ssp = NULL;
3014 Int4 len;
3015 CharPtr new_note;
3016 ModTextFixPtr tfp;
3017
3018 if (biop == NULL || biop->subtype == NULL) return;
3019
3020 if (userdata == NULL)
3021 {
3022 tfp = ModTextFixNew();
3023 if (tfp == NULL) return;
3024 }
3025 else
3026 {
3027 tfp = (ModTextFixPtr) userdata;
3028 }
3029
3030 for (ssp = biop->subtype; ssp != NULL; ssp = ssp->next)
3031 {
3032 tfp->move_this = FALSE;
3033 tfp->remove_this = FALSE;
3034 if ((ssp->subtype == SUBSRC_germline
3035 || ssp->subtype == SUBSRC_transgenic
3036 || ssp->subtype == SUBSRC_rearranged
3037 || ssp->subtype == SUBSRC_environmental_sample
3038 || ssp->subtype == SUBSRC_metagenomic)
3039 && ! StringHasNoText (ssp->name))
3040 {
3041 GetModifierTextFix (tfp, ssp->subtype, ssp->name);
3042 if (tfp->move_this)
3043 {
3044 /* if a note modifier is found, add this text to it, otherwise create a new
3045 * note modifier to hold this text.
3046 */
3047 if (note_ssp == NULL)
3048 {
3049 for (note_ssp = biop->subtype; note_ssp != NULL && note_ssp->subtype != 255; note_ssp = note_ssp->next)
3050 {
3051 }
3052 }
3053 if (note_ssp == NULL)
3054 {
3055 note_ssp = SubSourceNew ();
3056 if (note_ssp != NULL)
3057 {
3058 note_ssp->subtype = 255;
3059 note_ssp->name = ssp->name;
3060 ssp->name = StringSave ("");
3061 note_ssp->next = ssp->next;
3062 ssp->next = note_ssp;
3063 }
3064 }
3065 else if (StringHasNoText (note_ssp->name))
3066 {
3067 note_ssp->name = MemFree (note_ssp->name);
3068 note_ssp->name = ssp->name;
3069 ssp->name = StringSave ("");
3070 }
3071 else
3072 {
3073 len = StringLen (note_ssp->name) + StringLen (ssp->name) + 3;
3074 new_note = (CharPtr) MemNew (len * sizeof (Char));
3075 if (new_note != NULL)
3076 {
3077 StringCpy (new_note, note_ssp->name);
3078 StringCat (new_note, "; ");
3079 StringCat (new_note, ssp->name);
3080 note_ssp->name = MemFree (note_ssp->name);
3081 note_ssp->name = new_note;
3082 ssp->name = MemFree (ssp->name);
3083 ssp->name = StringSave ("");
3084 }
3085 }
3086 }
3087 else if (tfp->remove_this)
3088 {
3089 ssp->name = MemFree (ssp->name);
3090 ssp->name = StringSave ("");
3091 }
3092 }
3093 }
3094 if (userdata == NULL)
3095 {
3096 MemFree (tfp);
3097 }
3098 }
3099
SubsourceDialogToSubSourcePtr(DialoG d)3100 static Pointer SubsourceDialogToSubSourcePtr (DialoG d)
3101
3102 {
3103 Char ch;
3104 SubSourcePtr head;
3105 Int2 j;
3106 Int2 len;
3107 SubSourcePtr ssp;
3108 SubSourcePtr ssplast;
3109 Boolean okay;
3110 CharPtr str;
3111 TagListPtr tlp;
3112 CharPtr tmp;
3113 int val;
3114 ValNodePtr vnp;
3115
3116 head = NULL;
3117 tlp = (TagListPtr) GetObjectExtra (d);
3118 if (tlp != NULL && tlp->vnp != NULL) {
3119 ssp = NULL;
3120 ssplast = NULL;
3121 for (vnp = tlp->vnp; vnp != NULL; vnp = vnp->next) {
3122 str = (CharPtr) vnp->data.ptrvalue;
3123 okay = FALSE;
3124 len = StringLen (str);
3125 for (j = 0; j < len; j++) {
3126 ch = str [j];
3127 if (ch != ' ' && ch != '\t' && ch != '\n') {
3128 okay = TRUE;
3129 }
3130 }
3131 if (okay) {
3132 tmp = ExtractTagListColumn ((CharPtr) vnp->data.ptrvalue, 0);
3133 if (tmp != NULL && sscanf (tmp, "%d", &val) == 1 && val != 0) {
3134 MemFree (tmp);
3135 tmp = ExtractTagListColumn ((CharPtr) vnp->data.ptrvalue, 1);
3136 if ((val == SUBSRC_germline ||
3137 val == SUBSRC_rearranged ||
3138 val == SUBSRC_transgenic ||
3139 val == SUBSRC_environmental_sample ||
3140 val == SUBSRC_metagenomic) &&
3141 StringHasNoText (tmp)) {
3142 MemFree (tmp);
3143 tmp = StringSave ("");
3144 }
3145 if ((! StringHasNoText (tmp)) ||
3146 val == SUBSRC_germline ||
3147 val == SUBSRC_rearranged ||
3148 val == SUBSRC_transgenic ||
3149 val == SUBSRC_environmental_sample ||
3150 val == SUBSRC_metagenomic) {
3151 ssp = SubSourceNew ();
3152 if (ssplast == NULL) {
3153 head = ssp;
3154 } else {
3155 ssplast->next = ssp;
3156 }
3157 ssplast = ssp;
3158 if (ssp != NULL) {
3159 ssp->subtype = (Uint1) val;
3160 ssp->name = tmp;
3161 tmp = NULL;
3162 }
3163 }
3164 MemFree (tmp);
3165 }
3166 }
3167 }
3168 }
3169 return (Pointer) head;
3170 }
3171
3172 Uint2 orgmod_widths [] = {
3173 0, 25
3174 };
3175
3176 Uint2 subsource_widths [] = {
3177 0, 25
3178 };
3179
3180 Uint2 orgmod_types [] = {
3181 TAGLIST_POPUP, TAGLIST_TEXT
3182 };
3183
3184 Uint2 subsource_types [] = {
3185 TAGLIST_POPUP, TAGLIST_TEXT
3186 };
3187
3188 /*
3189 static CharPtr orgmod_extra_prompts [] = {
3190 "Additional", "Organism", "Information", NULL
3191 };
3192
3193 static CharPtr subsource_extra_prompts [] = {
3194 "Additional", "Source", "Information", NULL
3195 };
3196 */
3197
3198 static CharPtr orgTabs [] = {
3199 "Names", "Location", "Genetic Codes", "Lineage", NULL
3200 };
3201
3202 static CharPtr modTabs [] = {
3203 "Source", "Organism", "GenBank", NULL
3204 };
3205
3206 static CharPtr modTabsUns [] = {
3207 "Source", "Organism", "GenBank", "Unstructured", NULL
3208 };
3209
3210 typedef enum {
3211 eModTabSource = 0,
3212 eModTabOrganism = 1,
3213 eModTabGenBank = 2,
3214 eModTabUnstructured = 3
3215 } EModTab;
3216
3217 static CharPtr miscTabs1 [] = {
3218 "Cross-Refs", NULL
3219 };
3220
3221 static CharPtr miscTabs2 [] = {
3222 "Synonyms", "Cross-Refs", NULL
3223 };
3224
ChangeOrgSubPage(VoidPtr data,Int2 newval,Int2 oldval)3225 static void ChangeOrgSubPage (VoidPtr data, Int2 newval, Int2 oldval)
3226
3227 {
3228 GenBioPagePtr gbp;
3229
3230 gbp = (GenBioPagePtr) data;
3231 if (gbp != NULL) {
3232 if (oldval >= 0 && oldval <= 3) {
3233 SafeHide (gbp->orgGrp [oldval]);
3234 }
3235 if (newval >= 0 && newval <= 3) {
3236 SafeShow (gbp->orgGrp [newval]);
3237 }
3238 Update ();
3239 }
3240 }
3241
ChangeModSubPage(VoidPtr data,Int2 newval,Int2 oldval)3242 static void ChangeModSubPage (VoidPtr data, Int2 newval, Int2 oldval)
3243
3244 {
3245 GenBioPagePtr gbp;
3246
3247 gbp = (GenBioPagePtr) data;
3248 if (gbp != NULL) {
3249 if (oldval >= 0 && oldval <= 3) {
3250 SafeHide (gbp->modGrp [oldval]);
3251 }
3252 if (newval >= 0 && newval <= 3) {
3253 SafeShow (gbp->modGrp [newval]);
3254 }
3255 Update ();
3256 }
3257 }
3258
ChangeMiscSubPage(VoidPtr data,Int2 newval,Int2 oldval)3259 static void ChangeMiscSubPage (VoidPtr data, Int2 newval, Int2 oldval)
3260
3261 {
3262 GenBioPagePtr gbp;
3263
3264 gbp = (GenBioPagePtr) data;
3265 if (gbp != NULL) {
3266 if (oldval >= 0 && oldval <= 1) {
3267 SafeHide (gbp->miscGrp [oldval]);
3268 }
3269 if (newval >= 0 && newval <= 1) {
3270 SafeShow (gbp->miscGrp [newval]);
3271 }
3272 Update ();
3273 }
3274 }
3275
LookupTheTaxonomyProc(ButtoN b)3276 static void LookupTheTaxonomyProc (ButtoN b)
3277
3278 {
3279 GenBioFormPtr gfp;
3280
3281 gfp = (GenBioFormPtr) GetObjectExtra (b);
3282 if (gfp != NULL && gfp->lookupTaxonomy != NULL) {
3283 if (gfp->lookupTaxonomy (gfp->input_entityID)) {
3284 Remove (gfp->form);
3285 ObjMgrSendMsg (OM_MSG_UPDATE, gfp->input_entityID, 0, 0);
3286 Update ();
3287 }
3288 }
3289 }
3290
EnumListFromQualNameAssoc(Nlm_QualNameAssocPtr qp)3291 static EnumFieldAssocPtr EnumListFromQualNameAssoc (Nlm_QualNameAssocPtr qp)
3292 {
3293 EnumFieldAssocPtr eap;
3294 /* start num_qual at one to count terminator */
3295 Int4 i, num_qual = 1;
3296
3297 for (i = 0; qp[i].name != NULL; i++) {
3298 num_qual++;
3299 }
3300
3301 eap = (EnumFieldAssocPtr) MemNew (sizeof (EnumFieldAssoc) * num_qual);
3302 for (i = 0; qp[i].name != NULL; i++) {
3303 eap[i].name = qp[i].name;
3304 eap[i].value = qp[i].value;
3305 }
3306 eap[i].name = NULL;
3307 eap[i].value = 0;
3308 return eap;
3309 }
3310
3311
3312 Uint2 pcr_primer_dlg_types [] = {
3313 TAGLIST_TEXT, TAGLIST_POPUP, TAGLIST_TEXT, TAGLIST_TEXT
3314 };
3315
3316 Uint2 pcr_primer_dlg_widths [] = {
3317 3, 4, 10, 20
3318 };
3319
ENUM_ALIST(pcr_primer_dlg_alist)3320 static ENUM_ALIST(pcr_primer_dlg_alist)
3321 {" ", 0},
3322 {"Fwd", 1},
3323 {"Rev", 2},
3324 END_ENUM_ALIST
3325
3326 static EnumFieldAssocPtr pcr_primer_dlg_popups [] = {
3327 NULL, pcr_primer_dlg_alist, NULL, NULL
3328 };
3329
3330
PCRReactionSetPtrToPCRPrimerDialog(DialoG d,Pointer data)3331 static void PCRReactionSetPtrToPCRPrimerDialog (DialoG d, Pointer data)
3332
3333 {
3334 ValNodePtr head;
3335 Int2 j;
3336 CharPtr str;
3337 CharPtr fmt = "%d\t2\t%s\t%s\n";
3338 TagListPtr tlp;
3339 ValNodePtr vnp;
3340 PCRReactionSetPtr ps;
3341 PCRPrimerPtr pp;
3342 Int4 set_num = 1;
3343
3344 tlp = (TagListPtr) GetObjectExtra (d);
3345 if (tlp == NULL) {
3346 return;
3347 }
3348 ps = (PCRReactionSetPtr) data;
3349 head = NULL;
3350 if (ps == NULL) {
3351 str = (CharPtr) MemNew (sizeof (Char) * StringLen (fmt));
3352 sprintf (str, "%d\t1\t\t\n", set_num);
3353 ValNodeAddPointer (&head, 0, str);
3354 str = (CharPtr) MemNew (sizeof (Char) * StringLen (fmt));
3355 sprintf (str, "%d\t2\t\t\n", set_num);
3356 ValNodeAddPointer (&head, 0, str);
3357 } else {
3358 while (ps != NULL) {
3359 if (ps->forward == NULL) {
3360 str = (CharPtr) MemNew (sizeof (Char) * (StringLen (fmt) + 15));
3361 sprintf (str, "%d\t1\t\t\n", set_num);
3362 ValNodeAddPointer (&head, 0, str);
3363 } else {
3364 pp = ps->forward;
3365 while (pp != NULL) {
3366 str = (CharPtr) MemNew (sizeof (Char) * (StringLen (fmt) + 15 + StringLen (pp->name) + StringLen (pp->seq)));
3367 sprintf (str, "%d\t1\t%s\t%s\n",
3368 set_num,
3369 pp->name == NULL ? "" : pp->name,
3370 pp->seq == NULL ? "" : pp->seq);
3371 ValNodeAddPointer (&head, 0, str);
3372 pp = pp->next;
3373 }
3374 }
3375 if (ps->reverse == NULL) {
3376 str = (CharPtr) MemNew (sizeof (Char) * (StringLen (fmt) + 15));
3377 sprintf (str, "%d\t2\t\t\n", set_num);
3378 ValNodeAddPointer (&head, 0, str);
3379 } else {
3380 pp = ps->reverse;
3381 while (pp != NULL) {
3382 str = (CharPtr) MemNew (sizeof (Char) * (StringLen (fmt) + 15 + StringLen (pp->name) + StringLen (pp->seq)));
3383 sprintf (str, "%d\t2\t%s\t%s\n",
3384 set_num,
3385 pp->name == NULL ? "" : pp->name,
3386 pp->seq == NULL ? "" : pp->seq);
3387 ValNodeAddPointer (&head, 0, str);
3388 pp = pp->next;
3389 }
3390 }
3391 ps = ps->next;
3392 set_num++;
3393 }
3394 }
3395 SendMessageToDialog (tlp->dialog, VIB_MSG_RESET);
3396 tlp->vnp = head;
3397 SendMessageToDialog (tlp->dialog, VIB_MSG_REDRAW);
3398 for (j = 0, vnp = tlp->vnp; vnp != NULL; j++, vnp = vnp->next) {
3399 }
3400 tlp->max = MAX ((Int2) 0, (Int2) (j - tlp->rows + 1));
3401 CorrectBarMax (tlp->bar, tlp->max);
3402 CorrectBarPage (tlp->bar, tlp->rows - 1, tlp->rows - 1);
3403 }
3404
3405
PCRPrimerFromRow(CharPtr row)3406 static PCRPrimerPtr PCRPrimerFromRow (CharPtr row)
3407 {
3408 CharPtr p_name, p_seq;
3409 PCRPrimerPtr pp = NULL;
3410
3411 p_name = ExtractTagListColumn (row, 2);
3412 p_seq = ExtractTagListColumn (row, 3);
3413
3414 if (StringHasNoText (p_name) && StringHasNoText (p_seq)) {
3415 p_name = MemFree (p_name);
3416 p_seq = MemFree (p_seq);
3417 } else {
3418 pp = PCRPrimerNew ();
3419 pp->name = p_name;
3420 pp->seq = p_seq;
3421 }
3422 return pp;
3423 }
3424
3425
AddPrimerToSet(PCRReactionSetPtr PNTR p_set,Int4 set_num,int dir,PCRPrimerPtr pp)3426 static void AddPrimerToSet (PCRReactionSetPtr PNTR p_set, Int4 set_num, int dir, PCRPrimerPtr pp)
3427 {
3428 PCRReactionSetPtr prev = NULL;
3429 PCRReactionSetPtr ps;
3430 PCRPrimerPtr last;
3431 Int4 num = 1;
3432
3433 if (p_set == NULL || pp == NULL) {
3434 return;
3435 }
3436 ps = *p_set;
3437 while (num < set_num) {
3438 if (ps == NULL) {
3439 ps = PCRReactionSetNew ();
3440 if (prev == NULL) {
3441 *p_set = ps;
3442 } else {
3443 prev->next = ps;
3444 }
3445 }
3446 prev = ps;
3447 num++;
3448 ps = ps->next;
3449 }
3450 if (ps == NULL) {
3451 ps = PCRReactionSetNew ();
3452 if (prev == NULL) {
3453 *p_set = ps;
3454 } else {
3455 prev->next = ps;
3456 }
3457 }
3458 if (dir == 2) {
3459 /* add to reverse */
3460 if (ps->reverse == NULL) {
3461 ps->reverse = pp;
3462 } else {
3463 last = ps->reverse;
3464 while (last->next != NULL) {
3465 last = last->next;
3466 }
3467 last->next = pp;
3468 }
3469 } else {
3470 /* add to forward */
3471 if (ps->forward == NULL) {
3472 ps->forward = pp;
3473 } else {
3474 last = ps->forward;
3475 while (last->next != NULL) {
3476 last = last->next;
3477 }
3478 last->next = pp;
3479 }
3480 }
3481 }
3482
PCRPrimerDialogToPCRReactionSetPtr(DialoG d)3483 static Pointer PCRPrimerDialogToPCRReactionSetPtr (DialoG d)
3484
3485 {
3486 CharPtr str;
3487 TagListPtr tlp;
3488 CharPtr tmp;
3489 int val;
3490 ValNodePtr vnp;
3491 PCRReactionSetPtr ps_list = NULL;
3492 PCRPrimerPtr pp;
3493 Int4 set_num = 1;
3494
3495 tlp = (TagListPtr) GetObjectExtra (d);
3496 if (tlp != NULL && tlp->vnp != NULL) {
3497 for (vnp = tlp->vnp; vnp != NULL; vnp = vnp->next) {
3498 /* get set number */
3499 str = (CharPtr) vnp->data.ptrvalue;
3500 tmp = ExtractTagListColumn (str, 0);
3501 if (tmp != NULL && sscanf (tmp, "%d", &val) == 1 && val != 0) {
3502 set_num = val;
3503 }
3504 MemFree (tmp);
3505 /* get name and sequence */
3506 pp = PCRPrimerFromRow (str);
3507 if (pp != NULL) {
3508 /* get direction */
3509 tmp = ExtractTagListColumn (str, 1);
3510 if (tmp == NULL || sscanf (tmp, "%d", &val) != 1 || val != 2) {
3511 val = 1;
3512 }
3513
3514 /* add to set */
3515 AddPrimerToSet (&ps_list, set_num, val, pp);
3516 }
3517 }
3518 }
3519 /* TODO - before returning, need to delete any empty sets */
3520 return (Pointer) ps_list;
3521 }
3522
3523
MakePCRPrimerGroup(GrouP g,GenBioPagePtr gbp)3524 static GrouP MakePCRPrimerGroup (GrouP g, GenBioPagePtr gbp)
3525 {
3526 GrouP grp, q;
3527 PrompT p1, p2, p3, p4;
3528 TagListPtr tlp;
3529
3530 if (gbp == NULL) {
3531 return NULL;
3532 }
3533 grp = HiddenGroup (g, -1, 0, NULL);
3534 SetGroupSpacing (grp, 3, 10);
3535 q = HiddenGroup (grp, 4, 0, NULL);
3536 p1 = StaticPrompt (q, "Set", 0, 0, programFont, 'c');
3537 p2 = StaticPrompt (q, "Dir", 4 * stdCharWidth, 0, programFont, 'c');
3538 p3 = StaticPrompt (q, "Name", pcr_primer_dlg_widths[2] * stdCharWidth, 0, programFont, 'c');
3539 p4 = StaticPrompt (q, "Sequence", pcr_primer_dlg_widths[3] * stdCharWidth, 0, programFont, 'c');
3540
3541 gbp->pcr_primer_dlg = CreateTagListDialogEx3 (grp, 4, 4, 2,
3542 pcr_primer_dlg_types, pcr_primer_dlg_widths, pcr_primer_dlg_popups,
3543 TRUE, FALSE,
3544 PCRReactionSetPtrToPCRPrimerDialog,
3545 PCRPrimerDialogToPCRReactionSetPtr,
3546 NULL, NULL, FALSE, TRUE);
3547
3548 tlp = (TagListPtr) GetObjectExtra (gbp->pcr_primer_dlg);
3549 AlignObjects (ALIGN_JUSTIFY, (HANDLE) tlp->control [0], (HANDLE) p1, NULL);
3550 AlignObjects (ALIGN_JUSTIFY, (HANDLE) tlp->control [1], (HANDLE) p2, NULL);
3551 AlignObjects (ALIGN_JUSTIFY, (HANDLE) tlp->control [2], (HANDLE) p3, NULL);
3552 AlignObjects (ALIGN_JUSTIFY, (HANDLE) tlp->control [3], (HANDLE) p4, NULL);
3553
3554 return grp;
3555 }
3556
3557
ShowPCRPrimers(ButtoN b)3558 static void ShowPCRPrimers (ButtoN b)
3559 {
3560 GenBioPagePtr gbp;
3561
3562 gbp = (GenBioPagePtr) GetObjectExtra (b);
3563 if (gbp == NULL) {
3564 return;
3565 }
3566 if (GetStatus (b)) {
3567 Show (gbp->pcr_primer_grp);
3568 } else {
3569 Hide (gbp->pcr_primer_grp);
3570 }
3571 }
3572
3573
CleanupBioSourceDialog(GraphiC g,VoidPtr data)3574 static void CleanupBioSourceDialog (GraphiC g, VoidPtr data)
3575
3576 {
3577 GenBioPagePtr gbp;
3578
3579 gbp = (GenBioPagePtr) data;
3580 if (gbp != NULL) {
3581 gbp->origTaxName = MemFree (gbp->origTaxName);
3582 gbp->orgmod_alists[0] = MemFree (gbp->orgmod_alists[0]);
3583 gbp->subsource_alists[0] = MemFree (gbp->subsource_alists[0]);
3584 FreeGenBioOrgNameData (gbp);
3585 }
3586 StdCleanupExtraProc (g, data);
3587 }
3588
3589
CreateBioSourceDialog(GrouP h,CharPtr title,GrouP PNTR pages,BioSourcePtr biop,GenBioFormPtr gfp,Boolean diableFocusControl)3590 static DialoG CreateBioSourceDialog (GrouP h, CharPtr title, GrouP PNTR pages,
3591 BioSourcePtr biop, GenBioFormPtr gfp,
3592 Boolean diableFocusControl)
3593
3594 {
3595 ButtoN b;
3596 GrouP c;
3597 GrouP f, f1, f2, f3;
3598 GrouP g;
3599 GenBioPagePtr gbp;
3600 Boolean hasSynonyms;
3601 Int2 height;
3602 Char just;
3603 GrouP k;
3604 GrouP m;
3605 OrgRefPtr orp;
3606 GrouP p;
3607 PrompT ppt;
3608 GrouP q;
3609 RecT r;
3610 GrouP s;
3611 Boolean showUnstructMods;
3612 GrouP t;
3613 CharPtr PNTR tabs = NULL;
3614 DialoG tbs;
3615 PrompT y;
3616 Int2 z;
3617 Boolean indexerVersion;
3618 Boolean has_discontinued, has_discouraged;
3619 ValNode vn;
3620
3621 p = HiddenGroup (h, 1, 0, NULL);
3622 SetGroupSpacing (p, 10, 10);
3623
3624 gbp = (GenBioPagePtr) MemNew (sizeof (GenBioPage));
3625 if (gbp != NULL && pages != NULL) {
3626
3627 SetObjectExtra (p, gbp, CleanupBioSourceDialog);
3628 gbp->dialog = (DialoG) p;
3629 gbp->todialog = BioSourcePtrToGenBioPage;
3630 gbp->fromdialog = GenBioPageToBioSourcePtr;
3631 gbp->dialogmessage = BioSourceMessage;
3632 gbp->testdialog = TestGenBioDialog;
3633 gbp->orgname_choice = 0;
3634 gbp->orgname_data = NULL;
3635
3636 /* set up subsource and orgmod alists */
3637 indexerVersion = (Boolean) (GetAppProperty ("InternalNcbiSequin") != NULL);
3638 BioSourceHasOldOrgModQualifiers (biop, &has_discouraged, &has_discontinued);
3639 gbp->orgmod_alists[0] = GetModifiersEnum (FALSE, TRUE, has_discouraged || indexerVersion, has_discontinued);
3640 gbp->orgmod_alists[1] = NULL;
3641 BioSourceHasOldSubSourceQualifiers (biop, &has_discouraged, &has_discontinued);
3642 gbp->subsource_alists[0] = GetModifiersEnum (TRUE, FALSE, has_discouraged || indexerVersion, has_discontinued);
3643 gbp->subsource_alists[1] = NULL;
3644
3645 if (title != NULL && title [0] != '\0') {
3646 s = NormalGroup (p, 0, -2, title, systemFont, NULL);
3647 } else {
3648 s = HiddenGroup (p, 0, -2, NULL);
3649 }
3650 SetGroupSpacing (s, 10, 10);
3651
3652 m = HiddenGroup (s, 0, 0, NULL);
3653
3654 pages [0] = HiddenGroup (m, -1, 0, NULL);
3655 SetGroupSpacing (pages [0], 10, 10);
3656
3657 tbs = CreateFolderTabs (pages [0], orgTabs, 0, 0, 0,
3658 PROGRAM_FOLDER_TAB,
3659 ChangeOrgSubPage, (Pointer) gbp);
3660 k = HiddenGroup (pages [0], 0, 0, NULL);
3661
3662 gbp->orgGrp [0] = HiddenGroup (k, -1, 0, NULL);
3663 SetGroupSpacing (gbp->orgGrp [0], 10, 10);
3664
3665 gbp->origTaxName = NULL;
3666 gbp->stripOldName = FALSE;
3667
3668 g = HiddenGroup (gbp->orgGrp [0], 1, 0, NULL);
3669 SetGroupSpacing (g, 10, 10);
3670 f = HiddenGroup (g, 2, 0, NULL);
3671 SetGroupSpacing (f, 3, 5);
3672 StaticPrompt (f, "Scientific Name", 0, dialogTextHeight, programFont, 'l');
3673 gbp->taxName = DialogText (f, "", 20, TaxNameText);
3674 SetObjectExtra (gbp->taxName, gbp, NULL);
3675 StaticPrompt (f, "Common Name", 0, dialogTextHeight, programFont, 'l');
3676 gbp->commonName = (Handle) DialogText (f, "", 10, CommonNameText);
3677 /*
3678 gbp->commonName = StaticPrompt (f, "", 10 * stdCharWidth, dialogTextHeight, systemFont, 'l');
3679 */
3680 SetObjectExtra (gbp->commonName, gbp, NULL);
3681 StaticPrompt (f, "", 0, dialogTextHeight, programFont, 'l');
3682 f = HiddenGroup (g, 1, 0, NULL);
3683 SelectFont (programFont);
3684 height = LineHeight ();
3685 SelectFont (systemFont);
3686 gbp->orglist = DocumentPanel (f, stdCharWidth * 25, height * 6);
3687 SetObjectExtra (gbp->orglist, gbp, NULL);
3688 SetDocAutoAdjust (gbp->orglist, FALSE);
3689 orgListCol [0].pixWidth = screenRect.right - screenRect.left;
3690 AppendItem (gbp->orglist, AllButFirstLinePrtProc, orgTxtPtr, FALSE, orgNum,
3691 &orgListPar, orgListCol, programFont);
3692 SetDocAutoAdjust (gbp->orglist, TRUE);
3693 SetDocProcs (gbp->orglist, ClickTaxName, NULL, ReleaseTaxName, NULL);
3694 SetDocShade (gbp->orglist, NULL, NULL, HighlightTaxName, NULL);
3695
3696 gbp->disable_strain_forwarding = CheckBox (f, "Disable Strain Forwarding", NULL);
3697
3698 AlignObjects (ALIGN_RIGHT, (HANDLE) gbp->taxName, (HANDLE) gbp->commonName,
3699 (HANDLE) gbp->orglist, (HANDLE) gbp->disable_strain_forwarding, NULL);
3700
3701 gbp->orgGrp [1] = HiddenGroup (k, -1, 0, NULL);
3702 SetGroupSpacing (gbp->orgGrp [1], 10, 10);
3703
3704 g = HiddenGroup (gbp->orgGrp [1], -1, 0, NULL);
3705 SelectFont (programFont);
3706 f = HiddenGroup (g, 3, 0, NULL);
3707 StaticPrompt (f, "Location of Sequence",
3708 0, popupMenuHeight, programFont, 'l');
3709
3710 gbp->genome = ValNodeSelectionDialogExEx (f, GetLocListForBioSource (biop), SHORT_SELECTION_LIST, ValNodeStringName,
3711 ValNodeSimpleDataFree, ValNodeStringCopy,
3712 ValNodeChoiceMatch, "location",
3713 NULL, NULL, FALSE, FALSE, TRUE, NULL);
3714 vn.choice = Source_location_genomic;
3715 vn.data.ptrvalue = NULL;
3716 vn.next = NULL;
3717 PointerToDialog (gbp->genome, &vn);
3718
3719 ObjectRect (gbp->orglist, &r);
3720 MultiLinePrompt (g, useGenomicText, r.right - r.left - 2, programFont);
3721
3722 f = HiddenGroup (gbp->orgGrp [1], 3, 0, NULL);
3723 StaticPrompt (f, "Origin of Sequence",
3724 0, popupMenuHeight, programFont, 'l');
3725 gbp->origin = PopupList (f, TRUE, NULL);
3726 SetObjectExtra (gbp->origin, gbp, NULL);
3727 InitEnumPopup (gbp->origin, biosource_origin_alist, NULL);
3728 SetValue (gbp->origin, 0);
3729
3730 gbp->is_focus = CheckBox (gbp->orgGrp [1], "Biological focus (if multiple source features)", NULL);
3731 if (diableFocusControl) {
3732 Disable (gbp->is_focus);
3733 }
3734 AlignObjects (ALIGN_CENTER, (HANDLE) g, (HANDLE) f, NULL);
3735
3736 Hide (gbp->orgGrp [1]);
3737
3738 gbp->orgGrp [2] = HiddenGroup (k, -1, 0, NULL);
3739 SetGroupSpacing (gbp->orgGrp [2], 10, 10);
3740
3741 f = HiddenGroup (gbp->orgGrp [2], 2, 0, NULL);
3742 SetGroupSpacing (f, 10, 5);
3743 StaticPrompt (f, "Nuclear", 0, popupMenuHeight, programFont, 'l');
3744 gbp->gcode = PopupList (f, TRUE, NULL);
3745 PopulateGeneticCodePopup (gbp->gcode);
3746 SetValue (gbp->gcode, 1);
3747 StaticPrompt (f, "Mitochondrial", 0, popupMenuHeight, programFont, 'l');
3748 gbp->mgcode = PopupList (f, TRUE, NULL);
3749 PopulateGeneticCodePopup (gbp->mgcode);
3750 SetValue (gbp->mgcode, 1);
3751 StaticPrompt (f, "Plastid", 0, popupMenuHeight, programFont, 'l');
3752 gbp->pgcode = PopupList (f, TRUE, NULL);
3753 PopulateGeneticCodePopup (gbp->pgcode);
3754 SetValue (gbp->pgcode, 1);
3755
3756 Hide (gbp->orgGrp [2]);
3757
3758 gbp->orgGrp [3] = HiddenGroup (k, -1, 0, NULL);
3759 SetGroupSpacing (gbp->orgGrp [3], 10, 10);
3760
3761 f = HiddenGroup (gbp->orgGrp [3], 0, 2, NULL);
3762 y = StaticPrompt (f, "Taxonomic Lineage", 0, 0, programFont, 'c');
3763 gbp->lineage = ScrollText (f, 20, 3, programFont, TRUE, NULL);
3764 q = HiddenGroup (gbp->orgGrp [3], 2, 0, NULL);
3765 StaticPrompt (q, "Division", 0, dialogTextHeight, programFont, 'l');
3766 gbp->gbDiv = DialogText (q, "", 4, NULL);
3767 c = HiddenGroup (gbp->orgGrp [3], -1, 0, NULL);
3768 if (gfp != NULL && gfp->lookupTaxonomy != NULL) {
3769 ppt = StaticPrompt (c, "Looking up taxonomy will close this window.", 0, 0, programFont, 'c');
3770 b = PushButton (c, "Lookup Taxonomy", LookupTheTaxonomyProc);
3771 SetObjectExtra (b, gfp, NULL);
3772 AlignObjects (ALIGN_CENTER, (HANDLE) ppt, (HANDLE) b, NULL);
3773 }
3774 AlignObjects (ALIGN_CENTER, (HANDLE) f, (HANDLE) q, (HANDLE) c, NULL);
3775
3776 Hide (gbp->orgGrp [3]);
3777
3778 AlignObjects (ALIGN_CENTER, (HANDLE) tbs,
3779 (HANDLE) gbp->orgGrp [0], (HANDLE) gbp->orgGrp [1],
3780 (HANDLE) gbp->orgGrp [2], (HANDLE) gbp->orgGrp [3], NULL);
3781
3782 pages [1] = HiddenGroup (m, -1, 0, NULL);
3783 SetGroupSpacing (pages [1], 10, 10);
3784
3785 showUnstructMods = FALSE;
3786 hasSynonyms = FALSE;
3787 if (biop != NULL) {
3788 orp = biop->org;
3789 if (orp != NULL && orp->mod != NULL) {
3790 showUnstructMods = TRUE;
3791 }
3792 if (orp != NULL && orp->syn != NULL) {
3793 hasSynonyms = TRUE;
3794 }
3795 }
3796
3797 if (showUnstructMods) {
3798 tbs = CreateFolderTabs (pages [1], modTabsUns, 0, 0, 0,
3799 PROGRAM_FOLDER_TAB,
3800 ChangeModSubPage, (Pointer) gbp);
3801 } else {
3802 tbs = CreateFolderTabs (pages [1], modTabs, 0, 0, 0,
3803 PROGRAM_FOLDER_TAB,
3804 ChangeModSubPage, (Pointer) gbp);
3805 }
3806 k = HiddenGroup (pages [1], 0, 0, NULL);
3807
3808 gbp->modGrp [eModTabSource ] = HiddenGroup (k, -1, 0, NULL);
3809 SetGroupSpacing (gbp->modGrp [eModTabSource ], 10, 10);
3810
3811 g = HiddenGroup (gbp->modGrp [eModTabSource ], -1, 0, NULL);
3812 SetGroupSpacing (g, 3, 10);
3813 gbp->subsrc_val_dlg = CreateSubSourceDialog (g, gbp->subsource_alists[0]);
3814
3815 gbp->pcr_primer_btn = CheckBox (g, "PCR primers", ShowPCRPrimers);
3816 SetObjectExtra (gbp->pcr_primer_btn, gbp, NULL);
3817 gbp->pcr_primer_grp = MakePCRPrimerGroup (g, gbp);
3818 SetGroupSpacing (gbp->pcr_primer_grp, 3, 10);
3819 Hide (gbp->pcr_primer_grp);
3820
3821 AlignObjects (ALIGN_CENTER, (HANDLE) gbp->subsrc_val_dlg, (HANDLE) gbp->pcr_primer_btn, (HANDLE) gbp->pcr_primer_grp, NULL);
3822
3823 gbp->modGrp [eModTabOrganism] = HiddenGroup (k, -1, 0, NULL);
3824 SetGroupSpacing (gbp->modGrp [eModTabOrganism], 10, 10);
3825
3826 g = HiddenGroup (gbp->modGrp [eModTabOrganism], -1, 0, NULL);
3827 SetGroupSpacing (g, 3, 10);
3828
3829 gbp->orgmod_val_dlg = CreateOrgModDialog (g, gbp->orgmod_alists[0], gbp->taxName);
3830
3831 Hide (gbp->modGrp [eModTabOrganism]);
3832
3833 gbp->modGrp [eModTabGenBank] = HiddenGroup (k, -1, 0, NULL);
3834 SetGroupSpacing (gbp->modGrp [eModTabGenBank], 10, 10);
3835
3836 g = HiddenGroup (gbp->modGrp [eModTabGenBank], 2, 0, NULL);
3837 SetGroupSpacing (g, 3, 10);
3838
3839 StaticPrompt (g, "Assigned Acronym", 0, stdLineHeight, programFont, 'l');
3840 gbp->gbacr = StaticPrompt (g, "", 15 * stdCharWidth, stdLineHeight, systemFont, 'l');
3841 StaticPrompt (g, "Assigned Anamorph", 0, stdLineHeight, programFont, 'l');
3842 gbp->gbana = StaticPrompt (g, "", 15 * stdCharWidth, stdLineHeight, systemFont, 'l');
3843 StaticPrompt (g, "Assigned Synonym", 0, stdLineHeight, programFont, 'l');
3844 gbp->gbsyn = StaticPrompt (g, "", 15 * stdCharWidth, stdLineHeight, systemFont, 'l');
3845 StaticPrompt (g, "Type Material", 0, stdLineHeight, programFont, 'l');
3846 gbp->tymat = StaticPrompt (g, "", 15 * stdCharWidth, stdLineHeight, systemFont, 'l');
3847
3848 Hide (gbp->modGrp [eModTabGenBank]);
3849
3850 gbp->modGrp [eModTabUnstructured] = HiddenGroup (k, -1, 0, NULL);
3851 SetGroupSpacing (gbp->modGrp [eModTabUnstructured], 10, 10);
3852
3853 if (showUnstructMods) {
3854 f3 = HiddenGroup (gbp->modGrp [eModTabUnstructured], 0, 2, NULL);
3855 StaticPrompt (f3, "Unstructured Modifiers", 0, 0, programFont, 'c');
3856 gbp->mod = CreateVisibleStringDialog (f3, 3, -1, 15);
3857 }
3858
3859 Hide (gbp->modGrp [eModTabUnstructured]);
3860
3861 AlignObjects (ALIGN_CENTER, (HANDLE) tbs,
3862 (HANDLE) gbp->modGrp [eModTabSource],
3863 (HANDLE) gbp->modGrp [eModTabOrganism],
3864 (HANDLE) gbp->modGrp [eModTabGenBank],
3865 (HANDLE) gbp->modGrp [eModTabUnstructured], NULL);
3866
3867 Hide (pages [1]);
3868
3869 pages [2] = HiddenGroup (m, -1, 0, NULL);
3870 SetGroupSpacing (pages [2], 10, 10);
3871
3872 tabs = miscTabs1;
3873 if (hasSynonyms) {
3874 tabs = miscTabs2;
3875 }
3876 tbs = CreateFolderTabs (pages [2], tabs, 0, 0, 0,
3877 PROGRAM_FOLDER_TAB,
3878 ChangeMiscSubPage, (Pointer) gbp);
3879 k = HiddenGroup (pages [2], 0, 0, NULL);
3880
3881 for (z = 0; z < 2; z++) {
3882 gbp->miscGrp [z] = NULL;
3883 }
3884 z = 0;
3885
3886 if (hasSynonyms) {
3887 gbp->miscGrp [z] = HiddenGroup (k, -1, 0, NULL);
3888 SetGroupSpacing (gbp->miscGrp [z], 10, 10);
3889
3890 f1 = HiddenGroup (gbp->miscGrp [z], 0, 2, NULL);
3891 StaticPrompt (f1, "Synonyms", 0, 0, programFont, 'c');
3892 gbp->syn = CreateVisibleStringDialog (f1, 3, -1, 15);
3893
3894 z++;
3895 }
3896
3897 gbp->miscGrp [z] = HiddenGroup (k, -1, 0, NULL);
3898 SetGroupSpacing (gbp->miscGrp [z], 10, 10);
3899
3900 f2 = HiddenGroup (gbp->miscGrp [z], -1, 0, NULL);
3901 SetGroupSpacing (f2, 10, 10);
3902 if (GetAppProperty ("ReadOnlyDbTags") == NULL) {
3903 just = 'c';
3904 } else {
3905 just = 'l';
3906 StaticPrompt (f2, "This page is read-only", 15 * stdCharWidth, 0, programFont, 'c');
3907 }
3908 t = HiddenGroup (f2, 2, 0, NULL);
3909 StaticPrompt (t, "Database", 7 * stdCharWidth, 0, programFont, just);
3910 StaticPrompt (t, "Object ID", 8 * stdCharWidth, 0, programFont, just);
3911 gbp->db = CreateDbtagDialog (f2, 3, -1, 7, 8);
3912
3913 Hide (gbp->miscGrp [1]);
3914
3915 AlignObjects (ALIGN_CENTER, (HANDLE) tbs,
3916 (HANDLE) gbp->miscGrp [0],
3917 (HANDLE) gbp->miscGrp [1], NULL);
3918
3919 Hide (pages [2]);
3920
3921
3922 AlignObjects (ALIGN_CENTER, (HANDLE) pages [ORGANISM_PAGE],
3923 (HANDLE) pages [MODIFIERS_PAGE],
3924 (HANDLE) pages [MISCELLANEOUS_PAGE], NULL);
3925 }
3926
3927 return (DialoG) p;
3928 }
3929
SetBioSourceImportExportItems(GenBioFormPtr gfp)3930 static void SetBioSourceImportExportItems (GenBioFormPtr gfp)
3931
3932 {
3933 IteM exportItm;
3934 IteM importItm;
3935
3936 if (gfp != NULL) {
3937 importItm = FindFormMenuItem ((BaseFormPtr) gfp, VIB_MSG_IMPORT);
3938 exportItm = FindFormMenuItem ((BaseFormPtr) gfp, VIB_MSG_EXPORT);
3939 switch (gfp->currentPage) {
3940 case ORGANISM_PAGE :
3941 SafeSetTitle (importItm, "Import BioSource...");
3942 SafeSetTitle (exportItm, "Export BioSource...");
3943 SafeEnable (importItm);
3944 SafeEnable (exportItm);
3945 break;
3946 case MODIFIERS_PAGE :
3947 SafeSetTitle (importItm, "Import...");
3948 SafeSetTitle (exportItm, "Export...");
3949 SafeDisable (importItm);
3950 SafeDisable (exportItm);
3951 break;
3952 case MISCELLANEOUS_PAGE :
3953 SafeSetTitle (importItm, "Import...");
3954 SafeSetTitle (exportItm, "Export...");
3955 SafeDisable (importItm);
3956 SafeDisable (exportItm);
3957 break;
3958 case COMMON_PAGE :
3959 SafeSetTitle (importItm, "Import...");
3960 SafeSetTitle (exportItm, "Export...");
3961 SafeDisable (importItm);
3962 SafeDisable (exportItm);
3963 break;
3964 case LOCATION_PAGE :
3965 SafeSetTitle (importItm, "Import SeqLoc...");
3966 SafeSetTitle (exportItm, "Export SeqLoc...");
3967 SafeEnable (importItm);
3968 SafeEnable (exportItm);
3969 break;
3970 default :
3971 break;
3972 }
3973 }
3974 }
3975
ChangeBioSourcePage(VoidPtr data,Int2 newval,Int2 oldval)3976 static void ChangeBioSourcePage (VoidPtr data, Int2 newval, Int2 oldval)
3977
3978 {
3979 GenBioFormPtr gfp;
3980
3981 gfp = (GenBioFormPtr) data;
3982 if (gfp != NULL) {
3983 gfp->currentPage = newval;
3984 SafeHide (gfp->pages [oldval]);
3985 SafeShow (gfp->pages [newval]);
3986 switch (newval) {
3987 case ORGANISM_PAGE :
3988 break;
3989 case MODIFIERS_PAGE :
3990 break;
3991 case MISCELLANEOUS_PAGE :
3992 break;
3993 case COMMON_PAGE :
3994 break;
3995 case LOCATION_PAGE :
3996 SendMessageToDialog (gfp->location, VIB_MSG_ENTER);
3997 break;
3998 default :
3999 break;
4000 }
4001 SetBioSourceImportExportItems (gfp);
4002 Update ();
4003 }
4004 }
4005
ImportBioSourceForm(ForM f,CharPtr filename)4006 static Boolean ImportBioSourceForm (ForM f, CharPtr filename)
4007
4008 {
4009 AsnIoPtr aip;
4010 BioSourcePtr biop;
4011 GenBioFormPtr gfp;
4012 Char path [PATH_MAX];
4013
4014 path [0] = '\0';
4015 StringNCpy_0 (path, filename, sizeof (path));
4016 gfp = (GenBioFormPtr) GetObjectExtra (f);
4017 if (gfp != NULL) {
4018 switch (gfp->currentPage) {
4019 case ORGANISM_PAGE :
4020 if (path [0] != '\0' || GetInputFileName (path, sizeof (path), "", "TEXT")) {
4021 aip = AsnIoOpen (path, "r");
4022 if (aip != NULL) {
4023 biop = BioSourceAsnRead (aip, NULL);
4024 AsnIoClose (aip);
4025 if (biop != NULL) {
4026 PointerToDialog (gfp->data, (Pointer) biop);
4027 biop = BioSourceFree (biop);
4028 Update ();
4029 return TRUE;
4030 }
4031 }
4032 }
4033 break;
4034 case LOCATION_PAGE :
4035 return ImportDialog (gfp->location, filename);
4036 default :
4037 break;
4038 }
4039 }
4040 return FALSE;
4041 }
4042
ExportBioSourceForm(ForM f,CharPtr filename)4043 static Boolean ExportBioSourceForm (ForM f, CharPtr filename)
4044
4045 {
4046 AsnIoPtr aip;
4047 BioSourcePtr biop;
4048 GenBioFormPtr gfp;
4049 Char path [PATH_MAX];
4050 #ifdef WIN_MAC
4051 FILE *fp;
4052 #endif
4053
4054 path [0] = '\0';
4055 StringNCpy_0 (path, filename, sizeof (path));
4056 gfp = (GenBioFormPtr) GetObjectExtra (f);
4057 if (gfp != NULL) {
4058 switch (gfp->currentPage) {
4059 case ORGANISM_PAGE :
4060 if (path [0] != '\0' || GetOutputFileName (path, sizeof (path), NULL)) {
4061 #ifdef WIN_MAC
4062 fp = FileOpen (path, "r");
4063 if (fp != NULL) {
4064 FileClose (fp);
4065 } else {
4066 FileCreate (path, "TEXT", "ttxt");
4067 }
4068 #endif
4069 aip = AsnIoOpen (path, "w");
4070 if (aip != NULL) {
4071 biop = DialogToPointer (gfp->data);
4072 BioSourceAsnWrite (biop, aip, NULL);
4073 AsnIoClose (aip);
4074 biop = BioSourceFree (biop);
4075 return TRUE;
4076 }
4077 }
4078 break;
4079 case LOCATION_PAGE :
4080 return ExportDialog (gfp->location, filename);
4081 default :
4082 break;
4083 }
4084 }
4085 return FALSE;
4086 }
4087
4088 static CharPtr biosourceDescFormTabs [] = {
4089 "Organism", "Modifiers", "Miscellaneous", NULL
4090 };
4091
BioSourceDescFormMessage(ForM f,Int2 mssg)4092 static void BioSourceDescFormMessage (ForM f, Int2 mssg)
4093
4094 {
4095 GenBioFormPtr gfp;
4096
4097 gfp = (GenBioFormPtr) GetObjectExtra (f);
4098 if (gfp != NULL) {
4099 switch (mssg) {
4100 case VIB_MSG_INIT :
4101 SendMessageToDialog (gfp->data, VIB_MSG_INIT);
4102 break;
4103 case VIB_MSG_IMPORT :
4104 ImportBioSourceForm (f, NULL);
4105 break;
4106 case VIB_MSG_EXPORT :
4107 ExportBioSourceForm (f, NULL);
4108 break;
4109 case VIB_MSG_CLOSE :
4110 Remove (f);
4111 break;
4112 case VIB_MSG_CUT :
4113 StdCutTextProc (NULL);
4114 break;
4115 case VIB_MSG_COPY :
4116 StdCopyTextProc (NULL);
4117 break;
4118 case VIB_MSG_PASTE :
4119 StdPasteTextProc (NULL);
4120 break;
4121 case VIB_MSG_DELETE :
4122 StdDeleteTextProc (NULL);
4123 break;
4124 default :
4125 if (gfp->appmessage != NULL) {
4126 gfp->appmessage (f, mssg);
4127 }
4128 break;
4129 }
4130 }
4131 }
4132
BioSourceFormActivate(WindoW w)4133 static void BioSourceFormActivate (WindoW w)
4134
4135 {
4136 GenBioFormPtr gfp;
4137
4138 gfp = (GenBioFormPtr) GetObjectExtra (w);
4139 if (gfp != NULL) {
4140 if (gfp->activate != NULL) {
4141 gfp->activate (w);
4142 }
4143 SetBioSourceImportExportItems (gfp);
4144 }
4145 }
4146
OkayToAcceptBioSource(ButtoN b)4147 static Boolean OkayToAcceptBioSource (ButtoN b)
4148
4149 {
4150 Boolean abort;
4151 MsgAnswer ans;
4152 OrgModPtr curr;
4153 GenBioPagePtr gbp;
4154 GenBioFormPtr gfp;
4155 OrgModPtr mod;
4156 CharPtr str;
4157 ValNodePtr err_list;
4158
4159 gfp = (GenBioFormPtr) GetObjectExtra (b);
4160 if (gfp != NULL) {
4161 gbp = (GenBioPagePtr) GetObjectExtra (gfp->data);
4162 if (gbp != NULL) {
4163 err_list = TestDialog (gbp->orgmod_val_dlg);
4164 ValNodeLink (&err_list, TestDialog (gbp->subsrc_val_dlg));
4165 if (err_list != NULL)
4166 {
4167 if (ANS_CANCEL == Message (MSG_OKC, "You have selected values for modifiers, but not types - values without types will be discarded. Continue?"))
4168 {
4169 err_list = ValNodeFreeData (err_list);
4170 return FALSE;
4171 }
4172 err_list = ValNodeFreeData (err_list);
4173 }
4174 mod = DialogToPointer (gbp->orgmod_val_dlg);
4175 if (mod == NULL) return TRUE;
4176 abort = TRUE;
4177 for (curr = mod; curr != NULL; curr = curr->next) {
4178 if (curr->subtype == 254) {
4179 abort = FALSE;
4180 }
4181 }
4182 OrgModFree (mod);
4183 if (abort) return TRUE;
4184 str = SaveStringFromText (gbp->taxName);
4185 ans = ANS_NO;
4186 if (StringICmp (str, gbp->origTaxName) != 0) {
4187 ans = Message (MSG_YNC, "Delete original name (necessary for correct lookup)?");
4188 }
4189 MemFree (str);
4190 if (ans == ANS_CANCEL) return FALSE;
4191 if (ans == ANS_YES) {
4192 gbp->stripOldName = TRUE;
4193 }
4194 }
4195 }
4196 return TRUE;
4197 }
4198
BioSourceDescFormAcceptButtonProc(ButtoN b)4199 static void BioSourceDescFormAcceptButtonProc (ButtoN b)
4200
4201 {
4202 if (OkayToAcceptBioSource (b)) {
4203
4204 StdAcceptFormButtonProc (b);
4205 }
4206 }
4207
CreateBioSourceDescForm(Int2 left,Int2 top,Int2 width,Int2 height,CharPtr title,ValNodePtr sdp,SeqEntryPtr sep,FormActnFunc actproc,BioSourceEditProcsPtr bepp)4208 extern ForM CreateBioSourceDescForm (Int2 left, Int2 top, Int2 width,
4209 Int2 height, CharPtr title, ValNodePtr sdp,
4210 SeqEntryPtr sep, FormActnFunc actproc,
4211 BioSourceEditProcsPtr bepp)
4212
4213 {
4214 ButtoN b;
4215 BioSourcePtr biop;
4216 GrouP c;
4217 GrouP g;
4218 GenBioFormPtr gfp;
4219 StdEditorProcsPtr sepp;
4220 WindoW w;
4221
4222 w = NULL;
4223 gfp = (GenBioFormPtr) MemNew (sizeof (GenBioForm));
4224 if (gfp != NULL) {
4225 w = FixedWindow (left, top, width, height, title, StdCloseWindowProc);
4226 SetObjectExtra (w, gfp, StdDescFormCleanupProc);
4227 gfp->form = (ForM) w;
4228 gfp->actproc = actproc;
4229 gfp->toform = NULL;
4230 gfp->fromform = NULL;
4231 gfp->testform = NULL;
4232 gfp->formmessage = BioSourceDescFormMessage;
4233 gfp->importform = ImportBioSourceForm;
4234 gfp->exportform = ExportBioSourceForm;
4235
4236 #ifndef WIN_MAC
4237 CreateStdEditorFormMenus (w);
4238 #endif
4239
4240 if (bepp == NULL) {
4241 bepp = (BioSourceEditProcsPtr) GetAppProperty ("BioSourcEditForm");
4242 }
4243 if (bepp != NULL) {
4244 gfp->lookupTaxonomy = bepp->lookupTaxonomy;
4245 }
4246 sepp = (StdEditorProcsPtr) GetAppProperty ("StdEditorForm");
4247 if (sepp != NULL) {
4248 gfp->activate = sepp->activateForm;
4249 gfp->appmessage = sepp->handleMessages;
4250 }
4251 SetActivate (w, BioSourceFormActivate);
4252
4253 g = HiddenGroup (w, -1, 0, NULL);
4254 SetGroupSpacing (g, 3, 10);
4255
4256 gfp->foldertabs = CreateFolderTabs (g, biosourceDescFormTabs, ORGANISM_PAGE,
4257 0, 0, SYSTEM_FOLDER_TAB,
4258 ChangeBioSourcePage, (Pointer) gfp);
4259 gfp->currentPage = ORGANISM_PAGE;
4260
4261 biop = NULL;
4262 if (sdp != NULL && sdp->choice == Seq_descr_source) {
4263 biop = sdp->data.ptrvalue;
4264 }
4265 gfp->data = CreateBioSourceDialog (g, NULL, gfp->pages, biop, gfp, FALSE);
4266
4267 AlignObjects (ALIGN_CENTER, (HANDLE) gfp->foldertabs, (HANDLE) gfp->data, NULL);
4268
4269 c = HiddenGroup (w, 2, 0, NULL);
4270 b = PushButton (c, "Accept", BioSourceDescFormAcceptButtonProc);
4271 SetObjectExtra (b, gfp, NULL);
4272 PushButton (c, "Cancel", StdCancelButtonProc);
4273 AlignObjects (ALIGN_CENTER, (HANDLE) g, (HANDLE) c, NULL);
4274 RealizeWindow (w);
4275
4276 SendMessageToDialog (gfp->data, VIB_MSG_INIT);
4277 Show (gfp->pages [gfp->currentPage]);
4278 SendMessageToDialog (gfp->data, VIB_MSG_ENTER);
4279 Update ();
4280 }
4281 return (ForM) w;
4282 }
4283
4284 typedef struct biosourcedlg
4285 {
4286 DIALOG_MESSAGE_BLOCK
4287 DialoG foldertabs;
4288 GrouP pages [NUM_PAGES];
4289 DialoG location;
4290 Int2 currentPage;
4291 DialoG gbp;
4292
4293 LookupTaxonomyProc lookupTaxonomy; /* read in from the application properties */
4294 } BioSourceDlgData, PNTR BioSourceDlgPtr;
4295
ChangeBioSourceDialogPage(VoidPtr data,Int2 newval,Int2 oldval)4296 static void ChangeBioSourceDialogPage (VoidPtr data, Int2 newval, Int2 oldval)
4297
4298 {
4299 BioSourceDlgPtr dlg;
4300
4301 dlg = (BioSourceDlgPtr) data;
4302 if (dlg != NULL) {
4303 dlg->currentPage = newval;
4304 SafeHide (dlg->pages [oldval]);
4305 SafeShow (dlg->pages [newval]);
4306 switch (newval) {
4307 case ORGANISM_PAGE :
4308 break;
4309 case MODIFIERS_PAGE :
4310 break;
4311 case MISCELLANEOUS_PAGE :
4312 break;
4313 case COMMON_PAGE :
4314 break;
4315 case LOCATION_PAGE :
4316 SendMessageToDialog (dlg->location, VIB_MSG_ENTER);
4317 break;
4318 default :
4319 break;
4320 }
4321 Update ();
4322 }
4323 }
4324
BioSourceToDialog(DialoG d,Pointer userdata)4325 static void BioSourceToDialog (DialoG d, Pointer userdata)
4326 {
4327 BioSourceDlgPtr dlg;
4328 BioSourcePtr biop;
4329
4330 dlg = (BioSourceDlgPtr) GetObjectExtra (d);
4331 if (dlg == NULL)
4332 {
4333 return;
4334 }
4335
4336 biop = (BioSourcePtr) userdata;
4337 PointerToDialog (dlg->gbp, biop);
4338 }
4339
DialogToBioSource(DialoG d)4340 static Pointer DialogToBioSource (DialoG d)
4341 {
4342 BioSourceDlgPtr dlg;
4343
4344 dlg = (BioSourceDlgPtr) GetObjectExtra (d);
4345 if (dlg == NULL)
4346 {
4347 return NULL;
4348 }
4349
4350 return DialogToPointer (dlg->gbp);
4351 }
4352
TestBioSourceDialog(DialoG d)4353 static ValNodePtr TestBioSourceDialog (DialoG d)
4354 {
4355 BioSourceDlgPtr dlg;
4356
4357 dlg = (BioSourceDlgPtr) GetObjectExtra (d);
4358 if (dlg == NULL)
4359 {
4360 return NULL;
4361 }
4362 return TestDialog (dlg->gbp);
4363 }
4364
BioSourceDialogMessage(DialoG d,Int2 message)4365 static void BioSourceDialogMessage (DialoG d, Int2 message)
4366 {
4367 BioSourceDlgPtr dlg;
4368
4369 dlg = (BioSourceDlgPtr) GetObjectExtra (d);
4370 if (dlg != NULL)
4371 {
4372 SendMessageToDialog (dlg->gbp, message);
4373 }
4374 }
4375
DoTaxLookup(ButtoN b)4376 static void DoTaxLookup (ButtoN b)
4377 {
4378 BioSourceDlgPtr dlg;
4379 SeqEntryPtr sep;
4380 BioseqSetPtr bssp;
4381 SeqDescrPtr sdp;
4382 BioSourcePtr biop;
4383 Uint2 entityID;
4384
4385 dlg = (BioSourceDlgPtr) GetObjectExtra (b);
4386 if (dlg == NULL)
4387 {
4388 return;
4389 }
4390
4391 sep = SeqEntryNew ();
4392 if (sep == NULL)
4393 {
4394 return;
4395 }
4396
4397 biop = (BioSourcePtr) DialogToPointer (dlg->dialog);
4398 bssp = BioseqSetNew ();
4399
4400 if (biop == NULL || bssp == NULL)
4401 {
4402 biop = BioSourceFree (biop);
4403 bssp = BioseqSetFree (bssp);
4404 sep = SeqEntryFree (sep);
4405 return;
4406 }
4407
4408 bssp->_class = BioseqseqSet_class_empty_set;
4409
4410 sep->choice = 2;
4411 sep->data.ptrvalue = bssp;
4412 sdp = CreateNewDescriptor (sep, Seq_descr_source);
4413 sdp->data.ptrvalue = biop;
4414 entityID = ObjMgrGetEntityIDForChoice (sep);
4415 if (entityID > 0)
4416 {
4417 SeqMgrIndexFeatures (entityID, NULL);
4418 if ((dlg->lookupTaxonomy) (entityID))
4419 {
4420 /* find the new BioSource */
4421 sdp = bssp->descr;
4422 while (sdp != NULL && sdp->choice != Seq_descr_source)
4423 {
4424 sdp = sdp->next;
4425 }
4426 if (sdp != NULL)
4427 {
4428 /* put it in our dialog */
4429 PointerToDialog (dlg->dialog, sdp->data.ptrvalue);
4430 }
4431 }
4432 }
4433 SeqEntryFree (sep);
4434 }
4435
BioSourceDialog(GrouP parent)4436 extern DialoG BioSourceDialog (GrouP parent)
4437 {
4438 BioSourceDlgPtr dlg;
4439 GrouP p;
4440 BioSourceEditProcsPtr bepp;
4441 ButtoN b;
4442
4443 dlg = (BioSourceDlgPtr) MemNew (sizeof (BioSourceDlgData));
4444 if (dlg == NULL)
4445 {
4446 return NULL;
4447 }
4448
4449 p = HiddenGroup (parent, -1, 0, NULL);
4450 SetObjectExtra (p, dlg, StdCleanupExtraProc);
4451 SetGroupSpacing (p, 3, 10);
4452 dlg->dialog = (DialoG) p;
4453 dlg->todialog = BioSourceToDialog;
4454 dlg->fromdialog = DialogToBioSource;
4455 dlg->dialogmessage = BioSourceDialogMessage;
4456 dlg->testdialog = TestBioSourceDialog;
4457
4458 dlg->foldertabs = CreateFolderTabs (p, biosourceDescFormTabs, ORGANISM_PAGE,
4459 0, 0, SYSTEM_FOLDER_TAB,
4460 ChangeBioSourceDialogPage, (Pointer) dlg);
4461 dlg->currentPage = ORGANISM_PAGE;
4462
4463 dlg->gbp = CreateBioSourceDialog (p, NULL, dlg->pages, NULL, NULL, TRUE);
4464
4465 bepp = (BioSourceEditProcsPtr) GetAppProperty ("BioSourcEditForm");
4466
4467 if (bepp != NULL && bepp->lookupTaxonomy != NULL) {
4468 dlg->lookupTaxonomy = bepp->lookupTaxonomy;
4469 b = PushButton (p, "Look up Taxonomy", DoTaxLookup);
4470 SetObjectExtra (b, dlg, NULL);
4471 }
4472 else
4473 {
4474 b = NULL;
4475 }
4476
4477
4478 AlignObjects (ALIGN_CENTER, (HANDLE) dlg->foldertabs,
4479 (HANDLE) dlg->gbp,
4480 (HANDLE) b,
4481 NULL);
4482
4483 SendMessageToDialog (dlg->gbp, VIB_MSG_INIT);
4484 SendMessageToDialog (dlg->gbp, VIB_MSG_ENTER);
4485
4486 return (DialoG) p;
4487 }
4488
4489 static CharPtr biosourceFeatFormTabs [] = {
4490 "Organism", "Modifiers", "Miscellaneous", "Properties", "Location", NULL
4491 };
4492
BioSourceFeatFormMessage(ForM f,Int2 mssg)4493 static void BioSourceFeatFormMessage (ForM f, Int2 mssg)
4494
4495 {
4496 GenBioFormPtr gfp;
4497
4498 gfp = (GenBioFormPtr) GetObjectExtra (f);
4499 if (gfp != NULL) {
4500 switch (mssg) {
4501 case VIB_MSG_INIT :
4502 SendMessageToDialog (gfp->data, VIB_MSG_INIT);
4503 StdInitFeatFormProc (f);
4504 break;
4505 case VIB_MSG_IMPORT :
4506 ImportBioSourceForm (f, NULL);
4507 break;
4508 case VIB_MSG_EXPORT :
4509 ExportBioSourceForm (f, NULL);
4510 break;
4511 case VIB_MSG_CLOSE :
4512 Remove (f);
4513 break;
4514 case VIB_MSG_CUT :
4515 StdCutTextProc (NULL);
4516 break;
4517 case VIB_MSG_COPY :
4518 StdCopyTextProc (NULL);
4519 break;
4520 case VIB_MSG_PASTE :
4521 StdPasteTextProc (NULL);
4522 break;
4523 case VIB_MSG_DELETE :
4524 StdDeleteTextProc (NULL);
4525 break;
4526 default :
4527 if (gfp->appmessage != NULL) {
4528 gfp->appmessage (f, mssg);
4529 }
4530 break;
4531 }
4532 }
4533 }
4534
BioSourceFeatFormAcceptButtonProc(ButtoN b)4535 static void BioSourceFeatFormAcceptButtonProc (ButtoN b)
4536
4537 {
4538 if (OkayToAcceptBioSource (b)) {
4539 StdFeatFormAcceptButtonProc (b);
4540 }
4541 }
4542
CreateBioSourceFeatForm(Int2 left,Int2 top,Int2 width,Int2 height,CharPtr title,SeqFeatPtr sfp,SeqEntryPtr sep,FormActnFunc actproc,BioSourceEditProcsPtr bepp)4543 extern ForM CreateBioSourceFeatForm (Int2 left, Int2 top, Int2 width,
4544 Int2 height, CharPtr title, SeqFeatPtr sfp,
4545 SeqEntryPtr sep, FormActnFunc actproc,
4546 BioSourceEditProcsPtr bepp)
4547
4548 {
4549 ButtoN b;
4550 BioSourcePtr biop;
4551 GrouP c;
4552 GrouP g;
4553 GenBioFormPtr gfp;
4554 GrouP h;
4555 GrouP s;
4556 StdEditorProcsPtr sepp;
4557 WindoW w;
4558
4559 w = NULL;
4560 gfp = (GenBioFormPtr) MemNew (sizeof (GenBioForm));
4561 if (gfp != NULL) {
4562 w = FixedWindow (left, top, width, height, title, StdCloseWindowProc);
4563 SetObjectExtra (w, gfp, StdFeatFormCleanupProc);
4564 gfp->form = (ForM) w;
4565 gfp->actproc = actproc;
4566 gfp->toform = StdSeqFeatPtrToFeatFormProc;
4567 gfp->fromform = NULL;
4568 gfp->testform = NULL;
4569 gfp->formmessage = BioSourceFeatFormMessage;
4570 gfp->importform = ImportBioSourceForm;
4571 gfp->exportform = ExportBioSourceForm;
4572
4573 #ifndef WIN_MAC
4574 CreateStdEditorFormMenus (w);
4575 #endif
4576
4577 if (bepp == NULL) {
4578 bepp = (BioSourceEditProcsPtr) GetAppProperty ("BioSourcEditForm");
4579 }
4580 if (bepp != NULL) {
4581 gfp->lookupTaxonomy = bepp->lookupTaxonomy;
4582 }
4583 sepp = (StdEditorProcsPtr) GetAppProperty ("StdEditorForm");
4584 if (sepp != NULL) {
4585 gfp->activate = sepp->activateForm;
4586 gfp->appmessage = sepp->handleMessages;
4587 }
4588 SetActivate (w, BioSourceFormActivate);
4589
4590 g = HiddenGroup (w, -1, 0, NULL);
4591 SetGroupSpacing (g, 3, 10);
4592
4593 gfp->foldertabs = CreateFolderTabs (g, biosourceFeatFormTabs, ORGANISM_PAGE,
4594 0, 0, SYSTEM_FOLDER_TAB,
4595 ChangeBioSourcePage, (Pointer) gfp);
4596 gfp->currentPage = ORGANISM_PAGE;
4597
4598 h = HiddenGroup (g, 0, 0, NULL);
4599
4600 biop = NULL;
4601 if (sfp != NULL && sfp->data.choice == SEQFEAT_BIOSRC) {
4602 biop = sfp->data.value.ptrvalue;
4603 }
4604 gfp->data = CreateBioSourceDialog (h, NULL, gfp->pages, biop, gfp, TRUE);
4605
4606 s = HiddenGroup (h, -1, 0, NULL);
4607 CreateCommonFeatureGroup (s, (FeatureFormPtr) gfp, sfp, FALSE, TRUE);
4608 gfp->pages [COMMON_PAGE] = s;
4609 Hide (gfp->pages [COMMON_PAGE]);
4610
4611 s = HiddenGroup (h, -1, 0, NULL);
4612 gfp->location = CreateIntervalEditorDialogEx (s, NULL, 4, 2, sep, TRUE, TRUE,
4613 TRUE, TRUE, FALSE,
4614 (FeatureFormPtr) gfp,
4615 StdFeatIntEdPartialCallback);
4616 gfp->pages [LOCATION_PAGE] = s;
4617 Hide (gfp->pages [LOCATION_PAGE]);
4618
4619 AlignObjects (ALIGN_CENTER, (HANDLE) gfp->data,
4620 (HANDLE) gfp->pages [COMMON_PAGE],
4621 (HANDLE) gfp->pages [LOCATION_PAGE], NULL);
4622 AlignObjects (ALIGN_CENTER, (HANDLE) gfp->foldertabs, (HANDLE) h, NULL);
4623
4624 c = HiddenGroup (w, 2, 0, NULL);
4625 b = PushButton (c, "Accept", BioSourceFeatFormAcceptButtonProc);
4626 SetObjectExtra (b, gfp, NULL);
4627 PushButton (c, "Cancel", StdCancelButtonProc);
4628 AlignObjects (ALIGN_CENTER, (HANDLE) g, (HANDLE) c, NULL);
4629 RealizeWindow (w);
4630
4631 SendMessageToDialog (gfp->data, VIB_MSG_INIT);
4632 SendMessageToDialog (gfp->location, VIB_MSG_INIT);
4633 Show (gfp->pages [gfp->currentPage]);
4634 SendMessageToDialog (gfp->data, VIB_MSG_ENTER);
4635 Update ();
4636 }
4637 return (ForM) w;
4638 }
4639
BioSourceGenFunc(Pointer data)4640 extern Int2 LIBCALLBACK BioSourceGenFunc (Pointer data)
4641
4642 {
4643 GenBioFormPtr gfp;
4644 HelpMessageFunc helpfunc;
4645 Uint2 itemtype;
4646 OMProcControlPtr ompcp;
4647 OMUserDataPtr omudp;
4648 ObjMgrProcPtr proc;
4649 ValNodePtr sdp;
4650 SeqEntryPtr sep;
4651 SeqFeatPtr sfp;
4652 Uint2 subtype;
4653 WindoW w;
4654
4655 ompcp = (OMProcControlPtr) data;
4656 w = NULL;
4657 sdp = NULL;
4658 sfp = NULL;
4659 sep = NULL;
4660 itemtype = 0;
4661 subtype = 0;
4662 if (ompcp == NULL || ompcp->proc == NULL) return OM_MSG_RET_ERROR;
4663 proc = ompcp->proc;
4664 switch (ompcp->input_itemtype) {
4665 case OBJ_SEQFEAT :
4666 sfp = (SeqFeatPtr) ompcp->input_data;
4667 if (sfp != NULL && sfp->data.choice != SEQFEAT_BIOSRC) {
4668 return OM_MSG_RET_ERROR;
4669 }
4670 itemtype = OBJ_SEQFEAT;
4671 subtype = FEATDEF_BIOSRC;
4672 break;
4673 case OBJ_SEQDESC :
4674 sdp = (ValNodePtr) ompcp->input_data;
4675 if (sdp != NULL && sdp->choice != Seq_descr_source) {
4676 return OM_MSG_RET_ERROR;
4677 }
4678 itemtype = OBJ_SEQDESC;
4679 subtype = Seq_descr_source;
4680 break;
4681 case OBJ_BIOSEQ :
4682 break;
4683 case OBJ_BIOSEQSET :
4684 break;
4685 case 0 :
4686 break;
4687 default :
4688 return OM_MSG_RET_ERROR;
4689 }
4690 omudp = ItemAlreadyHasEditor (ompcp->input_entityID, ompcp->input_itemID,
4691 ompcp->input_itemtype, ompcp->proc->procid);
4692 if (omudp != NULL) {
4693 gfp = (GenBioFormPtr) omudp->userdata.ptrvalue;
4694 if (gfp != NULL) {
4695 Select (gfp->form);
4696 }
4697 return OM_MSG_RET_DONE;
4698 }
4699 sep = GetTopSeqEntryForEntityID (ompcp->input_entityID);
4700 if (sfp != NULL) {
4701 w = (WindoW) CreateBioSourceFeatForm (-50, -33, -10, -10,
4702 "Organism Information", sfp, sep,
4703 StdFeatFormActnProc, NULL);
4704 } else if (sdp != NULL) {
4705 w = (WindoW) CreateBioSourceDescForm (-50, -33, -10, -10,
4706 "Organism Information", sdp, sep,
4707 #if 0
4708 StdDescFormActnProc, NULL);
4709 #else
4710 StdDescFormActnProcNoFeatureChangeNoMolInfoChange, NULL);
4711 #endif
4712 } else {
4713 itemtype = proc->inputtype;
4714 subtype = proc->subinputtype;
4715 if (itemtype == OBJ_SEQFEAT && subtype == FEATDEF_BIOSRC) {
4716 w = (WindoW) CreateBioSourceFeatForm (-50, -33, -10, -10,
4717 "Organism Information", sfp, sep,
4718 StdFeatFormActnProc, NULL);
4719 } else if (itemtype == OBJ_SEQDESC && subtype == Seq_descr_source) {
4720 w = (WindoW) CreateBioSourceDescForm (-50, -33, -10, -10,
4721 "Organism Information", sdp, sep,
4722 StdDescFormActnProc, NULL);
4723 } else {
4724 return OM_MSG_RET_ERROR;
4725 }
4726 }
4727 gfp = (GenBioFormPtr) GetObjectExtra (w);
4728 if (gfp != NULL) {
4729 gfp->input_entityID = ompcp->input_entityID;
4730 gfp->input_itemID = ompcp->input_itemID;
4731 gfp->input_itemtype = ompcp->input_itemtype;
4732 gfp->this_itemtype = itemtype;
4733 gfp->this_subtype = subtype;
4734 gfp->procid = ompcp->proc->procid;
4735 gfp->proctype = ompcp->proc->proctype;
4736 gfp->userkey = OMGetNextUserKey ();
4737 omudp = ObjMgrAddUserData (ompcp->input_entityID, ompcp->proc->procid,
4738 OMPROC_EDIT, gfp->userkey);
4739 if (omudp != NULL) {
4740 omudp->userdata.ptrvalue = (Pointer) gfp;
4741 omudp->messagefunc = StdVibrantEditorMsgFunc;
4742 }
4743 SendMessageToForm (gfp->form, VIB_MSG_INIT);
4744 if (sdp != NULL) {
4745 PointerToDialog (gfp->data, (Pointer) sdp->data.ptrvalue);
4746 SetClosestParentIfDuplicating ((BaseFormPtr) gfp);
4747 } else if (sfp != NULL) {
4748 PointerToForm (gfp->form, (Pointer) sfp);
4749 SetClosestParentIfDuplicating ((BaseFormPtr) gfp);
4750 } else if (itemtype == OBJ_SEQFEAT) {
4751 SetNewFeatureDefaultInterval ((FeatureFormPtr) gfp);
4752 }
4753 }
4754 Show (w);
4755 Select (w);
4756 helpfunc = (HelpMessageFunc) GetAppProperty ("HelpMessageProc");
4757 if (helpfunc != NULL) {
4758 helpfunc ("Biological Source", NULL);
4759 }
4760 return OM_MSG_RET_DONE;
4761 }
4762
4763
ChooseNext(Nlm_QualNameAssocPtr PNTR choice_list,Int4 num_in_list)4764 static Int4 ChooseNext (Nlm_QualNameAssocPtr PNTR choice_list, Int4 num_in_list)
4765 {
4766 Int4 best_choice = -1, i;
4767
4768 for (i = 0; i < num_in_list; i++) {
4769 if (choice_list[i] == NULL || choice_list[i]->name == NULL) {
4770 /* do nothing */
4771 } else if (best_choice == -1) {
4772 /* no previous choice */
4773 best_choice = i;
4774 } else if (StringCmp (choice_list[i]->name, choice_list[best_choice]->name) <= 0) {
4775 best_choice = i;
4776 }
4777 }
4778 return best_choice;
4779 }
4780
GetModifiersEnum(Boolean get_subsource,Boolean get_orgmod,Boolean get_discouraged,Boolean get_discontinued)4781 extern EnumFieldAssocPtr GetModifiersEnum (Boolean get_subsource, Boolean get_orgmod, Boolean get_discouraged, Boolean get_discontinued)
4782 {
4783 Int4 best_choice, k;
4784 EnumFieldAssocPtr eap;
4785 CharPtr newname;
4786 Uint2 newval;
4787 Boolean inserted_note = FALSE;
4788 Int4 num_eap = 2; /* count terminators */
4789 Nlm_QualNameAssocPtr choice_list[6];
4790 Int4 num_choices = 0;
4791
4792
4793 /* initialize choice_list */
4794 for (k = 0; k < 6; k++) {
4795 choice_list[k] = NULL;
4796 }
4797
4798 /* need size of both because despite the fact that we need only one blank and one terminator, we are adding in two notes */
4799 if (get_orgmod) {
4800 for (k = 0; current_orgmod_subtype_alist[k].name != NULL; k++) {
4801 num_eap++;
4802 }
4803 choice_list[num_choices ++] = current_orgmod_subtype_alist + 1;
4804 }
4805 if (get_subsource) {
4806 for (k = 0; current_subsource_subtype_alist[k].name != NULL; k++) {
4807 num_eap++;
4808 }
4809 choice_list[num_choices ++] = current_subsource_subtype_alist + 1;
4810 }
4811
4812
4813 if (get_discouraged) {
4814 if (get_orgmod) {
4815 for (k = 0; discouraged_orgmod_subtype_alist[k].name != NULL; k++) {
4816 num_eap++;
4817 }
4818 choice_list[num_choices++] = discouraged_orgmod_subtype_alist;
4819 }
4820
4821 if (get_subsource) {
4822 for (k = 0; discouraged_subsource_subtype_alist[k].name != NULL; k++) {
4823 num_eap++;
4824 }
4825 choice_list[num_choices++] = discouraged_subsource_subtype_alist;
4826 }
4827 }
4828
4829 if (get_discontinued) {
4830 if (get_orgmod) {
4831 for (k = 0; discontinued_orgmod_subtype_alist[k].name != NULL; k++) {
4832 num_eap++;
4833 }
4834 choice_list[num_choices++] = discontinued_orgmod_subtype_alist;
4835 }
4836 if (get_subsource) {
4837 for (k = 0; discontinued_subsource_subtype_alist[k].name != NULL; k++) {
4838 num_eap++;
4839 }
4840 choice_list[num_choices++] = discontinued_subsource_subtype_alist;
4841 }
4842 }
4843
4844 eap = (EnumFieldAssocPtr) MemNew (sizeof (EnumFieldAssoc) * num_eap);
4845
4846 eap[0].name = " ";
4847 eap[0].value = 0;
4848 k = 1;
4849 while ((best_choice = ChooseNext(choice_list, num_choices)) != -1) {
4850 newname = choice_list[best_choice]->name;
4851 newval = choice_list[best_choice]->value;
4852 if (get_subsource && get_orgmod && (best_choice == 1 || best_choice == 3 || best_choice == 5)) {
4853 /* add 1000 to let calling function distinguish between subsource and orgmod */
4854 newval += 1000;
4855 }
4856 choice_list[best_choice]++;
4857 /* only add in notes if we are getting both subsource and orgmod */
4858 if (!inserted_note && get_subsource && get_orgmod && StringCmp (newname, "Note") > 0) {
4859 eap[k].name = "Note -- OrgMod";
4860 eap[k].value = ORGMOD_other;
4861 k++;
4862 eap[k].name = "Note -- SubSource";
4863 eap[k].value = SUBSRC_other + 1000;
4864 k++;
4865 inserted_note = TRUE;
4866 }
4867 eap[k].name = newname;
4868 eap[k].value = newval;
4869 k++;
4870 }
4871 eap[k].name = NULL;
4872 eap[k].value = 0;
4873 return eap;
4874 }
4875
GetSubSourceAndOrgModEnum(Boolean get_discouraged,Boolean get_discontinued)4876 extern EnumFieldAssocPtr GetSubSourceAndOrgModEnum (Boolean get_discouraged, Boolean get_discontinued)
4877 {
4878 return GetModifiersEnum (TRUE, TRUE, get_discouraged, get_discontinued);
4879 }
4880
4881
4882
4883