Skip to content
This repository was archived by the owner on Jul 25, 2024. It is now read-only.

KeyError: "Can't open attribute #23

Open
690645258 opened this issue Feb 27, 2020 · 4 comments
Open

KeyError: "Can't open attribute #23

690645258 opened this issue Feb 27, 2020 · 4 comments

Comments

@690645258
Copy link

Hi,

I just tried demultiplexing a run with the following command:

poreplex -i fast5_pass -o demultiplexed --trim-adapter --barcoding --fast5

Which failed due to an unknown error according to the output:

`==== Result Summary ====
BC1 BC2 BC3 BC4 undetermined
Processing failed

  • File could not be opened due to unknown error 8554 30492 819 33735 22579
  • Signal is too short 0 0 0 0 318
  • Signal scaling QC failed 0 0 0 0 3`

Looking at the log files, the following error is coming up for each read:

2020-02-27 18:20:43,004 [signal_analyzer.py:114] (FAL30205_pass_2b4b39c4_108.fast5#0076af39-aa83-4ff6-8a27-ef145447359b) Unhandled exception KeyError: "Can't open attribute (can't locate attribute: 'num_events_template')" Traceback (most recent call last): File "/Users/yan/opt/miniconda3/lib/python3.7/site-packages/poreplex/signal_analyzer.py", line 114, in process siganal.process() File "/Users/yan/opt/miniconda3/lib/python3.7/site-packages/poreplex/signal_analyzer.py", line 259, in process events = self.load_events() File "/Users/yan/opt/miniconda3/lib/python3.7/site-packages/poreplex/signal_analyzer.py", line 315, in load_events events = self.npread.load_fast5_events() File "/Users/yan/opt/miniconda3/lib/python3.7/site-packages/poreplex/signal_loader.py", line 265, in load_fast5_events bcall = self.fast5.get_basecall() File "/Users/yan/opt/miniconda3/lib/python3.7/site-packages/poreplex/fast5_file.py", line 142, in get_basecall summary['num_events'] = int(segattrs['num_events_template']) File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper File "/Users/yan/opt/miniconda3/lib/python3.7/site-packages/h5py/_hl/attrs.py", line 60, in __getitem__ attr = h5a.open(self._id, self._e(name)) File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper File "h5py/h5a.pyx", line 77, in h5py.h5a.open KeyError: "Can't open attribute (can't locate attribute: 'num_events_template')"

Any ideas on what went wrong or have oxford changed the fast5 file structure and broke poreplex because of it?

@690645258
Copy link
Author

Managed a fix for myself by modifing fast5_file.py in a couple places by making sure I used the guppy output fast5, not original.

The changes to fast5_file.py were:

groupno = analyses.name.rsplit('_', 1)[1] #ensures selection of Basecall_1D_001 and Segmentation_001 for any extra analysis

summary['num_events'] = int(len(fastqenc[1])) #fixed my original error, brought up another issue where it couldnt find Events or Move, fixed with above change to groupno

@matthew-valentine
Copy link

matthew-valentine commented Apr 9, 2021

I was facing the same error you got originally and edited the fast_file.py file as you suggested, however I am still getting the secondary Neither Events or Move table found in the basecall error. Are those definitely the only two places you modded the file (though it's been a long time I'm sure you can't remember!)?

@690645258
Copy link
Author

Those are all the modifications I remember doing, I think I used guppy to rebasecall and the --fast5_out and ran it on those fresh fast5's. Might be worth digging into your fast5s and check if analyses.name.rsplit('_', 1)[1] is pointing to the right things.

I only ended up using poreplex for one run, and now I've swapped to https://github.com/Psy-Fer/deeplexicon which is still actively maintained. Its slower than poreplex but works reliably and at this point is what I'd recommend.

@matthew-valentine
Copy link

Thanks for getting back to me. I am currently rerunning guppy with --fast5_out, so I will give it a go on the fast5s I get from that. I'll also have a look at deeplexicon. I was put off by the fact I would have to retrain it for our barcodes, as we used the barcodes that Poreplex was built for, but hopefully it won't be too arduous!

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

No branches or pull requests

2 participants