Skip to content

Commit

Permalink
Fix relion5 compat (#220)
Browse files Browse the repository at this point in the history
* fix: starfile write as dict so blocks are saved with _data_particles

* fix: change rlnDetectorPixelSize to rlnTomoTiltSeriesPixelSize for relion5 compatibility

* add: make sure new column name is also checked in tests
  • Loading branch information
McHaillet authored Aug 14, 2024
1 parent f78f54a commit 8133e9a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/pytom_tm/entry_points.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,9 @@ def extract_candidates(argv=None):

# write out as a RELION type starfile
starfile.write(
df, job.output_dir.joinpath(f"{job.tomo_id}_particles.star"), overwrite=True
{"particles": df},
job.output_dir.joinpath(f"{job.tomo_id}_particles.star"),
overwrite=True,
)


Expand Down Expand Up @@ -1007,5 +1009,7 @@ def merge_stars(argv=None):
dataframes = [starfile.read(f) for f in files]

starfile.write(
pd.concat(dataframes, ignore_index=True), args.output_file, overwrite=True
{"particles": pd.concat(dataframes, ignore_index=True)},
args.output_file,
overwrite=True,
)
1 change: 1 addition & 0 deletions src/pytom_tm/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ def extract_particles(
"rlnCoordinateY": "rlnCenteredCoordinateYAngst",
"rlnCoordinateZ": "rlnCenteredCoordinateZAngst",
"rlnMicrographName": "rlnTomoName",
"rlnDetectorPixelSize": "rlnTomoTiltSeriesPixelSize",
}
output = output.rename(columns=column_change)

Expand Down
1 change: 1 addition & 0 deletions tests/test_tmjob.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,7 @@ def test_extraction(self):
"rlnCenteredCoordinateYAngst",
"rlnCenteredCoordinateZAngst",
"rlnTomoName",
"rlnTomoTiltSeriesPixelSize",
):
self.assertTrue(
column in df_rel5.columns,
Expand Down

0 comments on commit 8133e9a

Please sign in to comment.