Skip to content

Added possibility to read only header and text. #11

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

Merged
merged 1 commit into from
Jan 28, 2022

Conversation

JcGKitten
Copy link
Contributor

For me sometimes its very handy to read only the header/metadata of many fcs files, to compare or find out which channels, markers etc. where used, to only read the header information and not the whole data. This saves time and space I suppose, even your FlowIO is very fast anyway. See FlowCores read.FCSheader https://rdrr.io/bioc/flowCore/man/read.FCSheader.html.
I thought that could be handy for others as well and decided to try a pull request.

Thereby only the header and text data can be read.
@whitews
Copy link
Owner

whitews commented Jan 24, 2022

Hi Maximilian,

This does seem useful and increases feature parity compared to R's flowCore. I'm curious as to what the speedup is, have you run any benchmarks with and without the read_only flag? Maybe use timeit to open an FCS file 1000 times with & without? Of course it would vary with the size of the file and the datatypes of the event data, but a simple test would give us some idea.

Many thanks for the pull request! I will try to review it today or tomorrow.

Cheers,
Scott

@JcGKitten
Copy link
Contributor Author

Hey Scott,
thx for the fast reply.
I tested it with a 85MB fcs file:

timeit.timeit(f"FlowData('{path}')", setup=setup, number=1000)
106.73966625000003

timeit.timeit(f"FlowData('{path}', only_text=True)", setup=setup, number=1000)
1.5725342300002012

And i tested it on your smaller example files, there the improvement isn't as much of course:
image

Have a nice day,
Max

PS: That's my first pull request so feel free to give me some coding or github advice if needed.

@whitews whitews merged commit eb10dc5 into whitews:master Jan 28, 2022
@whitews
Copy link
Owner

whitews commented Jan 28, 2022

Hey Max,

I've accepted the PR, made a few modifications & released version 0.9.13 with this new option.

Advice for submitting PR's is tricky, as each project has their own rules & conventions. The only thing here would be the omission of updating the docstring for the FlowData constructor and not adding a test for the new functionality. Many projects are sticklers for that kind of thing, but I find the real-world feedback for features that users find helpful outweighs that.

Thanks again for contributing to FlowIO!
-Scott

@JcGKitten
Copy link
Contributor Author

Hey Scott,

Thx for taking the time and giving me some advice for the future. That helps me a lot.

Best wishes.
Max

whitews added a commit that referenced this pull request Apr 2, 2025
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