Skip to content

ValueError: fetch called on bamfile without index #56

@SabinaMT

Description

@SabinaMT

Hello @mlbendall!

I'm trying to run Telescope assign but I get this error. I sorted the bam file based on name and also I tried samtools collate. They both give me this error. I was wondering if you have any idea what could be happening.
Thank you for your time.

Command:
telescope assign /data1/sabina/telescope/bam/H3K4me2_IR01_48b.nodupsort.bam /data1/sabina/telescope/te_pan_gtf/IR01_48b.te_reference.gtf --ncpu 8 --outdir /data1/sabina/telescope/output --updated_sam

Output:

2024-01-24 13:28:27 INFO
Version: 1.0.3
Input Options
samfile: /data1/sabina/telescope/bam/H3K4me2_IR01_48b.nodupsort.bam
gtffile: /data1/sabina/telescope/te_pan_gtf/IR01_48b.te_reference.gtf
attribute: locus
no_feature_key: __no_feature
ncpu: 8
tempdir: /tmp/tmpq81tl_44
Reporting Options
quiet: False
debug: False
logfile:
outdir: /data1/sabina/telescope/output
exp_tag: telescope
updated_sam: True
Run Modes
reassign_mode: exclude
conf_prob: 0.9
overlap_mode: threshold
overlap_threshold: 0.2
annotation_class: intervaltree
Model Parameters
pi_prior: 0
theta_prior: 200000
em_epsilon: 1e-07
max_iter: 100
use_likelihood: False
skip_em: False
(from run in telescope_assign.py:197)
2024-01-24 13:28:27 INFO Loading annotation... (from run in telescope_assign.py:205)
2024-01-24 13:28:27 INFO Loaded annotation in 0 minutes and 0 secs (from run in telescope_assign.py:208)
2024-01-24 13:28:27 INFO Loaded 3684 features. (from run in telescope_assign.py:209)
2024-01-24 13:28:27 INFO Loading alignments... (from run in telescope_assign.py:214)
2024-01-24 13:28:27 INFO Loading alignments in parallel... (from _load_parallel in model.py:175)
2024-01-24 13:28:28 INFO processing IR01_48b.chr_1:0-6232260 (from fetch_region in alignment.py:191)
2024-01-24 13:28:28 INFO processing IR01_48b.chr_2:0-3836410 (from fetch_region in alignment.py:191)
2024-01-24 13:28:28 INFO processing IR01_48b.chr_10:0-1811216 (from fetch_region in alignment.py:191)
2024-01-24 13:28:28 INFO processing IR01_48b.chr_11:0-1636465 (from fetch_region in alignment.py:191)
2024-01-24 13:28:28 INFO processing IR01_48b.chr_12:0-1426635 (from fetch_region in alignment.py:191)
2024-01-24 13:28:28 INFO processing IR01_48b.chr_13:0-1167977 (from fetch_region in alignment.py:191)
2024-01-24 13:28:28 INFO processing IR01_48b.chr_16:0-543404 (from fetch_region in alignment.py:191)
2024-01-24 13:28:28 INFO processing IR01_48b.chr_20:0-423683 (from fetch_region in alignment.py:191)
2024-01-24 13:28:28 INFO processing IR01_48b.chr_19:0-541371 (from fetch_region in alignment.py:191)
2024-01-24 13:28:28 INFO processing IR01_48b.chr_21:0-339780 (from fetch_region in alignment.py:191)
2024-01-24 13:28:28 INFO processing IR01_48b.chr_3:0-3545279 (from fetch_region in alignment.py:191)
2024-01-24 13:28:28 INFO processing IR01_48b.chr_4:0-3013063 (from fetch_region in alignment.py:191)
2024-01-24 13:28:28 INFO processing IR01_48b.chr_5:0-2898299 (from fetch_region in alignment.py:191)
2024-01-24 13:28:28 INFO processing IR01_48b.chr_6:0-2494635 (from fetch_region in alignment.py:191)
2024-01-24 13:28:28 INFO processing IR01_48b.chr_7:0-2855057 (from fetch_region in alignment.py:191)
2024-01-24 13:28:28 INFO processing IR01_48b.chr_8:0-2400776 (from fetch_region in alignment.py:191)
2024-01-24 13:28:28 INFO processing IR01_48b.chr_9:0-1967252 (from fetch_region in alignment.py:191)
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/home/sabina/mambaforge/envs/telescope/lib/python3.10/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "/home/sabina/mambaforge/envs/telescope/lib/python3.10/multiprocessing/pool.py", line 48, in mapstar
return list(map(*args))
File "/home/sabina/mambaforge/envs/telescope/lib/python3.10/site-packages/telescope/utils/alignment.py", line 206, in fetch_region
samiter = sf.fetch(*region, multiple_iterators=True)
File "pysam/libcalignmentfile.pyx", line 1100, in pysam.libcalignmentfile.AlignmentFile.fetch
ValueError: fetch called on bamfile without index
"""

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

Traceback (most recent call last):
File "/home/sabina/mambaforge/envs/telescope/bin/telescope", line 10, in
sys.exit(main())
File "/home/sabina/mambaforge/envs/telescope/lib/python3.10/site-packages/telescope/main.py", line 95, in main
args.func(args)
File "/home/sabina/mambaforge/envs/telescope/lib/python3.10/site-packages/telescope/telescope_assign.py", line 216, in run
ts.load_alignment(annot)
File "/home/sabina/mambaforge/envs/telescope/lib/python3.10/site-packages/telescope/utils/model.py", line 159, in load_alignment
maps, scorerange, alninfo = self._load_parallel(annotation)
File "/home/sabina/mambaforge/envs/telescope/lib/python3.10/site-packages/telescope/utils/model.py", line 198, in _load_parallel
for mfile, scorerange, _pxu in result.get():
File "/home/sabina/mambaforge/envs/telescope/lib/python3.10/multiprocessing/pool.py", line 774, in get
raise self._value
ValueError: fetch called on bamfile without index

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions