Skip to content

Commit

Permalink
do not check names, i.e. do not convert dashes into dots in the row a…
Browse files Browse the repository at this point in the history
…nd column names when loading TSV genotype data
  • Loading branch information
jeffersonfparil committed Jun 3, 2024
1 parent ce54dde commit 42d8866
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions R/load.R
Original file line number Diff line number Diff line change
Expand Up @@ -899,12 +899,17 @@ fn_simulate_data = function(n=100, l=1000, ploidy=2, n_alleles=2, min_depth=5, m
#' Load genotype data as an allele frequency matrix
#'
#' @param fname_geno filename of the genotype file
#' This may be in:
#' This may be in 1 of 3 formats:
#' - VCF format,
#' - allele frequency table saved as a tab-delimited file with a header line and the first 3 columns refer to the
#' chromosome (chr), position (pos), and allele (allele),
#' with subsequent columns referring to the allele frequencies of a sample, entry or pool.
#' Names of the samples, entries, or pools in the header line can be any unique string of characters.
#' - Rds file containing a single numeric n samples x p loci-alleles matrix of allele frequencies with non-null row and column names.
#' Row names can be any string of characters which identify the sample or entry or pool names.
#' Column names need to be tab-delimited, where first element refers to the chromosome or scaffold name,
#' the second should be numeric which refers to the position in the chromosome/scaffold, and
#' subsequent elements are optional which may refer to the allele identifier and other identifiers.
#' @param ploidy ploidy level which will generate genotype classes instead of continuous allele frequencies.
#' If NULL, then continuous allele frequencies and no binning or classification into genotype classes
#' will be performed (Default=NULL).
Expand Down Expand Up @@ -985,7 +990,7 @@ fn_load_genotype = function(fname_geno, ploidy=NULL, retain_minus_one_alleles_pe
########################################
### TSV: allele frequency table file ###
########################################
df = utils::read.delim(fname_geno, sep="\t", header=TRUE)
df = utils::read.delim(fname_geno, sep="\t", header=TRUE, check.names=FALSE)
if (!((grepl("chr", colnames(df)[1], ignore.case=TRUE)) &
(grepl("pos", colnames(df)[2], ignore.case=TRUE)) &
(grepl("allele", colnames(df)[3], ignore.case=TRUE)))
Expand Down

0 comments on commit 42d8866

Please sign in to comment.