The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
‘minimapR’ is a wrapper for ‘Minimap2’. ‘Minimap2’ is a very valuable long read aligner for the Pacbio and Oxford Nanopore Technologies sequencing platforms. ‘minimapR’ is an R wrapper for ‘minimap2’ which was developed by Heng Li me@liheng.org. This tool aligns long reads to a reference genome and is used in many different bioinformatics workflows.
library(minimapR)
#> Loading required package: Rsamtools
#> Loading required package: GenomeInfoDb
#> Loading required package: BiocGenerics
#>
#> Attaching package: 'BiocGenerics'
#> The following objects are masked from 'package:stats':
#>
#> IQR, mad, sd, var, xtabs
#> The following objects are masked from 'package:base':
#>
#> Filter, Find, Map, Position, Reduce, anyDuplicated, aperm, append,
#> as.data.frame, basename, cbind, colnames, dirname, do.call,
#> duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
#> lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin,
#> pmin.int, rank, rbind, rownames, sapply, saveRDS, setdiff, table,
#> tapply, union, unique, unsplit, which.max, which.min
#> Loading required package: S4Vectors
#> Loading required package: stats4
#>
#> Attaching package: 'S4Vectors'
#> The following object is masked from 'package:utils':
#>
#> findMatches
#> The following objects are masked from 'package:base':
#>
#> I, expand.grid, unname
#> Loading required package: IRanges
#> Loading required package: GenomicRanges
#> Loading required package: Biostrings
#> Loading required package: XVector
#>
#> Attaching package: 'Biostrings'
#> The following object is masked from 'package:base':
#>
#> strsplit
#> Loading required package: pafr
#> Loading required package: ggplot2
‘minimap2’ and ‘samtools’ must be installed on your system along with the R packages ‘Rsamtools’, ‘git2r’, and ‘pafr’. ‘minimap2’ can be installed on various operating systems by running the following function or following the instruction from the output of the function. “/your/path/to/directory/for/install” should be replaced with the path to the directory where you want to install ‘minimap2’.
check if dependencies were successfully installed.
We will download the reference genomes and the query sequences for the example. The reference genomes are the human genome (GRCh38) and the yeast genome (S288C). The query sequences are the human ONT reads and yeast HIFI reads.
tmp_folder <- tempdir()
cat("Temporary folder is:", tmp_folder, "\n")
#> Temporary folder is: /var/folders/5v/ln0t2kjj24g0vmr9t6qwp2rh0000gp/T//Rtmp6Cb3FB
href_url <- "https://github.com/jake-bioinfo/minimapR/raw/master/inst/extdata/GRCh38_chr1_130k.fa.gz"
hfq_url <- "https://github.com/jake-bioinfo/minimapR/raw/master/inst/extdata/ont_hs_sample.fastq.gz"
yref_url <- "https://github.com/jake-bioinfo/minimapR/raw/master/inst/extdata/S288C_ref_genome.fasta.gz"
yfq_url <- "https://github.com/jake-bioinfo/minimapR/raw/master/inst/extdata/yeast_sample_hifi.fastq.gz"
url_list <- c(href_url, hfq_url, yref_url, yfq_url)
lapply(url_list, function(x) download.file(x, destfile = file.path(tmp_folder, basename(x))))
#> [[1]]
#> [1] 0
#>
#> [[2]]
#> [1] 0
#>
#> [[3]]
#> [1] 0
#>
#> [[4]]
#> [1] 0
# Contents of the temporary folder
cat("Contents of the temporary folder are:", "\n")
#> Contents of the temporary folder are:
fa_list <- list.files(tmp_folder, pattern = ".fa", full.names = TRUE)
fa_list
#> [1] "/var/folders/5v/ln0t2kjj24g0vmr9t6qwp2rh0000gp/T//Rtmp6Cb3FB/GRCh38_chr1_130k.fa.gz"
#> [2] "/var/folders/5v/ln0t2kjj24g0vmr9t6qwp2rh0000gp/T//Rtmp6Cb3FB/S288C_ref_genome.fasta.gz"
#> [3] "/var/folders/5v/ln0t2kjj24g0vmr9t6qwp2rh0000gp/T//Rtmp6Cb3FB/ont_hs_sample.fastq.gz"
#> [4] "/var/folders/5v/ln0t2kjj24g0vmr9t6qwp2rh0000gp/T//Rtmp6Cb3FB/yeast_sample_hifi.fastq.gz"
We will align the human ONT reads to the human genome and the yeast HIFI reads to the yeast genome using ‘minimap2’. The ‘minimap2’ function returns a data frame with the alignment information.
# Human ONT alignment
h_out <- file.path(tmp_folder, "ont_hs_sample")
h_alignment <- minimap2(reference = fa_list[1],
query_sequences = fa_list[2],
output_file_prefix = h_out,
preset_string = "map-ont",
threads = 4,
return = TRUE,
verbose = FALSE)
# Yeast HIFI alignment
y_out <- file.path(tmp_folder, "yeast_sample_hifi")
y_alignment <- minimap2(reference = fa_list[3],
query_sequences = fa_list[4],
output_file_prefix = y_out,
preset_string = "map-hifi",
threads = 4,
return = TRUE,
verbose = TRUE)
#> Generating output file: /var/folders/5v/ln0t2kjj24g0vmr9t6qwp2rh0000gp/T//Rtmp6Cb3FB/yeast_sample_hifi
#> Running minimap2...
#> Running minimap with the following command:
#> /Users/jakereed/mamba/bin/minimap2 -ax map-hifi -t 4 /var/folders/5v/ln0t2kjj24g0vmr9t6qwp2rh0000gp/T//Rtmp6Cb3FB/ont_hs_sample.fastq.gz /var/folders/5v/ln0t2kjj24g0vmr9t6qwp2rh0000gp/T//Rtmp6Cb3FB/yeast_sample_hifi.fastq.gz -o /var/folders/5v/ln0t2kjj24g0vmr9t6qwp2rh0000gp/T//Rtmp6Cb3FB/yeast_sample_hifi.sam
# Check the alignment
cat("Alignment for the human sample is:\n")
#> Alignment for the human sample is:
h_alignment[1:5, 1:7]
#> qname flag rname strand pos qwidth mapq
#> 1 ref|NC_001140| 16 NC_000001.11_1-50000000 - 1769970 562643 1
#> 2 ref|NC_001135| 256 NC_000001.11_1-50000000 + 3929397 316620 0
#> 3 ref|NC_001135| 256 NC_000001.11_1-50000000 + 3929627 316620 0
#> 4 ref|NC_001135| 16 NC_000001.11_1-50000000 - 5386833 316620 1
#> 5 ref|NC_001134| 0 NC_000001.11_1-50000000 + 6370452 813184 1
cat("Alignment for the yeast sample is:\n")
#> Alignment for the yeast sample is:
y_alignment[1:5, 1:7]
#> qname flag rname strand pos qwidth mapq
#> 1 SRR13577847.2407 4 <NA> <NA> NA NA NA
#> 2 SRR13577847.2521 4 <NA> <NA> NA NA NA
#> 3 SRR13577847.3037 4 <NA> <NA> NA NA NA
#> 4 SRR13577847.5431 4 <NA> <NA> NA NA NA
#> 5 SRR13577847.6723 4 <NA> <NA> NA NA NA
# Clean up
unlink(tmp_folder, recursive = TRUE)
sessionInfo()
#> R version 4.4.3 (2025-02-28)
#> Platform: aarch64-apple-darwin20
#> Running under: macOS Sequoia 15.3.2
#>
#> Matrix products: default
#> BLAS: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRblas.0.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.0
#>
#> locale:
#> [1] C/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#>
#> time zone: America/Denver
#> tzcode source: internal
#>
#> attached base packages:
#> [1] stats4 stats graphics grDevices utils datasets methods
#> [8] base
#>
#> other attached packages:
#> [1] minimapR_0.0.1.1 pafr_0.0.2 ggplot2_3.5.1
#> [4] Rsamtools_2.22.0 Biostrings_2.74.1 XVector_0.46.0
#> [7] GenomicRanges_1.58.0 GenomeInfoDb_1.42.3 IRanges_2.40.1
#> [10] S4Vectors_0.44.0 BiocGenerics_0.52.0
#>
#> loaded via a namespace (and not attached):
#> [1] gtable_0.3.6 jsonlite_2.0.0 dplyr_1.1.4
#> [4] compiler_4.4.3 crayon_1.5.3 tidyselect_1.2.1
#> [7] stringr_1.5.1 bitops_1.0-9 parallel_4.4.3
#> [10] jquerylib_0.1.4 scales_1.3.0 BiocParallel_1.40.0
#> [13] yaml_2.3.10 fastmap_1.2.0 R6_2.6.1
#> [16] generics_0.1.3 knitr_1.50 tibble_3.2.1
#> [19] munsell_0.5.1 GenomeInfoDbData_1.2.13 pillar_1.10.1
#> [22] bslib_0.9.0 rlang_1.1.5 stringi_1.8.7
#> [25] cachem_1.1.0 xfun_0.51 sass_0.4.9
#> [28] cli_3.6.4 withr_3.0.2 magrittr_2.0.3
#> [31] zlibbioc_1.52.0 digest_0.6.37 grid_4.4.3
#> [34] lifecycle_1.0.4 vctrs_0.6.5 evaluate_1.0.3
#> [37] glue_1.8.0 codetools_0.2-20 colorspace_2.1-1
#> [40] rmarkdown_2.29 httr_1.4.7 pkgconfig_2.0.3
#> [43] tools_4.4.3 htmltools_0.5.8.1 UCSC.utils_1.2.0
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.