Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tree.scale_bar() returns undefined, maybe an edge case? #7

Closed
guidorice opened this issue Nov 4, 2016 · 6 comments
Closed

tree.scale_bar() returns undefined, maybe an edge case? #7

guidorice opened this issue Nov 4, 2016 · 6 comments

Comments

@guidorice
Copy link

Hi Miguel, we have noticed that in some of our trees, the tnt.tree is unable to calculate the distance. For the tree below, tree.scale_bar(100, 'pixels'); returns undefined.

This only happens with some of our trees- and I suspect it has something to do with zero- length branches, but I cannot see what is going wrong in the code. Please let me know if you have any ideas or fixes.

Here is the newick

(((arath.AT5G60640.1:0.32911,(solly.Solyc06g075210.2.1:0.42215,solly.Solyc11g069400.1.1:0.13359):0.16168):0.06772,((((lotja.Lj3g3v3085830.1:0.11216,((aradu.Aradu.IRK0C.1:0.01585,aradu.Aradu.XJ6TW.1:0.01412):0.00053,(araip.Araip.9K298.1:0.00213,aradu.Aradu.1291C.1:0.09688):0.00186):0.22815):0.02341,(cajca.C.cajan_21520:0.06963,((phavu.Phvul.011G079000.1:0.03461,vigra.Vradi02g05810.1:0.04503):0.04038,(glyma.Glyma.11G146800.1:0.03475,glyma.Glyma.12G067700.1:0.0674):0.02313):0.01473):0.03652):0.02815,(cicar.Ca_14570:0.06004,medtr.Medtr4g059450.1:0.07727):0.038):0.09289,((((glyma.Glyma.12G172800.1:0.05337,glyma.Glyma.13G326200.1:0.04236):0.04403,(cajca.C.cajan_34019:0.07586,(phavu.Phvul.005G135600.1:0.05345,vigra.Vradi04g02780.1:0.04608):0.05396):0.0156):0.04602,(lotja.Lj0g3v0149129.2:0.09957,(cicar.Ca_02530:0.07903,medtr.Medtr2g094180.1:0.11076):0.07025):0.03662):0.01674,(aradu.Aradu.8P6BN.1:0.00171,araip.Araip.SB6R7.1:0.01115):0.11834):0.04132):0.06071):0,(vitvi.GSVIVT01025184001:0.11134,(prupe.ppa003432m:0.21011,(((arath.AT3G54960.1:0.42194,(orysa.LOC_Os02g01010.1:0.1347,(zeama.GRMZM2G033829_P01:0.09654,zeama.GRMZM2G134889_P01:0.06871):0.11319):0.37777):0.08035,(ambtr.evm_27.model.AmTr_v1.0_scaffold00175.37:0.34236,solly.Solyc04g049450.2.1:0.26635):0.03042):0.01848,vitvi.GSVIVT01016282001:0.25257):0.02943):0.03241):0.00833):0;

Also note the tree displays fine with scale(true), it's just the scale_bar() calculation that fails.

@emepyc
Copy link
Collaborator

emepyc commented Nov 5, 2016

Yes, the scale was set based on the first branch length, if it is zero it returned NaN.
I have fixed this now in v0.1.8. Please update and let me know if that works properly now.

@guidorice
Copy link
Author

@emepyc I updated to latest in npm, and it's working now. Thanks so much! We are going-live with the tnt.tree and the biojs msa component this week, I will post a note on Gitter if you want to take look.

@guidorice
Copy link
Author

guidorice commented Nov 7, 2016

Oops just noticed one minor thing, I think you left some console.log() in the tree.js file.
edit: apparently just in the build/tnt.tree.js.

@guidorice guidorice reopened this Nov 7, 2016
@emepyc
Copy link
Collaborator

emepyc commented Nov 7, 2016

Yay! sorry, just fixed it (v0.1.9)

@guidorice
Copy link
Author

Thanks :)

@emepyc
Copy link
Collaborator

emepyc commented Nov 7, 2016

btw, I'd love to take a look at your implementation once you have something live! :-)
Thanks for your feedback and your bug reports

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants