question-mark

Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pysam ValueError: start out of range (-1500)

See original GitHub issue

Issue Description

Version :

Truvari v3.1.0 (latest on pip)

Describe the bug :

Exits with the following stderr/stdout

2022-03-29 18:14:44,524 [INFO] Running /home/ubuntu/.local/bin/truvari bench --base /data/sv/samples/hg0073
3/hifiasm/variants.vcf.gz --comp /data/sv/samples/hg00733/hapdup/variants.vcf.gz --reference /data/sv/hg37/
human_g1k_v37.fasta -o /data/sv/samples/hg00733/hapdup/truvari --passonly -r 2000 -C 2000
2022-03-29 18:14:44,524 [INFO] Params:
{
    "base": "/data/sv/samples/hg00733/hifiasm/variants.vcf.gz",
    "comp": "/data/sv/samples/hg00733/hapdup/variants.vcf.gz",
    "output": "/data/sv/samples/hg00733/hapdup/truvari",
    "reference": "/data/sv/hg37/human_g1k_v37.fasta",
    "giabreport": false,
    "debug": false,
    "prog": false,
    "refdist": 2000,
    "pctsim": 0.7,
    "buffer": 0.1,
    "pctsize": 0.7,
    "pctovl": 0.0,
    "typeignore": false,
    "use_lev": false,
    "chunksize": 2000,
    "gtcomp": false,
    "bSample": null,
    "cSample": null,
    "sizemin": 50,
    "sizefilt": 30,
    "sizemax": 50000,
    "passonly": true,
    "no_ref": false,
    "includebed": null,
    "multimatch": false
}
2022-03-29 18:14:44,524 [INFO] Truvari version: 3.1.0
[W::bcf_update_info] INFO/END=0 is smaller than POS at 13:1
Traceback (most recent call last):
  File "/home/ubuntu/.local/bin/truvari", line 8, in <module>
    sys.exit(main())
  File "/home/ubuntu/.local/lib/python3.8/site-packages/truvari/__main__.py", line 82, in main
    TOOLS[args.cmd](args.options) 
  File "/home/ubuntu/.local/lib/python3.8/site-packages/truvari/bench.py", line 775, in bench_main
    for call in itertools.chain.from_iterable(map(compare_chunk, chunks)):
  File "/home/ubuntu/.local/lib/python3.8/site-packages/truvari/bench.py", line 398, in compare_chunk
    mat = matcher.build_match(b, c, f"{chunk_id}.{bid}.{cid}")
  File "/home/ubuntu/.local/lib/python3.8/site-packages/truvari/bench.py", line 212, in build_match
    ret.seqsim = truvari.entry_pctsim(base, comp, self.params.reference,
  File "/home/ubuntu/.local/lib/python3.8/site-packages/truvari/comparisons.py", line 257, in entry_pctsim
    allele1, allele2 = entry_create_haplotype(entryA, entryB, ref, buf_len=buf_len)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/truvari/comparisons.py", line 204, in entry_create_
haplotype
    return create_pos_haplotype(a1, a2, ref, buf_len=buf_len)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/truvari/comparisons.py", line 170, in create_pos_ha
plotype
    hap1_seq = ref.fetch(chrom, start, a1_start) + \
  File "pysam/libcfaidx.pyx", line 290, in pysam.libcfaidx.FastaFile.fetch
  File "pysam/libcutils.pyx", line 282, in pysam.libcutils.parse_region
ValueError: start out of range (-1500)

Expected behavior : No crash

Example Data : Willing to share if approved by @fenderglass

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
ACEnglishcommented, Mar 29, 2022

bwapy is only required for a couple of the truvari anno commands. It’s a kinda finicky package so I built it in a way that if its installation fails the rest of truvari still works. But if you wanted to fix it, I suspect you could simply do:

python3 -m pip install --upgrade setuptools
0reactions
rlorigrocommented, Mar 29, 2022

@ACEnglish It looks like the install fails when I build from the dev branch. It ends on this message:

Installed /usr/local/lib/python3.8/dist-packages/sortedcontainers-2.4.0-py3.8.egg
error: setuptools 45.2.0 is installed but setuptools>=49.2.0 is required by {'bwapy'}

But it does seem to be running despite this error…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python: start out of range · Issue #8 · adamewing/tldr - GitHub
Hi @adamewing I was trying to run TLDR with the drosophila genome and a specific TE library. ... ValueError: start out of range...
Read more >
ValueError: reference_id -1 out of range 0<=tid<65334. Any ...
If a read is unaligned, pysam returns a tid/reference_id of -1, which wont work in getrname(). Perhaps wrap it in a try/except block?...
Read more >
Pysam ValueError - Google Groups
I used pysam to read bamfile, samfile = pysam.AlignmentFile(os.path.join(path,bam),'rb') and wanted to count inside samfile, sum1 = samfile.count(chr,start ...
Read more >
Introduction — pysam 0.20.0 documentation
ValueError – if the genomic coordinates are out of range or invalid or the file does not permit random access to genomic coordinates....
Read more >
Package: python-pysam / 0.7.7-1 - Debian Sources
__samtools_version__): + raise ValueError("versions of pysam/samtools and samtools ... self.samfile.lengths): + for start in range( 1, length, 90): + self.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found