Skip to content

ChemCompGroupFactory cache not being reset properly #313

Closed

Description

@lafita

This issue is related to the closed issue #145, about a problem with singletons in the structure module. The fix145 made sure that the cache is reset if the ChemCompProvider is set (changed).

However there is another problem: when the method setLoadChemCompInfo() of the FileParsingParameters is set, neither the cache is cleaned or the ChemCompProvider is changed in the ChemCompGroupFactory. That generated unexpected results if the ChemCompProvider was set previously and the parameters are changed afterwards.

The fix will need to reset the ChemCompProvider if the parameters are changed, i.e. every time setLoadChemCompInfo() is called.

Activity

  1. added a commit that references this issue on Aug 4, 2015
    8b4a9d7
  2. lafita commented on Aug 4, 2015

    @lafita
    MemberAuthor

    After revising the code with @josemduarte we realized that the real problem was a bug in PDBFileReader that was setting the static variables of ChemCompGroupFactory inconsistently. This bug has been fixed, and the other parts of the code behave the same way.

    This is closely related to issue #169, because the user has to specify the ChemCompProvider he/she needs, independently of the parser used. Because it is a static variable, the same default will apply to MMCiff and PDB parsers.

  3. josemduarte commented on Aug 4, 2015

    @josemduarte
    Contributor

    Just a note on that: it seems that as @andreasprlic says in #169, the PDB parser sets the ChemCompProvider intentionally so that it is faster and more streamlined (versus the more correct but slower mmCIF parser). That in principle is fine, but before the patches above, the ChemCompProvider was setting the singleton and affecting the whole JVM globally. So that affected all parsers and would result in unexpected side effects.

    With these patches, in order to produce the "quick and dirty" PDB parsing behaviour that we had before, the user would need to explicitly set it like this:

    ChemCompGroupFactory.setChemCompProvider(new ReducedChemCompProvider());

    So we should clarify that in documentation, but otherwise the functionality we had before would still be available.

  4. lafita commented on Aug 4, 2015

    @lafita
    MemberAuthor

    Regarding the Test created for https://redmine.open-bio.org/issues/3334, it does not apply anymore because the value of the variable loadChemCompInfo does not change the static ChemCompProvider, which is valid for the whole JVM. The user needs to change the Provider explicitly as @josemduarte explained.

  5. added a commit that references this issue on Aug 4, 2015
  6. andreasprlic commented on Aug 4, 2015

    @andreasprlic
    Member

    Can we keep the ReducedChemCompProvider the default provider, unless the user specifies a different one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions