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