High resolution image of 2D classification

Hi @alburse,

I believe the parameter is figsize_each.

Hi @maarten.tuijtel,

I was wondering if there are any updates on this. Is there a simple way to save higher resolution images of 2D class averages yet?

Thanks

Dave

1 Like

Dear @stephan,

I was wondering if there an update on this topic or do I still need to use the plotting function to obtain the high resolution images.

EDIT: Trying using the aforementioned procedure using Jupyter Notebook but stuck on this error:
" ModuleNotFoundError: No module named ‘finitesum’ " I am not sure which module this function belongs to. A Google search also did not help narrow it down. I made sure to install all the other required modules (Numpy, Scipy… ect).

Any suggestions?
Omid

Hi @Omid,

For the time being, you still need to use the plotting function.
A better method to use the python kernel would be through the interactive python shell provided by cryoSPARC (cryosparcm icli).
For more information on how to use this, and how to load .cs files, read our “Manipulating .cs Files” Tutorial here.

1 Like

Thanks @stephan for your quick reply.
I’ll give this a go today.

Best,
Omid

I have two alternative solutions.

Solution 1:
I don’t know if I’d call it simple, but… I use EMAN2 to display images. EMAN was one of the original 3D reconstruction tools. I don’t use it for that anymore, but still find it to have a very useful set of tools. I can run it from my Mac, so that’s handy too.

  1. Install EMAN2: https://blake.bcm.edu/emanwiki/EMAN2/Install
  2. Go to the cryoSPARC project folder and the job folder for the 2D class averages you want. You should see a file that looks like this: cryospac_P##_J##_020_class_averages.mrc. That’s the file you need to display. Download or copy that file to your local computer (or wherever you installed EMAN2).
  3. Run this EMAN command: e2proc3d.py inputFile.mrc outputFile.mrcs. This converts the file from .mrc (which will be understood as a 3D volume) to a .mrcs (which will be understood as a stack of 2D images.
  4. Then to display the image, run this command: e2display.py outFile.mrcs.
  5. When the image displays, you can middle click to get a popup window that allows you to adjust the magnfication, which you should set to 1, and the brightness, contrast, and gamma, which you can adjust how you like to make the averages look pretty. You can resize the image window to make it however many column/rows you want it to be.
  6. The crazy part, is that you then need to take a screen shot of that image. That’s the only way to save. But if the magnification = 1, then everything is ok, and the image will have the same number of pixels as the actual reconstruction.

Solution 2:

  1. Install Fiji: https://imagej.net/Fiji/Downloads. Fiji is just a version of ImageJ with the necessary plugins already added. The advantage is that it’s a point and click installation and usage. It will open mrc files automatically. You can save them in any format you like. The disadvantage is that it opens them as a stack, so you get one class average at a time. If want to tile them, the way you normally view 2D class averages, you will have to tile them yourself in some other program.

Best,
RJ

6 Likes

Dear @rj.edwards,

Thank you for this suggestion. I already had EMAN2 installed so it was really easy to do. Really appreciate the quick tip :slight_smile:

Kindly,
Omid

Hi @rj.edwards - although the manuscript I wanted this for has now been published, I will definitely give this a go for the next one :wink:
Many thanks
Dave

Can I use e2display.py to display .mrc?

If you mean can you use e2display.py to display 3D volumes, the answer is yes, although I don’t use that function much. I recommend Chimera X (https://www.cgl.ucsf.edu/chimerax/download.html).

And @alburse, the OP, those 2D class averages of yours really are beautiful. Proteosomes, if I’m not mistaken.

1 Like

Hi @rj.edwards
Stephan shared those class averages. They are probably from the T20S proteasome benchmark dataset and indeed beautiful.

Thank you @rj.edwards for the useful tips. May I ask one more question? I tried to download the 2D class average from the output of the 2D class job and open them in Fiji as @rj.edwards suggested, but it seems like the box size of the 2D class average I downloaded was reduced to 128 pixels. When I extracted the particle, the box size was 428 pixels. I’m not sure if I was downloading the 2D average from the right place. Is there a way that I can get the 2D class average that has the same box size as the original particle box size (i.e. 428 pixels)? I’d appreciate any suggestion. Thank you so much!

Best,
Meiling

Hi Meiling, by default the box size of 2D classification I think is controlled by the Maximum Resolution input parameter.

By default this is 6Å, so the box size for 2D is reduced to speed things up. If you want to get larger box size images, you can run 2D with a higher maximum resolution (say 3 Å), while keeping the maximum alignment resolution limited to 6Å so that the classification results are equivalent.

Cheers
Oli

Thank you @olibclarke for the information. I am running 2D classification with a 3Å maximum resolution as you suggested. Hopefully, I will get a bigger box size for the 2D average!

Best,
Meiling

Hi @stephan
I tried your suggestion of using the plotutil function in a jupyter notebook but got the following error:

import os

os.chdir(os.environ[‘CRYOSPARC_ROOT_DIR’])

from cryosparc2_compute import plotutil

from cryosparc2_compute.blobio import mrc


ModuleNotFoundError Traceback (most recent call last)
ipython-input-1-073baef4faa3 in module
2 os.chdir(os.environ[‘CRYOSPARC_ROOT_DIR’])
3
----> 4 from cryosparc2_compute import plotutil
5 from cryosparc2_compute.blobio import mrc

ModuleNotFoundError: No module named ‘cryosparc2_compute’

My bashrc file contains:
export CRYOSPARC_ROOT_DIR=/home/cryosparc/cryosparc_worker

This directory has the cryosparc_compute directory. Do you know how I can fix this?

Hi @lizellelubbe,

In the v3.0 upgrade, we renamed cryosparc2_ to cryosparc_ for most of our internal modules. If you replace cryosparc2_compute with cryosparc_compute in lines 4 and 5, does the script still run?

Michael

Hi @mmclean,
Unfortunately not although thanks for pointing out that cryosparc2_ was renamed, I didn’t realize it.
This is the new error:
image

I can try to install a virtualenv using cryosparc’s python and then install jupyter notebook using the virtualenv. Perhaps that can help to run this?

I just installed a virtualenv using cryosparc’s python (virtualenv -p /home/cryosparc/cryosparc_master/deps/anaconda/bin/python3 env3) as well as a new jupyter notebook, numpy, scipy, numba, matplotlib and pyFFTW (all in env3). Unfortunately still running into errors:

image

Hi @lizellelubbe,

The best way to use Jupyter to leverage cryoSPARC modules is to start it in the same python environment.
To do this, run the following commands on the master node:

cd cryosparc_worker
# activate cryoSPARC's worker environment in your shell
eval $(./bin/cryosparcw env)
# jupyter doesn't come installed by default
conda install jupyter
# start the jupyter server
# ./bin/cryosparcw start_ipynb <port number>
./bin/cryosparcw start_ipynb 39011

The start_ipynb command will start the jupyter server in a screen on your machine. You can access the UI by navigating to the port (localhost:39011; if the server is remote, you may need to forward the port first). You can kill the server by entering the screen screen -r and pressing CRTL+C.

Hi @stephan
Thanks for the reply.
I have tried your recommendation but got stuck on the jupyter installation. Should I specify a certain version of jupyter to be compatible with cryosparc (we have cryosparc v 3.2)? I got a very long list of incompatible packages when running conda install jupyter. Which conda returns /home/cryosparc/cryosparc_worker/deps/anaconda/condabin/conda.

lbbliz002@athena:/home/cryosparc/cryosparc_worker$ conda install jupyter
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: -
Found conflicts! Looking for incompatible packages. failed

UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

  • wcwidth==0.2.5=pyh9f0ad1d_2 -> python[version=’>=2.7,<2.8.0a0’]

Your python: python==3.7.9=hffdb5ce_0_cpython

If python is on the left-most side of the chain, that’s the version you’ve asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.

The following specifications were found to be incompatible with a past
explicit spec that is not an explicit spec in this operation (pip):

  • jupyter -> ipykernel -> importlib-metadata[version=’<5’]
  • jupyter -> ipykernel -> ipython[version=’>=4.0.0|>=4.0|>=5.0|>=7.23.1,<8.0’]
  • jupyter -> ipykernel -> ipython_genutils[version=’>=0.2.0,<0.3.0’]
  • jupyter -> ipykernel -> tornado[version=’>=4,<6|>=4.0|>=4.2|>=4.2,<7.0|>=6.1|>=5.0|>=5.0,<7|>=4.1,<7’]
  • jupyter -> ipykernel -> traitlets[version=’>=4.1|>=4.1.0,<6.0|>=4.3.1,<6.0.0|>=4.3.1,<5.0.0|>=4.3.1|>=5.0|>=4.2|>=4.2.1|>=4.3’]
  • jupyter -> jupyter_console -> pexpect
  • jupyter -> jupyter_console -> pygments[version=’>=2.4.1’]
  • jupyter -> nbconvert -> jinja2[version=’>=2.4’]
  • jupyter -> python[version=’>=2.7,<2.8.0a0’] -> ca-certificates

(I truncated the list here)