Open alancleary opened 1 year ago
Forked the web-components repo --> https://github.com/rispop/web-components
Just added the lis-phylotree.ts file --> https://github.com/rispop/web-components/blob/main/src/lis-phylotree.ts. Would this be the correct format and have the correct dependencies?
Just added the lis-phylotree.ts file --> https://github.com/rispop/web-components/blob/main/src/lis-phylotree.ts. Would this be the correct format and have the correct dependencies?
Good progress @rispop. I've emailed you about the format and whatnot.
Created a test in /dev directory and have almost completed the component. One error regarding data still remains while compiling. Also fixed src/controllers/lis-cancel-promise-controller.ts
as you said in email.
Created a test in /dev directory and have almost completed the component. One error regarding data still remains while compiling. Also fixed
src/controllers/lis-cancel-promise-controller.ts
as you said in email.
Sounds good. Let me know when you're ready for me try out your code.
Finished component and test. The component prompts the user to enter a newick tree and then displays it.
Great! I've added more items to the task list.
Declared and exported Phylotree type
Added the private _data state to LisPhylotree class
Replaced input with tree and new type, implemented setter with conditions if tree is a string or a Phylotree.
Also changed the drawing tree code to use _data, but for some reason, the tree doesn't display properly afterward.
Fixed the tree display error by modifying the setter for the tree. Also fixed a couple of compile errors.
Added 2nd <lis-phylotree>
component which uses the Phylotree object.
Added optional color attribute
Updated tree drawing code to color the nodes based on their attributes and updated Phylotree object to include some nodes with colors. Also made the default color of the nodes gray. If any color attribute is an empty string or null, the color will be gray.
Updated tree drawing code to color the nodes based on their attributes and updated Phylotree object to include some nodes with colors. Also made the default color of the nodes gray. If any color attribute is an empty string or null, the color will be gray.
Mind making the default color white? That's what the Funnotate implementation does and we want to replicate that.
Yup, done.
Adjusted width in drawing code to use screen.availWidth rather than a set value.
Nevermind it looks like window.innerWidth is better to use as it makes the tree viewable in a windowed browser tab as well.
The Funnotate implementation is at https://github.com/legumeinfo/Funnotate/blob/main/static/js/phylogram.js
The layout property has been added and is used in the tree drawing code.
The layout property has been added and is used in the tree drawing code.
Works great! Very cool that the tree automatically redraws if you change this property on an existing element.
Added scale property and used in .scale method
Clears the previous tree whenever it is redrawn using this.innerHTML = "";
Built query query GeneFamilies($page: Int, $pageSize: Int) { geneFamilies(page: $page, pageSize: $pageSize) { results { phylotree { newick } } } }
And variables { "pageSize": 1, "page": 1 }
Sorry the formating doesn't look right.
Updated /dev/lis-phylotree.html
with query and displaying it in the Tree object.
Completed GraphQL query and made pull-request.
This is basically a second attempt at #10. @rispop is going to implement a phylotree component in an iterative manner. See the list below for steps and details:
src/
@property
) Newick tree using TnT (don't install TnT with npm; just include its scripts in the head of the page)dev/
directoryPhylotree
type before the LisPhylotree class that describes a phytotree object_data
state to the LisPhylotree classinput
property with atree
property that has typestring|Phylotree
and implement a setter for the property that saves the tree in the_data
state; you'll need to check if the tree is a string and parse it as Newick first_data
state<lis-phylotree>
element in thedev/
example and set its tree property to aPhylotree
object programmatically inside a<script>
tagcolor
string attribute to thePhylotree
typecolor
attribute if they have itPhylotree
object in thedev/
example to color some, but not all, nodeslayout
property to the component with type"vertical"|"radial"
with"vertical"
as the default value.layout
propertyscale
boolean property that's false by default.scale
methodgeneFamilies
query to fetch the Newick string for 1 phylotree. Be sure to set thepage
andpageSize
variables to 1 or else it's going to return results for all phylotrees in the database!dev/lis-linkout-element.html
as an example, use your GraphQL query from the previous step to updatedev/lis-phylotree.html
to get a phylotree with thegraphqlQuery
functiondev/lis-phylotree.html
to set thetree
property of the lis-phylotree-element programmaticallyphylotree
branch in the legumeinfo/web-components repo