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

Test running SCINGE inside MATLAB Docker container #16

Merged
merged 47 commits into from
May 3, 2019

Conversation

agitter
Copy link
Member

@agitter agitter commented Apr 19, 2019

Closes #14

Use https://hub.docker.com/r/fbenz/docker-java-matlab as the base Docker container or an example of how to create a container with the MATLAB runtime.

Do not add the large SCINGE_Example compiled file.
Compiled with:
mcc -m -R -singleCompThread -R -nodisplay -R -nojvm -a ./glmnet_matlab/ SCINGE_Example.m
@agitter
Copy link
Member Author

agitter commented Apr 19, 2019

https://hub.docker.com/r/amarburg/matlab-runtime is a similar container that has MATLAB R2018a (9.4), which matches the version used to compile SCINGE. It also attempts to fix libstdc++ problems, which were encountered in 678337e.

@agitter
Copy link
Member Author

agitter commented Apr 19, 2019

The compiled SCINGE_Example now runs successfully in the MATLAB Docker container. Before merging, we'll need to confirm that it produces the correct output. Currently, it only runs GLG_instance one time. @atuldeshpande is it safe to remove
https://github.com/gitter-lab/SCINGE/blob/2609ecf9a24c07c825144325c4c892cdeda27dc4/code/GLG_Instance.m#L89-L91

We can discuss how to create a SCINGE interface that supports command line arguments or a config file.

We'll also need to decide where to permanently host the compiled SCINGE code. Currently it is on a temporary biostat.wisc.edu directory for testing.

Compiled with:
mcc -m -R -singleCompThread -R -nodisplay -R -nojvm -a ./glmnet_matlab/ -a ./code/ SCINGE_Example.m
@agitter
Copy link
Member Author

agitter commented Apr 19, 2019

e17ac05 now runs GLG the correct number of times and produces the expected output files

-rw-r--r-- 1 root root  7947 Apr 19 21:52 AdjMatrix_data1_X_SCODE_datapmat_ID_541_replicate_1.mat
-rw-r--r-- 1 root root  7905 Apr 19 21:56 AdjMatrix_data1_X_SCODE_datapmat_ID_541_replicate_2.mat
-rw-r--r-- 1 root root  5719 Apr 19 21:55 AdjMatrix_data1_X_SCODE_datapmat_ID_542_replicate_1.mat
-rw-r--r-- 1 root root  5689 Apr 19 21:59 AdjMatrix_data1_X_SCODE_datapmat_ID_542_replicate_2.mat
-rw-r--r-- 1 root root  1246 Apr 19 21:59 SCINGE_Gene_Influence.txt
-rw-r--r-- 1 root root 26389 Apr 19 21:59 SCINGE_Ranked_Edge_List.txt

@agitter
Copy link
Member Author

agitter commented Apr 27, 2019

I ran SCINGE_Example.m in MATLAB R2018a to generate reference output files. The file sizes are small so I stored them all as uncompressed files. The new script compare_example_output.sh tests that the output from the compiled SCINGE_Example run inside the Docker container matches the output files. It uses the csvdiff Python package to compare SCINGE_Gene_Influence.txt and SCINGE_Ranked_Edge_List.txt. This package can ignore differences past a desired number of significant figures.

In order to run the tests in Python, Miniconda is now installed inside the Docker container approximatley following the Miniconda Dockerfile.

Currently, the intermediate .mat files are not tested. They could be if we use Python to import these files or convert them to .csv and compare them with csvdiff. That would require additional Python packages, in which case we should create a conda environment for the testing. What would we want to compare? Only the values in the sparse adjacency matrix?

Running the tests in Python and bash scripts is unusual, but if we write them in MATLAB we would need to compile them to run them in Travis CI. These tests scripts can eventually be used to

  • Run Travis CI cron jobs periodically to confirm the Docker container still works
  • Locally test the compiled SCINGE code before releasing new versions

print('Spare matrices in {} and {} are equal'.format(args.mat_file[0],
args.mat_file[1]))
else:
print('Spare matrices in {} and {} are not equal'.format(args.mat_file[0],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we please add maximum absolute value of difference obtained from np.allclose?

@agitter
Copy link
Member Author

agitter commented Apr 30, 2019

The sparse adjacency matrix test now outputs the maximum absolute value of difference if the values are not close. The test cases now run correctly and run inside a conda environment, which will be important for our local testing.

Before the final code review, I plan to further test my test code by modifying some of the sparse matrices and making sure the tests fail.

AdjMatrix_data1_X_SCODE_datapmat_ID_541_replicate_1.mat: modify 'params' but not 'Adj_Matrix'
AdjMatrix_data1_X_SCODE_datapmat_ID_541_replicate_2.mat: modify two values of 'Adj_Matrix'
AdjMatrix_data1_X_SCODE_datapmat_ID_542_replicate_1.mat: delete a value from 'Adj_Matrix'
AdjMatrix_data1_X_SCODE_datapmat_ID_542_replicate_2.mat: add a value to 'Adj_Matrix'
@agitter
Copy link
Member Author

agitter commented May 3, 2019

@atuldeshpande this is ready for review. I will merge after you approve.

I tested that the test cases work, failing Travis CI they should:

  • Commit 9143e7a (build output) shows the build fails if an intermediate test fails even if the rest of them pass
  • Commit ba78163 (build output) runs on modified versions of the reference files. All of the comparisons correctly detect the differences except when the params but not the Adj_Matrix are modified in the .mat file, which is the desired behavior

I've also done some local testing to confirm that the spare adjacency matrix test only fails when the absolute difference is large enough. It passes for very small differences.

@atuldeshpande atuldeshpande merged commit 499ba3f into master May 3, 2019
@agitter agitter deleted the matlab-docker branch May 3, 2019 17:01
atuldeshpande added a commit that referenced this pull request Jun 14, 2019
Test running SCINGE inside MATLAB Docker container
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

Successfully merging this pull request may close these issues.

Store example output data for testing
2 participants