statgen / savvy

Interface to various variant calling formats.
Mozilla Public License 2.0
26 stars 5 forks source link

sav concat commend #34

Open Nahyeon203 opened 1 month ago

Nahyeon203 commented 1 month ago

I’m currently using the test VCF file you provided to create SAV files for chromosomes 18 and 20, and I encountered some issues when trying to concatenate the two SAV files.

Attempt 1: I used the following commands to create the SAV files:

sav import test_file.vcf test_file.sav
sav export --regions 18 test_file.sav > chr18.sav
sav export --regions 20 test_file.sav > chr20.sav
sav concat chr18.sav chr20.sav > concat.sav

However, when running the concat command, I received the following error:

Error: chr18.sav is not a SAV v2 file

Could you help me understand why chr18.sav is not recognized as a SAV v2 file?

Attempt 2:

I tried an alternative approach using the following commands:

sav import test_file.vcf test_file.sav
sav import --regions 18 test_file.sav > chr18.im.sav
sav import --regions 20 test_file.sav > chr20.im.sav
sav concat chr18.im.sav chr20.im.sav > concat.im.sav

This time, I received a different error:

Header dictionaries incompatible

When I inspect the headers using the sav head command, they appear to be identical. Could you provide any insight into why this issue occurs and how I might resolve it?

jonathonl commented 1 month ago

The first error is because the export sub command defaults to VCF as the default file format (while import defaults to SAV). You can add -O sav to the export command to specify that SAV should be the output file format.

I believe your second error was fixed with https://github.com/statgen/savvy/commit/82fb57602ccabb23ba5a686444102e842c382d28, which isn't in the latest release. Building the latest from the master branch should resolve this.

Nahyeon203 commented 1 month ago

I was able to resolve the first error using the method you mentioned.

However, I still haven’t been able to solve the second error. The version I installed is 2.1.0 Isn’t this the latest version? I installed it using the following command:

conda install -c conda-forge -c bioconda savvy
$sav --version
sav v2.1.0
jonathonl commented 1 month ago

The bug fix is NOT in the latest version. Until another release is made, you will need to install the latest commit to the master branch of the Git repo. The easiest way of doing this on Linux is to install cget with pip3 and run cget install --prefix <install_prefix> statgen/savvy. See https://github.com/statgen/savvy?tab=readme-ov-file#installing.