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

TypeError: __init__() takes 2 positional arguments but 3 were given #24

Open
marcejuarez90 opened this issue May 5, 2023 · 3 comments

Comments

@marcejuarez90
Copy link

Hi, I'm trying to use read2tree, but after it finishes making the orthologous genes selection and allignment it gives me the error I'm attaching. I suspect that it has something to do with this specific line in the Aligner.py script:

SeqRecord(Seq("".join(self._get_translated_seq_list(codon, str(rec.seq))), generic_dna), id=rec.id))

the error is:

TypeError: init() takes 2 positional arguments but 3 were given

maybe I am doing something wrong. I've tried to use it both in single and multi species mode but it crashes in the same place.

Also I'm attaching the print out of the error. Could you help me please? and thanks a lot, it looks like a very promising tool

--- Load OGs with min 0 species from oma OMA/marker_genes - mode = marker_genes --- Loading files for pre-filter: 100%|████████████████████████████████████████████| 8047/8047 [00:00<00:00, 10035.98 OGs/s]2023-05-05 14:02:34,049

  • read2tree.OGSet - INFO - --- Load ogs and find their corresponding DNA seq using the REST api --- Loading OGs: 100%|██████████████████████████████████████████████████████████████| 8047/8047 [2:15:21<00:00, 1.01s/ OGs] 2023-05-05 16:17:55,512 - read2tree.OGSet
  • INFO - : Gathering of DNA seq for 8047 OGs took 8121.462993144989.
  • --- Generating reference for mapping ---
  • Loading records: 100%█████████████████████████████████████████████████████████████████████████████████████████████████████| 8047/8047 [00:00<00:00, 115837.87 record/s]2023-05-05 16:17:55,583 - read2tree.ReferenceSet - INFO - : Extracted 5 reference species form 8047 ogs took 0.07038140296936035
  • --- Alignment of 8047 OGs --- multiprocessing.pool.RemoteTraceback: """ Traceback (most recent call last):
    File "/home/mjuarez/anaconda3/lib/python3.7/multiprocessing/pool.py", line 121, in worker result = (True, func(*args, **kwds))
    File "/home/mjuarez/anaconda3/lib/python3.7/multiprocessing/pool.py", line 44, in mapstar return list(map(*args))
    File "/home/mjuarez/anaconda3/lib/python3.7/site-packages/read2tree-0.1.5-py3.7.egg/read2tree/Aligner.py", line 292, in _align_worker align.dna = self._get_translated_alignment(codons, alignment)
    File "/home/mjuarez/anaconda3/lib/python3.7/site-packages/read2tree-0.1.5-py3.7.egg/read2tree/Aligner.py", line 218, in _get_translated_alignment
    SeqRecord(Seq("".join(self._get_translated_seq_list(codon, str(rec.seq))), generic_dna), id=rec.id))
    TypeError: init() takes 2 positional arguments but 3 were given """

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

Traceback (most recent call last):
File "/home/mjuarez/anaconda3/bin/read2tree", line 4, in import('pkg_resources').run_script('read2tree==0.1.5', 'read2tree')
File "/home/mjuarez/anaconda3/lib/python3.7/site-packages/pkg_resources/init.py", line 667, in run_script self.require(requires)[0].run_script(script_name, ns)
File "/home/mjuarez/anaconda3/lib/python3.7/site-packages/pkg_resources/init.py", line 1470, in run_script exec(script_code, namespace, namespace)
File "/home/mjuarez/anaconda3/lib/python3.7/site-packages/read2tree-0.1.5-py3.7.egg/EGG-INFO/scripts/read2tree", line 16, in
File "/home/mjuarez/anaconda3/lib/python3.7/site-packages/read2tree-0.1.5-py3.7.egg/read2tree/main.py", line 291, in main
File "/home/mjuarez/anaconda3/lib/python3.7/site-packages/read2tree-0.1.5-py3.7.egg/read2tree/Aligner.py", line 51, in init
File "/home/mjuarez/anaconda3/lib/python3.7/site-packages/read2tree-0.1.5-py3.7.egg/read2tree/Aligner.py", line 330, in _align File "/home/mjuarez/anaconda3/lib/python3.7/multiprocessing/pool.py", line 268, in map return self._map_async(func, iterable, mapstar, chunksize).get()
File "/home/mjuarez/anaconda3/lib/python3.7/multiprocessing/pool.py", line 657, in get raise self._value
TypeError: init() takes 2 positional arguments but 3 were given

@sinamajidian
Copy link
Contributor

Dear @marcejuarez90

Thanks for using read2tree.

I would suggest using python version 3.10.8 (with a fresh environment) instead of python 3.7. I also suggest running read2tree on the test dataset provided on the github page.

You can run in two steps

read2tree --standalone_path marker_genes --output_path output --reference
read2tree --tree --standalone_path marker_genes --reads sample_1.fastq sample_2.fastq --output_path output

If still you have an issue, please let us how you find the gene markers and the command you run.

Best regards,
Sina

@afairnie
Copy link

Hello,

I'm also experiencing a similar issue to the one posed in issue #24. I also have the error "TypeError: init() takes 2 positional arguments but 3 were given" and I'm still encountering problems. My python version is 3.10.8. I found the marker genes using the OMA browser and instructions from your GitHub. It could easy be my code because I'm an absolute beginner. The file attached explains how I selected the marker genes, and the code I ran for making the tree:

r2t_2024JAN26.txt

I would be very grateful if you have any advice or can help.

Kind regards,

Alice

@sinamajidian
Copy link
Contributor

Dear Alice @afairnie

Thanks for reaching out. Could you please send us the mplog.log file?
I had a run with 9 species that you mentioned

wget https://omabrowser.org/media/markers/marker_genes_7887d74f24fe883b16b92fe9f6b0d40b.tgz
tar -cvfz marker_genes_7887d74f24fe883b16b92fe9f6b0d40b.tgz 
cat marker_genes/*.fna > dna_ref.fa
read2tree  --reference --standalone_path marker_genes/  --output_path output --dna_reference  dna_ref.fa 

Could you please try the same procedure ?
This finished successfully.

--- Load OGs with min 0 species from oma marker_genes - mode = marker_genes ---
Loading files for pre-filter: 100%|█████████████████████████████████████| 400/400 [00:00<00:00, 1002.08 OGs/s]
2024-01-31 11:15:01,262 - read2tree.OGSet - INFO - --- Load ogs and find their corresponding DNA seq from dna_ref.fa ---
2024-01-31 11:15:01,262 - read2tree.OGSet - INFO - Loading dna_ref.fa into memory. This might take a while . . . 
Loading OGs: 100%|██████████████████████████████████████████████████████| 400/400 [00:00<00:00, 1117.43 OGs/s]
2024-01-31 11:15:01,676 - read2tree.OGSet - INFO - : Gathering of DNA seq for 400 OGs took 0.3587369918823242.
--- Generating reference for mapping ---
Loading records: 100%|██████████████████████████████████████████████| 400/400 [00:00<00:00, 81880.02 record/s]
2024-01-31 11:15:01,682 - read2tree.ReferenceSet - INFO - : Extracted 9 reference species form 400 ogs took 0.005280256271362305
--- Alignment of 400 OGs ---
/work/FAC/FBM/DBC/cdessim2/default/smajidi1/software/miniconda/envs/r2t_3.10.8b/lib/python3.10/subprocess.py:961: RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used
  self.stdout = io.open(c2pread, 'rb', bufsize)
/work/FAC/FBM/DBC/cdessim2/default/smajidi1/software/miniconda/envs/r2t_3.10.8b/lib/python3.10/subprocess.py:966: RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used
  self.stderr = io.open(errread, 'rb', bufsize)
2024-01-31 11:17:27,686 - read2tree.Aligner - INFO - : Alignment of 400 OGs took 145.98742842674255.

As I didn't have your sequencing reads, I only run the first step of read2tree by adding --reference to the command line. ( and I guess the issue is related to the first step of read2tree)

I'm also wondering what is your Biopython version? mine is 1.81

Best,
Sina

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

3 participants