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

PhylogenyNode.NODE_COUNT does not reset #20

Open
Vishal-Joshi opened this issue Aug 10, 2021 · 0 comments
Open

PhylogenyNode.NODE_COUNT does not reset #20

Vishal-Joshi opened this issue Aug 10, 2021 · 0 comments

Comments

@Vishal-Joshi
Copy link

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.

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

1 participant