From 1f4da07f984ae2de0133a31e1a09083fc0099242 Mon Sep 17 00:00:00 2001 From: Karl Broman Date: Mon, 18 Sep 2023 14:33:18 -0500 Subject: [PATCH] Fix Issue #103 re read.cross.csvs with just id as phenotype --- DESCRIPTION | 4 ++-- NEWS.md | 5 ++++- R/read.cross.csvs.R | 4 +++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 5b4cd4db..b2bbf71d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: qtl -Version: 1.61-1 -Date: 2023-07-15 +Version: 1.61-2 +Date: 2023-09-19 Title: Tools for Analyzing QTL Experiments Author: Karl W Broman and Hao Wu, with ideas from Gary Churchill and Saunak Sen and contributions from diff --git a/NEWS.md b/NEWS.md index 60cb4383..57e8698f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,12 +1,15 @@ # Revision history for the R/qtl package -## Version 1.61, 2023-07-15 +## Version 1.61, 2023-09-19 ### Bug fixes - Fixed bug in `summary.scanone()` for the case `format="onepheno"` but `threshold` has length > 1. (Issue #102.) +- Fixed bug in `read.cross()` for format `"csvs"` when the phenotype + file contains only the identifiers. (Issue #103.) + ## Version 1.60, 2023-04-18 diff --git a/R/read.cross.csvs.R b/R/read.cross.csvs.R index 29904822..4c99609f 100644 --- a/R/read.cross.csvs.R +++ b/R/read.cross.csvs.R @@ -196,9 +196,11 @@ read.cross.csvs <- else map <- rep(0,ncol(gen)) - colnames(pheno) <- unlist(pheno[1,]) + colnames_pheno <- unlist(pheno[1,]) + pheno <- apply(pheno, 2, function(a) { a[!is.na(a) & a==""] <- NA; a }) pheno <- as.data.frame(pheno[-1,], stringsAsFactors=TRUE) + colnames(pheno) <- colnames_pheno # replace empty cells with NA gen <- sapply(gen,function(a) { a[!is.na(a) & a==""] <- NA; a })