alanrogers / legofit

Estimate population history parameters from site pattern frequencies.
Other
12 stars 1 forks source link

legotree.py does not work #8

Closed janxkoci closed 3 years ago

janxkoci commented 3 years ago

I wanted to check the topology of my model using legotree.py, but the tool doesn't seem to work.

If I try to run it using the command from the manual, I get this:

$ python legofit-git/src/legotree.py --lgo m6.lgo
Only 1 input file is allowed
Usage: legotree.py [options] <input_file>

where options may include:
  --log                graph time on log scale
  --nomixtimes         don't print admixture times
  --allmix             draw arrows even if admixture is zero
  --textsize <x>       set text size to integer <x> points (def: 12)
  --gentime <x>        print time in years assuming <x> y/generation
  --width <x>          set width of tree branches (def: 27)
  --nolegend           suppress legend
  --outfile <xxx.png>  specify name of output file (def: screen)
  -h or --help         print this message

Note the first line saying Only 1 input file is allowed.

So since the help message actually doesn't mention the --lgo flag, I tried to run it without it, but it also failed:

$ python legofit-git/src/legotree.py  m6.lgo
Traceback (most recent call last):
  File "/home/jena/Dropbox/Science/human/legofit/scripts/legofit-git/src/legotree.py", line 305, in <module>
    tree = lego_tree("tree",open(infile).readlines())
  File "/home/jena/Dropbox/Science/human/legofit/scripts/legofit-git/src/legotree.py", line 159, in __init__
    i.parents = [self.pieces[np.where(self.segs == j)[0][0]] for j in i.parents]
  File "/home/jena/Dropbox/Science/human/legofit/scripts/legofit-git/src/legotree.py", line 159, in <listcomp>
    i.parents = [self.pieces[np.where(self.segs == j)[0][0]] for j in i.parents]
IndexError: index 0 is out of bounds for axis 0 with size 0

One last note: The docs mention that the script only requires matplotlib and numpy, but I had to also install shapely and descartes. I think the docs should be updated to reflect this.

alanrogers commented 3 years ago

Thank you for bringing this to my attention. I'll have a look.

alanrogers commented 3 years ago

I've moved legotree.py into the "obsolete" directory, so that it is no longer part of the distribution.