Adamtaranto / teloclip

A tool for the recovery of unassembled telomeres from soft-clipped read alignments.
Other
35 stars 4 forks source link

No 'rU' option in Python 3.12 #17

Closed PengfeiInTuebingen closed 10 months ago

PengfeiInTuebingen commented 10 months ago

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 commented 10 months ago

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 commented 10 months ago

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 commented 10 months ago

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

PengfeiInTuebingen commented 10 months ago

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