Is there a way to export 2D classification result at a higher resolution than the png or pdf files provided by 2D classification job? I would like to export a publication quality 2D classification result from Select 2D Classes job, however the images are lower resolution than the actual pixel size of the particles.
You can use the plotting function used by the 2D Classification job itself. Check out the function parameters for more info (found in cryosparc2_worker/cryosparc2_compute/plotutils.py)
Hi
I tried this but could not get it to work. I guess CRYOSPARC_ROOT_DIR is not right, I tried the master folder and worker too. I found this link but not sure if this solution will effect other operations.
Thank you
import os
os.chdir(os.environ[â/share/PI/yiorgo/alpay/modules/alpaysprograms/cryosparc/2.9â])
from cryosparc2_compute import plotutil
from cryosparc2_compute.blobio import mrc
KeyErrorTraceback (most recent call last)
in ()
1 import os
----> 2 os.chdir(os.environ[â/share/PI/yiorgo/alpay/modules/alpaysprograms/cryosparc/2.9â])
3 from cryosparc2_compute import plotutil
4 from cryosparc2_compute.blobio import mrc
/share/software/user/open/python/2.7.13/lib/python2.7/UserDict.pyc in getitem(self, key)
38 if hasattr(self.class, âmissingâ):
39 return self.class.missing(self, key)
â> 40 raise KeyError(key)
41 def setitem(self, key, item): self.data[key] = item
42 def delitem(self, key): del self.data[key]
Iâm also struggling with this. Unfortuantely, I donât really understand what you meant. Where should I use this plotting function?
Also, is there a reason why this is relatively difficult, compared to a downloading or displaying a 3d map? It seems to me 2D classes are an important (intermediate) result?
@stephan showed an example on Jupyter Notebook. You can start a Jupyter notebook and use it as a python environment. I believe cryosparc itself has the jupyter notebook setup and has all the necessary python libraries but I could not find how to start Jupyter notebook from cryosparc environment. Therefore I used my own Jupyter notebook. You will need at least the following python 2.7 libraries installed.
py-numpy py-scipy py-numba py-matplotlib pyFFTW
and CRYOSPARC_ROOT_DIR defined in your bashrc or bash_profile or equivalent file for other shells.
Below worked for me on my bash_profile file.
export CRYOSPARC_ROOT_DIR="/directory-to-cryosparc/cryosparc/2.11/cryosparc2_worker"
If @stephan tells us how to use the jupyter notebook from cryosparc that would be great.
More importantly, I could not really find what parameter to change on the plotutils.py to get the native resolution on the 2D-class averages. If you find it, please let me know.
Youâre right- weâre planning on adding a âdownload imagesâ button that will output a compressed folder of individual class images at full resolution. Iâll keep you updated on this!
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).
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.
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.
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).
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.
Then to display the image, run this command: e2display.py outFile.mrcs.
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.
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:
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.
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.