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

Conda easy-ish installation guide #13

Open
pollicipes opened this issue Jan 21, 2022 · 2 comments
Open

Conda easy-ish installation guide #13

pollicipes opened this issue Jan 21, 2022 · 2 comments

Comments

@pollicipes
Copy link

pollicipes commented Jan 21, 2022

Dear Yang Yang,

This may be a bit random of an issue, but I thought I would like to simply share the following with the Phylo-HMRF community.

First of all, I honestly believe that Phylo-HMRF is a very nice tool, with a great potential. Congrats on the work and the idea!

I've spent a couple of days struggling to install the package and trying to make it work, thus I thought that it could be worth sharing this modest tutorial install guide... Not sure if it will be a universal solution, but it worked in our Linux cluster and could also serve as an inspiration. ;)

I thought that the easiest would be to put it into a conda environment. Note that some package versions are not exactly the same as the ones Yang Yang used because they were not available through conda and I wanted to stick to it as much as possible, but the test run with the example_input provided by the authors worked perfectly (~30 minutes on an 8 CPU, 24Gb machine).

# Download packages and setup a new conda environment
conda create -n phyloHMRF # create a new conda environment
conda activate phyloHMRF # activate it!
conda install python=2.7
conda install -c anaconda scikit-learn=0.19.0
conda install -c anaconda pandas=0.20.3
pip install medpy==0.3.0 # This had to be installed through pip
# conda install -c conda-forge scikit-image=0.12.3  # Not working; version not available.
# Substitute with:
pip install scikit-image==0.12.3 # that should do it :)

# Getting Phylo-HMRF
cd ~/software/ # Make or go to a directory where you would like to put the Phylo-HMRF package
git clone https://github.com/ma-compbio/Phylo-HMRF.git # git clone this very same repo!

# Installing the Python wrapper for pygco:
wget https://github.com/yujiali/pygco/archive/refs/heads/master.zip # Download the wrapper
unzip master.zip 
rm master.zip # clean

# As pointed out by the authors of Phylo-HMRF, the original source binary files from `pygco` are not present in repo above. 
# Luckily, Yang et al., have stored a copy of the files under Phylo-HMRF/gco_source/
# We can simply transfer those files to the pygco repo downloaded earlier, like this:
cp ~/software/Phylo-HMRF/gco_source/* ~/software/pygco-master/gco_source/

# Now we have to compile those pygco libs:
cd ~/software/pygco-master/
make all
make test_wrapper

# Add the current folder to your  $LD_LIBRARY_PATH, and also to the $PYTHONPATH
# You can add these lines to your bashrc init file 
# Substitute the path for your own path, so that the program can find those pygco libraries
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/people/juarod/software/pygco-master/ 
# The same for python to find the python wrapper functions 
export PYTHONPATH=$PYTHONPATH:/home/people/juarod/software/pygco-master/

# TEST THE BINARY OF THE WRAPPER
./test_wrapper
# You should see the following output:
labels = [ 0 2 2 1 ], energy=19
data energy=15, smooth energy=4

# NOW TEST THE PYTHON WRAPPER
# Uncomment the last lines in test.py invoking the __main__ call and run it like:
python test.py
# You should not be getting errors or output. Additionally, some images have been generated in the images/ folder.

# TIME TO TEST RUN Phylo-HMRF!:
cd /home/people/guard/software/Phylo-HMRF # Go to your Phylo-HMRF downloaded folder
conda activate phyloHMRF # activate the conda environment (if you have closed the session, or if you are working on another tab)
# Run the program!
python phylo_hmrf.py -n 20 -r 1 --reload 0 --chromvec 21,22 --miter 100 -p /home/people/juarod/software/Phylo-HMRF/example_input
# It is advisable to add the full path to the example_input folder, with the `-p` option, so that the program can always find the input files
# … And that should be all!

Hope someone finds it useful!
I am also attaching the yaml file, obtained from my work environment (seems like *.yaml extension files can't be uploaded in here, so just change the extension to that.)
phyloHMRF.txt

Thank you so much, Yang!

Cheers,
Juan

@ma-compbio
Copy link
Owner

ma-compbio commented Jan 21, 2022

Hi Juan - Thank you so much for your effort. This is super cool. Would you mind if we include your conda installation tutorial in the README of Phylo-HMRF and acknowledge that you made this available? Thank you again for your generous help. We hope the method is useful for your work.

Best,
Jian Ma

@pollicipes
Copy link
Author

Dear Jian Ma,

Of course, please go ahead! And feel free to modify the recipe to your convenience, or if you think something can be improved.

And thank you for your positive response, glad you liked it!! :)
Best,
Juan

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

2 participants