Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How import SerialEM data #23

Open
ricounet67 opened this issue Dec 30, 2024 · 1 comment
Open

How import SerialEM data #23

ricounet67 opened this issue Dec 30, 2024 · 1 comment

Comments

@ricounet67
Copy link

I am trying to test ETSpy for my research purpose and, since I am a poor python user, I am stucked with some basic features. Indeed, I have tilt series acquired with SerialEM, so I have a mrc stack and the mdoc file associated.

I saw that I can read the SerialEM stack with the command
serie=tomo.io.load_serialem('manips/20240710-hc_aa_1000g-after-annealing/tomo1-2024-07-10/hc_aa_1000g.mrc', 'manips/20240710-hc_aa_1000g-after-annealing/tomo1-2024-07-10/hc_aa_1000g.mrc.mdoc')
One this made I obtain a TomoStack with the right dimensions but I have no tilt angles associated. How can I read the tilt angles from the data ?

I tried also the etspy.io.parse_mdoc('manips/20240710-hc_aa_1000g-after-annealing/tomo1-2024-07-10/hc_aa_1000g.mrc.mdoc') command but I obtain a tuple :
({'PixelSpacing': 36.4912,
'Voltage': 300.0,
'ImageFile': 'hc_aa_1000g.mrc',
'DataMode': 1.0,
'Magnification': 28500.0,
'SpotSize': 3.0,
'Defocus': -23.6507,
'ExposureTime': 1.678},
array([ 6.89979e+01, 6.80020e+01, 6.70040e+01, 6.60041e+01,
6.50067e+01, 6.40083e+01, 6.30084e+01, 6.20080e+01,
6.10091e+01, 6.00068e+01, 5.90079e+01, 5.80075e+01,
5.70081e+01, 5.60072e+01, 5.50088e+01, 5.40070e+01,
5.30066e+01, 5.20077e+01, 5.10073e+01, 5.00069e+01,
4.90070e+01, 4.80071e+01, 4.70063e+01, 4.60069e+01,
4.50060e+01, 4.40071e+01, 4.30067e+01, 4.20059e+01,
4.10060e+01, 4.00061e+01, 3.90062e+01, 3.80063e+01,
3.70059e+01, 3.60060e+01, 3.50057e+01, 3.40063e+01,
3.30059e+01, 3.20060e+01, 3.10056e+01, 3.00062e+01,
2.90073e+01, 2.80069e+01, 2.70075e+01, 2.60077e+01,
2.50087e+01, 2.40084e+01, 2.30080e+01, 2.20076e+01,
2.10097e+01, 2.00088e+01, 1.90084e+01, 1.80100e+01,
1.70096e+01, 1.60088e+01, 1.50104e+01, 1.40075e+01,
1.30086e+01, 1.20097e+01, 1.10098e+01, 1.00094e+01,
9.00907e+00, 8.00772e+00, 7.00832e+00, 6.01087e+00,
5.00855e+00, 4.00866e+00, 3.00975e+00, 2.01084e+00,
1.00997e+00, 1.00845e-02, -9.86875e-01, -1.98725e+00,
-2.98958e+00, -3.98898e+00, -4.98984e+00, -5.98973e+00,
-6.98962e+00, -7.98999e+00, -8.99086e+00, -9.98928e+00,
-1.09887e+01, -1.19881e+01, -1.29889e+01, -1.39879e+01,
-1.49882e+01, -1.59881e+01, -1.69880e+01, -1.79864e+01,
-1.89863e+01, -1.99857e+01, -2.09846e+01, -2.19835e+01,
-2.29844e+01, -2.39843e+01, -2.49827e+01, -2.59826e+01,
-2.69830e+01, -2.79814e+01, -2.89813e+01, -2.99807e+01,
-3.09713e+01, -3.19839e+01, -3.29808e+01, -3.39812e+01,
-3.49792e+01, -3.59820e+01, -3.69804e+01, -3.79808e+01,
-3.89807e+01, -3.99801e+01, -4.09804e+01, -4.19808e+01,
-4.29817e+01, -4.39801e+01, -4.49805e+01, -4.59804e+01,
-4.69798e+01, -4.79816e+01, -4.89795e+01, -4.99760e+01,
-5.09759e+01, -5.19777e+01, -5.29815e+01, -5.39765e+01,
-5.49798e+01, -5.59739e+01, -5.69738e+01, -5.79751e+01,
-5.89750e+01, -5.97802e+01]))
The tilt angles are in the array but I don’t know how to exploit this.

It is really basic questions but I am blocked with them. Can you help me ?

@AndrewHerzing
Copy link
Collaborator

There is no need to use the load_serialem function directly as this function is used to read a special subset of SerialEM file where multiple images were stored at each tilt. For conventional SerialEM MRC files as it appears you are using, you can simply call the load function and the reader will handle the tilt assignment.

series = etspy.load('manips/20240710-hc_aa_1000g-after-annealing/tomo1-2024-07-10/hc_aa_1000g.mrc')

If your MRC file still fails to load for some reason, please update this issue with additional detail.

As for the parse_mdoc function, you should not need to use this either. However, just to clarify, this function returns two variables. The first is a metadata dictionary and the second is the tilt array. So, the proper usage is:

metadata, tilts = etspy.io.parse_mdoc('manips/20240710-hc_aa_1000g-after-annealing/tomo1-2024-07-10/hc_aa_1000g.mdoc'

Here is the documentation for the function that describes what it returns:

etspy/etspy/io.py

Lines 114 to 139 in f39ac59

def parse_mdoc(
mdoc_file: PathLike,
series: bool = False,
) -> Tuple[dict, Union[np.ndarray, float]]:
"""Parse experimental parameters from a SerialEM MDOC file.
Parameters
----------
mdoc_file
Name of a SerialEM MDOC file
series
If ``True``, the MDOC files originated from a multiscan SerialEM acquisition.
If ``False``, the files originated from a single scan SerialEM acquisition.
Returns
-------
metadata : dict
A dictionary containing the metadata read from the MDOC file
tilt : :py:class:`~numpy.ndarray` or float
If ``series`` is true, tilt will be a single float value, otherwise
it will be an ndarray containing multiple tilt values.
Group
-----
io
"""

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants