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

Node IDs are undefined #442

Open
Mirekium opened this issue Sep 7, 2023 · 4 comments
Open

Node IDs are undefined #442

Mirekium opened this issue Sep 7, 2023 · 4 comments
Assignees

Comments

@Mirekium
Copy link

Mirekium commented Sep 7, 2023

Hi,
I have a problem with the "id" on the tree when I use phylotree.js v 1.4.0 and D3.js v 6, I can't get defined "id" of the nodes they whether internal or leaf, you can see the image, all the "id" are "node-undefined".

I haven't had a problem with phylotree.js v 0.1.6 and D3.js v 3,
Is there a way to make these "ids" appear?
here is my code:


    let tree;
    function drawTree(newickSource) { 
        const height = innerHeight * 0.97;
        const width = innerWidth * 0.253;
        tree = new phylotree.phylotree(newickSource);		
        global_tree = tree;

        const renderOptions = {
          container:"#svg", 
          height:height, 
          width:width,
          "left-right-spacing": "fit-to-size",
          "top-bottom-spacing": "fit-to-size",
          selectable: true,
          "restricted-selectable": false,
          "binary-selectable": false,
          collapsible: false,
          transitions: false,
          "show-scale": false,
          "align-tips": false,
          zoom: false,
          reroot: false,
          hide: false,
          brush: false,
          branches: "step",
          "label-nodes-with-name": true,
          "internal-names": true,
          "node-styler": nodeStyler,
          "edge-styler": edgeStyler
        };
          
        tree.render(renderOptions);

       $(tree.display.container).append(tree.display.show());

      };

capture-tree

@stevenweaver
Copy link
Member

Dear @Mirekium,

Do you happen to have an example Newick tree that I can reproduce the issue with?

Best,
Steven

@stevenweaver stevenweaver self-assigned this Sep 7, 2023
@Mirekium
Copy link
Author

Mirekium commented Sep 7, 2023

For the moment, I am currently using phylotree.js with genealogical data, here is my data:
((((((((('Al Dhabab','Jaafar','Al Adhbat','Amru_','Abu Bakr')'Kilab',('Uqayl','Quchair','Jeda')'Kaab','Hilal','Amer Essoghra','Numair')'Amir',('Jusham','Nasr','Saad_','Thaqif')'Upper Hawazin')'Hawazin',(('Morra','Thalaba','Fazara')'Dhubyan','Abs','Achja','Abdallah ibn Ghatafan')'Ghatafan','Jadila','Bahila','Ghani','Sulaym','Mouhareb')'Qays',((('Layth','Damrah','Doal')'Abd Menat','Quraysh','Malken','Malek')'Kinanah',(('Saad','Imru Al-Qays')'Saad',('Malek','Yarboue')'Handala','Amru','Arrabeb')'Tamim','Asad','Hudhayl','Muzaina','Khuzaah_')'Khondof')'Mudar',('Bakr','Taghlib','Abdul Qays','Hanifa','Anz')'Rabia')'Maad','Akk')'Adnan',(((('Kalb','Al-Qayn','Udhrah','Bali','Majid','Khulan Qudaa','Tanukh','Juhaynah','Al-Mahra','Nahd','Bahra')'Quodaa','Al-Humaisa')'Himyar')'Sabaa',(('Hamdan',('Khatham','Bajila')'Anmar',('Azd Assarat','Azd Oman','Ghassen','Al-Aws - Al-Khazraj','Khuzaah')'Azd')'Malek',('Al-Achar','Khulan El-Alya','Kindah','Madhhij','Tayy','Judham','Lakhm','Amilah')'Orayb')'Kahlan')'Qahtan')' ')'Arabs'

@stevenweaver
Copy link
Member

Dear @Mirekium,

Do you have the nodeStyler code? We don't typically set an id for each node, so I'm curious if you are trying to do that with your code.

Best,
Steven

@Mirekium
Copy link
Author

Mirekium commented Sep 8, 2023

It seems that D3.js version 6 does not allow you to create "id" of the nodes unlike D3.js version 3.
As you see, my project is phylogeographic even if I currently use now genealogical data, the "ids" of the nodes are therefore essential for my project.
If there is no solution I stay on D3.js version 3.

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