We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 2749821 + a329e46 commit cbda13dCopy full SHA for cbda13d
13 files changed
DESCRIPTION
@@ -1,6 +1,6 @@
1
Package: qtl2
2
-Version: 0.31-5
3
-Date: 2023-04-20
+Version: 0.32
+Date: 2023-04-21
4
Title: Quantitative Trait Locus Mapping in Experimental Crosses
5
Description: Provides a set of tools to perform quantitative
6
trait locus (QTL) analysis in experimental crosses. It is a
NEWS.md
@@ -1,4 +1,13 @@
-## qtl2 0.31-5 (2023-04-20)
+## qtl2 0.32 (2023-04-21)
+
+### Major changes
+- In `create_variant_query_func()`, added new arguments `id_field` and
+ `sdp_field`, and in `create_gene_query_func()`, added arguments
7
+ `name_field` and `strand_field` (Issue #215). This gives new
8
+ flexibility, but also adds new requirements (for example, that the
9
+ variant database has a field `"snp_id"`) and so could potentially
10
+ break working code.
11
12
### New features
13
@@ -9,22 +18,22 @@
18
19
### Minor changes
20
-- Fixed date in citation, Broman et al. (2019) <doi:10.1534/genetics.118.301595>
-
14
21
- `read_cross2()` now gives a warning if sex isn't provided but is
15
22
needed. Also, if sex is missing we assume all individuals are
16
23
female; previously we assumed they were male. (Issue #214)
17
24
25
- In `plot_genes()`, allow strand to be +/- 1 and not just `"+"` or
26
`"-"`. (Issue #216)
27
28
+- Fixed date in citation, Broman et al. (2019)
29
+ [doi:10.1534/genetics.118.301595](https://doi.org/10.1534/genetics.118.301595)
30
31
### Bug fixes
32
33
- In `plot_genes()` there was a case where `stop` was used that should
34
have been `end`.
35
36
37
## qtl2 0.30 (2022-12-02)
38
39
### Major changes
@@ -72,7 +81,7 @@
72
81
a color-blind friendly palette. The original CC colors remain as
73
82
`CCorigcolors`; the previous default is now `CCaltcolors`. The new
74
83
colors are derived from the palette in Wong (2011) Nature
75
- Methods <doi:10.1038/nmeth.1618>.
84
+ Methods [doi:10.1038/nmeth.1618](https://doi.org/10.1038/nmeth.1618).
76
85
77
86
- `plot_coefCC()` was revised to include `col=CCcolors` as an argument.
78
87
The default is the new color-blind friendly CC colors, but one can
R/create_gene_query_func.R
@@ -10,6 +10,8 @@
#' @param chr_field Name of chromosome field
#' @param start_field Name of field with start position (in basepairs)
#' @param stop_field Name of field with stop position (in basepairs)
+#' @param name_field Name of field with gene name
+#' @param strand_field Name of field with strand (+/-)
#' @param filter Additional SQL filter (as a character string).
#'
#' @return Function with three arguments, `chr`, `start`,
@@ -48,6 +50,7 @@
48
50
create_gene_query_func <-
49
51
function(dbfile=NULL, db=NULL, table_name="genes",
52
chr_field="chr", start_field="start", stop_field="stop",
53
+ name_field="Name", strand_field="strand",
54
filter=NULL)
55
{
56
if(!is.null(db)) {
@@ -80,6 +83,10 @@ create_gene_query_func <-
80
result$start <- result[,start_field]/1e6
result$stop <- result[,stop_field]/1e6
+ # name and strand
+ result <- swap_colname(result, name_field, "Name")
88
+ result <- swap_colname(result, strand_field, "strand")
89
90
result
91
}
92
@@ -120,6 +127,10 @@ create_gene_query_func <-
120
127
121
128
122
129
130
131
132
133
123
134
124
135
125
136
R/create_variant_query_func.R
@@ -9,6 +9,8 @@
#' @param table_name Name of table in the database
#' @param pos_field Name of position field
+#' @param id_field Name of SNP/variant ID field
+#' @param sdp_field Name of strain distribution pattern (SDP) field
#' @param filter Additional SQL filter (as a character string)
@@ -50,7 +52,9 @@
create_variant_query_func <-
function(dbfile=NULL, db=NULL, table_name="variants",
- chr_field="chr", pos_field="pos", filter=NULL)
+ chr_field="chr", pos_field="pos",
+ id_field="snp_id", sdp_field="sdp",
57
+ filter=NULL)
58
59
60
if(!is.null(dbfile))
@@ -82,6 +86,10 @@ create_variant_query_func <-
# include pos column in Mbp
result$pos <- result[,pos_field]/1e6
+ # name and sdp fields
+ result <- swap_colname(result, id_field, "snp")
+ result <- swap_colname(result, sdp_field, "sdp")
93
94
95
@@ -122,6 +130,10 @@ create_variant_query_func <-
137
126
138
139
R/swap_colname.R
@@ -0,0 +1,26 @@
+# swap_colname
+#
+# replace column name in dataframe
+# column labeled orig_name becomes new_name
+# if there had already been a column labeled new_name,
+# we append "_old"
+# (used in create_variant_query_func and create_gene_query_func)
+swap_colname <-
+ function(df, orig_name, new_name)
+{
+ if(orig_name == new_name) return(df)
+ cn <- colnames(df)
+ if(!any(cn == orig_name)) {
+ stop('field "', orig_name, '" not found')
+ }
+ if(any(cn==new_name)) {
+ cn[cn==new_name] <- paste0(new_name, "_old")
+ cn[cn==orig_name] <- new_name
+ colnames(df) <- cn
+ df
+}
README.md
@@ -31,11 +31,12 @@ Install R/qtl2 from [CRAN](https://cran.r-project.org):
- [user guide](https://kbroman.org/qtl2/assets/vignettes/user_guide.html)
- [categorized list of functions in R/qtl2](https://kbroman.org/qtl2/pages/rqtl2_functions.html)
- [input file formats](https://kbroman.org/qtl2/assets/vignettes/input_files.html)
- (see also the
+ (also see the
[sample data files](https://kbroman.org/qtl2/pages/sampledata.html)
and the [qtl2data repository](https://github.com/rqtl/qtl2data))
- [using qtl2fst for on-disk genotype probabilities](https://kbroman.org/qtl2/assets/vignettes/qtl2fst.html)
- [preparing diversity outbred mouse data for R/qtl2](https://kbroman.org/qtl2/pages/prep_do_data.html)
+- [resources for mouse genome build GRCm39](https://kbroman.org/qtl2/pages/move_to_build39.html)
40
- [genotype diagnostics for diversity outbred mice](https://kbroman.org/qtl2/assets/vignettes/do_diagnostics.html)
41
- [identifying sample mix-ups in diversity outbred mice](https://kbroman.org/qtl2/assets/vignettes/do_mixups.html)
42
- [differences between R/qtl and R/qtl2](https://kbroman.org/qtl2/assets/vignettes/rqtl_diff.html)
inst/CITATION
@@ -2,14 +2,14 @@ citHeader("To cite R/qtl2 in publications use:")
bibentry(bibtype="article",
title = "R/qtl2: software for mapping quantitative trait loci with high-dimensional data and multi-parent populations.",
- author = personList(person(c("Karl", "W."), "Broman"),
- person(c("Daniel", "M."), "Gatti"),
- person("Petr", "Simecek"),
- person(c("Nicholas", "A."), "Furlotte"),
- person("Pjotr", "Prins"),
- person("Śaunak", "Sen"),
- person(c("Brian", "S."), "Yandell"),
- person(c("Gary", "A."), "Churchill")),
+ author = c(person(c("Karl", "W."), "Broman"),
+ person(c("Daniel", "M."), "Gatti"),
+ person("Petr", "Simecek"),
+ person(c("Nicholas", "A."), "Furlotte"),
+ person("Pjotr", "Prins"),
+ person("Śaunak", "Sen"),
+ person(c("Brian", "S."), "Yandell"),
+ person(c("Gary", "A."), "Churchill")),
journal = "Genetics",
doi = "10.1534/genetics.118.301595",
year = 2019,
man/create_gene_query_func.Rd
man/create_variant_query_func.Rd
tests/testthat/test-arrange_genes.R
@@ -2,7 +2,7 @@ context("Arrange genes vertically so they don't overlap")
test_that("arrange_genes gives appropriate errors", {
- expect_error(arrange_genes(NULL, NULL))
+# expect_error(arrange_genes(NULL, NULL))
expect_error(arrange_genes(numeric(0), numeric(0)))
expect_error(arrange_genes(c(1,2), 4))
expect_error(arrange_genes(c(1,2), c(4,5,6)))
0 commit comments