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

bad recognition of particular file #15

Open
jasondbiggs opened this issue Apr 15, 2021 · 10 comments
Open

bad recognition of particular file #15

jasondbiggs opened this issue Apr 15, 2021 · 10 comments

Comments

@jasondbiggs
Copy link

Using the image below, molvec version 0.9.8 is recognizing it as ethane (version 0.9.6 was finding propane). Is there something wrong with this PNG? Is there some kind of preprocessing that might improve the recognition?

$ java -jar $molvec -f '/Users/jasonb/molvec_issue.png'

  Molvec0104152114022D

  2  1  0  0  0  0  0  0  0  0999 V2000
    0.5000   -0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
   -0.5000   -0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
  1  2  1  0
M  END

molvec_issue

@dkatzel-ncats
Copy link
Contributor

Thanks for creating this issue. We are looking into the problem

@caodac
Copy link
Contributor

caodac commented Apr 15, 2021

Yeah, the color model for this image isn't properly handled in our grayscale conversion. We've found the problem and should have a fix shortly.

@dkatzel-ncats
Copy link
Contributor

We have pushed a fix for this issue. I have also pushed this change out to maven's snapshot repository.

Can you either check out the latest version of the codebase or change your molvec dependency in your build tool to 0.9.9-SNAPSHOT (might require adding the snapshot url depending on your build tool) and then give your images another try? if you're satisfied we will close the ticket.

thanks!!
Molvec Team

@jasondbiggs
Copy link
Author

Thank you for the fast response on this - we rebuilt the jar off of master, but I still get the same result on this particular image:

jasonb2maclap-2:build jasonb$ echo $molvec
/Users/jasonb/Downloads/molvec-0.9.9-SNAPSHOT-jar-with-dependencies.jar
jasonb2maclap-2:build jasonb$ java -jar $molvec -f '/Users/jasonb/molvec_issue.png'

  Molvec0104172113152D

  2  1  0  0  0  0  0  0  0  0999 V2000
    0.5000   -0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
   -0.5000   -0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
  1  2  1  0
M  END

@tylerperyea
Copy link
Contributor

Sorry to hear that! I just tried the same locally by downloading the png file above, and it seems to work.

$ java -jar target/molvec-0.9.9-SNAPSHOT-jar-with-dependencies.jar -f 114924211-5abece80-9df3-11eb-81fc-6480db039b20.png

  Molvec0104172116072D

 10 10  0  0  0  0  0  0  0  0999 V2000
    0.0017    1.7524    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
   -0.8672    2.2531    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    0.8672   -0.7510    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    0.8672    0.2504    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
   -0.8672   -0.7510    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    0.0017   -1.2517    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
   -0.8672    0.2504    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    0.0017   -2.2531    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    0.8672    2.2531    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    0.0017    0.7511    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
  7 10  1  0
  1  2  2  0
  3  4  1  0
  3  6  2  0
  1  9  1  0
  1 10  1  0
  5  6  1  0
  5  7  1  0
  4 10  1  0
  6  8  1  0
M  END

Is it possible that local cached changes or something similar have prevented a clean build? Can you do a git stash, git pull, and try building again? Also see if a mvn clean test finishes with any failing tests? There should be 310 tests run, if there are fewer there's probably some inconsistent state on the local git repo.

Thanks for bringing this to our attention!

@jasondbiggs
Copy link
Author

Thanks for those results, that means it is on my end somewhere. I'll build locally Monday instead of on a remote machine and see what is going wrong.

@jasondbiggs
Copy link
Author

I made a fresh checkout and built the jar locally on my mac rather than a remote Linux machine. I built it in Eclipse by right clicking the pom.xml and selecting Run as -> Maven install. The output there shows all tests passing but it also prints a stack trace for a CDK-related exception, not sure if that is relevant. I don't have any experience with maven so I don't know if the warning on the third line is regarding my setup or the project.

But I still seem to get the same result from using the jar file. When I open the file up in the GUI, it shows it only recognized a line at the bottom of the image, the rest is blank. Attaching the gui's command-line output here as well.

maven_log.txt
gui_output.txt

@tylerperyea
Copy link
Contributor

It's possible that the image we tried is different than the one you're testing, or that something strange is happening with the jar build. Here is a gist of the jar I tried:

https://gist.github.com/tylerperyea/6df01e5693105dd93c4815ea43c733bf/raw/d7edac4542652c672ca38cbee586eec26dc4dd91/molvec-0.9.9-SNAPSHOT-jar-with-dependencies.jar

Here is the md5sum of the image above that I tried:

$md5sum 114924211-5abece80-9df3-11eb-81fc-6480db039b20.png
635e821cb12f10a7d8df01ca6a7e2498  114924211-5abece80-9df3-11eb-81fc-6480db039b20.png

Could you confirm that the md5sum of your image locally matches this? You can also see if the raw jar does work for that image. This may help debug the issue.

@jasondbiggs
Copy link
Author

It is the same file, same md5sum, and I got the same result from your jar as the one I built. Then I tried it on a linux machine and got the correct result. Looking a little closer I find different behavior for different java versions.

On the linux machine the command java -version returns openjdk version "1.8.0_262" and the image is recognized properly. On my mac java -version returns openjdk version "15.0.2" 2021-01-19 and it fails. But looking further I see a few versions on my mac:

$ ls /Library/Java/JavaVirtualMachines/
jdk-11.0.5.jdk		jdk1.7.0_79.jdk		jdk1.8.0_101.jdk

If I find the java executable in those directories and use it on the image here, then it works for 1.7 and 1.8 but fails for 11.0.5 (I do not understand java versioning).

I hope that was clear.

@jasondbiggs
Copy link
Author

jasondbiggs commented Apr 19, 2021

I looked at the jar that I had built, and Eclipse was set to use java 8 (which is the same as 1.8?). I manually switched the java home for maven to use to the jdk-11.0.5.jdk listed above, and it no longer builds (I did run maven clean before maven install). I'm attaching the output from the maven install in case that is helpful.

maven_output_j11.txt

edit: I should have narrowed in on this sooner. The current sources will compile and pass tests against java 1.8. If you take that jar and run it from java 11 then it fails this test file. If I try to compile against java 11 then it fails due to test failures.

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

4 participants