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

Update indelpost to fix realignment bug #91

Open
aroon-color opened this issue Feb 25, 2025 · 0 comments
Open

Update indelpost to fix realignment bug #91

aroon-color opened this issue Feb 25, 2025 · 0 comments

Comments

@aroon-color
Copy link
Contributor

genome_aln_pos = ref_start + aln.reference_start
aligned_read_len = (aln.read_end - aln.read_start)
window_len = window * 6

Hi @inumanag

There's a known bug in this indelpost function that was fixed/worked around about 2 years ago: https://github.com/stjude/indelPost/blob/ecad282eada13e6bb7e54c4b6fe5d32808cca233/indelpost/pileup.pyx#L654-L656

Could you either update the vendored indelpost to the latest release from St Judes or cherrypick this change in? We have a number of samples that reliable trip this particular indelpost bug, where it will correctly run ~10-15% of the time but fail the remainder of times. For example, for this one sample (which I'm happy to provide via email):

for i in $(seq 0 20); uvx --with-requirements $PWD/3rdparty/aldy/requirements.txt aldy genotype --profile illumina -g ugt1a1 --cn=1,1 --output run.$i.aldy --genome hg19 sample.bam

17 of the runs fail with:

🐿  Aldy v4.7 (Python 3.13.1 on macOS 15.3.1)
   (c) 2016-2025 Aldy Authors. All rights reserved.
   Free for non-commercial/academic use only.
Genotyping sample sample.bam...
Trace back error: 0.
ERROR: gene= ugt1a1, file= sample.bam
AttributeError("'NoneType' object has no attribute 'count'")
Traceback (most recent call last):
  File ".cache/uv/archive-v0/cV0mTG-moBE_x3g4pb_YH/lib/python3.13/site-packages/aldy/__main__.py", line 122, in main
    _genotype(args.gene, output, args)
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".cache/uv/archive-v0/cV0mTG-moBE_x3g4pb_YH/lib/python3.13/site-packages/aldy/__main__.py", line 443, in _genotype
    run(None)
    ~~~^^^^^^
  File ".cache/uv/archive-v0/cV0mTG-moBE_x3g4pb_YH/lib/python3.13/site-packages/aldy/__main__.py", line 393, in run
    _ = genotype(
        gene_db=gene,
    ...<8 lines>...
        **{k: v for k, v in params.items() if v is not None},
    )
  File ".cache/uv/archive-v0/cV0mTG-moBE_x3g4pb_YH/lib/python3.13/site-packages/aldy/genotype.py", line 186, in genotype
    sample = sam.Sample(gene, profile, sam_path, reference, debug)
  File ".cache/uv/archive-v0/cV0mTG-moBE_x3g4pb_YH/lib/python3.13/site-packages/aldy/sam.py", line 117, in __init__
    norm, muts = self._load_sam(path, reference, debug)
                 ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
  File ".cache/uv/archive-v0/cV0mTG-moBE_x3g4pb_YH/lib/python3.13/site-packages/aldy/sam.py", line 168, in _load_sam
    self._realign_indels(tmp, sam, reference)
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
  File ".cache/uv/archive-v0/cV0mTG-moBE_x3g4pb_YH/lib/python3.13/site-packages/aldy/sam.py", line 499, in _realign_indels
    valn = VariantAlignment(  # type: ignore
        v,
    ...<4 lines>...
        exact_match_for_shiftable=exact_match_for_shiftable,
    )
  File "aldy/indelpost/varaln.pyx", line 169, in aldy.indelpost.varaln.VariantAlignment.__cinit__
  File "aldy/indelpost/varaln.pyx", line 299, in aldy.indelpost.varaln.VariantAlignment._VariantAlignment__parse_pileup
  File "aldy/indelpost/varaln.pyx", line 1165, in aldy.indelpost.varaln.grid_search
  File "aldy/indelpost/pileup.pyx", line 788, in aldy.indelpost.pileup.retarget
  File "aldy/indelpost/pileup.pyx", line 788, in aldy.indelpost.pileup.retarget
  File "aldy/indelpost/pileup.pyx", line 659, in aldy.indelpost.pileup.retarget
AttributeError: 'NoneType' object has no attribute 'count'

and 3 create the expected UGT1A1 result:

🐿  Aldy v4.7 (Python 3.13.1 on macOS 15.3.1)
   (c) 2016-2025 Aldy Authors. All rights reserved.
   Free for non-commercial/academic use only.
Genotyping sample XH2W3GDMX2_CHE-003710-A7_CGCTGTTGAC-CAAGAATTGG.bam...
Potential UGT1A1 gene structures for XH2W3GDMX2_CHE-003710-A7_CGCTGTTGAC-CAAGAATTGG:
   1: 2x*1 (confidence: 100%)
Potential major UGT1A1 star-alleles for XH2W3GDMX2_CHE-003710-A7_CGCTGTTGAC-CAAGAATTGG:
   1: 2x*1 (confidence: 100%)
Best UGT1A1 star-alleles for XH2W3GDMX2_CHE-003710-A7_CGCTGTTGAC-CAAGAATTGG:
   1: *1 / *1 (confidence=100%)
      Minor alleles: *1, *1
UGT1A1 results:
  - *1 / *1
    Minor: [*1] / [*1]
    Legacy notation: [*1] / [*1]
    Estimated activity for *1: unknown
    Estimated activity for *1: unknown
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

1 participant