Lev1Generator is an algorithm for generating random level-1 networks from
simpler level-1 networks that we call subNets, which are
essentially simple level-1 networks. The algorithm behind this
generator forms a part of the article "A practical algorithm for reconstructing
level-1 phylogenetic networks" by Huber, Van Iersel, Kelk, and Suchecki.
The algorithm has been implemented in Java to provide an efficient way of generating random level-1 networks. The generated networks have been used in a simulation study that aimed at assessing (and possibly improving) the performance of LEV1ATHAN, a practical algorithm for reconstructing level-1 phylogenetic networks. Consequently, the output that is generated is aimed at being used as input for LEV1ATHAN.
Lev1Generator is a Java application that has been developed and tested on Ubuntu Linux and Windows Vista, but it should work under any operating system where Java is available.
We have supplied all the relevant Java .class files as a .jar file, which in theory means that only a Java interpreter is necessary to run the algorithm. However, user may want to recompile the Java source on his/her own system, and for this access to the Java compiler javac will be necessary. This can be done with the command (run from 'parent' directory),
javac lev1generator/*.java
If all goes well this should compile all .java files in lev1generator package folder, crating a number of class files in that location. You can type java lev1generator.Lev1Generator --help to check if the code has compiled correctly (please note that this commands are case sensitive). The following output should appear:
Lev1Generator Version 1.0, 20 October 2009
----------------------------------------------
Usage: java Level1Generator [options]
----------------------------------------------
[options] can be:
--input [file_name] : file containing network(s) in eNewick format,
if not specified the default subNet is used.
--n [num] : number [num] of subNets to be used by the generator. The default is 2.
--multiple [num] : number [num] of networks to be generated, the default is 1.
If more than one network is generated, additional file (all.net),
containing eNewick strings is generated
--trees : Extracts trees consistent with generated network.
Outputs .tre file for each generated network.
--dot : Generates 'dot' representation of generated network(s).
Outputs .dot file for each generated network.
--dottrees : Generates 'dot' representation of ALL trees consistent
with generated network(s). Outputs .dot file for each tree. Implies --trees.
Lev1Generator by default uses n=2 instances of this subNet (also depicted on the right) to generate more complex, random level-1 networks. User can provide an alternative, also multiple subNets by using --input [file_name] option. The input file should be a plain text file containing preferably simple level-1 networks in eNewick format. Each eNewick string should appear on a separate line of the file. An example of such input file is provided here, the networks in that file, depicted using dot are respectively network 1 and network 2.
The actual output depends on additional settings, which are described below. When used with default settings Lev1Generator produces a single output file 0001.net which contains eNewick string representing the generated Network. (numerical file names are convenient when multiple networks are generated). You can generate multiple networks using --multiple [number],
This network (also depicted on the right/below) was generated using the following settings.
java -jar Lev1Generator.jar --input subNets.net --n 3 --trees --dot
Setting -n 3 means that three instances of subNet(s)
found in input file subNets.net were used in generation process.
The output was a .net file that contained this eNewick string:
By using the --trees option we have also obtained .tre file that contains all four trees that are consistent with the above network, the newick tree representation of the four trees:
![]() |
![]() |
![]() |
![]() |
![]() |
|---|---|---|---|---|
| Generated network | Tree 1 | Tree 2 | Tree 3 | Tree 4 |
Additionally we have used --dot switch to obtain 'dot' representation of the generated network, which is convenient if we want to visually inspect the network. When dot interpreter is available, this 'dot' output can easily be converted into an image file, by running the following command,
dot -Tgif -O example.dot
More information on DOT language can be found here
Alternatively, you may use Dendroscope - newick and eNewick compatible software for visualizing phylogenetic trees and rooted networks. If you choose to do so, there is no need of using --dot and --dottree options.
As stated earlier, networks generated by Lev1Generator have been used in a simulation study focused on LEV1ATHAN - this website also contains supplementary data as well as instructions on how to extract triplets from the newick trees that can be obtained using --trees option of Lev1Generator.