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

Read rlnTomoName as str #50

Closed
wants to merge 1 commit into from
Closed

Conversation

EuanPyle
Copy link
Contributor

@EuanPyle EuanPyle commented Feb 7, 2024

As discussed in Issue #37, perhaps a little bit inelegant, but works.

@alisterburt
Copy link
Collaborator

Hey Euan, thanks for the PR but oooh no - we shouldn't hard code anything RELION related into the STAR file parser 😆

What I was proposing was an API like this starfile.read('my_file.star', parse_as_string=['rlnTomoName'])

You would then add some mechanism to the StarParser which took in those headers (maybe called parse_as_string there too)

def __init__(self, filename: PathLike, n_blocks_to_read: Optional[int] = None):

When parsing loop blocks you would then change

df_numeric = df.apply(pd.to_numeric, errors='ignore')

to iterate over the columns and individually apply to_numeric if the column name wasn't in that list

You would have to do a similar thing with simple data blocks here

k, v = shlex.split(self.current_line)
block[k[1:]] = numericise(v)

Does that make sense? You would then explicitly pass 'rlnTomoName' as a header to ignore when reading those files in RELION

@EuanPyle
Copy link
Contributor Author

EuanPyle commented Feb 7, 2024

woops, I'm out of practice, that makes sense! will get back to it

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

Successfully merging this pull request may close these issues.

2 participants