Skip to content

Commit

Permalink
Minor bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
EuanPyle committed Mar 29, 2022
1 parent 8a15545 commit d4d9c8a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 55 deletions.
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ packages = find:
python_requires = >=3.7
install_requires =
numpy
click==8.0.4
starfile
pandas
thefuzz
Expand Down
70 changes: 17 additions & 53 deletions tomogram_shift_alignment/tomogram_shift_alignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ def tomogram_shift_alignment(
new_tomograms_dir: Path,
particles_star: Path,
tomogram_binning: float,
tomogram_trimming: Optional[float] = 40,
) -> Path:
tomogram_trimming: Optional[float] = typer.Argument(40),
):
"""tomogram_shift_alignment
Requirements
Expand All @@ -40,7 +40,7 @@ def tomogram_shift_alignment(
Returns
---------------
adjusted_star_file : a star file with adjusted subtomogram coordinates which should match the tomograms in new_tomograms_dir \n
tomogram_coordinates_shifted.star : a star file with adjusted subtomogram coordinates which should match the tomograms in new_tomograms_dir \n
Example Input
---------------
Expand All @@ -63,11 +63,19 @@ def tomogram_shift_alignment(
print('Can\'t find dm2mrc, try loading imod outside of this script first. Birkbeck users type: module load imod')
sys.exit()

original_tomo_list = list(Path(original_tomograms_dir).glob('*'))
original_tomo_list = list(Path(original_tomograms_dir).glob('*.mrc'))

if original_tomo_list == []:
original_tomo_list = list(Path(original_tomograms_dir).glob('*.st'))

for idx in range(len(original_tomo_list)):
original_tomo_list[idx] = original_tomo_list[idx].name

new_tomo_list = list(Path(new_tomograms_dir).glob('*'))
new_tomo_list = list(Path(new_tomograms_dir).glob('*.mrc'))

if new_tomo_list == []:
new_tomo_list = list(Path(new_tomograms_dir).glob('*.st'))

for idx in range(len(new_tomo_list)):
new_tomo_list[idx] = new_tomo_list[idx].name

Expand All @@ -84,52 +92,8 @@ def tomogram_shift_alignment(
particles_star = Path('./tomogram_coordinates_shifted.star')
run_corrsearch3d((Path(original_tomograms_dir) / tomo),(Path(new_tomograms_dir) / matched_new_tomograms[tomo]),tomogram_trimming)
apply_shifts((Path(original_tomograms_dir) / tomo),particles_star,tomogram_binning)

















































if os.path.exists('./tomogram_coordinates_shifted.star'):
print('\n\nProduced tomogram_coordinates_shifted.star in this directory. Import the new tomograms into RELION 4, then use tomogram_coordinates_shifted.star as input for RELION 4\'s Import Coordinates function.\n\n')
else:
print('No output, error somewhere')
4 changes: 2 additions & 2 deletions tomogram_shift_alignment/version.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# coding: utf-8
# file generated by setuptools_scm
# don't change, don't track in version control
version = '0.1.dev7+g15d6516.d20220328'
version_tuple = (0, 1, 'dev7', 'g15d6516.d20220328')
version = '0.1.dev9+g5d6a418.d20220329'
version_tuple = (0, 1, 'dev9', 'g5d6a418.d20220329')

0 comments on commit d4d9c8a

Please sign in to comment.