write_control_file: Write a control file for QTL data

Description Usage Arguments Details Value See Also Examples

Description

Write the control file (in YAML needed by read_cross2 for a set of QTL data.

Usage

1
2
3
4
5
write_control_file(output_file, crosstype, geno_file, foundergeno_file,
  gmap_file, pmap_file, pheno_file, covar_file, phenocovar_file, sex_file,
  sex_covar, sex_codes, crossinfo_file, crossinfo_covar, crossinfo_codes,
  linemap_file, linemap_covar, geno_codes, alleles, xchr, na.strings = c("-",
  "NA"), comments)

Arguments

output_file

File name (with path) of the YAML file to be created, as a character string.

crosstype

Character string with the cross type.

geno_file

File name for genotype data.

foundergeno_file

File name for the founder genotype data.

gmap_file

File name for genetic map.

pmap_file

File name for the physical map.

pheno_file

File name for the phenotype data.

covar_file

File name for the covariate data.

phenocovar_file

File name for the phenotype covariate data (i.e., metadata about the phenotypes).

sex_file

File name for the individuals' sex. (Specify just one of sex_file or sex_covar.)

sex_covar

Column name in the covariate data that corresponds to sex. (Specify just one of sex_file or sex_covar.)

sex_codes

Named vector of character strings specifying the encoding of sex. The names attribute should be the codes used in the data files; the values within the vector should be "female" and "male".

crossinfo_file

File name for the cross_info data. (Specify just one of crossinfo_file or crossinfo_covar.)

crossinfo_covar

Column name in the covariate data that corresponds to the cross_info data. (Specify just one of crossinfo_file or crossinfo_covar.)

crossinfo_codes

In the case that crossinfo_covar is provided (and not crossinfo_file; it would be left untouched), a named vector of character strings specifying the encoding of cross_info. The names attribute should be the codes used in the covariate column; the values within the vector should be the codes to which they will be converted (for example, 0 and 1 for an intercross).

linemap_file

File name for the linemap data (indicating the mapping of individuals to lines). (Specify just one of linemap_file or linemap_covar.)

linemap_covar

Column name in the covariate data that corresponds to the linemap data. (Specify just one of linemap_file or linemap_covar.)

geno_codes

Named vector specifying the encoding of genotypes. The names attribute has the codes used within the genotype and founder genotype data files; the values within the vector should be the integers to which the genotypes will be converted.

alleles

Vector of single-character codes for the founder alleles.

xchr

Character string with the ID for the X chromosome.

na.strings

Vector of character strings with codes to be treated as missing values.

comments

Vector of character strings to be inserted as comments at the top of the file, with each string as a line.

Details

This function takes a set of parameters and creates the control file (in YAML format) needed for the new input data file format for R/qtl2. See the sample data files and the vignette describing the input file format.

Value

(Invisibly) The data structure that was written.

See Also

read_cross2, sample data files at http://kbroman.org/qtl2/pages/sampledata.html

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
## Not run: 
# Control file for the sample dataset, grav2
write_control_file("~/my_data/grav2.yaml",
                   crosstype="riself",
                   geno_file="grav2_geno.csv",
                   gmap_file="grav2_gmap.csv",
                   pheno_file="grav2_pheno.csv",
                   phenocovar_file="grav2_phenocovar.csv",
                   geno_codes=c(L=1L, C=2L),
                   alleles=c("L", "C"),
                   na.strings=c("-", "NA"))

# Control file for the sample dataset, iron
write_control_file("~/my_data/iron.yaml",
                   crosstype="f2",
                   geno_file="iron_geno.csv",
                   gmap_file="iron_gmap.csv",
                   pheno_file="iron_pheno.csv",
                   covar_file="iron_covar.csv",
                   phenocovar_file="iron_phenocovar.csv",
                   geno_codes=c(SS=1L, SB=2L, BB=3L),
                   sex_covar="sex",
                   sex_codes=c(f="female", m="male"),
                   crossinfo_covar="cross_direction",
                   crossinfo_codes=c("(SxB)x(SxB)"=0L, "(BxS)x(BxS)"=1L),
                   xchr="X",
                   alleles=c("S", "B"),
                   na.strings=c("-", "NA"))

## End(Not run)

simecek/qtl2 documentation built on May 29, 2019, 10:01 p.m.