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

Exception: REPORT BUG: error calculating text offset #105

Closed
andreas-wilm opened this issue May 18, 2022 · 3 comments
Closed

Exception: REPORT BUG: error calculating text offset #105

andreas-wilm opened this issue May 18, 2022 · 3 comments

Comments

@andreas-wilm
Copy link

Describe the bug

When exporting samples with the newish export(..., include_metadata=True) we sometimes experience Exception: REPORT BUG: error calculating text offset.

Code To Reproduce

We take one big FCS files and split it into multiple smaller ones. Every now and then we get the above error. I pickled two affected (sub)samples for a reproducible minimal working example.

In [1]: import pickle
In [2]: import flowkit as fk

In [3]: with open("SDBB030_210_ATVQGQNLK.pkl", 'rb') as fh:
    ...:     sample = pickle.load(fh)
In [4]: sample
Out[4]: Sample(v3.1, None, 60 channels, 6 events)
In [5]: sample.export(export_fcs, source='raw', include_metadata=True)
---------------------------------------------------------------------------
Exception                                 Traceback (most recent call last)
<ipython-input-28-4a3b1964e193> in <module>
----> 1 sample.export(export_fcs, source='raw', include_metadata=True)

~/miniconda3/envs/tetdecon-test/lib/python3.9/site-packages/flowkit/_models/sample.py in export(self, filename, source, exclude_neg_scatter, exclude_flagged, exclude_normal, subsample, include_metadata, directory)
   1102             fh = open(output_path, 'wb')
   1103
-> 1104             flowio.create_fcs(
   1105                 fh,
   1106                 events.flatten().tolist(),

~/miniconda3/envs/tetdecon-test/lib/python3.9/site-packages/flowio/create_fcs.py in create_fcs(file_handle, event_data, channel_names, opt_channel_names, metadata_dict)
    312     # verify the final BEGINDATA value == text start position + length of the text string
    313     if text_start + len(text_string) != int(text['BEGINDATA']):
--> 314         raise Exception("REPORT BUG: error calculating text offset")
    315
    316     #

Exception: REPORT BUG: error calculating text offset

Expected behavior

Exporting should work (as it does in most cases)

Desktop (please complete the following information):

Reproduced in multiple OS

  • OS: Mac OS 12.3.1
  • Python version 3.9.12
  • FlowKit version 0.9.0

Additional context

Happy to provide pkl files with affected samples via PM.

@whitews
Copy link
Owner

whitews commented May 18, 2022

Hey Andreas,

Yep, send me an example and I'll try to figure out what's going on. I put that tripwire exception in there b/c I suspected there may be additional edge cases where the offset needs to be adjusted.

@whitews
Copy link
Owner

whitews commented May 19, 2022

Andreas,

I think I've fixed this in FlowIO. Can you try uninstalling FlowIO and clone the latest master branch of FlowIO to replace it (should be version 1.0.1b0)?

@andreas-wilm
Copy link
Author

Works! Wonderful. Thanks so much for the prompt fix.

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