diff --git a/docs/src/man/introduction.md b/docs/src/man/introduction.md index 1877d70a..d4cec380 100644 --- a/docs/src/man/introduction.md +++ b/docs/src/man/introduction.md @@ -119,7 +119,7 @@ gene flow/hybridization or gene tree estimation error, and can be hard to interpret biologically. ```@raw html -implicit split network +implicit split network ``` In PhyloNetworks, we consider **explicit** phylogenetic networks exclusively. @@ -130,14 +130,14 @@ In parenthetical format, internal nodes can have a name, like node `C` below, in a tree written as `(A,B)C` in newick format: ```@raw html -internal tree node C +internal tree node C ``` To represent networks in parenthetical format, the extended newick format splits each hybrid node into two nodes with the same name: ```@raw html -a hybrid node is split into 2 nodes with the same name, to represent a network as a tree +a hybrid node is split into 2 nodes with the same name, to represent a network as a tree ``` By convention, the hybrid tag is `# + H,LGT,R + number`, and the minor @@ -174,4 +174,4 @@ the edge was a tree edge: setgamma!(net.edge[4], 0.7) # should return this: # ERROR: cannot change gamma in a tree edge -``` \ No newline at end of file +``` diff --git a/src/readwrite.jl b/src/readwrite.jl index 61043054..c29559d4 100644 --- a/src/readwrite.jl +++ b/src/readwrite.jl @@ -113,12 +113,12 @@ end # aux function to read floats like length or gamma values, to be read after a colon function readnewick_float(s::IO, c::Char) - if !(isdigit(c) || c in ['.','e','-','E']) + if !(isdigit(c) || c in ['.','e','-','E', '+']) a = read(s, String); error("Expected float digit after ':' but found $(c). remaining is $(a)."); end num = "" - while isdigit(c) || c in ['.','e','-', 'E'] + while isdigit(c) || c in ['.','e','-', 'E', '+'] d = read(s, Char) # reads c and advances IO num = string(num,d); c = peekskip(s); diff --git a/test/test_relaxed_reading.jl b/test/test_relaxed_reading.jl index 686847a7..a01f813e 100644 --- a/test/test_relaxed_reading.jl +++ b/test/test_relaxed_reading.jl @@ -35,6 +35,11 @@ global net @test_throws Exception readnewick("(E,((B)#H1") # doesn't end with ; @test_throws Exception readnewick(IOBuffer("E;")) # Expected beginning of tree with ( end +@testset "edge parameters" begin + net = readnewick("(A:2e-03,((B:1.2e1,#H1:1e+1):2.2E-02,(D:1.1E+2)#H1:4.4E+2::5.5E-10));") + @test [e.length for e in net.edge] == [0.002,12,10,0.022,110,440,-1] + @test [e.gamma for e in net.edge if e.hybrid] == [0.99999999945, 5.5e-10] +end @testset "ismajor & gamma consistency, and miscellaneous" begin net = readnewick("((((B)#H1)#H2,((D,C,#H2:::0.8),(#H1,A))));"); @test writenewick(net, round=true, digits=8) == "(#H2:::0.2,((D,C,((B)#H1)#H2:::0.8),(#H1,A)));"