Repository navigation
Gh1325 eva igv - #1360
Gh1325 eva igv#1360kebarr wants to merge 38 commits into
Conversation
… later if usage expands beyond IGV
…torised implementation, noticed in diff igv.ipynb had changed due to me running it previously, restored to original state and added nbstripout to pre-commit hooks to prevent this happening in future
…o agreement with reference VCF
…with compression despite me testing on uncompressed outputs, so I am unconvinced
… version and figure out removing homozygous sites
…can be made alognside VCF
…viously and their related tests
…n't work at all, or IGV-related funcitonality will not be available to Windows users
|
Just waiting for other tests to finished, but one failure: "FAILED tests/anoph/test_snp_frq.py::test_allele_frequencies_advanced_with_sample_query[af1_sim] - ValueError: variant_position_aa_change must not be empty" from tests(3.11,==2.0.2) appears to be related to code I haven't touched. Still waiting on the others. @jonbrenas @ahernank is this expected? Will update this comment if any further fail in similar ways. |
|
Thanks @kebarr. The other tests were cancelled on failure. I restarted the test that failed, I assume it is a transient error that resulted from the randomly selected region containing no non-synonymous mutations. We may want to update the tests at some point to treat such a lack of data as a warning instead of an error, but it probably requires a bit of thinking. |
|
Thanks @kebarr. Should we try to find some time next week for you to walk through what you have done? In the meantime, it looks like a lot of notebooks that don't have much to do with what you were doing were added to this PR. Could you do some clean up? |
|
@jonbrenas I've booked a meeting for Monday. The changes to the notebooks are a side-effect of me adding nbstripout to my pre-commit-hooks, because it was difficult looking through massive diffs whilst working on the notebook side. I'm in travel training all day but will figure out how to remove those from this PR tomorrow, and look into having a "personal" pre-commit hook with it or another way of making it easier. |
|
I did some profiling of the two steps required for my approach vs the previous approach. The previous approach includes indexed VCFs so lower memory consumption is expected. It appears, and makes sense that, the updated version uses more memoory when more SNPs are present in the region. Which would make guiding users much more difficult than just saying "don't load regions more than X bps." I've also attached the notebooks used for profiling + script used for making papermill run them in batches. Working on a more generalisable script. test_capture_mem_output.ipynb 10_samples_10_increments_default_vcf.csv |


Closes issues 1325 (the main motivation for starting this branch) and these discovered whilst working on fixes: 1357, and 1356.
Re-implement the to_vcf function so that snp_calls from native datasets can be used for visualisation with IGV. Uses Biopython’s bgzf option, the issue with this is that it does not enable the output VCF to be indexed without using external tools. This decision was made because neither pysam nor tabix can be used in Windows without WSL so this was the only way I could find of exposing this functionality to Windows users. This does mean that only small regions can be viewed through the IGV
This implementation only outputs heterozygous calls, this can be made an option if preferable. Missingness, is no longer tested for but can be re-added. The input has changed to require a single sample ID, as currently the only use case for this method is for IGV. These are breaking changes compared to the previous to_vcf method, but this was not used anywhere in the code base, so will not affect any other methods. It also now requires the output filename to end with “vcf.gz,”
Tests added in test_vcf_exporter and demo added to igv.ipynv - rather than replace the current IGV methods, the local VCF format has been added as an alternative to grabbing one from the external URL. For the IGV notebook to run, the VCFs must be written to a path within the “notebooks” directory, this is explained in the notebook.
Validation of output VCFs was carried out by comparing to VCF linked in wgs_data_catalogue. The results are not identical because the variant calling pipeline used a site list frozen at the time it was called, whereas this just pulls SNPs from the Zarr dataset for the specific sample. They were confirmed using tools from ”bedtools” and “bcftools” intersect for individual chromosomes and the full ag3 genome. There are n sites in active disagreement.
Prior to PR, full test suite was run, and coverage, reported as 98% for to_vcf and 96% for igv.