Radial density average

Hello,
Is there a functionality in cryosparc to calculate a radial density average of spherical virus particles from a negative staining dataset? Thanks.

Hi @SaifH,

This functionality does not currently exist. May I inquire as to what you would use this information for?

Thanks,
Kye

Hello.
Thanks for your reply. Radial averaging is extremely helpful when investigating the structures of spherical objects that undergo conformational and size-related changes such as viruses, which is what I am studying. One example is given in Figure 1 in this article- https://www.cell.com/cell/fulltext/S0092-8674(02)00660-8?_returnURL=https%3A%2F%2Flinkinghub.elsevier.com%2Fretrieve%2Fpii%2FS0092867402006608%3Fshowall%3Dtrue

Hi @saifh,

Thanks for following up! After looking over the paper you linked plus this one, it seems that radial averaging is pretty useful for virus maps from cryo-EM experiments. I am unsure of how well this would work with maps from a negative stain data collection due to inherent limitations with negative staining and resolution of features. We have noted your request, though.

It appears most labs use EMAN2 for this type of analysis (following the methods in the paper above). If you wish to remain fully with the CS ecosystem this type of analysis could be possible with a CS-tools script (we have supplied a very rudimentary one below). Note we have not ensured that this script is identical to the analysis within the EMAN2 script e2proc3D.py (eg. things like normalization or scaling of voxel values).

This can be run from a cs-tools conda environment using python script.py P1 J1

from cryosparc.tools import CryoSPARC
import numpy as np
from pathlib import Path
import matplotlib.pyplot as plt
import argparse

license = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
email = "ali@example.com"
password = "password123"
cs = CryoSPARC(
    license=license,
    email=email,
    password=password,
    host="localhost",
    base_port=39000
)

cs = CryoSPARC(**instance_info)
assert cs.test_connection()

# Arguments to recieve
parser = argparse.ArgumentParser()
parser.add_argument(
    "puid",
    help = "Project"
)
parser.add_argument(
    "juid",
    help = "Refinement Job"
)

args = parser.parse_args()
project_uid = args.puid if "P" in args.puid else f"P{args.puid}"
job_uid = args.juid if "J" in args.juid else f"J{args.juid}"

project = cs.find_project(project_uid)
job = project.find_job(job_uid)
results = job.load_output("volume")

def radial_average(hdr, vol):
    apix = hdr.xlen / hdr.nx
    xi, yi, zi = np.meshgrid(*[range(-x//2, x//2) for x in vol.shape])
    radius = np.sqrt(xi**2 + yi**2 + zi**2) * apix
    radius = radius.astype(int)
    rad_avs = []
    for r in range(np.min(radius), np.max(radius)):
        voxels = vol[radius == r]
        rad_avs.append(np.mean(voxels))
    
    return np.array(rad_avs)

hdr, vol = project.download_mrc(results["map/path"][0])

ravs = radial_average(hdr, vol)
plt.plot(ravs)
1 Like

Thank you. We use EMAN2 as well but some of the datasets were initially processed in cryoSPARC. This information is extremely helpful.