IsoNet-cryoET / spIsoNet

Overcoming the preferred orientation problem in cryoEM with self-supervised deep-learning
https://www.biorxiv.org/content/10.1101/2024.04.11.588921v1
MIT License
14 stars 3 forks source link

Can not recognize the pixel size from RELION star #9

Open procyontao opened 2 months ago

procyontao commented 2 months ago

This happens when the name of a opticgroup does not contain "opticsGroup" https://github.com/IsoNet-cryoET/spIsoNet/blob/9614f8f47a8e31667f1709dce4698b5b2ef8df0c/spIsoNet/bin/relion_wrapper.py#L294-L295

rpiwowarczyk commented 2 months ago

Had the same issue! Here's a quick fix I made to avoid it in the future.

sampling_index = None
# sampling(pixelsize)        
with open("%s/%s_it%s_data.star" %(dir,basename,beforeVar)) as f:
    for line in f.readlines():
        if "_rlnImagePixelSize" in line:
            sampling_index = int(line.split()[1].split("#")[1])
        if sampling_index and line[0] != '_':
            sampling = float(line.split()[sampling_index-1])
            if not silence:
                print("pixel size = %s" %sampling) 
            break
procyontao commented 2 months ago

Hi rpiwowarczyk,

Thank you for the fix. Do you want to fork this repo and make pull request, so that you will be recognized as a contributor. Otherwise I can direct incorporate the change.