# Dockerized mvMAPIT

In order to enable users to work with mvMAPIT without having to install all dependencies and libraries on their local, we provide a docker build with all dependencies and an installed R package `mvMAPIT`. Learn how to build your own version of the docker image.

## Docker Setup

Follow the official guide to learn how to Get Docker. This is required for being able to follow this tutorial.

## Build an Image with mvMAPIT

The github repository of mvMAPIT already comes with a `Dockerfile`. To build the image, clone the github repository and run the following commands.

    cd mvMAPIT
    docker build -t mvmapit .

This will produce an image named `mvmapit` that contains `Rstudio`, `mvMAPIT`, and all dependencies.

## Run the mvMAPIT Image

With a local copy of the docker image `mvmapit` available, run the following code.

    docker run --rm -ti \
        -e DISABLE_AUTH=true \
        -p 8787:8787 \
        --name my_container \
        mvmapit

This will start the docker container that serves an RStudio application at `localhost:8787`. In this container, `mvMAPIT` is already installed and can be imported and run in the R console via the following code.

    library(mvMAPIT)
    mvmapit(t(simulated_data$genotype[1:100,1:10]),
            t(simulated_data$trait[1:100,]),
            cores = 2, logLevel = "DEBUG")

    ## 2026-02-20 18:17:11.752763 DEBUG:mvmapit:Running in normal test mode.
    ## 2026-02-20 18:17:11.756005 DEBUG:mvmapit:Genotype matrix: 10 x 100
    ## 2026-02-20 18:17:11.758907 DEBUG:mvmapit:Phenotype matrix: 2 x 100
    ## 2026-02-20 18:17:11.75922 DEBUG:mvmapit:Number of zero variance variants: 0
    ## 2026-02-20 18:17:11.759511 DEBUG:mvmapit:Genotype matrix after removing zero variance variants: 10 x 100
    ## 2026-02-20 18:17:11.759714 DEBUG:mvmapit:Scale X matrix appropriately.
    ## 2026-02-20 18:17:11.760121 INFO:mvmapit:Running normal C++ routine.
    ## 2026-02-20 18:17:11.766399 DEBUG:mvmapit:Calculated mean time of execution. Return list.

    ## $pvalues
    ## # A tibble: 30 × 3
    ##    id        trait         p
    ##    <chr>     <chr>     <dbl>
    ##  1 snp_00001 p_01*p_01 0.435
    ##  2 snp_00001 p_02*p_01 0.476
    ##  3 snp_00001 p_02*p_02 0.909
    ##  4 snp_00002 p_01*p_01 0.510
    ##  5 snp_00002 p_02*p_01 0.606
    ##  6 snp_00002 p_02*p_02 0.326
    ##  7 snp_00003 p_01*p_01 0.452
    ##  8 snp_00003 p_02*p_01 0.536
    ##  9 snp_00003 p_02*p_02 0.140
    ## 10 snp_00004 p_01*p_01 0.688
    ## # ℹ 20 more rows
    ##
    ## $pves
    ## # A tibble: 30 × 3
    ##    id        trait          PVE
    ##    <chr>     <chr>        <dbl>
    ##  1 snp_00001 p_01*p_01  0.0615
    ##  2 snp_00001 p_02*p_01  0.0663
    ##  3 snp_00001 p_02*p_02 -0.00451
    ##  4 snp_00002 p_01*p_01 -0.0215
    ##  5 snp_00002 p_02*p_01 -0.0239
    ##  6 snp_00002 p_02*p_02 -0.0287
    ##  7 snp_00003 p_01*p_01  0.0579
    ##  8 snp_00003 p_02*p_01  0.0493
    ##  9 snp_00003 p_02*p_02 -0.0400
    ## 10 snp_00004 p_01*p_01 -0.0146
    ## # ℹ 20 more rows
    ##
    ## $duration
    ##       process duration_ms
    ## 1         cov   0.1666667
    ## 2 projections   0.1666667
    ## 3   vectorize   0.1666667
    ## 4           q   0.1666667
    ## 5           S   0.1666667
    ## 6          vc   0.1666667
    ##
    ## $vc
    ## # A tibble: 30 × 4
    ##    id        trait           VC     SE
    ##    <chr>     <chr>        <dbl>  <dbl>
    ##  1 snp_00001 p_01*p_01  0.0724  0.0928
    ##  2 snp_00001 p_02*p_01  0.0393  0.0551
    ##  3 snp_00001 p_02*p_02 -0.00490 0.0430
    ##  4 snp_00002 p_01*p_01 -0.0249  0.0378
    ##  5 snp_00002 p_02*p_01 -0.0145  0.0282
    ##  6 snp_00002 p_02*p_02 -0.0318  0.0323
    ##  7 snp_00003 p_01*p_01  0.0693  0.0921
    ##  8 snp_00003 p_02*p_01  0.0304  0.0491
    ##  9 snp_00003 p_02*p_02 -0.0442  0.0300
    ## 10 snp_00004 p_01*p_01 -0.0177  0.0440
    ## # ℹ 20 more rows