draeger-lab / ModelPolisher

ModelPolisher accesses the BiGG Models knowledgebase to annotate SBML models.
MIT License
23 stars 7 forks source link

ModelPolisher cannot find any relations in ADB. #56

Closed codekaust closed 5 years ago

codekaust commented 5 years ago

Current code in feat/annotatedb is not able to find relations in adb. You can recreate error by building lightJar and running these commands:

docker build -t bigg:latest ./docker/bigg_docker/
docker build -t adb:latest ./docker/adb_docker/
docker run --name adb -p 1013:5432 -d adb:latest && docker run --name bigg -p 1310:5432 -d bigg:latest
java -jar ./target/ModelPolisher-noDB-1.7.jar --input=<input> --output=<output> --annotate-with-bigg=true --bigg-host=0.0.0.0 --bigg-port=1310 --add-adb-annotations=true --adb-host=0.0.0.0 --adb-port=1013
matthiaskoenig commented 5 years ago

@codekaust I will have a look at this in the next few hours

matthiaskoenig commented 5 years ago

This is now fixed. There were problems in your dockerfile and the postgres init script. Mainly you did not create the correct users and so on so that the database dump was not put in the container. You should always look at the logs of your containers if running in detached mode, i.e.,

docker container logs adb

Shows you what went wrong. Also always run pg_restore with the -v or --verbose flag to make sure things work.

After creating the container your should test if you can connect to the database. I did this with idea.sh data sources (see below)

pycharm_adb_connect

You can see the data in the docker container image pycharm_adb_content

Also don't map the ports in the docker files! only expose what must be exposed, i.e., 5432 in case of postgres

In summary, your scripts for restoring the db did not work, this is fixed now.

codekaust commented 5 years ago

Thank You @matthiaskoenig! I will take care of your suggestions.

codekaust commented 5 years ago

Above is not the solution for this issue. REASON: ModelPolisher is querying biggdb.

matthiaskoenig commented 5 years ago

Could you explain what the issue is? The relations are in the database, you just have to query them. If the issue is that ModelPolisher is not using the annotatedb relations then you should open a respective issue. But the relations are there and can be queried which fixes your issue description.

codekaust commented 5 years ago

Yes, the problem is not in ADB or in setting up of ADB by docker. The issue is somewhere in the connection of ModelPolisher with ADB container. I am trying to understand and resolve this issue, will update if I find anything.

codekaust commented 5 years ago

Issue found: Here we create connector for BGGDB and here for ADB.

connector.connect() runs in each constructor but after one connector is connected(which happens for BiGGDB) the connect function for other connector is not run.

@mephenor any idea?

codekaust commented 5 years ago
PostgreSQLConnector psqlConnect = new PostgreSQLConnector(adb_host, new Integer(adb_port), adb_user, adb_passwd != null ? adb_passwd : "", adb_dbName);
          logger.info(psqlConnect.isConnected()+"");
          adb = new AnnotateDB(psqlConnect);

2nd line gives result true. Get by adding log here.

draeger commented 5 years ago

It seems to me this is a problem of ADB.

codekaust commented 5 years ago

No, it was a problem with SQLConnector only as I have mentioned in the above comments.