Skip to content

PhylogenyNode.NODE_COUNT does not reset #20

@Vishal-Joshi

Description

@Vishal-Joshi

I am seeing an issue with reading phylogenies with your library. I have multiple files to read phylogenies from sequentially.

Issue is that, once I read the first file, the NODE_COUNT in PhylogenyNode does not reset to 0. That is why, the second file's root does not start with 0 but a count after, where the last file ended. This does not appear to be a correct behavior.

I see that method PhylogenyNode.setNodeCount

synchronized final static void setNodeCount( final long i ) {
       PhylogenyNode.NODE_COUNT = i;
   }

is not accessible from outside the class which prevents me to reset it before I run read phylogenies for second file.

Since NODE_COUNT is a static variable it will live till the class remains loaded by a class loader. Is there a reason why the variable is static? Could we expose this setNodeCount() in PhylogenyNode?

This is the code snipped where I am trying to read multiple files, for your reference.

for (String aFile : files) {
            System.out.println(aFile);

            Phylogeny[] phylogeny = ParserUtils.readPhylogenies(aFile);

           for (Phylogeny p : phylogeny) {
                PhylogenyNode root = p.getRoot();
                System.out.println("Root node: " + root.getName() + " , ID: AN" + root.getId());
                //some more code
            }

        }

Alternatively, if this is not a correct usage for the lib please let me know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions