Skip to content

Dev #1

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

Merged
merged 6 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
FROM phusion/baseimage:jammy-1.0.1

ARG HTSLIB_VERSION=1.17

ENV TERM=xterm-256color \
HTSLIB_URL=https://github.com/samtools/htslib/releases/download/${HTSLIB_VERSION}/htslib-${HTSLIB_VERSION}.tar.bz2

COPY . minimap2_index_modifier

# install deps and cleanup apt garbage
RUN set -eux; \
apt-get update; \
apt-get install -y \
wget \
make \
autoconf \
gcc \
libcurl4-openssl-dev \
zlib1g-dev \
libbz2-dev \
liblzma-dev \
bzip2 \
&& rm -rf /var/lib/apt/lists/*;

#install htslib
RUN set -eux; \
mkdir temp; \
cd temp; \
\
wget ${HTSLIB_URL}; \
tar -xf htslib-${HTSLIB_VERSION}.tar.bz2; \
cd htslib-${HTSLIB_VERSION}; \
\
autoreconf -i; \
./configure; \
make; \
make install; \
cd ../../; \
rm -rf temp;

#install minimap2_index_modifier
RUN set -eux; \
cd minimap2_index_modifier; \
make; \
cp minimap2 /usr/local/bin; \
cd ../; \
rm -rf minimap2_index_modifier;

ENV LD_LIBRARY_PATH=/usr/local/lib
63 changes: 39 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,47 @@
## Build
install htslib 1.17
make
Minimap2_index_modifier
=======================
Minimap2_index_modifier is a fork of alignment tool [minimap2](https://github.com/lh3/minimap2).
Unlike the original tool, this can use the variants defined in the VCF file when generating the index, for more accurate alignment.

## Make gz and gz.tbi from VCF
bgzip -c filename.vcf > filename.vcf.gz\
tabix -p vcf filename.vcf.gz

## Run modified index creation
bgzip -c test.vcf > test.vcf.gz\
tabix -p vcf test.vcf.gz\
./minimap2 -d test/test.modified.mni --vcf-file-with-variants test/test_long_chr1.vcf.gz test/test.fasta
Minimap2_index_modifier can be used in the same way as the original minimap2.
To create a modified index use additional parameter `--vcf-file-with-variants <vcf-file>`.
```bash
minimap2 -d index.mmi --vcf-file-with-variants input.vcf.gz reference.fasta
```

Use flag --parse-haplotype if your VCF contains phased haplotypes
Use flag `--parse-haplotype` if your VCF contains phased haplotypes.

## Run test
## Contents
* [Installation](#installation)
* [Compiling from source](#compiling-from-source)
* [Docker](#docker)
* [Pre-built indexes](#pre-built-indexes)
* [Tests](#tests)

### Empty test
./minimap2 -d test/test.mni test/test.fasta\
./minimap2 -d test/test.modified.mni --vcf-file-with-variants test/empty.vcf.gz test/test.fasta\
diff test/test.mni test/test.modified.mni
## Installation
### Compiling from source
To compile from source, use this version of tools:

* GCC/G++ 11.4.0+
* HTSlib v1.17

### The same test
./minimap2 -d test/test.mni test/test.fasta\
./minimap2 -d test/test.modified.mni --vcf-file-with-variants test/test_long_chr1_the_same.vcf.gz test/test.fasta\
diff test/test.mni test/test.modified.mni
Command to compile:
```bash
cd minimap2_index_modifier && make
```

### Docker
Clone this repository and build a Docker image as follows.
```bash
docker build -t minimap2_index_modifier:2.24 .
```

## Pre-built indexes
This [link](https://nextcloud.ispras.ru/index.php/s/wcb9PpZyr8Gb5CC) contains pre-built modified indexes for next references:
* GRCh38 [(GCA_000001405.15)](https://ftp-trace.ncbi.nlm.nih.gov/giab/ftp/release/references/GRCh38/)
* GRCh37 [(hs37d5)](https://ftp-trace.ncbi.nlm.nih.gov/giab/ftp/release/references/GRCh37/)

## Tests
See [test/tests.md](test/tests.md) for more details.

### Not the same test
./minimap2 -d test/test.mni test/test.fasta\
./minimap2 -d test/test.modified.mni --vcf-file-with-variants test/test_long_chr1_not_the_same.vcf.gz test/test.fasta\
diff test/test.mni test/test.modified.mni
32 changes: 32 additions & 0 deletions test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
## Tests for minimap2_index_modiifer
There are three tests to check base functionality.

### Common test
This test create two index files: regular and modified.
```bash
minimap2 -d test/test.mni test/test.fasta
minimap2 -d test/test.modified.mni --vcf-file-with-variants test/test_long_chr1_not_the_same.vcf.gz test/test.fasta
diff test/test.mni test/test.modified.mni
```

Modified index file should contains extra string and some strings should be mismatched.

### Empty VCF test
If input VCF file contains no variants from reference modified index would be same as regular one.
```bash
minimap2 -d test/test.mni test/test.fasta
minimap2 -d test/test.modified.mni --vcf-file-with-variants test/empty.vcf.gz test/test.fasta
diff test/test.mni test/test.modified.mni
```

Index files should be the same (empty output after third command).

### Pseudo-variants test
In this test `test/test_long_chr1_the_same.vcf.gz` contains pseudo-variants (like A -> A, C -> C, etc). This variants would be processed with no effect.
```bash
minimap2 -d test/test.mni test/test.fasta
minimap2 -d test/test.modified.mni --vcf-file-with-variants test/test_long_chr1_the_same.vcf.gz test/test.fasta
diff test/test.mni test/test.modified.mni
```

Index files should be the same.
Loading