| Title: | Command-Line Interface for R/qtl2 |
|---|---|
| Description: | Support for a command-line interface for R/qtl2. |
| Authors: | Karl W Broman [aut, cre]
|
| Maintainer: | Karl W Broman <[email protected]> |
| License: | GPL-3 |
| Version: | 0.23-1 |
| Built: | 2026-05-07 02:15:06 UTC |
| Source: | https://github.com/rqtl/qtl2cl |
Read cross files and save as rds
cross2rds(input_file, output_file, compress = FALSE)cross2rds(input_file, output_file, compress = FALSE)
input_file |
Character string with path to the YAML or JSON file containing all of the control information. This could instead be a zip file containing all of the data files, in which case the contents are unzipped to a temporary directory and then read. |
output_file |
Character string with path to RDS file for output |
compress |
If TRUE, save a compressed RDS file (smaller but slower). |
input_file <- paste0("https://github.com/rqtl/qtl2data/", "blob/master/B6BTBR/b6btbr.zip") ## Not run: cross2rds(input_file, "b6btbr.rds")input_file <- paste0("https://github.com/rqtl/qtl2data/", "blob/master/B6BTBR/b6btbr.zip") ## Not run: cross2rds(input_file, "b6btbr.rds")
Read a file that is either RDS, CSV, JSON, or YAML, with the method determined by the file extension.
read_file(file, ...)read_file(file, ...)
file |
Character string of input file; must have file
extension |
... |
Passed to whatever function it calls |
For CSV files, we use qtl2::fread_csv(),
which calls data.table::fread() with a particular set
of options; note that columns are forced to be numeric in this
case.
For RDS files, we use base::readRDS(). For JSON files,
we use base::readLines() and
jsonlite::fromJSON(). For YAML files, we use
yaml::yaml.load_file().
Could be most anything; whatever gets read in by the corresponding R function for the file type. See Details.
## Not run: w <- read_file("myfile.rds") x <- read_file("myfile.csv") y <- read_file("myfile.json") z <- read_file("myfile.yaml") ## End(Not run)## Not run: w <- read_file("myfile.rds") x <- read_file("myfile.csv") y <- read_file("myfile.json") z <- read_file("myfile.yaml") ## End(Not run)
Run calc_genoprob and save result to rds
run_calcgenoprob( cross_file, output_file, map_file = NULL, step = 0, off_end = 0, stepwidth = c("fixed", "max"), error_prob = 0.0001, map_function = c("haldane", "kosambi", "c-f", "morgan"), cores = 1, compress = FALSE )run_calcgenoprob( cross_file, output_file, map_file = NULL, step = 0, off_end = 0, stepwidth = c("fixed", "max"), error_prob = 0.0001, map_function = c("haldane", "kosambi", "c-f", "morgan"), cores = 1, compress = FALSE )
cross_file |
Character string with path to RDS file containing cross |
output_file |
Character string with path to RDS file for output |
map_file |
Character string with path to RDS file for writing genetic map (with inserted pseudomarkers) |
step |
Distance between pseudomarkers and markers; if
|
off_end |
Distance beyond terminal markers in which to insert pseudomarkers. |
stepwidth |
Indicates whether to use a fixed grid
( |
error_prob |
Assumed genotyping error probability |
map_function |
Character string indicating the map function to use to convert genetic distances to recombination fractions. |
cores |
Number of CPU cores to use, for parallel calculations.
(If |
compress |
If TRUE, save compressed RDS files (smaller but slower). |
input_file <- paste0("https://github.com/rqtl/qtl2data/", "blob/master/B6BTBR/b6btbr.zip") ## Not run: cross2rds(input_file, "b6btbr.rds") ## Not run: run_calcgenoprob("b6btbr.rds", "b6btbr_probs.rds", "b6btbr_gmap.rds")input_file <- paste0("https://github.com/rqtl/qtl2data/", "blob/master/B6BTBR/b6btbr.zip") ## Not run: cross2rds(input_file, "b6btbr.rds") ## Not run: run_calcgenoprob("b6btbr.rds", "b6btbr_probs.rds", "b6btbr_gmap.rds")
Calculate genetic similarity among individuals (kinship matrix) from conditional genotype probabilities.
run_calckinship( input_file, output_file, type = c("overall", "loco", "chr"), omit_x = FALSE, use_allele_probs = TRUE, cores = 1, compress = FALSE )run_calckinship( input_file, output_file, type = c("overall", "loco", "chr"), omit_x = FALSE, use_allele_probs = TRUE, cores = 1, compress = FALSE )
input_file |
Input RDS file containing genotype or allele probabilities |
output_file |
Output RDS file for calculated kinship matrix |
type |
Indicates whether to calculate the overall kinship
( |
omit_x |
If |
use_allele_probs |
If |
cores |
Number of CPU cores to use, for parallel calculations.
(If |
compress |
If TRUE, save a compressed RDS file (smaller but slower). |
input_file <- paste0("https://github.com/rqtl/qtl2data/", "blob/master/B6BTBR/b6btbr.zip") ## Not run: cross2rds(input_file, "b6btbr.rds") ## Not run: run_calcgenoprob("b6btbr.rds", "b6btbr_probs.rds") ## Not run: run_calckinship("b6btbr_probs.rds", "b6btbr_kinship.rds")input_file <- paste0("https://github.com/rqtl/qtl2data/", "blob/master/B6BTBR/b6btbr.zip") ## Not run: cross2rds(input_file, "b6btbr.rds") ## Not run: run_calcgenoprob("b6btbr.rds", "b6btbr_probs.rds") ## Not run: run_calckinship("b6btbr_probs.rds", "b6btbr_kinship.rds")
Read cross from RDS file, determine X chromosome covariates, and write to another RDS file.
run_getXcovar(input_file, output_file, compress = FALSE)run_getXcovar(input_file, output_file, compress = FALSE)
input_file |
Input RDS file for cross |
output_file |
Output RDS file for X chromosome covariates |
compress |
If TRUE, save a compressed RDS file (smaller but slower). |
input_file <- paste0("https://github.com/rqtl/qtl2data/", "blob/master/B6BTBR/b6btbr.zip") ## Not run: cross2rds(input_file, "b6btbr.rds") ## Not run: run_getXcovar("b6btbr.rds", "b6btbr_xcovar.rds")input_file <- paste0("https://github.com/rqtl/qtl2data/", "blob/master/B6BTBR/b6btbr.zip") ## Not run: cross2rds(input_file, "b6btbr.rds") ## Not run: run_getXcovar("b6btbr.rds", "b6btbr_xcovar.rds")
Read in genotype probabilities, convert them to allele probabilities, and write them back out.
run_gp2ap(input_file, output_file, cores = 1, compress = FALSE)run_gp2ap(input_file, output_file, cores = 1, compress = FALSE)
input_file |
Name of input file (should be RDS) |
output_file |
Name of output file (will be RDS) |
cores |
Number of CPU cores to use, for parallel calculations.
(If |
compress |
If TRUE, save a compressed RDS file (smaller but slower). |
input_file <- paste0("https://github.com/rqtl/qtl2data/", "blob/master/B6BTBR/b6btbr.zip") ## Not run: cross2rds(input_file, "b6btbr.rds") ## Not run: run_calcgenoprob("b6btbr.rds", "b6btbr_probs.rds") ## Not run: run_gp2ap("b6btbr_probs.rds", "b6btbr_aprobs.rds")input_file <- paste0("https://github.com/rqtl/qtl2data/", "blob/master/B6BTBR/b6btbr.zip") ## Not run: cross2rds(input_file, "b6btbr.rds") ## Not run: run_calcgenoprob("b6btbr.rds", "b6btbr_probs.rds") ## Not run: run_gp2ap("b6btbr_probs.rds", "b6btbr_aprobs.rds")
Read in a bunch of data and then run qtl2::scan1().
run_scan1( genoprobs_file, pheno_file, output_file = NULL, map_file = NULL, kinship_file = NULL, addcovar_file = NULL, Xcovar_file = NULL, intcovar_file = NULL, weights_file = NULL, reml = TRUE, cores = 1, compress = FALSE )run_scan1( genoprobs_file, pheno_file, output_file = NULL, map_file = NULL, kinship_file = NULL, addcovar_file = NULL, Xcovar_file = NULL, intcovar_file = NULL, weights_file = NULL, reml = TRUE, cores = 1, compress = FALSE )
genoprobs_file |
Name of file with genotype probabilities |
pheno_file |
Name of file with phenotypes |
output_file |
Optional output RDS file. If NULL, print output as a table. |
map_file |
Optional (RDS) file containing map. Needed if |
kinship_file |
Optional file containing kinship matrix |
addcovar_file |
Optional file containing additive covariates |
Xcovar_file |
Optional file containing X chromosome covariates |
intcovar_file |
Optional file containing interactive covariates |
weights_file |
Optional file containing covariates |
reml |
If TRUE, use REML; otherwise, use maximum likelihood |
cores |
Number of CPU cores to use |
compress |
If TRUE, save a compressed RDS file (smaller but slower). |