t-neumann / slamdunk

Streamlining SLAM-seq analysis with ultra-high sensitivity
GNU Affero General Public License v3.0
37 stars 22 forks source link

IndexError: list index out of range errror when running alleyoop tcperreadpos #145

Closed BRYZAV closed 5 months ago

BRYZAV commented 6 months ago

So I've been trying to run alleyoop tcperreadpos but run into the error of an IndexError and I'm not sure why this is?

alleyoop tcperreadpos -r PlasmoDB-66_PbergheiANKA_Genome.fasta -s SLAM_all_output/snp/ -l 150 -o alleyoop_tcperreadpos -t 8 SLAM_all_output/filter/*bam

alleyoop tcperreadpos -r PlasmoDB-66_PbergheiANKA_Genome.fasta -s SLAM_all_output/snp/ -l 150 -o alleyoop_tcperread pos -t 8 SLAM_all_output/filter/bam Running alleyoop tcperreadpos for 2 files (8 threads) joblib.externals.loky.process_executor._RemoteTraceback: """ Traceback (most recent call last): File "/apps/pkg/anaconda3/2020.11/lib/python3.8/site-packages/joblib/externals/loky/process_executor.py", line 436, in _process_worker r = call_item() File "/apps/pkg/anaconda3/2020.11/lib/python3.8/site-packages/joblib/externals/loky/process_executor.py", line 288, in call return self.fn(self.args, self.kwargs) File "/apps/pkg/anaconda3/2020.11/lib/python3.8/site-packages/joblib/_parallel_backends.py", line 595, in call return self.func(*args, *kwargs) File "/apps/pkg/anaconda3/2020.11/lib/python3.8/site-packages/joblib/parallel.py", line 262, in call return [func(args, kwargs) File "/apps/pkg/anaconda3/2020.11/lib/python3.8/site-packages/joblib/parallel.py", line 262, in return [func(*args, **kwargs) File "/users/bzavalam/.local/lib/python3.8/site-packages/slamdunk/alleyoop.py", line 232, in runTcPerReadPos stats.tcPerReadPos(referenceFile, bam, minMQ, maxReadLength, outputCSV, outputPDF, inputSNP, log) File "/users/bzavalam/.local/lib/python3.8/site-packages/slamdunk/dunks/stats.py", line 642, in tcPerReadPos totalReadCountFwd[i] += 1 IndexError: list index out of range """

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/users/bzavalam/.local/bin/alleyoop", line 8, in sys.exit(run()) File "/users/bzavalam/.local/lib/python3.8/site-packages/slamdunk/alleyoop.py", line 559, in run results = Parallel(n_jobs=n, verbose=verbose)(delayed(runTcPerReadPos)(tid, args.bam[tid], referenceFile, minMQ, args.maxLength, outputDirectory, snpDirectory, vcfFile) for tid in range(0, len(args.bam))) File "/apps/pkg/anaconda3/2020.11/lib/python3.8/site-packages/joblib/parallel.py", line 1056, in call self.retrieve() File "/apps/pkg/anaconda3/2020.11/lib/python3.8/site-packages/joblib/parallel.py", line 935, in retrieve self._output.extend(job.get(timeout=self.timeout)) File "/apps/pkg/anaconda3/2020.11/lib/python3.8/site-packages/joblib/_parallel_backends.py", line 542, in wrap_future_result return future.result(timeout=timeout) File "/apps/pkg/anaconda3/2020.11/lib/python3.8/concurrent/futures/_base.py", line 439, in result return self.get_result() File "/apps/pkg/anaconda3/2020.11/lib/python3.8/concurrent/futures/_base.py", line 388, in get_result raise self._exception IndexError: list index out of range

BRYZAL commented 5 months ago

Is there any insight or possible explanations for this?

t-neumann commented 5 months ago

Hi - sorry for the delayed answer. This actually seems to be some kind of bug. Any chance you could provide me with this testdata to debug?

BRYZAL commented 5 months ago

Well, I feel that this is a subjective issue as this works with other files but not this one. I'll let you know more soon.

Thanks

BRYZAL commented 5 months ago

So I was able to fix it but it turns out I had to add a if statement (if len(read.sequence) <= 150:) for the max read length to avoid the index error. Don't know if this happens to other people but if so it could be that reason

t-neumann commented 5 months ago

Could you maybe add a PR with this? Then I can merge it in. Thanks a lot for following this up

BRYZAL commented 5 months ago

Could you maybe add a PR with this? Then I can merge it in. Thanks a lot for following this up

What is a PR, the code?

t-neumann commented 5 months ago

Exactly - it's very easy and makes you also an official contributor:

https://www.youtube.com/watch?v=0HKE5nDypUg

BRYZAL commented 5 months ago

Ok all done!

t-neumann commented 5 months ago

Thanks a lot!