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

No 'rU' option in Python 3.12 #17

Closed
PengfeiInTuebingen opened this issue Nov 1, 2023 · 4 comments
Closed

No 'rU' option in Python 3.12 #17

PengfeiInTuebingen opened this issue Nov 1, 2023 · 4 comments

Comments

@PengfeiInTuebingen
Copy link

hi,
I just found this tool and I was trying to fill telomere to our assembly.
I just installed this tool by conda as you wrote
conda install -c bioconda teloclip
then I tried use the test data like:
[$]> lh
total 180K
-rw-r--r-- 1 pliu ebio 17K Nov 1 13:28 test.bam
-rw-r--r-- 1 pliu ebio 336 Nov 1 13:28 test.bam.bai
-rw-r--r-- 1 pliu ebio 5.4K Nov 1 13:28 test.fna
-rw-r--r-- 1 pliu ebio 95 Nov 1 13:28 test.fna.fai
-rw-r--r-- 1 pliu ebio 141K Nov 1 13:28 test.sam
[$]
> samtools view -h test.bam | teloclip --ref test.fna.fai | samtools sort > out.bam
Traceback (most recent call last):
File "/ebio/abt5_projects/3D_genome_of_brown_algae/envs/hic/bin/teloclip", line 10, in
sys.exit(main())
^^^^^^
File "/ebio/abt5_projects/3D_genome_of_brown_algae/envs/hic/lib/python3.11/site-packages/teloclip/run_self.py", line 44, in main
ContigDict = teloclip.read_fai(args.refIdx)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ebio/abt5_projects/3D_genome_of_brown_algae/envs/hic/lib/python3.11/site-packages/teloclip/init.py", line 247, in read_fai
with open(path, "rU") as f:
^^^^^^^^^^^^^^^^
ValueError: invalid mode: 'rU'
samtools sort: failed to read header from "-";
then I tried run another command:
[$]~> samtools view -h test.bam | teloclip --ref test.fna.fai --motifs TTAGGG | teloclip-extract --refIdx test.fna.fai --extractReads --extractDir SplitOverhangs
Importing reference contig info from: test.fna.fai
Traceback (most recent call last):
File "/ebio/abt5_projects/3D_genome_of_brown_algae/envs/hic/bin/teloclip", line 10, in
Traceback (most recent call last):
File "/ebio/abt5_projects/3D_genome_of_brown_algae/envs/hic/bin/teloclip-extract", line 10, in
sys.exit(main())
^^^^^^
File "/ebio/abt5_projects/3D_genome_of_brown_algae/envs/hic/lib/python3.11/site-packages/teloclip/run_self.py", line 44, in main
sys.exit(main())
^^^^^^
File "/ebio/abt5_projects/3D_genome_of_brown_algae/envs/hic/lib/python3.11/site-packages/teloclip/run_extract.py", line 283, in main
ContigDict = teloclip.read_fai(args.refIdx)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ebio/abt5_projects/3D_genome_of_brown_algae/envs/hic/lib/python3.11/site-packages/teloclip/init.py", line 247, in read_fai
with open(path, "rU") as f:
^^^^^^^^^^^^^^^^
ValueError: invalid mode: 'rU'
contigInfo = teloclip.read_fai(args.refIdx)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ebio/abt5_projects/3D_genome_of_brown_algae/envs/hic/lib/python3.11/site-packages/teloclip/init.py", line 247, in read_fai
with open(path, "rU") as f:
^^^^^^^^^^^^^^^^
ValueError: invalid mode: 'rU'
do you have any idea about this issue?
Best, PF

@Adamtaranto
Copy link
Owner

This issue was raised in issue #11 it is due to file read mode "rU" being removed in Python 3.11

I've fixed this on the main branch of this repo but haven't pushed updates to conda and pypi yet.

In the meantime, clone the repo and do a local pip install like this:
git clone https://github.com/Adamtaranto/teloclip.git && cd teloclip && pip install -e .

Or run in a conda env with an earlier version of Python.

@PengfeiInTuebingen
Copy link
Author

Thanks for your reply, now it works with test data.
i am using my own data now, I got another issue:
[$]~> teloclip --ref V5.male.fasta.fai male.minimap2.sam
@pg ID:minimap2 PN:minimap2 VN:2.17-r941 CL:minimap2 -ax map-ont /ebio/scratch/fhaas/Ec_nanopore/Ec32/basecall_Ec32_modbase_all_super_V3/pass/Ec32_all.fasta V5.male.fasta
Reference sequence not found in FAI file: 58e481aa-cb3d-418f-9194-fc89512d369e
saying i didn't build index for my genome, actually i build the index(samtools faidx V5.male.fasta), do you have any idea about this?

@Adamtaranto
Copy link
Owner

Can you post the contents of your fai index file, and also the headers and first couple of alignments from your sam file.

@PengfeiInTuebingen
Copy link
Author

Thanks a lot. I found an issue with my script, and now I have solved it. Thank you so much for the promotion!!!

@Adamtaranto Adamtaranto changed the title can't run this tool even use test data No 'rU' option in Python 3.12 Nov 2, 2023
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