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

AttributeError: 'CollapsedCalls' object has no attribute 'consolidate' | version 4.2.1 #196

Closed
leone93 opened this issue Feb 11, 2024 · 4 comments

Comments

@leone93
Copy link

leone93 commented Feb 11, 2024

Version : Truvari v4.2.1

Describe the bug :
2024-02-11 15:51:37,661 [INFO] Truvari v4.2.1
2024-02-11 15:51:37,662 [INFO] Command /home/fabbial/truvari/bin/truvari collapse --gt het --chain -i sample_merged.vcf.gz -o truvari_merge.vcf -c truvari_collapsed.vcf -f /home/fabbial/reference/all.chrs.con.fasta
2024-02-11 15:51:37,669 [INFO] Params:
{
"input": "sample_merged.vcf.gz",
"output": "truvari_merge.vcf",
"collapsed_output": "truvari_collapsed.vcf",
"reference": "/home/fabbial/reference/all.chrs.con.fasta",
"keep": "first",
"bed": null,
"gt": "het",
"intra": false,
"median_info": false,
"debug": false,
"refdist": 500,
"pctseq": 0.95,
"minhaplen": 50,
"pctsize": 0.95,
"pctovl": 0.0,
"typeignore": false,
"hap": false,
"chain": true,
"no_consolidate": true,
"null_consolidate": null,
"sizemin": 50,
"sizemax": 50000,
"passonly": false,
"chunksize": 500,
"bSample": null,
"cSample": null,
"sizefilt": 50,
"no_ref": false
}
2024-02-11 15:51:37,676 [WARNING] Unresolved SVs (e.g. ALT=) are filtered when --pctseq != 0
Traceback (most recent call last):
File "/home/fabbial/truvari/bin/truvari", line 8, in
sys.exit(main())
^^^^^^
File "/home/fabbial/truvari/lib/python3.11/site-packages/truvari/main.py", line 105, in main
TOOLSargs.cmd
File "/home/fabbial/truvari/lib/python3.11/site-packages/truvari/collapse.py", line 799, in collapse_main
for call in itertools.chain.from_iterable(map(m_collap, even_smaller_chunks)):
File "/home/fabbial/truvari/lib/python3.11/site-packages/truvari/collapse.py", line 148, in collapse_chunk
if not matcher.chain or not chain_collapse(m_collap, ret, matcher):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/fabbial/truvari/lib/python3.11/site-packages/truvari/collapse.py", line 110, in chain_collapse
m_collap.consolidate(cur_collapse)
^^^^^^^^^^^^^^^^^^^^
AttributeError: 'CollapsedCalls' object has no attribute 'consolidate'

Expected behavior :
Working

Example Data :
If applicable/possible, add example data to help recreate your problem.

Additional context :
I tried both installing with python venv (your instruction) and with pip in a clear conda environment. Same results. Operating on svim2 vcf.

@leone93
Copy link
Author

leone93 commented Feb 11, 2024

Actually I have the same bug with version 4.2.0 but 4.1.0 is working

@ACEnglish
Copy link
Owner

Hello,

You have exposed a gap in my functional tests' coverage. I have added a putative fix to develop, but it's going to take time to ensure it works while I make synthetic data that reaches that line of code. I will keep you updated.

If you'd like to move ahead and test it, keep me updated on if it works. Alternatively, since this is caused by the--chain parameter, you could presumably run successfully without it.

Thanks
~/Adam English

ACEnglish added a commit that referenced this issue Feb 11, 2024
functional tests failed to hit chain collapse
@leone93
Copy link
Author

leone93 commented Feb 11, 2024

Thanks for your fast answer.
I can test the dev version, meanwhile. Where can I find it?

Leonardo

ACEnglish added a commit that referenced this issue Feb 11, 2024
A single site, but it covers the logic
@ACEnglish
Copy link
Owner

ACEnglish commented Feb 11, 2024

The test coverage is complete. There were a couple of more tweaks I had to make to get it to work for the test data.

You can install from develop directly from the repository:

git clone https://github.com/ACEnglish/truvari.git
cd truvari/
python3 -m pip install .

Edit: I'm unsure when I'll cut a release for this since I just put out a patch last week and I'm currently halfway into implementing a new minor release. So I don't know how long you'll have to use develop.

Below are some notes I need to make related to this ticket so I remember them:
The new test example has three deletions where A matches B and B matches C, but A does not match C when --pctseq 0 --pctsize 0.35. Without --chain A and B would be collapsed and C (because A!=C) would be left alone.

chr21    14088112    14088558    A
chr21    14088212    14088828    B
chr21    14088312    14089203    C

Still need tests to reach conditions around e.g. --chain --gt all

Variant C in the test example will be added to the --collapsed-output with metrics of its similarity to Variant B since that's the one that 'pulled' it into the CollapsedCalls.

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