Is there an easy way to automate export of (just) the particles.cs files from multiple refinements/volume alignment runs? CryoSPARC Tools can do it I expect? I’d prefer a method which doesn’t require using a terminal, as we have several new users who are… less than comfortable in the command line.
Would it be possible to add an export sub-option in the job right click menu?
Or would it be possible to have a customisable pop-out menu in the right click options, where options which users find themselves following regularly could be added?
Thanks in advance.
edit: Export job exports everything. Don’t really need everything exported most of the time, hence the specificity…
Thanks very much for your suggestion! I believe you’re referring to additional download options, rather than modified export functionality?
Typically jobs are not necessarily self-contained, as they may contain symlinks and references to other files in the project. Exporting jobs allows them to be consolidated such that you can compress/copy the job directory and import it into another project or instance.
The export function is different from downloading, which allows users to select outputs/results and download them via the web application.
If I’m interpreting correctly, you’d like more advanced download options such that multiple result types (particles, maps) can be downloaded simultaneously across iterations or jobs? For example, you could multi-select a set of refinement jobs and choose to download the particle .cs file for each.
If so, we’ve made a note of this on our to-do list!
If I could return to this request, I’d like to add to the wishlist the ability to download the plots from the card view without entering the job itself (projections, angular sampling, FSC, etc), perhaps in a bundle?
It would make internal reports a lot quicker, as I’ve got a project at the minute which is pretty large and going into each NU Refine job to download the plots takes quite a while just waiting for the UI to catch up! With a dozen states, plus various focussed refinements for each state, it’s taken me nearly an hour just to grab plots and it feels like much of that has been watching the nine-dot loading animation…
Hi @rbs_sci! The following script will download all of the plots for the final iteration of jobs like NU Refine and Local Refine. For instance, if I run ./download_final_iter.py P312 J39 on my laptop, I download the plots for the final iteration of that job. You could, of course, only download the PNG files by further filtering on the filename, etc.
This script assumes you have a JSON file with your CryoSPARC credentials at ~/instance-info.json, but you could hard code the license id, email, password, host, and port instead.
I hope that is helpful!
#!/usr/bin/env python
from cryosparc.tools import CryoSPARC
from pathlib import Path
import json
import re
import sys
credentials_file = Path("~/instance-info.json").expanduser()
with open(credentials_file, "r") as f:
instance_info = json.load(f)
cs = CryoSPARC(**instance_info)
assert cs.test_connection()
project_number = sys.argv[1]
job_number = sys.argv[2]
project = cs.find_project(project_number)
job = project.find_job(job_number)
files_with_iteration = [x for x in job.list_assets() if "iteration" in x["filename"]]
final_iter = max(
re.search(r"iteration_[0-9]+", x["filename"]).group(0) for x in files_with_iteration
)
download_dir = Path(f"~/Downloads/{job_number}-plots").expanduser()
download_dir.mkdir(exist_ok=True)
for file in files_with_iteration:
if final_iter in file["filename"]:
job.download_asset(fileid=file["_id"], target=download_dir / file["filename"])