nexus_parser 1.1.4 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/LICENSE +25 -17
- data/{README.rdoc → README.md} +7 -5
- data/Rakefile +5 -21
- data/lib/{lexer.rb → nexus_parser/lexer.rb} +17 -17
- data/lib/{parser.rb → nexus_parser/parser.rb} +2 -2
- data/lib/{tokens.rb → nexus_parser/tokens.rb} +36 -36
- data/lib/nexus_parser/version.rb +5 -0
- data/lib/nexus_parser.rb +44 -39
- data/nexus_parser.gemspec +49 -50
- data/test/MX_test_03.nex +3 -3
- data/test/test_nexus_parser.rb +134 -138
- metadata +111 -63
- data/MIT-LICENSE +0 -20
- data/README +0 -13
- data/VERSION +0 -1
- data/init.rb +0 -1
data/test/test_nexus_parser.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'test/unit'
|
2
2
|
require 'rubygems'
|
3
|
-
require '
|
3
|
+
require 'byebug'
|
4
4
|
|
5
5
|
require File.expand_path(File.join(File.dirname(__FILE__), '../lib/nexus_parser'))
|
6
6
|
|
@@ -28,7 +28,6 @@ class Test_Regex < Test::Unit::TestCase
|
|
28
28
|
@regexp = Regexp.new(/\s*(Begin\s*taxa\s*;)\s*/i)
|
29
29
|
assert txt =~ @regexp
|
30
30
|
end
|
31
|
-
|
32
31
|
end
|
33
32
|
|
34
33
|
|
@@ -57,7 +56,6 @@ class Test_Lexer < Test::Unit::TestCase
|
|
57
56
|
assert lexer2.pop(NexusParser::Tokens::LParen)
|
58
57
|
assert lexer2.pop(NexusParser::Tokens::RParen)
|
59
58
|
|
60
|
-
|
61
59
|
lexer3 = NexusParser::Lexer.new("[ foo ] Begin Characters; BLORF end; [] () some crud here")
|
62
60
|
assert lexer3.pop(NexusParser::Tokens::LBracket)
|
63
61
|
assert id = lexer3.pop(NexusParser::Tokens::ID)
|
@@ -66,52 +64,52 @@ class Test_Lexer < Test::Unit::TestCase
|
|
66
64
|
assert lexer3.pop(NexusParser::Tokens::BeginBlk)
|
67
65
|
assert lexer3.pop(NexusParser::Tokens::ChrsBlk)
|
68
66
|
assert foo = lexer3.pop(NexusParser::Tokens::ID)
|
69
|
-
assert_equal("BLORF", foo.value)
|
67
|
+
assert_equal("BLORF", foo.value)
|
70
68
|
assert lexer3.pop(NexusParser::Tokens::BlkEnd)
|
71
69
|
|
72
70
|
lexer4 = NexusParser::Lexer.new("Begin Characters; 123123123 end; [] () some crud here")
|
73
71
|
assert lexer4.pop(NexusParser::Tokens::BeginBlk)
|
74
72
|
assert lexer4.pop(NexusParser::Tokens::ChrsBlk)
|
75
73
|
assert foo = lexer4.pop(NexusParser::Tokens::Number)
|
76
|
-
assert_equal(123123123, foo.value)
|
74
|
+
assert_equal(123123123, foo.value)
|
77
75
|
assert lexer4.pop(NexusParser::Tokens::BlkEnd)
|
78
76
|
|
79
77
|
lexer5 = NexusParser::Lexer.new("(0,1)")
|
80
78
|
assert lexer5.pop(NexusParser::Tokens::LParen)
|
81
79
|
assert foo = lexer5.pop(NexusParser::Tokens::Number)
|
82
|
-
assert_equal(0, foo.value)
|
80
|
+
assert_equal(0, foo.value)
|
83
81
|
assert lexer5.pop(NexusParser::Tokens::Comma)
|
84
82
|
assert foo = lexer5.pop(NexusParser::Tokens::Number)
|
85
|
-
assert_equal(1, foo.value)
|
83
|
+
assert_equal(1, foo.value)
|
86
84
|
assert lexer5.pop(NexusParser::Tokens::RParen)
|
87
85
|
|
88
86
|
lexer6 = NexusParser::Lexer.new(" 210(0,1)10A1\n")
|
89
87
|
assert foo = lexer6.pop(NexusParser::Tokens::RowVec)
|
90
|
-
assert_equal(["2","1","0",["0","1"],"1","0","A","1"], foo.value)
|
88
|
+
assert_equal(["2","1","0",["0","1"],"1","0","A","1"], foo.value)
|
91
89
|
|
92
90
|
lexer6a = NexusParser::Lexer.new(" 21a(0 1)0b{3 4 5}(0)(1 a)\n")
|
93
91
|
assert foo = lexer6a.pop(NexusParser::Tokens::RowVec)
|
94
|
-
assert_equal(["2", "1", "a", ["0", "1"], "0", "b", ["3", "4", "5"], "0", ["1", "a"]], foo.value)
|
95
|
-
|
92
|
+
assert_equal(["2", "1", "a", ["0", "1"], "0", "b", ["3", "4", "5"], "0", ["1", "a"]], foo.value)
|
93
|
+
|
96
94
|
lexer6b = NexusParser::Lexer.new(" 201{0 1}{0 1}0100)\x0A") # *nix line ending
|
97
95
|
assert foo = lexer6b.pop(NexusParser::Tokens::RowVec)
|
98
|
-
assert_equal(["2", "0", "1", ["0", "1"], ["0", "1"], "0", "1", "0", "0"], foo.value)
|
96
|
+
assert_equal(["2", "0", "1", ["0", "1"], ["0", "1"], "0", "1", "0", "0"], foo.value)
|
99
97
|
|
100
98
|
lexer6c = NexusParser::Lexer.new(" 201{0 1}{0 1}0100)\x0D\x0A") # * dos line ending
|
101
99
|
assert foo = lexer6c.pop(NexusParser::Tokens::RowVec)
|
102
|
-
assert_equal(["2", "0", "1", ["0", "1"], ["0", "1"], "0", "1", "0", "0"], foo.value)
|
100
|
+
assert_equal(["2", "0", "1", ["0", "1"], ["0", "1"], "0", "1", "0", "0"], foo.value)
|
103
101
|
|
104
102
|
|
105
103
|
lexer7 = NexusParser::Lexer.new("read nothing till Nexus, not that nexus 13243 Block [] ();, this one: #nexus FOO")
|
106
104
|
assert foo = lexer7.pop(NexusParser::Tokens::NexusStart)
|
107
|
-
assert_equal('#nexus', foo.value)
|
105
|
+
assert_equal('#nexus', foo.value)
|
108
106
|
|
109
107
|
|
110
108
|
## we strip comments before parsing now
|
111
109
|
# lexer8 = NexusParser::Lexer.new("[ foo ] Begin Characters; BLORF end; [] () some crud here")
|
112
110
|
# assert foo = lexer8.pop(NexusParser::Tokens::NexusComment)
|
113
111
|
# assert_equal "foo", foo.value
|
114
|
-
|
112
|
+
|
115
113
|
# assert lexer.pop(NexusParser::Tokens::Colon)
|
116
114
|
# assert num = lexer.pop(NexusParser::Tokens::Number)
|
117
115
|
# assert_equal(num.value, 0.0)
|
@@ -122,7 +120,7 @@ class Test_Lexer < Test::Unit::TestCase
|
|
122
120
|
def test_row_vec
|
123
121
|
lexer = NexusParser::Lexer.new("0?(0 1)10(A BD , C)1(0,1,2)1-\n")
|
124
122
|
assert foo = lexer.pop(NexusParser::Tokens::RowVec)
|
125
|
-
assert_equal(["0", "?", ["0", "1"], "1", "0", ["A", "BD", "C"], "1", ["0", "1", "2"], "1", "-"], foo.value)
|
123
|
+
assert_equal(["0", "?", ["0", "1"], "1", "0", ["A", "BD", "C"], "1", ["0", "1", "2"], "1", "-"], foo.value)
|
126
124
|
end
|
127
125
|
|
128
126
|
def test_punctuation
|
@@ -145,7 +143,7 @@ class Test_Lexer < Test::Unit::TestCase
|
|
145
143
|
def test_tax_labels
|
146
144
|
lexer = NexusParser::Lexer.new("Taxlabels 'foo' bar blorf \"stuff things\" stuff 'and foo';")
|
147
145
|
assert foo = lexer.pop(NexusParser::Tokens::Taxlabels)
|
148
|
-
assert_equal("Taxlabels ", foo.value)
|
146
|
+
assert_equal("Taxlabels ", foo.value)
|
149
147
|
end
|
150
148
|
|
151
149
|
def test_EndBlk
|
@@ -153,7 +151,7 @@ class Test_Lexer < Test::Unit::TestCase
|
|
153
151
|
assert foo = lexer.pop(NexusParser::Tokens::EndBlk)
|
154
152
|
lexer = NexusParser::Lexer.new("\n\nEnd;")
|
155
153
|
assert foo = lexer.pop(NexusParser::Tokens::EndBlk)
|
156
|
-
|
154
|
+
|
157
155
|
lexer = NexusParser::Lexer.new("123123 \n\nEnd;")
|
158
156
|
assert !lexer.peek(NexusParser::Tokens::EndBlk)
|
159
157
|
lexer = NexusParser::Lexer.new("this is not an \"end\"\n\nEnd;")
|
@@ -167,27 +165,27 @@ class Test_Lexer < Test::Unit::TestCase
|
|
167
165
|
end
|
168
166
|
|
169
167
|
def test_label
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
168
|
+
lexer = NexusParser::Lexer.new(' \'foo\' bar, blorf; "stuff things" stuff \'and foo\' 23434 ""asdf"" \'Foo_And_Stuff\' ')
|
169
|
+
assert foo = lexer.pop(NexusParser::Tokens::Label)
|
170
|
+
assert_equal "foo", foo.value
|
171
|
+
assert foo = lexer.pop(NexusParser::Tokens::Label)
|
172
|
+
assert_equal "bar", foo.value
|
173
|
+
assert lexer.pop(NexusParser::Tokens::Comma)
|
174
|
+
assert foo = lexer.pop(NexusParser::Tokens::Label)
|
175
|
+
assert_equal "blorf", foo.value
|
176
|
+
assert lexer.pop(NexusParser::Tokens::SemiColon)
|
177
|
+
assert foo = lexer.pop(NexusParser::Tokens::Label)
|
178
|
+
assert_equal "stuff things", foo.value
|
179
|
+
assert foo = lexer.pop(NexusParser::Tokens::Label)
|
180
|
+
assert_equal "stuff", foo.value
|
181
|
+
assert foo = lexer.pop(NexusParser::Tokens::Label)
|
182
|
+
assert_equal "and foo", foo.value
|
183
|
+
assert foo = lexer.pop(NexusParser::Tokens::Label)
|
184
|
+
assert_equal "23434", foo.value
|
185
|
+
assert foo = lexer.pop(NexusParser::Tokens::Label)
|
186
|
+
assert_equal '"asdf"', foo.value
|
187
|
+
assert foo = lexer.pop(NexusParser::Tokens::Label)
|
188
|
+
assert_equal 'Foo_And_Stuff', foo.value
|
191
189
|
end
|
192
190
|
|
193
191
|
def test_odd_labels
|
@@ -219,14 +217,14 @@ class Test_Lexer < Test::Unit::TestCase
|
|
219
217
|
|
220
218
|
|
221
219
|
def test_dimensions
|
222
|
-
input = " DIMENSIONS NCHAR= 10"
|
220
|
+
input = " DIMENSIONS NCHAR= 10"
|
223
221
|
lexer = NexusParser::Lexer.new(input)
|
224
222
|
assert foo = lexer.pop(NexusParser::Tokens::Dimensions)
|
225
223
|
assert_equal "DIMENSIONS", foo.value
|
226
224
|
end
|
227
225
|
|
228
226
|
def test_format
|
229
|
-
input = " format NCHAR= 10"
|
227
|
+
input = " format NCHAR= 10"
|
230
228
|
lexer = NexusParser::Lexer.new(input)
|
231
229
|
assert foo = lexer.pop(NexusParser::Tokens::Format)
|
232
230
|
assert_equal "format", foo.value
|
@@ -234,7 +232,7 @@ class Test_Lexer < Test::Unit::TestCase
|
|
234
232
|
|
235
233
|
def test_odd_value_pair
|
236
234
|
lexer = NexusParser::Lexer.new(" TEXT CHARACTER = 3 TEXT = A62.003;
|
237
|
-
|
235
|
+
|
238
236
|
TEXT CHARACTER = 4 TEXT = A62.004; \n end; ")
|
239
237
|
assert foo = lexer.pop(NexusParser::Tokens::Label)
|
240
238
|
assert foo = lexer.pop(NexusParser::Tokens::ValuePair)
|
@@ -299,38 +297,38 @@ class Test_Lexer < Test::Unit::TestCase
|
|
299
297
|
assert foo = lexer6.pop(NexusParser::Tokens::ValuePair)
|
300
298
|
smorf = {:missing => '-'}
|
301
299
|
assert_equal smorf, foo.value
|
302
|
-
|
300
|
+
|
303
301
|
lexer6a = NexusParser::Lexer.new("ntaxa=1;\n")
|
304
302
|
assert foo = lexer6a.pop(NexusParser::Tokens::ValuePair)
|
305
303
|
smorf = {:ntaxa => '1'}
|
306
|
-
assert_equal smorf, foo.value
|
304
|
+
assert_equal smorf, foo.value
|
307
305
|
|
308
306
|
lexer7 = NexusParser::Lexer.new("ntaxa =1;\n")
|
309
307
|
assert foo = lexer7.pop(NexusParser::Tokens::ValuePair)
|
310
308
|
smorf = {:ntaxa => '1'}
|
311
|
-
assert_equal smorf, foo.value
|
312
|
-
|
309
|
+
assert_equal smorf, foo.value
|
310
|
+
|
313
311
|
lexer8 = NexusParser::Lexer.new(" ntaxa = 1 ;\n")
|
314
312
|
assert foo = lexer8.pop(NexusParser::Tokens::ValuePair)
|
315
313
|
smorf = {:ntaxa => '1'}
|
316
|
-
assert_equal smorf, foo.value
|
314
|
+
assert_equal smorf, foo.value
|
317
315
|
|
318
316
|
lexer9 = NexusParser::Lexer.new(" TF = (CM 'This is an annotation that haa a hard return in it^n^n^n^nSo there!') ")
|
319
317
|
assert foo = lexer9.pop(NexusParser::Tokens::ValuePair)
|
320
318
|
smorf = {:tf => "(CM 'This is an annotation that haa a hard return in it^n^n^n^nSo there!')" }
|
321
|
-
assert_equal smorf, foo.value
|
322
|
-
|
319
|
+
assert_equal smorf, foo.value
|
320
|
+
|
323
321
|
lexer10 = NexusParser::Lexer.new(" TF = (CM 'This is an value pair that has (parens) within the value, twice! ()') ; some stuff left here ")
|
324
322
|
assert foo = lexer10.pop(NexusParser::Tokens::ValuePair)
|
325
323
|
smorf = {:tf => "(CM 'This is an value pair that has (parens) within the value, twice! ()')" }
|
326
|
-
assert_equal smorf, foo.value
|
327
|
-
|
324
|
+
assert_equal smorf, foo.value
|
325
|
+
|
328
326
|
lexer11 = NexusParser::Lexer.new("CHARACTER = 1 TEXT = A62.001;")
|
329
327
|
assert_equal true, !lexer11.peek(NexusParser::Tokens::SemiColon)
|
330
328
|
assert_equal true, lexer11.peek(NexusParser::Tokens::ValuePair)
|
331
329
|
assert foo = lexer11.pop(NexusParser::Tokens::ValuePair)
|
332
330
|
smorf = {:character => "1" }
|
333
|
-
assert_equal smorf, foo.value
|
331
|
+
assert_equal smorf, foo.value
|
334
332
|
assert foo = lexer11.pop(NexusParser::Tokens::ValuePair)
|
335
333
|
end
|
336
334
|
|
@@ -342,7 +340,7 @@ class Test_Lexer < Test::Unit::TestCase
|
|
342
340
|
end
|
343
341
|
|
344
342
|
def test_TreesBlk
|
345
|
-
|
343
|
+
lexer = NexusParser::Lexer.new("BEGIN TREES;
|
346
344
|
Title Imported_trees;
|
347
345
|
LINK Taxa = 'Scharff&Coddington_1997_Araneidae';
|
348
346
|
TRANSLATE
|
@@ -376,7 +374,7 @@ class Test_Lexer < Test::Unit::TestCase
|
|
376
374
|
|
377
375
|
|
378
376
|
END;")
|
379
|
-
|
377
|
+
|
380
378
|
assert lexer.pop(NexusParser::Tokens::BeginBlk)
|
381
379
|
assert foo = lexer.pop(NexusParser::Tokens::TreesBlk)
|
382
380
|
assert_equal 'TREES', foo.value.slice(0,5)
|
@@ -387,39 +385,39 @@ class Test_Lexer < Test::Unit::TestCase
|
|
387
385
|
end
|
388
386
|
|
389
387
|
def test_NotesBlk
|
390
|
-
input = "BEGIN NOTES ;"
|
388
|
+
input = "BEGIN NOTES ;"
|
391
389
|
lexer = NexusParser::Lexer.new(input)
|
392
390
|
assert lexer.pop(NexusParser::Tokens::BeginBlk)
|
393
391
|
assert foo = lexer.pop(NexusParser::Tokens::NotesBlk)
|
394
392
|
assert "NOTES", foo.value
|
395
393
|
end
|
396
394
|
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
395
|
+
def test_LabelsBlk
|
396
|
+
lexer = NexusParser::Lexer.new("
|
397
|
+
LABELS;
|
398
|
+
CHARGROUPLABEL MM_Genitalia COLOR = (RGB 1.0 0.4 0.4) ;
|
399
|
+
CHARGROUPLABEL Somatic COLOR = (RGB 0.6 1.0 0.33333333) ;
|
400
|
+
CHARGROUPLABEL Spinnerets COLOR = (RGB 0.46666667 0.57254902 1.0) ;
|
401
|
+
CHARGROUPLABEL Behavior COLOR = (RGB 1.0 0.46666667 1.0) ;
|
404
402
|
|
405
403
|
|
406
|
-
|
404
|
+
END;
|
405
|
+
|
406
|
+
BEGIN some other block;")
|
407
407
|
|
408
|
-
BEGIN some other block;")
|
409
|
-
|
410
408
|
assert foo = lexer.pop(NexusParser::Tokens::LabelsBlk)
|
411
409
|
assert_equal 'LABELS', foo.value.slice(0,6)
|
412
410
|
assert_equal 'END;', foo.value.slice(-4,4)
|
413
411
|
end
|
414
412
|
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
413
|
+
def test_SetsBlk
|
414
|
+
lexer = NexusParser::Lexer.new("
|
415
|
+
SETS;
|
416
|
+
CHARPARTITION * UNTITLED = Somatic : 1 - 2 4, MM_Genitalia : 5 - 8 10;
|
417
|
+
|
418
|
+
END;
|
419
|
+
BEGIN some other block;")
|
419
420
|
|
420
|
-
END;
|
421
|
-
BEGIN some other block;")
|
422
|
-
|
423
421
|
assert foo = lexer.pop(NexusParser::Tokens::SetsBlk)
|
424
422
|
assert_equal 'SETS', foo.value.slice(0,4)
|
425
423
|
assert_equal 'END;', foo.value.slice(-4,4)
|
@@ -441,17 +439,17 @@ class Test_Parser < Test::Unit::TestCase
|
|
441
439
|
def teardown
|
442
440
|
@nf = nil
|
443
441
|
end
|
444
|
-
|
442
|
+
|
445
443
|
def test_that_file_might_be_nexus
|
446
444
|
begin
|
447
445
|
assert !parse_nexus_file("#Nexblux Begin Natrix end;")
|
448
|
-
rescue NexusParser::ParseError
|
446
|
+
rescue NexusParser::ParseError
|
449
447
|
assert true
|
450
448
|
end
|
451
449
|
end
|
452
450
|
|
453
451
|
def test_parse_initializes
|
454
|
-
|
452
|
+
parse_nexus_file(@nf)
|
455
453
|
end
|
456
454
|
|
457
455
|
def test_parse_file
|
@@ -460,7 +458,7 @@ class Test_Parser < Test::Unit::TestCase
|
|
460
458
|
|
461
459
|
assert_equal 10, foo.taxa.size
|
462
460
|
assert_equal 10, foo.characters.size
|
463
|
-
assert_equal 10, foo.codings.size
|
461
|
+
assert_equal 10, foo.codings.size
|
464
462
|
assert_equal 1, foo.taxa[1].notes.size # asserts that notes are parsing
|
465
463
|
assert_equal "norm", foo.characters[0].states["0"].name
|
466
464
|
assert_equal "modified", foo.characters[0].states["1"].name
|
@@ -471,11 +469,11 @@ class Test_Parser < Test::Unit::TestCase
|
|
471
469
|
|
472
470
|
def test_taxa_block
|
473
471
|
# we've popped off the header already
|
474
|
-
input =
|
472
|
+
input =
|
475
473
|
"TITLE 'Scharff&Coddington_1997_Araneidae';
|
476
474
|
DIMENSIONS NTAX=10;
|
477
475
|
TAXLABELS
|
478
|
-
Dictyna Uloborus Deinopis Nephila&Herennia 'Nephilengys_cruentata' Meta Leucauge_venusta Pachygnatha 'Theridiosoma_01' Tetragnatha
|
476
|
+
Dictyna Uloborus Deinopis Nephila&Herennia 'Nephilengys_cruentata' Meta Leucauge_venusta Pachygnatha 'Theridiosoma_01' Tetragnatha
|
479
477
|
;
|
480
478
|
IDS JC1191fcddc2b128 JC1191fcddc2b129 JC1191fcddc2b130 JC1191fcddc2b131 JC1191fcddc2b132 JC1191fcddc2b133 JC1191fcddc2b134 JC1191fcddc2b135 JC1191fcddc2b137 JC1191fcddc2b136 ;
|
481
479
|
BLOCKID JC1191fcddc0c4;
|
@@ -484,7 +482,7 @@ class Test_Parser < Test::Unit::TestCase
|
|
484
482
|
builder = NexusParser::Builder.new
|
485
483
|
lexer = NexusParser::Lexer.new(input)
|
486
484
|
NexusParser::Parser.new(lexer,builder).parse_taxa_blk
|
487
|
-
foo = builder.nexus_file
|
485
|
+
foo = builder.nexus_file
|
488
486
|
|
489
487
|
assert_equal 10, foo.taxa.size
|
490
488
|
assert_equal "Dictyna", foo.taxa[0].name
|
@@ -495,18 +493,18 @@ class Test_Parser < Test::Unit::TestCase
|
|
495
493
|
|
496
494
|
def test_taxa_block_without_IDS
|
497
495
|
# we've popped off the header already
|
498
|
-
input =
|
496
|
+
input =
|
499
497
|
"TITLE 'Scharff&Coddington_1997_Araneidae';
|
500
498
|
DIMENSIONS NTAX=10;
|
501
499
|
TAXLABELS
|
502
|
-
Dictyna Uloborus Deinopis Nephila&Herennia 'Nephilengys_cruentata' Meta Leucauge_venusta Pachygnatha 'Theridiosoma_01' Tetragnatha
|
500
|
+
Dictyna Uloborus Deinopis Nephila&Herennia 'Nephilengys_cruentata' Meta Leucauge_venusta Pachygnatha 'Theridiosoma_01' Tetragnatha
|
503
501
|
;
|
504
502
|
END;"
|
505
503
|
|
506
504
|
builder = NexusParser::Builder.new
|
507
505
|
lexer = NexusParser::Lexer.new(input)
|
508
506
|
NexusParser::Parser.new(lexer,builder).parse_taxa_blk
|
509
|
-
foo = builder.nexus_file
|
507
|
+
foo = builder.nexus_file
|
510
508
|
|
511
509
|
assert_equal 10, foo.taxa.size
|
512
510
|
assert_equal "Dictyna", foo.taxa[0].name
|
@@ -522,8 +520,8 @@ class Test_Parser < Test::Unit::TestCase
|
|
522
520
|
TITLE 'Scharff&Coddington_1997_Araneidae';
|
523
521
|
DIMENSIONS NCHAR=10;
|
524
522
|
FORMAT DATATYPE = STANDARD GAP = - MISSING = ? SYMBOLS = \" 0 1 2 3 4 5 6 7 8 9 A\";
|
525
|
-
CHARSTATELABELS
|
526
|
-
1 Tibia_II / norm modified, 2 TII_macrosetae / '= TI' stronger, 3 Femoral_tuber / abs pres 'm-setae', 5 Cymbium / dorsal mesal lateral, 6 Paracymbium / abs pres, 7 Globular_tegulum / abs pres, 8 / entire w_lobe, 9 Conductor_wraps_embolus, 10 Median_apophysis / pres abs;
|
523
|
+
CHARSTATELABELS
|
524
|
+
1 Tibia_II / norm modified, 2 TII_macrosetae / '= TI' stronger, 3 Femoral_tuber / abs pres 'm-setae', 5 Cymbium / dorsal mesal lateral, 6 Paracymbium / abs pres, 7 Globular_tegulum / abs pres, 8 / entire w_lobe, 9 Conductor_wraps_embolus, 10 Median_apophysis / pres abs;
|
527
525
|
MATRIX
|
528
526
|
Dictyna 0?00201001
|
529
527
|
Uloborus 0?11000000
|
@@ -552,10 +550,10 @@ class Test_Parser < Test::Unit::TestCase
|
|
552
550
|
(0..9).each{|i| builder.stub_taxon}
|
553
551
|
|
554
552
|
NexusParser::Parser.new(@lexer,builder).parse_characters_blk
|
555
|
-
foo = builder.nexus_file
|
556
|
-
|
553
|
+
foo = builder.nexus_file
|
554
|
+
|
557
555
|
assert_equal 10, foo.characters.size
|
558
|
-
assert_equal "Tibia_II", foo.characters[0].name
|
556
|
+
assert_equal "Tibia_II", foo.characters[0].name
|
559
557
|
assert_equal "TII_macrosetae", foo.characters[1].name
|
560
558
|
|
561
559
|
assert_equal "norm", foo.characters[0].states["0"].name
|
@@ -573,11 +571,11 @@ class Test_Parser < Test::Unit::TestCase
|
|
573
571
|
end
|
574
572
|
|
575
573
|
def test_characters_block_without_IDs_or_title
|
576
|
-
|
574
|
+
input= "
|
577
575
|
DIMENSIONS NCHAR=10;
|
578
576
|
FORMAT DATATYPE = STANDARD GAP = - MISSING = ? SYMBOLS = \" 0 1 2 3 4 5 6 7 8 9 A\";
|
579
|
-
CHARSTATELABELS
|
580
|
-
1 Tibia_II / norm modified, 2 TII_macrosetae / '= TI' stronger, 3 Femoral_tuber / abs pres 'm-setae', 5 Cymbium / dorsal mesal lateral, 6 Paracymbium / abs pres, 7 Globular_tegulum / abs pres, 8 / entire w_lobe, 9 Conductor_wraps_embolus, 10 Median_apophysis / pres abs;
|
577
|
+
CHARSTATELABELS
|
578
|
+
1 Tibia_II / norm modified, 2 TII_macrosetae / '= TI' stronger, 3 Femoral_tuber / abs pres 'm-setae', 5 Cymbium / dorsal mesal lateral, 6 Paracymbium / abs pres, 7 Globular_tegulum / abs pres, 8 / entire w_lobe, 9 Conductor_wraps_embolus, 10 Median_apophysis / pres abs;
|
581
579
|
MATRIX
|
582
580
|
Dictyna 0?00201001
|
583
581
|
Uloborus 0?11000000
|
@@ -603,10 +601,10 @@ class Test_Parser < Test::Unit::TestCase
|
|
603
601
|
(0..9).each{|i| builder.stub_taxon}
|
604
602
|
|
605
603
|
NexusParser::Parser.new(@lexer,builder).parse_characters_blk
|
606
|
-
foo = builder.nexus_file
|
607
|
-
|
604
|
+
foo = builder.nexus_file
|
605
|
+
|
608
606
|
assert_equal 10, foo.characters.size
|
609
|
-
assert_equal "Tibia_II", foo.characters[0].name
|
607
|
+
assert_equal "Tibia_II", foo.characters[0].name
|
610
608
|
assert_equal "TII_macrosetae", foo.characters[1].name
|
611
609
|
assert_equal "norm", foo.characters[0].states["0"].name
|
612
610
|
assert_equal "modified", foo.characters[0].states["1"].name
|
@@ -618,21 +616,21 @@ class Test_Parser < Test::Unit::TestCase
|
|
618
616
|
|
619
617
|
def test_characters_block_from_file
|
620
618
|
foo = parse_nexus_file(@nf)
|
621
|
-
|
619
|
+
assert_equal 10, foo.characters.size
|
622
620
|
end
|
623
621
|
|
624
622
|
def test_codings
|
625
623
|
foo = parse_nexus_file(@nf)
|
626
|
-
|
624
|
+
assert_equal 100, foo.codings.flatten.size # two multistates count in single cells
|
627
625
|
end
|
628
626
|
|
629
627
|
def test_parse_dimensions
|
630
|
-
input= " DIMENSIONS NCHAR=10 ntaxa =10 nfoo='999' nbar = \" a b c \" blorf=2; "
|
628
|
+
input= " DIMENSIONS NCHAR=10 ntaxa =10 nfoo='999' nbar = \" a b c \" blorf=2; "
|
631
629
|
builder = NexusParser::Builder.new
|
632
630
|
lexer = NexusParser::Lexer.new(input)
|
633
631
|
|
634
632
|
NexusParser::Parser.new(lexer,builder).parse_dimensions
|
635
|
-
foo = builder.nexus_file
|
633
|
+
foo = builder.nexus_file
|
636
634
|
|
637
635
|
assert_equal "10", foo.vars[:nchar]
|
638
636
|
assert_equal "10", foo.vars[:ntaxa]
|
@@ -648,7 +646,7 @@ class Test_Parser < Test::Unit::TestCase
|
|
648
646
|
lexer = NexusParser::Lexer.new(input)
|
649
647
|
|
650
648
|
NexusParser::Parser.new(lexer,builder).parse_format
|
651
|
-
foo = builder.nexus_file
|
649
|
+
foo = builder.nexus_file
|
652
650
|
|
653
651
|
assert_equal "STANDARD", foo.vars[:datatype]
|
654
652
|
assert_equal "-", foo.vars[:gap]
|
@@ -662,15 +660,15 @@ class Test_Parser < Test::Unit::TestCase
|
|
662
660
|
1 Tibia_II / norm modified, 2 TII_macrosetae / '= TI' stronger, 3 Femoral_tuber / abs pres 'm-setae', 5 Cymbium / dorsal mesal lateral, 6 Paracymbium / abs pres, 7 Globular_tegulum / abs pres, 8 / entire w_lobe, 9 Conductor_wraps_embolus, 10 Median_apophysis / pres abs ;
|
663
661
|
MATRIX
|
664
662
|
fooo 01 more stuff here that should not be hit"
|
665
|
-
|
663
|
+
|
666
664
|
builder = NexusParser::Builder.new
|
667
665
|
lexer = NexusParser::Lexer.new(input)
|
668
|
-
|
666
|
+
|
669
667
|
(0..9).each{builder.stub_chr()}
|
670
|
-
|
668
|
+
|
671
669
|
NexusParser::Parser.new(lexer,builder).parse_chr_state_labels
|
672
670
|
|
673
|
-
foo = builder.nexus_file
|
671
|
+
foo = builder.nexus_file
|
674
672
|
assert_equal 10, foo.characters.size
|
675
673
|
assert_equal "Tibia_II", foo.characters[0].name
|
676
674
|
assert_equal "norm", foo.characters[0].states["0"].name
|
@@ -692,7 +690,7 @@ class Test_Parser < Test::Unit::TestCase
|
|
692
690
|
assert_equal "dorsal", foo.characters[4].states["0"].name
|
693
691
|
assert_equal "mesal", foo.characters[4].states["1"].name
|
694
692
|
assert_equal "lateral", foo.characters[4].states["2"].name
|
695
|
-
|
693
|
+
|
696
694
|
assert_equal "Paracymbium", foo.characters[5].name
|
697
695
|
assert_equal "abs", foo.characters[5].states["0"].name
|
698
696
|
assert_equal "pres", foo.characters[5].states["1"].name
|
@@ -717,15 +715,15 @@ class Test_Parser < Test::Unit::TestCase
|
|
717
715
|
29 'Metatarsal trichobothria (CodAra.29)' / 37623 '>2', 30 'Spinneret cuticle (CodAra.30)' / annulate ridged squamate;
|
718
716
|
Matrix
|
719
717
|
fooo 01 more stuff here that should not be hit"
|
720
|
-
|
718
|
+
|
721
719
|
builder = NexusParser::Builder.new
|
722
720
|
lexer = NexusParser::Lexer.new(input)
|
723
721
|
|
724
|
-
|
725
|
-
|
722
|
+
(0..29).each{builder.stub_chr()}
|
723
|
+
|
726
724
|
NexusParser::Parser.new(lexer,builder).parse_chr_state_labels
|
727
725
|
|
728
|
-
foo = builder.nexus_file
|
726
|
+
foo = builder.nexus_file
|
729
727
|
|
730
728
|
assert_equal "Metatarsal trichobothria (CodAra.29)", foo.characters[28].name
|
731
729
|
assert_equal "37623", foo.characters[28].states["0"].name
|
@@ -739,19 +737,19 @@ class Test_Parser < Test::Unit::TestCase
|
|
739
737
|
end
|
740
738
|
|
741
739
|
def DONT_test_parse_really_long_string_of_chr_state_labels
|
742
|
-
input =" CHARSTATELABELS
|
743
|
-
1 Epigynal_ventral_margin / 'entire (Fig. 15G)' 'with scape (Fig. 27D)', 2 Epigynal_external_structure / openings_on_a_broad_depression 'copulatory openings on plate, flush with abdomen, sometimes slit like', 3 Epigynal_depression / 'round or square, at most slightly wider than high ' 'elongate, at least twice as wide as high ', 4 Epigynal_plate_surface / 'smooth (Fig. 12E)' 'ridged (Fig. 21G)', 5 epignynal_septum / absent_ present_, 6 Copulatory_bursa_anterior_margin / 'entire, broadly transverse (Fig. 19B)' 'medially acute (Figs. 22G, 40B)', 7 'Copulatory duct: spermathecal junction' / posterior lateral_or_anterior, 8 Copulatory_duct_loops_relative_to_spermathecae / apart 'encircling (Fig. 93J)', 9 Copulatory_duct_terminal_sclerotization / as_rest_of_duct_ 'distinctly sclerotized, clearly more than rest of duct ', 10 Hard_sclerotized_CD_region / mostly_or_entirely_ectal_to_the_ectal_rim_of_the_spermathecae 'caudal to the spermathecae, mesal to ectal margin of spermathecae', 11 Male_palpal_tibial_rim / uniform_or_only_slightly_asymmetric 'strongly and asymmetrically protruding, scoop-shaped (Fig 36D)', 12 Male_palpal_tibia_prolateral_trichobothria / one none, 13 Cymbial_ridge_ectal_setae / unmodified 'strongly curved towards the palpal bulb (Kochiura, Figs. 51B-C, 52C)', 14 Cymbial_distal_promargin / entire 'with an apophysis (Argyrodes, Figs.) ', 15 Cymbial_mesal_margin / entire 'incised (Anelosimus, Figs. 17D, 20A) ' deeply_notched, 16 Cymbial_tip_sclerotization / like_rest_of_cymbium 'lightly sclerotized, appears white', 17 Cymbial_tip_setae / like_other_setae 'thick and strongly curved (Kochiura, Figs. 51B, 52C)', 18 Cymbial_sheath / absent present, 19 Lock_placement / 'distal (Figs. 67B, 92F-G, I, M)' 'central (Fig. 92H)', 20 Lock_mechanism / 'hook (Figs 31F, 60D, 91A, 92D-E, J-L)' 'hood (Figs 18A, 75B, 92F-I, M)' 'Theridula (Fig 81D)', 21 Cymbial_hook_orientation / 'facing downwards (Figs. 91A, 92D-E, J-K)' 'facing upwards (Fig. 60C-D, 92L)', 22 Cymbial_hook_location / 'inside cymbium (Fig. 92D-E, J-K)' 'ectal cymbial margin (Figs. 67B, 92L).', 23 Cymbial_hook_distal_portion / 'blunt (Figs. 31F, 92D-E)' 'tapering to a narrow tongue (Figs. 66B, 67D, 92L)', 24 Cymbial_hood_size / 'narrow (Fig. 92F-H)' 'broad (Fig. 92I)' 'Spintharus (Fig. 92M)', 25 Cymbial_hood_region / 'translucent, hood visible through cymbium (Anelosimus, Figs. 90A, 91C)' 'opaque, hood not visible', 26 Alveolus_shape / 'circular or oval (Fig. 92A-H)' 'with a mesal extension (Fig. 92A)', 27 Tegulum_ectal_margin / entire 'protruded (Fig. 20D)', 28 Tegular_groove / absent 'present (Fig. 28B)', 29 SDT_SB_I / separate touching, 30 'SDT post-SB II turn' / gradual '90 degrees (Anelosimus, Fig. 93B)', 31 SDT_SB_I_&_II_reservoir_segment_alignment / divergent parallel, 32 SDT_SB_I_&_II_orientation / in_plane_of_first_loop_from_fundus 'out of plane of first loop, against tegular wall', 33 SDT_RSB_I_&_II / absent present, 34 SDT_SB_III / absent present, 35 SDT_SB_IV / absent 'present (Fig. 93E)', 36 Conductor_shape / 'simple, round or oval, short' 'fan shaped, narrow base and broad tip (Selkirkiella, Kochiura)' Enoplognatha Argyrodes Achaearanea Theridion '''rupununi''' '''tanzania''' '''cup-shaped''', 37 Conductor / 'with a groove for embolus (Figs. 10A, 28D, 69B)' 'entire (Figs. 13D, 17F, 52C-D)', 38 Conductor_surface / 'smooth (Figs. 75B, 77B-C)' ' heavily ridged (Figs. 10B-C, 44D. 67C, 69D)', 39 Conductor_tip_sclerotization / like_base more_than_base, 40 Subconductor / absent present, 41 Subconductor_pit_upper_wall / 'entire, or slightly protruding' forms_a_regular_oval_lip, 42 Subconductor_at_C_base / narrows_abruptly_before_C_base narrows_gradually_along_its_entire_length broad_at_base, 43 'Embolus tail-SC relation' / 'hooked in, or oriented towards SC' surpasses_SC behind_E_base, 44 Tegulum_ectally_ / occupying_less_than_half_of_the_cymbial_cavity_ occupying_more_than_half_of_the_cymbial_cavity, 45 MA_and_sperm_duct / sperm_duct_loop_not_inside_MA 'sperm duct loop inside MA (Figs. 90F, 91B)', 46 'MA-tegular membrane connection' / broad narrow, 47 MA_form / unbranched 'two nearly equally sized branches (Fig. 22A-B) ', 48 MA_distal_tip / entire hooded, 49 MA_hood_form / 'narrow, pit-like (Figs. 31F, 34D)' 'scoop-shaped (Figs. 60D, 66B, 67D)', 50 TTA_form / entire 'grooved (Fig. 44C)', 51 TTA / bulky 'prong shaped (vittatus group)', 52 TTA_distal_tip / entire_or_gently_curved Argyrodes 'hooked (branched)', 53 TTA_hook_distal_branch / barely_exceeding_lower_branch_ 'extending beyond lower branch (jucundus group) ', 54 TTA_hook_distal_branch / thick_ 'thin, finger like (domingo, dubiosus)', 55 TTA_hook_proximal_branch / 'blunt, broad' 'flattened, bladelike' 'cylindrical, elongated', 56 TTA_surface_subterminally / smooth ridged, 57 TTA_tip_surface / smooth 'ridged (Figs. 7A-B, 17F, 31D, 34D, 54A, 56B, 86A)', 58 Embolus_and_TTA / loosely_associated_to_or_resting_in_TTA_shallow_groove 'parts of E entirely enclosed in TTA (Figs. 37A-B, 44C, 89C)', 59 Embolus_tip_surface / smooth denticulate, 60 Embolus_spiral_curviture / gentle whip_like corkscrew, 61 Embolus_tip / entire bifid, 62 Embolus_origin / retroventral_on_tegulum 'retrolateral (ectal), partially or completely hidden by cymbium (Figs 44C, 60A-C, 67B)', 63 Embolus_ridges / absent present, 64 Embolus_shape / short_to_moderately_elongate 'extremely long, >2 spirals (Figs. 54D, 73A-E)', 65 Embolus_spiral_width / 'thin, much of E spiral subequal to E tip ' 'thick, entire E spiral much broader than tip ', 66 Embolus_distal_rim / 'entire (normal)' deeply_grooved, 67 Embolic_terminus / abrupt 'with a distal apophysis (EA, Fig. 34E) ', 68 Embolus_tail / 'entire, smooth' 'distinct, lobed', 69 'Embolus-dh connection grooves' / absent present, 70 'Embolus-dh grooves' / 'deep, extend into the E base more than twice longer than the distance between them' 'short, extend into the E base about as long, or slightly longer than the distance between them', 71 E_spiral_distally / 'relatively thin or filiform, cylindrical' 'thick, not cylindrical' 'rupununi/lorenzo like', 72 Embolus_spiral / entire 'biparted (Eb)' pars_pendula, 73 Eb_orientation / towards_embolus_tip towards_tibia, 74 Embolic_division_b / separates_early_from_E E_and_Eb_tightly_associated_the_entire_spiral, 75 Embolic_division_b / broad 'narrow, relative to Eb spiral, snout-like', 76 'Eb distal portion, ectal marginl' / 'level, not raised ' with_a_distinct_ridge_, 77 Eb_form / flat 'globose, inflated', 78 Eb_form / 'distinct, clearly separate apophysis' 'short, confined to first section of spiral, barely separate', 79 Eb_tip_and_E_tip_association / separate Eb_and_E_tips_juxtaposed 'E tip rests on Eb ''cup''', 80 Eb_snout / 'short, snug with E spiral ' 'long, separate from E spiral ', 81 Distal_portion_of_Eb / entire with_a_cup_shaped_apophysis with_a_raised_ridge, 82 E_tail / lobe_not_reaching_ectal_margin_of_Eb_ lobe_touching_ectal_margin_of_Eb_, 83 Extra_tegular_sclerite / absent_ present_, 84 'Median eyes (male)' / flush_with_carapace 'on tubercle (Argyrodes)', 85 'AME size (male)' / subequal_or_slightly_larger_than_ALE clearly_smaller_than_ALE, 86 Cheliceral_posterior_margin / toothed smooth, 87 Cheliceral_posterior_tooth_number / three_or_more two one, 88 Cheliceral_furrow / smooth denticulate, 89 Carapace_hairiness / 'sparsely or patchily hirsute (Fig. 48D)' 'uniformly hirsute (Fig. 71D)', 90 Carapace_pars_stridens / irregular regular_parallel_ridges, 91 Interocular_area / more_or_less_flush_with_clypeus projecting_beyond_clypeus, 92 Clypeus / concave_or_flat with_a_prominent_projection, 93 'ocular and clypeal region setae distribution (male)' / sparse 'in a dense field, or fields', 94 'Labium-sternum connection' / 'visible seam (Fig. 27C)' fused, 95 Sternocoxal_tubercles / present absent, 96 Pedicel_location / 'anterior (Fig. 94A-D)' 'medial (Fig. 94J-K)', 97 Abdominal_folium_pattern / bilateral_spots_or_blotches distinct_central_band_, 98 Abdomen_pattern / Anelosimus_, 99 Dorsal_band / 'dark edged by white (Kochiura, Anelosimus, Fig. 94G, J)' 'light edged by dark (Fig. 94H)' 'Ameridion, light edged by white (Fig. 94I)', 100 Abdominal_dot_pigment / silver 'non-reflective, dull', 101 SPR_form / 'weakly keeled (Figs. 67F, 74F)' 'strongly keeled and elongate (Figs. 16B-C, 24D-E, 42F)', 102 SPR_pick_number / '1-4' '6-28' '>30', 103 SPR_insertion / flush_with_abdominal_surface 'on a ridge (Figs 32D, 72A-B)', 104 'SPR mesally-oriented picks' / absent present, 105 'SPR mesally-oriented picks relative to sagittal plane' / angled_dorsally perpendicular_or_angled_ventrally, 106 SPR / straight_or_slightly_irregular distinctly_curved 'argyrodine, dorsal picks aside others', 107 SPR_dorsal_pick_spacing / subequal_to_ventral_pick_spacing distinctly_compressed, 108 SPR_relative_to_pedicel / lateral dorsal, 109 SPR_setae / separate tight, 110 'Supra pedicillate ventrolateral (4 o''clock) proprioreceptor' / absent present, 111 Epiandrous_fusule_arrangement / in_one_pair_of_sockets in_a_row, 112 Epiandrous_fusule_pair_number / '=>9' '6-8' '4-5' 1, 113 Colulus / 'present (Figs. 45E, 61F)' 'absent (Figs. 16E, 78A)' 'invaginated (Figs. 9D, 63G)', 114 Colulus_size / 'large and fleshy (Figs. 55H, 61F)' 'small, less than half the length of its setae (Fig. 38B)', 115 Colular_setae / present absent, 116 'Colular setae number (female)' / three_or_more two_, 117 'Palpal claw dentition (female)' / 'dense, > half of surface covered by denticles (Figs. 2D, 9E, 11D, 12G, 45G, 47E, 58G, 80D)' 'sparse < half of surface with denticles', 118 'Palpal tibial trichobothria (female)' / four three two five, 119 Femur_I_relative_to_II / subequal 'robust, clearly larger than femur II', 120 'Leg IV relative length (male)' / '3rd longest (typical leg formula 1243)' '2nd longest (typical leg formula 1423)' 'longest (typical leg formula 4123)', 121 'Leg IV relative length (female)' / 3rd_longest 2nd_longest longest_, 122 'Femur vs. metatarsus length (female)' / metatarsus_longer metatarsus_shorter, 123 'Femur vs. metatarsus length (male)' / metatarsus_longer metatarsus_shorter, 124 'Metatarsus vs. tibia length (female)' / metatarsus_longer metatarsus_shorter, 125 'Metatarsus vs. tibia length (male)' / metatarsus_longer metatarsus_shorter, 126 Metatarsal_ventral_macrosetae / like_other_macrosetae thickened_ventrally, 127 Tarsus_IV_comb_serrations / 'simple, straight' curved_hooks, 128 Tarsal_organ_size / 'smaller than setal sockets (normal)' enlarged, 129 'Tarsus IV central claw vs. laterals (male)' / 'short, at most subequal' 'elongate, longer (Figs. 19E, 21C, 23D, 32H, 57F, 58F)', 130 'Tarsus IV central claw vs. laterals (female)' / equal_or_shorter stout_and_distinctly_longer minute, 131 Spinneret_insertion / abdominal_apex 'subapical, abdomen extending beyond spinnerets', 132 PLS_flagelliform_spigot_length / subequal_to__PLS_CY 'longer than PLS CY (Figs. 68E, 78B, 82D)', 133 'PLS, PMS CY spigot bases' / 'not modified, subequal or smaller than ampullates' 'huge and elongated, much larger than ampullates ', 134 CY_shaft_surface / smooth grooved, 135 PLS_AC_spigot_number / five_or_more four_or_less, 136 PLS_flagelliform_spigot / present absent, 137 PLS_posterior_AG_spigot_shape / 'normal, round' flattened, 138 PLS_theridiid_type_AG_position / more_or_less_parallel end_to_end, 139 'PMS minor ampullate (mAP) spigot shaft length' / 'short, subequal to CY shaft' clearly_longer_than_any_CY_shaft, 140 Web_form / 'linyphioid-like sheet web (Fig. 99C)' 'cobweb (Figs. 97G, 99A-B, 100A-F, 101A-E)' 'network mesh web - with foraging field below (rupununi/lorenzo)' 'dry line-web', 141 'Knock-down lines' / absent present, 142 Sticky_silk_in_web / present absent, 143 Egg_sac_surface / spherical_to_lenticular 'stalked (Fig. 88E, 98D).', 144 Egg_case_structure / suboval_or_roundish basal_knob rhomboid elongated Spiky, 145 Web_construction / solitary communal, 146 Mating_thread / present absent, 147 Adult_females_per_nest / one multiple, 148 cooperative_behavior / solitary subsocial permanent_sociality ;
|
740
|
+
input =" CHARSTATELABELS
|
741
|
+
1 Epigynal_ventral_margin / 'entire (Fig. 15G)' 'with scape (Fig. 27D)', 2 Epigynal_external_structure / openings_on_a_broad_depression 'copulatory openings on plate, flush with abdomen, sometimes slit like', 3 Epigynal_depression / 'round or square, at most slightly wider than high ' 'elongate, at least twice as wide as high ', 4 Epigynal_plate_surface / 'smooth (Fig. 12E)' 'ridged (Fig. 21G)', 5 epignynal_septum / absent_ present_, 6 Copulatory_bursa_anterior_margin / 'entire, broadly transverse (Fig. 19B)' 'medially acute (Figs. 22G, 40B)', 7 'Copulatory duct: spermathecal junction' / posterior lateral_or_anterior, 8 Copulatory_duct_loops_relative_to_spermathecae / apart 'encircling (Fig. 93J)', 9 Copulatory_duct_terminal_sclerotization / as_rest_of_duct_ 'distinctly sclerotized, clearly more than rest of duct ', 10 Hard_sclerotized_CD_region / mostly_or_entirely_ectal_to_the_ectal_rim_of_the_spermathecae 'caudal to the spermathecae, mesal to ectal margin of spermathecae', 11 Male_palpal_tibial_rim / uniform_or_only_slightly_asymmetric 'strongly and asymmetrically protruding, scoop-shaped (Fig 36D)', 12 Male_palpal_tibia_prolateral_trichobothria / one none, 13 Cymbial_ridge_ectal_setae / unmodified 'strongly curved towards the palpal bulb (Kochiura, Figs. 51B-C, 52C)', 14 Cymbial_distal_promargin / entire 'with an apophysis (Argyrodes, Figs.) ', 15 Cymbial_mesal_margin / entire 'incised (Anelosimus, Figs. 17D, 20A) ' deeply_notched, 16 Cymbial_tip_sclerotization / like_rest_of_cymbium 'lightly sclerotized, appears white', 17 Cymbial_tip_setae / like_other_setae 'thick and strongly curved (Kochiura, Figs. 51B, 52C)', 18 Cymbial_sheath / absent present, 19 Lock_placement / 'distal (Figs. 67B, 92F-G, I, M)' 'central (Fig. 92H)', 20 Lock_mechanism / 'hook (Figs 31F, 60D, 91A, 92D-E, J-L)' 'hood (Figs 18A, 75B, 92F-I, M)' 'Theridula (Fig 81D)', 21 Cymbial_hook_orientation / 'facing downwards (Figs. 91A, 92D-E, J-K)' 'facing upwards (Fig. 60C-D, 92L)', 22 Cymbial_hook_location / 'inside cymbium (Fig. 92D-E, J-K)' 'ectal cymbial margin (Figs. 67B, 92L).', 23 Cymbial_hook_distal_portion / 'blunt (Figs. 31F, 92D-E)' 'tapering to a narrow tongue (Figs. 66B, 67D, 92L)', 24 Cymbial_hood_size / 'narrow (Fig. 92F-H)' 'broad (Fig. 92I)' 'Spintharus (Fig. 92M)', 25 Cymbial_hood_region / 'translucent, hood visible through cymbium (Anelosimus, Figs. 90A, 91C)' 'opaque, hood not visible', 26 Alveolus_shape / 'circular or oval (Fig. 92A-H)' 'with a mesal extension (Fig. 92A)', 27 Tegulum_ectal_margin / entire 'protruded (Fig. 20D)', 28 Tegular_groove / absent 'present (Fig. 28B)', 29 SDT_SB_I / separate touching, 30 'SDT post-SB II turn' / gradual '90 degrees (Anelosimus, Fig. 93B)', 31 SDT_SB_I_&_II_reservoir_segment_alignment / divergent parallel, 32 SDT_SB_I_&_II_orientation / in_plane_of_first_loop_from_fundus 'out of plane of first loop, against tegular wall', 33 SDT_RSB_I_&_II / absent present, 34 SDT_SB_III / absent present, 35 SDT_SB_IV / absent 'present (Fig. 93E)', 36 Conductor_shape / 'simple, round or oval, short' 'fan shaped, narrow base and broad tip (Selkirkiella, Kochiura)' Enoplognatha Argyrodes Achaearanea Theridion '''rupununi''' '''tanzania''' '''cup-shaped''', 37 Conductor / 'with a groove for embolus (Figs. 10A, 28D, 69B)' 'entire (Figs. 13D, 17F, 52C-D)', 38 Conductor_surface / 'smooth (Figs. 75B, 77B-C)' ' heavily ridged (Figs. 10B-C, 44D. 67C, 69D)', 39 Conductor_tip_sclerotization / like_base more_than_base, 40 Subconductor / absent present, 41 Subconductor_pit_upper_wall / 'entire, or slightly protruding' forms_a_regular_oval_lip, 42 Subconductor_at_C_base / narrows_abruptly_before_C_base narrows_gradually_along_its_entire_length broad_at_base, 43 'Embolus tail-SC relation' / 'hooked in, or oriented towards SC' surpasses_SC behind_E_base, 44 Tegulum_ectally_ / occupying_less_than_half_of_the_cymbial_cavity_ occupying_more_than_half_of_the_cymbial_cavity, 45 MA_and_sperm_duct / sperm_duct_loop_not_inside_MA 'sperm duct loop inside MA (Figs. 90F, 91B)', 46 'MA-tegular membrane connection' / broad narrow, 47 MA_form / unbranched 'two nearly equally sized branches (Fig. 22A-B) ', 48 MA_distal_tip / entire hooded, 49 MA_hood_form / 'narrow, pit-like (Figs. 31F, 34D)' 'scoop-shaped (Figs. 60D, 66B, 67D)', 50 TTA_form / entire 'grooved (Fig. 44C)', 51 TTA / bulky 'prong shaped (vittatus group)', 52 TTA_distal_tip / entire_or_gently_curved Argyrodes 'hooked (branched)', 53 TTA_hook_distal_branch / barely_exceeding_lower_branch_ 'extending beyond lower branch (jucundus group) ', 54 TTA_hook_distal_branch / thick_ 'thin, finger like (domingo, dubiosus)', 55 TTA_hook_proximal_branch / 'blunt, broad' 'flattened, bladelike' 'cylindrical, elongated', 56 TTA_surface_subterminally / smooth ridged, 57 TTA_tip_surface / smooth 'ridged (Figs. 7A-B, 17F, 31D, 34D, 54A, 56B, 86A)', 58 Embolus_and_TTA / loosely_associated_to_or_resting_in_TTA_shallow_groove 'parts of E entirely enclosed in TTA (Figs. 37A-B, 44C, 89C)', 59 Embolus_tip_surface / smooth denticulate, 60 Embolus_spiral_curviture / gentle whip_like corkscrew, 61 Embolus_tip / entire bifid, 62 Embolus_origin / retroventral_on_tegulum 'retrolateral (ectal), partially or completely hidden by cymbium (Figs 44C, 60A-C, 67B)', 63 Embolus_ridges / absent present, 64 Embolus_shape / short_to_moderately_elongate 'extremely long, >2 spirals (Figs. 54D, 73A-E)', 65 Embolus_spiral_width / 'thin, much of E spiral subequal to E tip ' 'thick, entire E spiral much broader than tip ', 66 Embolus_distal_rim / 'entire (normal)' deeply_grooved, 67 Embolic_terminus / abrupt 'with a distal apophysis (EA, Fig. 34E) ', 68 Embolus_tail / 'entire, smooth' 'distinct, lobed', 69 'Embolus-dh connection grooves' / absent present, 70 'Embolus-dh grooves' / 'deep, extend into the E base more than twice longer than the distance between them' 'short, extend into the E base about as long, or slightly longer than the distance between them', 71 E_spiral_distally / 'relatively thin or filiform, cylindrical' 'thick, not cylindrical' 'rupununi/lorenzo like', 72 Embolus_spiral / entire 'biparted (Eb)' pars_pendula, 73 Eb_orientation / towards_embolus_tip towards_tibia, 74 Embolic_division_b / separates_early_from_E E_and_Eb_tightly_associated_the_entire_spiral, 75 Embolic_division_b / broad 'narrow, relative to Eb spiral, snout-like', 76 'Eb distal portion, ectal marginl' / 'level, not raised ' with_a_distinct_ridge_, 77 Eb_form / flat 'globose, inflated', 78 Eb_form / 'distinct, clearly separate apophysis' 'short, confined to first section of spiral, barely separate', 79 Eb_tip_and_E_tip_association / separate Eb_and_E_tips_juxtaposed 'E tip rests on Eb ''cup''', 80 Eb_snout / 'short, snug with E spiral ' 'long, separate from E spiral ', 81 Distal_portion_of_Eb / entire with_a_cup_shaped_apophysis with_a_raised_ridge, 82 E_tail / lobe_not_reaching_ectal_margin_of_Eb_ lobe_touching_ectal_margin_of_Eb_, 83 Extra_tegular_sclerite / absent_ present_, 84 'Median eyes (male)' / flush_with_carapace 'on tubercle (Argyrodes)', 85 'AME size (male)' / subequal_or_slightly_larger_than_ALE clearly_smaller_than_ALE, 86 Cheliceral_posterior_margin / toothed smooth, 87 Cheliceral_posterior_tooth_number / three_or_more two one, 88 Cheliceral_furrow / smooth denticulate, 89 Carapace_hairiness / 'sparsely or patchily hirsute (Fig. 48D)' 'uniformly hirsute (Fig. 71D)', 90 Carapace_pars_stridens / irregular regular_parallel_ridges, 91 Interocular_area / more_or_less_flush_with_clypeus projecting_beyond_clypeus, 92 Clypeus / concave_or_flat with_a_prominent_projection, 93 'ocular and clypeal region setae distribution (male)' / sparse 'in a dense field, or fields', 94 'Labium-sternum connection' / 'visible seam (Fig. 27C)' fused, 95 Sternocoxal_tubercles / present absent, 96 Pedicel_location / 'anterior (Fig. 94A-D)' 'medial (Fig. 94J-K)', 97 Abdominal_folium_pattern / bilateral_spots_or_blotches distinct_central_band_, 98 Abdomen_pattern / Anelosimus_, 99 Dorsal_band / 'dark edged by white (Kochiura, Anelosimus, Fig. 94G, J)' 'light edged by dark (Fig. 94H)' 'Ameridion, light edged by white (Fig. 94I)', 100 Abdominal_dot_pigment / silver 'non-reflective, dull', 101 SPR_form / 'weakly keeled (Figs. 67F, 74F)' 'strongly keeled and elongate (Figs. 16B-C, 24D-E, 42F)', 102 SPR_pick_number / '1-4' '6-28' '>30', 103 SPR_insertion / flush_with_abdominal_surface 'on a ridge (Figs 32D, 72A-B)', 104 'SPR mesally-oriented picks' / absent present, 105 'SPR mesally-oriented picks relative to sagittal plane' / angled_dorsally perpendicular_or_angled_ventrally, 106 SPR / straight_or_slightly_irregular distinctly_curved 'argyrodine, dorsal picks aside others', 107 SPR_dorsal_pick_spacing / subequal_to_ventral_pick_spacing distinctly_compressed, 108 SPR_relative_to_pedicel / lateral dorsal, 109 SPR_setae / separate tight, 110 'Supra pedicillate ventrolateral (4 o''clock) proprioreceptor' / absent present, 111 Epiandrous_fusule_arrangement / in_one_pair_of_sockets in_a_row, 112 Epiandrous_fusule_pair_number / '=>9' '6-8' '4-5' 1, 113 Colulus / 'present (Figs. 45E, 61F)' 'absent (Figs. 16E, 78A)' 'invaginated (Figs. 9D, 63G)', 114 Colulus_size / 'large and fleshy (Figs. 55H, 61F)' 'small, less than half the length of its setae (Fig. 38B)', 115 Colular_setae / present absent, 116 'Colular setae number (female)' / three_or_more two_, 117 'Palpal claw dentition (female)' / 'dense, > half of surface covered by denticles (Figs. 2D, 9E, 11D, 12G, 45G, 47E, 58G, 80D)' 'sparse < half of surface with denticles', 118 'Palpal tibial trichobothria (female)' / four three two five, 119 Femur_I_relative_to_II / subequal 'robust, clearly larger than femur II', 120 'Leg IV relative length (male)' / '3rd longest (typical leg formula 1243)' '2nd longest (typical leg formula 1423)' 'longest (typical leg formula 4123)', 121 'Leg IV relative length (female)' / 3rd_longest 2nd_longest longest_, 122 'Femur vs. metatarsus length (female)' / metatarsus_longer metatarsus_shorter, 123 'Femur vs. metatarsus length (male)' / metatarsus_longer metatarsus_shorter, 124 'Metatarsus vs. tibia length (female)' / metatarsus_longer metatarsus_shorter, 125 'Metatarsus vs. tibia length (male)' / metatarsus_longer metatarsus_shorter, 126 Metatarsal_ventral_macrosetae / like_other_macrosetae thickened_ventrally, 127 Tarsus_IV_comb_serrations / 'simple, straight' curved_hooks, 128 Tarsal_organ_size / 'smaller than setal sockets (normal)' enlarged, 129 'Tarsus IV central claw vs. laterals (male)' / 'short, at most subequal' 'elongate, longer (Figs. 19E, 21C, 23D, 32H, 57F, 58F)', 130 'Tarsus IV central claw vs. laterals (female)' / equal_or_shorter stout_and_distinctly_longer minute, 131 Spinneret_insertion / abdominal_apex 'subapical, abdomen extending beyond spinnerets', 132 PLS_flagelliform_spigot_length / subequal_to__PLS_CY 'longer than PLS CY (Figs. 68E, 78B, 82D)', 133 'PLS, PMS CY spigot bases' / 'not modified, subequal or smaller than ampullates' 'huge and elongated, much larger than ampullates ', 134 CY_shaft_surface / smooth grooved, 135 PLS_AC_spigot_number / five_or_more four_or_less, 136 PLS_flagelliform_spigot / present absent, 137 PLS_posterior_AG_spigot_shape / 'normal, round' flattened, 138 PLS_theridiid_type_AG_position / more_or_less_parallel end_to_end, 139 'PMS minor ampullate (mAP) spigot shaft length' / 'short, subequal to CY shaft' clearly_longer_than_any_CY_shaft, 140 Web_form / 'linyphioid-like sheet web (Fig. 99C)' 'cobweb (Figs. 97G, 99A-B, 100A-F, 101A-E)' 'network mesh web - with foraging field below (rupununi/lorenzo)' 'dry line-web', 141 'Knock-down lines' / absent present, 142 Sticky_silk_in_web / present absent, 143 Egg_sac_surface / spherical_to_lenticular 'stalked (Fig. 88E, 98D).', 144 Egg_case_structure / suboval_or_roundish basal_knob rhomboid elongated Spiky, 145 Web_construction / solitary communal, 146 Mating_thread / present absent, 147 Adult_females_per_nest / one multiple, 148 cooperative_behavior / solitary subsocial permanent_sociality ;
|
744
742
|
MATRIX
|
745
743
|
fooo 01 more stuff here that should not be hit"
|
746
|
-
|
744
|
+
|
747
745
|
builder = NexusParser::Builder.new
|
748
746
|
lexer = NexusParser::Lexer.new(input)
|
749
|
-
|
747
|
+
|
750
748
|
(0..147).each{builder.stub_chr()}
|
751
|
-
|
749
|
+
|
752
750
|
NexusParser::Parser.new(lexer,builder).parse_chr_state_labels
|
753
751
|
|
754
|
-
foo = builder.nexus_file
|
752
|
+
foo = builder.nexus_file
|
755
753
|
assert_equal 10, foo.characters.size
|
756
754
|
assert_equal "Tibia_II", foo.characters[0].name
|
757
755
|
assert_equal "norm", foo.characters[0].states["0"].name
|
@@ -773,7 +771,7 @@ class Test_Parser < Test::Unit::TestCase
|
|
773
771
|
assert_equal "dorsal", foo.characters[4].states["0"].name
|
774
772
|
assert_equal "mesal", foo.characters[4].states["1"].name
|
775
773
|
assert_equal "lateral", foo.characters[4].states["2"].name
|
776
|
-
|
774
|
+
|
777
775
|
assert_equal "Paracymbium", foo.characters[5].name
|
778
776
|
assert_equal "abs", foo.characters[5].states["0"].name
|
779
777
|
assert_equal "pres", foo.characters[5].states["1"].name
|
@@ -791,12 +789,12 @@ class Test_Parser < Test::Unit::TestCase
|
|
791
789
|
assert_equal "Median_apophysis", foo.characters[9].name
|
792
790
|
assert_equal "pres", foo.characters[9].states["0"].name
|
793
791
|
assert_equal "abs", foo.characters[9].states["1"].name
|
794
|
-
end
|
792
|
+
end
|
795
793
|
|
796
794
|
|
797
795
|
|
798
796
|
def test_parse_notes_blk
|
799
|
-
|
797
|
+
input ="
|
800
798
|
TEXT TAXA = 'Scharff&Coddington_1997_Araneidae' TAXON = 2 TEXT = 'This is a footnote to taxon 2, Uloborus';
|
801
799
|
|
802
800
|
TEXT TAXON = 4 CHARACTER = 8 TEXT = This_is_a_footnote_to_a_cell.;
|
@@ -813,35 +811,35 @@ class Test_Parser < Test::Unit::TestCase
|
|
813
811
|
|
814
812
|
AN T = 2 C = 6 A = JC DC = 2008.4.13.20.35.20 DM = 2008.4.13.20.35.36 ID = JC1194a5b7e1a3 I = _ TF = (CM 'This is an annotation that haa a hard return in it^n^n^n^nSo there!') ;
|
815
813
|
|
816
|
-
AN T = 7 C = 10 A = 0 DC = 2008.4.20.17.25.11 DM = 2008.4.20.17.26.1 ID = 01196db9ebd25 I = _ TF = (CM 'this is an annotation^nwith several hard returns^nfor a cell of taxa 6, chr 9 (from zero)^ncoded as -') ;
|
817
|
-
|
814
|
+
AN T = 7 C = 10 A = 0 DC = 2008.4.20.17.25.11 DM = 2008.4.20.17.26.1 ID = 01196db9ebd25 I = _ TF = (CM 'this is an annotation^nwith several hard returns^nfor a cell of taxa 6, chr 9 (from zero)^ncoded as -') ;
|
815
|
+
|
818
816
|
AN T = 2 C = 6 A = JC DC = 2008.4.13.20.35.20 DM = 2008.4.13.20.35.36 ID = JC1194a5b7e1a3 I = _ TF = (CM 'This is ANOTHER annotation that haa a hard return in it^n^n^n^nSo there!') ;
|
819
817
|
|
820
818
|
END; Don't parse this bit, eh?"
|
821
|
-
|
819
|
+
|
822
820
|
# note the second last note note embedds parens in the value
|
823
|
-
|
821
|
+
|
824
822
|
builder = NexusParser::Builder.new
|
825
823
|
lexer = NexusParser::Lexer.new(input)
|
826
|
-
|
824
|
+
|
827
825
|
# stubs
|
828
826
|
(0..9).each{builder.stub_chr()}
|
829
827
|
(0..9).each{builder.stub_taxon()}
|
830
828
|
builder.nexus_file.codings[3] = []
|
831
829
|
builder.nexus_file.codings[3][7] = NexusParser::NexusParser::Coding.new()
|
832
|
-
builder.nexus_file.codings[8] = []
|
830
|
+
builder.nexus_file.codings[8] = []
|
833
831
|
builder.nexus_file.codings[8][2] = NexusParser::NexusParser::Coding.new()
|
834
832
|
builder.nexus_file.codings[1] = []
|
835
833
|
builder.nexus_file.codings[1][5] = NexusParser::NexusParser::Coding.new()
|
836
|
-
builder.nexus_file.codings[6] = []
|
834
|
+
builder.nexus_file.codings[6] = []
|
837
835
|
builder.nexus_file.codings[6][9] = NexusParser::NexusParser::Coding.new()
|
838
|
-
builder.nexus_file.codings[3] = []
|
836
|
+
builder.nexus_file.codings[3] = []
|
839
837
|
builder.nexus_file.codings[3][7] = NexusParser::NexusParser::Coding.new()
|
840
838
|
|
841
839
|
NexusParser::Parser.new(lexer,builder).parse_notes_blk
|
842
840
|
|
843
|
-
foo = builder.nexus_file
|
844
|
-
|
841
|
+
foo = builder.nexus_file
|
842
|
+
|
845
843
|
# make sure stubs are setup
|
846
844
|
assert_equal 10, foo.characters.size
|
847
845
|
assert_equal 10, foo.taxa.size
|
@@ -849,7 +847,7 @@ class Test_Parser < Test::Unit::TestCase
|
|
849
847
|
assert_equal 1, foo.taxa[1].notes.size
|
850
848
|
assert_equal 1, foo.codings[3][7].notes.size
|
851
849
|
assert_equal 'This_is_a_footnote_to_a_cell.', foo.codings[3][7].notes[0].note
|
852
|
-
|
850
|
+
|
853
851
|
assert_equal 1, foo.characters[9].notes.size
|
854
852
|
assert_equal 'This_is_footnote_to_char_10', foo.characters[9].notes[0].note
|
855
853
|
|
@@ -863,7 +861,7 @@ class Test_Parser < Test::Unit::TestCase
|
|
863
861
|
assert_equal 2, foo.codings[1][5].notes.size # TWO!!
|
864
862
|
assert_equal 1, foo.codings[3][7].notes.size
|
865
863
|
|
866
|
-
|
864
|
+
|
867
865
|
assert_equal "This_is_a_footnote_to_a_cell.", foo.codings[3][7].notes[0].note
|
868
866
|
|
869
867
|
assert_equal "This is an annotation to chr 3, taxa 9, coded ?", foo.codings[8][2].notes[0].note
|
@@ -885,9 +883,9 @@ class Test_Parser < Test::Unit::TestCase
|
|
885
883
|
TEXT CHARACTER = 8 TEXT = A62.008;
|
886
884
|
end;
|
887
885
|
"
|
888
|
-
|
886
|
+
|
889
887
|
# note the second last note note embeds parens in the value
|
890
|
-
|
888
|
+
|
891
889
|
builder = NexusParser::Builder.new
|
892
890
|
lexer = NexusParser::Lexer.new(input)
|
893
891
|
# stubs
|
@@ -895,11 +893,11 @@ class Test_Parser < Test::Unit::TestCase
|
|
895
893
|
|
896
894
|
NexusParser::Parser.new(lexer,builder).parse_notes_blk
|
897
895
|
|
898
|
-
foo = builder.nexus_file
|
899
|
-
|
896
|
+
foo = builder.nexus_file
|
897
|
+
|
900
898
|
# make sure stubs are setup
|
901
899
|
assert_equal 10, foo.characters.size
|
902
|
-
|
900
|
+
|
903
901
|
assert_equal 'A62.001', foo.characters[0].notes[0].note
|
904
902
|
assert_equal 'A62.002', foo.characters[1].notes[0].note
|
905
903
|
assert_equal 'A62.003', foo.characters[2].notes[0].note
|
@@ -926,18 +924,16 @@ class Test_Parser < Test::Unit::TestCase
|
|
926
924
|
|
927
925
|
def DONT_test_misc
|
928
926
|
nf = File.read('foo.nex') # MX_test_01.nex
|
929
|
-
foo = parse_nexus_file(nf)
|
927
|
+
foo = parse_nexus_file(nf)
|
930
928
|
assert true, foo
|
931
929
|
end
|
932
930
|
|
933
|
-
def
|
934
|
-
|
931
|
+
def DONT_test_misc2
|
932
|
+
# omit("test file doesn't currently exist")
|
935
933
|
assert nf = File.read(File.expand_path(File.join(File.dirname(__FILE__), '../test/Aptostichus.nex')) )
|
936
|
-
foo = parse_nexus_file(nf)
|
934
|
+
foo = parse_nexus_file(nf)
|
937
935
|
assert true, foo
|
938
936
|
end
|
939
937
|
|
940
|
-
|
941
|
-
|
942
938
|
end
|
943
939
|
|