HadrienG / InSilicoSeq

:rocket: A sequencing simulator
https://insilicoseq.readthedocs.io
MIT License
176 stars 32 forks source link

Error message python: "TypeError: data should be a string, bytes, bytearray, Seq, or MutableSeq object" #212

Closed Gandasegui closed 2 years ago

Gandasegui commented 2 years ago

Hello,

when trying to run iss in bioconda environment on a fasta file I always get the same error message from python:

INFO:iss.app:Starting iss generate INFO:iss.app:Using kde ErrorModel INFO:iss.util:Stitching input files together INFO:iss.app:Using lognormal abundance distribution INFO:iss.app:Using 2 cpus for read generation INFO:iss.app:Generating 1000000 reads INFO:iss.app:Generating reads for record: SNRZ01000001.1 /home/c.c2097288/.local/lib/python3.7/site-packages/Bio/Seq.py:1756: BiopythonDeprecationWarning: myseq.tomutable() is deprecated; please use MutableSeq(myseq) instead. BiopythonDeprecationWarning, /home/c.c2097288/.local/lib/python3.7/site-packages/Bio/Seq.py:2751: BiopythonDeprecationWarning: myseq.toseq() is deprecated; please use Seq(myseq) instead. BiopythonDeprecationWarning, /home/c.c2097288/.local/lib/python3.7/site-packages/Bio/Seq.py:1756: BiopythonDeprecationWarning: myseq.tomutable() is deprecated; please use MutableSeq(myseq) instead. BiopythonDeprecationWarning, /home/c.c2097288/.local/lib/python3.7/site-packages/Bio/Seq.py:2751: BiopythonDeprecationWarning: myseq.toseq() is deprecated; please use Seq(myseq) instead. BiopythonDeprecationWarning, joblib.externals.loky.process_executor._RemoteTraceback: """ Traceback (most recent call last): File "/home/c.c2097288/.local/lib/python3.7/site-packages/joblib/externals/loky/process_executor.py", line 431, in _process_worker r = call_item() File "/home/c.c2097288/.local/lib/python3.7/site-packages/joblib/externals/loky/process_executor.py", line 285, in call return self.fn(*self.args, *self.kwargs) File "/home/c.c2097288/.local/lib/python3.7/site-packages/joblib/_parallel_backends.py", line 595, in call return self.func(args, **kwargs) File "/home/c.c2097288/.local/lib/python3.7/site-packages/joblib/parallel.py", line 263, in call for func, args, kwargs in self.items] File "/home/c.c2097288/.local/lib/python3.7/site-packages/joblib/parallel.py", line 263, in for func, args, kwargs in self.items] File "/home/c.c2097288/.local/lib/python3.7/site-packages/iss/generator.py", line 62, in reads forward, reverse = simulate_read(record, ErrorModel, i, cpu_number) File "/home/c.c2097288/.local/lib/python3.7/site-packages/iss/generator.py", line 139, in simulate_read forward, 'forward', sequence, bounds) File "/home/c.c2097288/.local/lib/python3.7/site-packages/iss/error_models/init.py", line 193, in introduce_indels mutable_seq, orientation, full_seq, bounds) File "/home/c.c2097288/.local/lib/python3.7/site-packages/iss/error_models/init.py", line 135, in adjust_seq_length nucl_to_add = str(full_sequence[read_end + i]) File "/home/c.c2097288/.local/lib/python3.7/site-packages/Bio/Seq.py", line 433, in getitem return self.class(self._data[index]) File "/home/c.c2097288/.local/lib/python3.7/site-packages/Bio/Seq.py", line 1728, in init "data should be a string, bytes, bytearray, Seq, or MutableSeq object" TypeError: data should be a string, bytes, bytearray, Seq, or MutableSeq object """

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

Traceback (most recent call last): File "/home/c.c2097288/.conda/envs/insilicoseq/bin/iss", line 10, in sys.exit(main()) File "/home/c.c2097288/.local/lib/python3.7/site-packages/iss/app.py", line 608, in main args.func(args) File "/home/c.c2097288/.local/lib/python3.7/site-packages/iss/app.py", line 312, in generate_reads args.gc_bias, mode) for i in range(cpus)) File "/home/c.c2097288/.local/lib/python3.7/site-packages/joblib/parallel.py", line 1054, in call self.retrieve() File "/home/c.c2097288/.local/lib/python3.7/site-packages/joblib/parallel.py", line 933, in retrieve self._output.extend(job.get(timeout=self.timeout)) File "/home/c.c2097288/.local/lib/python3.7/site-packages/joblib/_parallel_backends.py", line 542, in wrap_future_result return future.result(timeout=timeout) File "/home/c.c2097288/.conda/envs/insilicoseq/lib/python3.7/concurrent/futures/_base.py", line 435, in result return self.get_result() File "/home/c.c2097288/.conda/envs/insilicoseq/lib/python3.7/concurrent/futures/_base.py", line 384, in get_result raise self._exception TypeError: data should be a string, bytes, bytearray, Seq, or MutableSeq object

How can I solve this? Thanks in advance.

hirosatosd commented 2 years ago

Try downgrading the biopython to 1.78. That worked for me

pip install biopython==1.78

bIomBen commented 2 years ago

Try downgrading the biopython to 1.78. That worked for me

pip install biopython==1.78

I have the same issue and downgrading biopython did not work for me

Gandasegui commented 2 years ago

I installed biopython 1.78 and it worked.

Thanks

bIomBen commented 2 years ago

I was able to fix the problem..I had biopython 1.78 installed in my conda enviroment but 1.79 previously installed via pip and for some reason my conda enviroment prefered using the 1.79 version. Downgrading this package aswell fixed the problem! Thanks! :)

HadrienG commented 2 years ago

I updated the bioconda recipe to require biopython <= 1.78. A minor version to fix the pip installs will follow soon

laxMax commented 1 year ago

Hi, I had the same issue and create a new conda enviroment to install biopython == 1.78. It turns out that it cannot work for me.

laxMax commented 1 year ago

Hi, I had the same issue and create a new conda enviroment to install biopython == 1.78. It turns out that it cannot work for me. Get this solved !