janas 2.2.0__tar.gz → 2.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. {janas-2.2.0 → janas-2.2.2}/CHANGELOG.md +55 -3
  2. {janas-2.2.0 → janas-2.2.2}/PKG-INFO +1 -1
  3. {janas-2.2.0 → janas-2.2.2}/setup.py +1 -1
  4. {janas-2.2.0 → janas-2.2.2}/src/janas/janas_cmd_caller.py +2 -1
  5. {janas-2.2.0 → janas-2.2.2}/src/janas/janas_cmd_session_manager.py +28 -5
  6. {janas-2.2.0 → janas-2.2.2}/src/janas/janas_cmd_utils.py +27 -2
  7. {janas-2.2.0 → janas-2.2.2}/src/janas/utils_csparc.py +269 -69
  8. {janas-2.2.0 → janas-2.2.2}/src/janas.egg-info/PKG-INFO +1 -1
  9. {janas-2.2.0 → janas-2.2.2}/src/janas.egg-info/SOURCES.txt +3 -0
  10. janas-2.2.2/tests/test_csparc_finalise.py +198 -0
  11. janas-2.2.2/tests/test_csparc_login.py +288 -0
  12. janas-2.2.2/tests/test_generated_session_scripts.py +248 -0
  13. {janas-2.2.0 → janas-2.2.2}/CMakeLists.txt +0 -0
  14. {janas-2.2.0 → janas-2.2.2}/LICENSE +0 -0
  15. {janas-2.2.0 → janas-2.2.2}/MANIFEST.in +0 -0
  16. {janas-2.2.0 → janas-2.2.2}/README.md +0 -0
  17. {janas-2.2.0 → janas-2.2.2}/pyproject.toml +0 -0
  18. {janas-2.2.0 → janas-2.2.2}/requirements.txt +0 -0
  19. {janas-2.2.0 → janas-2.2.2}/setup.cfg +0 -0
  20. {janas-2.2.0 → janas-2.2.2}/src/janas/IO_utils.py +0 -0
  21. {janas-2.2.0 → janas-2.2.2}/src/janas/__init__.py +0 -0
  22. {janas-2.2.0 → janas-2.2.2}/src/janas/assessParticles.py +0 -0
  23. {janas-2.2.0 → janas-2.2.2}/src/janas/benchmarking_janas_cmd_session_manager.py +0 -0
  24. {janas-2.2.0 → janas-2.2.2}/src/janas/bin/janas_app_meanMinMax +0 -0
  25. {janas-2.2.0 → janas-2.2.2}/src/janas/bin/janas_app_starProcess +0 -0
  26. {janas-2.2.0 → janas-2.2.2}/src/janas/bin_wrapper.py +0 -0
  27. {janas-2.2.0 → janas-2.2.2}/src/janas/images/selection_finished.png +0 -0
  28. {janas-2.2.0 → janas-2.2.2}/src/janas/images/selection_step1.png +0 -0
  29. {janas-2.2.0 → janas-2.2.2}/src/janas/images/selection_step2.png +0 -0
  30. {janas-2.2.0 → janas-2.2.2}/src/janas/images/selection_step3.png +0 -0
  31. {janas-2.2.0 → janas-2.2.2}/src/janas/images/selection_step4.png +0 -0
  32. {janas-2.2.0 → janas-2.2.2}/src/janas/images/selection_unstarted.png +0 -0
  33. {janas-2.2.0 → janas-2.2.2}/src/janas/janas_alternative_selector.py +0 -0
  34. {janas-2.2.0 → janas-2.2.2}/src/janas/janas_cmd_optimizer.py +0 -0
  35. {janas-2.2.0 → janas-2.2.2}/src/janas/janas_developer_test.py +0 -0
  36. {janas-2.2.0 → janas-2.2.2}/src/janas/janas_mapProcess.py +0 -0
  37. {janas-2.2.0 → janas-2.2.2}/src/janas/janas_progress.py +0 -0
  38. {janas-2.2.0 → janas-2.2.2}/src/janas/janas_reconstructor.py +0 -0
  39. {janas-2.2.0 → janas-2.2.2}/src/janas/locres_repro.py +0 -0
  40. {janas-2.2.0 → janas-2.2.2}/src/janas/locres_utils.py +0 -0
  41. {janas-2.2.0 → janas-2.2.2}/src/janas/projector_utils.py +0 -0
  42. {janas-2.2.0 → janas-2.2.2}/src/janas/reconstructor_utils.py +0 -0
  43. {janas-2.2.0 → janas-2.2.2}/src/janas/setup_environment_shell.sh +0 -0
  44. {janas-2.2.0 → janas-2.2.2}/src/janas/starDisplay.py +0 -0
  45. {janas-2.2.0 → janas-2.2.2}/src/janas/starHandler.py +0 -0
  46. {janas-2.2.0 → janas-2.2.2}/src/janas/utils.py +0 -0
  47. {janas-2.2.0 → janas-2.2.2}/src/janas/version.py +0 -0
  48. {janas-2.2.0 → janas-2.2.2}/src/janas.egg-info/dependency_links.txt +0 -0
  49. {janas-2.2.0 → janas-2.2.2}/src/janas.egg-info/entry_points.txt +0 -0
  50. {janas-2.2.0 → janas-2.2.2}/src/janas.egg-info/not-zip-safe +0 -0
  51. {janas-2.2.0 → janas-2.2.2}/src/janas.egg-info/requires.txt +0 -0
  52. {janas-2.2.0 → janas-2.2.2}/src/janas.egg-info/top_level.txt +0 -0
  53. {janas-2.2.0 → janas-2.2.2}/src/src_cpp/CsvStarReadWriteAnalyseLibs.h +0 -0
  54. {janas-2.2.0 → janas-2.2.2}/src/src_cpp/ctfLibs.h +0 -0
  55. {janas-2.2.0 → janas-2.2.2}/src/src_cpp/derivative_libs.h +0 -0
  56. {janas-2.2.0 → janas-2.2.2}/src/src_cpp/euler_libs.h +0 -0
  57. {janas-2.2.0 → janas-2.2.2}/src/src_cpp/imageProcessingLib.h +0 -0
  58. {janas-2.2.0 → janas-2.2.2}/src/src_cpp/janas_app_meanMinMax.cxx +0 -0
  59. {janas-2.2.0 → janas-2.2.2}/src/src_cpp/janas_app_starProcess.cxx +0 -0
  60. {janas-2.2.0 → janas-2.2.2}/src/src_cpp/janas_core.cpp +0 -0
  61. {janas-2.2.0 → janas-2.2.2}/src/src_cpp/matrix_computations.h +0 -0
  62. {janas-2.2.0 → janas-2.2.2}/src/src_cpp/mrcIO.h +0 -0
  63. {janas-2.2.0 → janas-2.2.2}/src/src_cpp/randomLibs.h +0 -0
  64. {janas-2.2.0 → janas-2.2.2}/src/src_cpp/recline.c +0 -0
  65. {janas-2.2.0 → janas-2.2.2}/src/src_cpp/recline.h +0 -0
  66. {janas-2.2.0 → janas-2.2.2}/src/src_cpp/scores.h +0 -0
  67. {janas-2.2.0 → janas-2.2.2}/tests/test_backmap_stars.py +0 -0
  68. {janas-2.2.0 → janas-2.2.2}/tests/test_behaviour_preserving_fixes.py +0 -0
  69. {janas-2.2.0 → janas-2.2.2}/tests/test_clean_csparc_blob_path.py +0 -0
  70. {janas-2.2.0 → janas-2.2.2}/tests/test_create_stack_path_mode.py +0 -0
  71. {janas-2.2.0 → janas-2.2.2}/tests/test_csparc2star_missing_pose.py +0 -0
  72. {janas-2.2.0 → janas-2.2.2}/tests/test_custom_selected_stacks.py +0 -0
  73. {janas-2.2.0 → janas-2.2.2}/tests/test_euler_anchor_assignment.py +0 -0
  74. {janas-2.2.0 → janas-2.2.2}/tests/test_eulerhist_show_flag.py +0 -0
  75. {janas-2.2.0 → janas-2.2.2}/tests/test_fixstack.py +0 -0
  76. {janas-2.2.0 → janas-2.2.2}/tests/test_janas_progress.py +0 -0
  77. {janas-2.2.0 → janas-2.2.2}/tests/test_locres_release_fixes.py +0 -0
  78. {janas-2.2.0 → janas-2.2.2}/tests/test_locres_reproducibility.py +0 -0
  79. {janas-2.2.0 → janas-2.2.2}/tests/test_locres_v3_closure.py +0 -0
  80. {janas-2.2.0 → janas-2.2.2}/tests/test_mrc_reader.py +0 -0
  81. {janas-2.2.0 → janas-2.2.2}/tests/test_reconstructor_nan_guard.py +0 -0
  82. {janas-2.2.0 → janas-2.2.2}/tests/test_sanitize_particle.py +0 -0
  83. {janas-2.2.0 → janas-2.2.2}/tests/test_score_particles_arrays_equivalence.py +0 -0
  84. {janas-2.2.0 → janas-2.2.2}/tests/test_scoreparticles_additional_options.py +0 -0
  85. {janas-2.2.0 → janas-2.2.2}/tests/test_support_floor.py +0 -0
@@ -1,5 +1,55 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.2.2
4
+
5
+ - **Refined particle metadata retrieved through the cryosparc-tools API.**
6
+ After a CryoSPARC refinement (`janas_utils csparc_localnurefinement`,
7
+ `csparc_nurefinement`), the job's `particles` output is now loaded with
8
+ `Job.load_output("particles")` and saved next to the output STAR file,
9
+ instead of searching the job directory for `<job>_<iter>_particles.cs`,
10
+ which failed on CryoSPARC installations whose job directories use a
11
+ different layout (`FileNotFoundError: No refined particle .cs files
12
+ found`). The filesystem search remains as a fallback, now also below
13
+ sub-directories and through the job's file listing, and the error message
14
+ lists the job directory contents. Exported half-maps are downloaded through
15
+ the API when they are not found on disk.
16
+ Verified against cryoSPARC v5.0.6 with cryosparc-tools 5.0.3 (local
17
+ refinement and non-uniform refinement jobs); cryoSPARC 4.x with
18
+ cryosparc-tools 4.x remains supported through the legacy login and the
19
+ filesystem fallback.
20
+ - **`--no-ssd-cache` for the cryoSPARC refinement commands.** `janas_utils
21
+ csparc_nurefinement` and `csparc_localnurefinement` can disable particle
22
+ caching on the worker SSD (`compute_use_ssd=False`), which is required on
23
+ lanes without an SSD cache (cluster lanes otherwise fail with "SSD path not
24
+ specified in worker config nor environment variable").
25
+
26
+ ## 2.2.1
27
+
28
+ - **Fixed the signal-subtraction test in the generated selection scripts
29
+ (#1).** `<session>_run.sh` compared the Python-style string
30
+ `signalSubtractionFlag=True|False` with `-eq $True`, so bash printed
31
+ `[: False: integer expression expected` at every iteration (the `else`
32
+ branch still ran, so results were unaffected). The test now goes through
33
+ the script's `str2bool()` helper like every other flag, accepting
34
+ `True/False/true/false/1/0`.
35
+ - **`--angpix` passed to RELION (#2).** The RELION route of the selection
36
+ script (`relion_reconstruct`, `relion_postprocess_mpi --locres` and the
37
+ `autobfac` `relion_postprocess`) and the classification script
38
+ (`relion_reconstruct`) now pass `--angpix <apix>`, so RELION no longer
39
+ warns that it is using the header pixel size. The option is emitted by a
40
+ guarded `angpix_opt` helper and stays empty when the pixel size is not a
41
+ number, in which case RELION keeps reading it from the header.
42
+ - **cryosparc-tools token login (#3).** When `CRYOSPARC_BASE_URL` is set
43
+ (or `base_url` is passed), `CryoSPARCToolsSession` opens the session with
44
+ the cryosparc-tools >= 5.0 token workflow (`python -m cryosparc.tools
45
+ login --url <base_url>`), verifies it with `test_connection()` and raises
46
+ a `RuntimeError` with the login command when it fails; the user e-mail is
47
+ optional on this path. Without `CRYOSPARC_BASE_URL` the legacy
48
+ license/host/port/e-mail/password login is unchanged. Lane, project
49
+ directory and job-log look-ups now also work with cryosparc-tools 5.x,
50
+ which has no `cli` client. Tests added for the generated scripts and for
51
+ both login paths.
52
+
3
53
  ## 2.2.0
4
54
 
5
55
  - **Fixed the Euler anchor assignment.** The direction vector used to assign
@@ -8,9 +58,11 @@
8
58
  so tilt and 180 - tilt fell in the same anchor. This affects only the anchor
9
59
  assignment behind the Euler-balanced rank (`<tag>_norm<n>` columns,
10
60
  `rankParticles` view labels) and the `starProcess --assessEuler`/`--infoDiff`
11
- statistics; particle orientations, SCI scores, class reassignment and
12
- reconstructions are unaffected. Rank columns written by earlier releases
13
- should be recomputed with `scoreParticles --rank`. Regression test added.
61
+ statistics; particle orientations, SCI scores, class reassignment and the
62
+ reconstruction code are unaffected, and reconstructions depend on it only
63
+ through the membership of the selected subsets. Rank columns written by
64
+ earlier releases should be recomputed with `scoreParticles --rank`.
65
+ Regression test added.
14
66
 
15
67
  ## 2.1.9
16
68
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: janas
3
- Version: 2.2.0
3
+ Version: 2.2.2
4
4
  Summary: Pipeline for per-particle selection and 3D class reassignment in single-particle cryo-EM.
5
5
  Home-page: https://gitlab.com/topf-lab/janas
6
6
  Author: Mauro Maiorca
@@ -99,7 +99,7 @@ janas_core = Extension(
99
99
 
100
100
  setup(
101
101
  name='janas',
102
- version='2.2.0',
102
+ version='2.2.2',
103
103
  description='Pipeline for per-particle selection and 3D class reassignment in single-particle cryo-EM.',
104
104
  long_description=read_long_description(),
105
105
  long_description_content_type='text/markdown',
@@ -1636,7 +1636,8 @@ def csparc_setup(args):
1636
1636
  "[csparc_setup] ERROR: 'cryosparc-tools' is not installed in this "
1637
1637
  "Python environment.\n"
1638
1638
  "Install it with:\n\n"
1639
- " pip install 'cryosparc-tools>=4.3,<5.0'\n"
1639
+ " pip install 'cryosparc-tools>=5.0' # token login (recommended)\n"
1640
+ " pip install 'cryosparc-tools>=4.3,<5.0' # legacy license/password login\n"
1640
1641
  )
1641
1642
  sys.exit(1)
1642
1643
 
@@ -690,6 +690,16 @@ ensure_directory() {
690
690
  mkdir -p -- "$dir"
691
691
  }
692
692
 
693
+ # RELION --angpix option: emitted only when the pixel size is a number;
694
+ # otherwise it stays empty and RELION reads the pixel size from the image header.
695
+ angpix_opt() {
696
+ local v="${1:-}"
697
+ v="${v/,/.}"
698
+ if [[ "$v" =~ ^[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?$ ]]; then
699
+ printf -- '--angpix %s' "$v"
700
+ fi
701
+ }
702
+
693
703
  # ------------------------------
694
704
  # Reconstruction / locres backends
695
705
  # ------------------------------
@@ -709,7 +719,7 @@ rec_subsets() {
709
719
  else
710
720
  all_done=false
711
721
  echo "DOING Reconstruction for file $fileOut"
712
- relion_reconstruct --i "$starFileIn" --o "$fileOut" --subset "$subset" --ctf &
722
+ relion_reconstruct --i "$starFileIn" --o "$fileOut" --subset "$subset" --ctf ${ANGPIX_OPT} &
713
723
  fi
714
724
  done
715
725
  wait
@@ -727,7 +737,7 @@ locres_one_relion() {
727
737
  --i "${file_basename}_recH1.mrc" \
728
738
  --i2 "${file_basename}_recH2.mrc" \
729
739
  --o "${file_basename}" \
730
- --locres
740
+ --locres ${ANGPIX_OPT}
731
741
  rm -f "${file_basename}_locres_fscs.star" "${file_basename}_locres_filtered.mrc"
732
742
  fi
733
743
  }
@@ -932,7 +942,7 @@ process_iteration() {
932
942
  run_script_cmd += " \n"
933
943
 
934
944
  run_script_cmd += (
935
- """ if [ $DO_WORK_WITH_SIGNAL_SUBTRACTION -eq $True ]; then
945
+ """ if [ "$(str2bool "$DO_WORK_WITH_SIGNAL_SUBTRACTION")" -eq "$True" ]; then
936
946
  echo "Working with signal subtraction"
937
947
  janas_app_starProcess --i ${fileWithNormalization} --invertTagName _janas_backup_rlnImageName _rlnImageName --o ${workingDir}/${tag}/tmp_inverted.star
938
948
  local fileWithNormalization=${workingDir}/${tag}/tmp_inverted.star #for signal subtraction, replace the file with subtraction with the whole particles
@@ -1048,7 +1058,7 @@ process_iteration() {
1048
1058
  " local singleReferenceFileBasename=${workingDir}/${tag}/norm_${tag}\n"
1049
1059
  )
1050
1060
  if data.get("postprocess", "avg") == "autobfac":
1051
- run_script_cmd += " relion_postprocess --i $targetMap1 --i2 $targetMap2 --auto_bfac --o ${singleReferenceFileBasename}_autobfac \n"
1061
+ run_script_cmd += " relion_postprocess --i $targetMap1 --i2 $targetMap2 --auto_bfac --o ${singleReferenceFileBasename}_autobfac ${ANGPIX_OPT} \n"
1052
1062
  run_script_cmd += (
1053
1063
  " singleReferenceFile=${singleReferenceFileBasename}_autobfac.mrc \n"
1054
1064
  )
@@ -1198,6 +1208,8 @@ EXTRACT_EOF
1198
1208
  run_script_cmd += f'GPU_ARG_OPT="{gpu_arg}"\n'
1199
1209
  run_script_cmd += f'USE_EXTERNAL_TOOLS="{external_flag}"\n'
1200
1210
  run_script_cmd += f'apix="{as_str(data.get("apix", "None"))}"\n'
1211
+ # Set here, after apix and before the main loop calls the RELION backends.
1212
+ run_script_cmd += 'ANGPIX_OPT="$(angpix_opt "${apix}")"\n'
1201
1213
  run_script_cmd += 'previousLocresFile="None"\n'
1202
1214
  run_script_cmd += "\n"
1203
1215
 
@@ -2475,6 +2487,16 @@ ensure_directory() {
2475
2487
  [ ! -d "$dir" ] && mkdir -p "$dir"
2476
2488
  }
2477
2489
 
2490
+ # RELION --angpix option: emitted only when the pixel size is a number;
2491
+ # otherwise it stays empty and RELION reads the pixel size from the image header.
2492
+ angpix_opt() {
2493
+ local v="${1:-}"
2494
+ v="${v/,/.}"
2495
+ if [[ "$v" =~ ^[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?$ ]]; then
2496
+ printf -- '--angpix %s' "$v"
2497
+ fi
2498
+ }
2499
+
2478
2500
  rec_subset() {
2479
2501
  fileIn=$1
2480
2502
  fileOut_basename=$2
@@ -2494,7 +2516,7 @@ rec_subset() {
2494
2516
  echo "DOING NOTHING: Reconstructed file ${fileOut_basename}_recH${subset}.mrc exists"
2495
2517
  else
2496
2518
  echo "DOING Reconstruction for file ${fileOut_basename}_recH${subset}.mrc"
2497
- relion_reconstruct --i "${fileIn}" --o "${fileOut_basename}_recH${subset}.mrc" --subset "${subset}" --ctf &
2519
+ relion_reconstruct --i "${fileIn}" --o "${fileOut_basename}_recH${subset}.mrc" --subset "${subset}" --ctf ${ANGPIX_OPT} &
2498
2520
  sleep 40
2499
2521
  fi
2500
2522
  fi
@@ -2581,6 +2603,7 @@ process_classification() {
2581
2603
  + '"\n'
2582
2604
  )
2583
2605
  run_script_cmd += 'angpix="' + data.get("angpix", "1.0") + '"\n'
2606
+ run_script_cmd += 'ANGPIX_OPT="$(angpix_opt "${angpix}")"\n'
2584
2607
  run_script_cmd += 'sigma="' + data.get("sigma", "1.0") + '"\n'
2585
2608
  run_script_cmd += 'numMPI="' + data.get("numMPI", "8") + '"\n'
2586
2609
  run_script_cmd += 'ctfMode="' + str(data.get("ctf_mode", "phaseflip")) + '"\n'
@@ -2747,6 +2747,16 @@ janas_csparc_nurefinement.add_argument(
2747
2747
  help="force re-splitting of half-sets in NU refinement",
2748
2748
  )
2749
2749
 
2750
+ janas_csparc_nurefinement.add_argument(
2751
+ "--no-ssd-cache",
2752
+ action="store_true",
2753
+ help=(
2754
+ "Do not cache particle images on the worker SSD (compute_use_ssd=False). "
2755
+ "Required on lanes without an SSD cache, e.g. cluster lanes that fail with "
2756
+ "'SSD path not specified in worker config'."
2757
+ ),
2758
+ )
2759
+
2750
2760
  janas_csparc_nurefinement.add_argument(
2751
2761
  "--local",
2752
2762
  action="store_true",
@@ -2778,9 +2788,10 @@ janas_csparc_nurefinement.add_argument(
2778
2788
  ),
2779
2789
  )
2780
2790
 
2781
- def _resolve_cryosparc_user(cli_user: Optional[str]) -> str:
2791
+ def _resolve_cryosparc_user(cli_user: Optional[str]) -> Optional[str]:
2782
2792
  """
2783
- returns e-mail of CryoSPARC user:
2793
+ returns e-mail of CryoSPARC user, or None with the token login
2794
+ (CRYOSPARC_BASE_URL set), where the stored token identifies the user.
2784
2795
  """
2785
2796
  if cli_user:
2786
2797
  return cli_user
@@ -2800,6 +2811,9 @@ def _resolve_cryosparc_user(cli_user: Optional[str]) -> str:
2800
2811
  except Exception:
2801
2812
  pass # non bloccare, si passa al fallback
2802
2813
 
2814
+ if os.getenv("CRYOSPARC_BASE_URL"):
2815
+ return None
2816
+
2803
2817
  raise RuntimeError(
2804
2818
  "CryoSPARC user e-mail not specified. "
2805
2819
  "Use --user or run `janas csparc_setup` to configure it."
@@ -2847,6 +2861,7 @@ def csparc_nurefinement_cli(args):
2847
2861
  ref_map=args.ref,
2848
2862
  ini_high=args.ini_high,
2849
2863
  resplit=args.resplit,
2864
+ use_ssd_cache=not args.no_ssd_cache,
2850
2865
  do_local=args.local,
2851
2866
  min_angular_step=args.min_angular_step,
2852
2867
  loglevel=args.loglevel,
@@ -2925,6 +2940,15 @@ janas_csparc_localnurefinement.add_argument(
2925
2940
  "(refine_gs_resplit=True)."
2926
2941
  ),
2927
2942
  )
2943
+ janas_csparc_localnurefinement.add_argument(
2944
+ "--no-ssd-cache",
2945
+ action="store_true",
2946
+ help=(
2947
+ "Do not cache particle images on the worker SSD (compute_use_ssd=False). "
2948
+ "Required on lanes without an SSD cache, e.g. cluster lanes that fail with "
2949
+ "'SSD path not specified in worker config'."
2950
+ ),
2951
+ )
2928
2952
  janas_csparc_localnurefinement.add_argument(
2929
2953
  "--min-angular-step",
2930
2954
  type=float,
@@ -2990,6 +3014,7 @@ def csparc_localnurefinement_cli(args):
2990
3014
  ref_map=args.ref,
2991
3015
  mask_map=args.mask,
2992
3016
  resplit=args.resplit,
3017
+ use_ssd_cache=not args.no_ssd_cache,
2993
3018
  min_angular_step=args.min_angular_step,
2994
3019
  loglevel=args.loglevel,
2995
3020
  precomputed_job_uid=args.precomputed,