Hello, are there any options for downloading volumes in ‘volume series’ format, specifically each iteration of NU-refine? I want to inspect each iteration, but downloading each one by one is not easy for me…
I mean, I want to download the volume series, but I also want to inspect the output of each iteration. like…3DVA.
Hi @Randomnick – for a few reasons, there is no straightforward way to do this in the UI, but I’ve put together the following CryoSPARC tools script that will collect MRCs (across iterations) from a refinement job and compress them into a zip file within the job folder. You’ll need to SCP the zip file yourself (i.e., no way to access it within the UI) EDIT: Script now also downloads the zipped file via the tools API. Hopefully this helps!
from cryosparc.tools import CryoSPARC
import zipfile
cs = CryoSPARC(
host="[CS HOST URI]",
base_port=[CS BASE PORT],
email="[EMAIL]",
password="[PASSWORD]"
)
assert cs.test_connection()
# Fill out as appropriate for homo / nu-refine job
project = cs.find_project("P321")
refine_job = project.find_job("J1428")
# Find all map files -- can also replace with "_map_half_A", "_map_half_B", "_map_sharp", as appropriate
map_paths_abs = [str(refine_job.dir / file) for file in refine_job.list_files() if file.endswith("_volume_map.mrc")]
print(map_paths_abs)
# Series will be a zip file in the job directory
series_path_abs = str(refine_job.dir / (refine_job.uid + "_volume_map_series.zip"))
print(series_path_abs)
def zip_files(file_paths_abs, zip_path_abs):
with zipfile.ZipFile(zip_path_abs, mode="w", compression=zipfile.ZIP_DEFLATED) as archive:
for path in file_paths_abs:
# this ensures that the directory structure is not in the zip file
filename = path.split("/")[-1]
archive.write(path, filename)
zip_files(map_paths_abs, series_path_abs)
print("Zipped maps into: {}".format(series_path_abs))
# Optional: download the zip file! Change target to the desired (local) filename
downloaded_file = refine_job.download_file(series_path_abs, target="/u/vperetroukhin/" + (refine_job.uid + "_volume_map_series.zip"))
print("Downloaded to: {}".format(downloaded_file))
1 Like