snaq! problem reading starting topology

34 views
Skip to first unread message

pietro antolini

unread,
Apr 13, 2023, 5:54:08 AM4/13/23
to PhyloNetworks users
Hi all,
I am trying to use Phylonetworks in my analysis but I encountered this error

using PhyloNetworks;
CF = readTableCF("vcf2phylpathnofilt.csv")
tre = readMultiTopology("populations.snps.min4.tre")
net0 = snaq!(tre,  CF, hmax=0, filename="snaq/net0_bucky", seed=123)

45 unique 4-taxon sets were found. CF values of repeated 4-taxon sets will be averaged.
Object DataCF
number of quartets: 45


1-element Vector{HybridNetwork}:
 HybridNetwork, Rooted Network
7 edges
8 nodes: 5 tips, 0 hybrid nodes, 3 internal tree nodes.
tip labels: Haplochromis_engystoma_2sorted, Haplochromis_glaucus_2sorted, Haplochromis_sp_ishasha_3sorted, Haplochromis_labiatussorted, ...
(Haplochromis_engystoma_2sorted:100.0,((Haplochromis_glaucus_2sorted:100.0,Haplochromis_sp_ishasha_3sorted:100.0):45.0,Haplochromis_labiatussorted:100.0):39.0,Haplochromis_shubotziellussorted:100.0);


ERROR: MethodError: no method matching snaq!(::Vector{HybridNetwork}, ::DataCF; hmax=0, filename="snaq/net0_bucky", seed=123)  
Closest candidates are:
  snaq!(::HybridNetwork, ::DataCF; hmax, liktolAbs, Nfail, ftolRel, ftolAbs, xtolRel, xtolAbs, verbose, closeN, Nmov0, runs, outgroup, filename, seed, probST, updateBL) at C:\Users\Pietro Antolini\.julia\packages\PhyloNetworks\A3FWh\src\snaq_optimization.jl:1868
Stacktrace:
 [1] top-level scope
   @ c:\Users\Pietro Antolini\Desktop\PhiloTest\using PhyloNetworks;.jl:11

I am not really practical with programming (and with Julia in particular) but it seems that my tree is recognized as a vector{HybridNetwork} instead of simply HybridNetwork.
Did anyone encounter a similar issue ? I attach here my tree file
populations.snps.min4.tre

Cécile Ané

unread,
Apr 13, 2023, 9:43:41 AM4/13/23
to PhyloNetworks users
Yes, your diagnostic is correct. snaq needs a single phylogeny as input to start the search, so you should read your tree file with "readTopology" (which reads the first phylogeny and returns a network object) instead of "readMultiTopology" (which reads all phylogenies in the file and returns a vector of networks). I think it should work then!

...
tre = readMultiTopology("populations.snps.min4.tre")
...
it seems that my tree is recognized as a vector{HybridNetwork} instead of simply HybridNetwork.
...

pietro antolini

unread,
Apr 17, 2023, 8:50:41 AM4/17/23
to PhyloNetworks users
Thanks! That was the problem, now it works smoothly
Reply all
Reply to author
Forward
0 new messages