Showing 4 of 42 files from the diff.
Newly tracked file
R/wrappers.R changed.
Newly tracked file
R/eigenstrat.R changed.
Newly tracked file
R/qpAdm.R changed.
Newly tracked file
R/utils.R changed.

@@ -8,7 +8,7 @@
Loading
8 8
#'
9 9
#' @examples
10 10
#' \dontrun{# download an example genomic data set and prepare it for analysis
11 -
#' snps <- eigenstrat(download_data())
11 +
#' snps <- eigenstrat(download_data(dirname = tempdir()))
12 12
#'
13 13
#' # define a set of populations to analyze
14 14
#' pops <- c("French", "Sardinian", "Han", "Papuan", "Dinka")
@@ -142,7 +142,7 @@
Loading
142 142
#'
143 143
#' @examples
144 144
#' \dontrun{# download example data set and prepare it for analysis
145 -
#' snps <- eigenstrat(download_data())
145 +
#' snps <- eigenstrat(download_data(dirname = tempdir()))
146 146
#'
147 147
#' # estimate the proportion of Neandertal ancestry in a French
148 148
#' # individual and other associated qpAdm statistics (see detailed
@@ -239,7 +239,7 @@
Loading
239 239
#'
240 240
#' @examples
241 241
#' \dontrun{# download example data set and prepare it for analysis
242 -
#' snps <- eigenstrat(download_data())
242 +
#' snps <- eigenstrat(download_data(dirname = tempdir()))
243 243
#'
244 244
#' # run the qpWave wrapper (detailed description in the tutorial vignette)
245 245
#' result <- qpWave(
@@ -278,4 +278,3 @@
Loading
278 278
279 279
  read_output(files[["log_file"]], details)
280 280
}
281 -

@@ -12,7 +12,7 @@
Loading
12 12
#' @examples
13 13
#' \dontrun{# download an example genomic data and get the path prefix to the
14 14
#' # trio of snp/geno/ind files in an EIGENSTRAT format
15 -
#' prefix <- download_data()
15 +
#' prefix <- download_data(dirname = tempdir())
16 16
#'
17 17
#' # wrap the trio of snp/geno/ind files in an object of the class
18 18
#' # EIGENSTRAT
@@ -80,18 +80,10 @@
Loading
80 80
#' 
81 81
#' This function utilizes the 'mergeit' command distributed in ADMIXTOOLS.
82 82
#'
83 -
#' @param merged Prefix of the final merged EIGENSTRAT object.
84 -
#' @param a,b Two EIGENSTRAT datasets to merge.
83 +
#' @param merged Prefix of the path to the merged EIGENSTRAT snp/ind/geno trio.
84 +
#' @param a,b Two EIGENSTRAT objects to merge.
85 85
#' @param strandcheck Deal with potential strand issues? Mostly for historic reasons. For details see the README of ADMIXTOOLS convertf.
86 86
#'
87 -
#' @examples
88 -
#' \dontrun{# merged <- merge_eigenstrat(
89 -
#' #    merged = <"path prefix of the merged snp/geno/ind data">
90 -
#' #    a = first_EIGENSTRAT_object,
91 -
#' #    b = second_EIGENSTRAT_object
92 -
#' #)
93 -
#' }
94 -
#'
95 87
#' @export
96 88
merge_eigenstrat <- function(merged, a, b, strandcheck = "NO") {
97 89
  parfile <- tempfile()
@@ -138,7 +130,7 @@
Loading
138 130
#'
139 131
#' @examples
140 132
#' \dontrun{# download an example genomic data set
141 -
#' prefix <- download_data()
133 +
#' prefix <- download_data(dirname = tempdir())
142 134
#' # create an EIGENSTRAT R object from the downloaded data
143 135
#' snps <- eigenstrat(prefix)
144 136
#'
@@ -150,6 +142,7 @@
Loading
150 142
#' # BED file contains regions to remove from an analysis
151 143
#' snps_removed <- filter_bed(snps, bed, remove = TRUE)
152 144
#' }
145 +
#'
153 146
#' @export
154 147
filter_bed <- function(data, bed, remove = FALSE, outfile = tempfile(fileext = ".snp")) {
155 148
  if (file.exists(outfile)) {
@@ -226,7 +219,7 @@
Loading
226 219
#'
227 220
#' @examples
228 221
#' \dontrun{# download an example genomic data set and prepare it for analysis
229 -
#' snps <- eigenstrat(download_data())
222 +
#' snps <- eigenstrat(download_data(dirname = tempdir()))
230 223
#'
231 224
#' # perform the calculation only on transversions
232 225
#' snps_tv <- transversions_only(snps)
@@ -268,7 +261,7 @@
Loading
268 261
#'#'
269 262
#' @examples
270 263
#' \dontrun{# download an example genomic data set and prepare it for analysis
271 -
#' snps <- eigenstrat(download_data())
264 +
#' snps <- eigenstrat(download_data(dirname = tempdir()))
272 265
#'
273 266
#' # group individual samples into larger populations, creating a new
274 267
#' # EIGENSTRAT R object
@@ -278,10 +271,6 @@
Loading
278 271
#'     African = c("Dinka", "Yoruba", "Mbuti", "Khomani_San"),
279 272
#'     Archaic = c("Vindija", "Altai", "Denisova")
280 273
#' )
281 -
#'
282 -
#' # use the newly created EIGENSTRAT object to run a D statistic with
283 -
#' # the new population groups
284 -
#' result_d  <- d(W = "European", X = "African", Y = "Archaic", Z = "Chimp", data = new_snps)
285 274
#' }
286 275
#'
287 276
#' @export
@@ -318,7 +307,7 @@
Loading
318 307
#'
319 308
#' @examples
320 309
#' \dontrun{# download an example genomic data set and prepare it for analysis
321 -
#' snps <- eigenstrat(download_data())
310 +
#' snps <- eigenstrat(download_data(dirname = tempdir()))
322 311
#'
323 312
#' # group individual samples into larger populations, creating a new
324 313
#' # EIGENSTRAT R object

@@ -16,7 +16,7 @@
Loading
16 16
#'
17 17
#' @examples
18 18
#' \dontrun{# download an example genomic data set and prepare it for analysis
19 -
#' snps <- eigenstrat(download_data())
19 +
#' snps <- eigenstrat(download_data(dirname = tempdir()))
20 20
#'
21 21
#' # find the set of most likely two-source qpAdm models of
22 22
#' # a French individual - produce only the 'proportions'
@@ -140,7 +140,7 @@
Loading
140 140
#'
141 141
#' @examples
142 142
#' \dontrun{# download an example genomic data set and prepare it for analysis
143 -
#' snps <- eigenstrat(download_data())
143 +
#' snps <- eigenstrat(download_data(dirname = tempdir()))
144 144
#'
145 145
#' # find the set of most likely two-source qpAdm models of
146 146
#' # a French individual - produce only the 'proportions'

@@ -7,7 +7,7 @@
Loading
7 7
#' @return A data.frame object with SNP counts/proportions.
8 8
#'
9 9
#' @examples
10 -
#' \dontrun{snps <- eigenstrat(download_data())
10 +
#' \dontrun{snps <- eigenstrat(download_data(dirname = tempdir()))
11 11
#' 
12 12
#' present_count <- count_snps(snps)
13 13
#' missing_count <- count_snps(snps, missing = TRUE)
@@ -91,7 +91,10 @@
Loading
91 91
92 92
#' Download example SNP data.
93 93
#'
94 -
#' @param dirname Directory in which to put the data (EIGENSTRAT trio of snp/geno/ind files).
94 +
#' The data is downloaded to a temporary directory by default.
95 +
#' 
96 +
#' @param dirname Directory in which to put the data (EIGENSTRAT trio
97 +
#'     of snp/geno/ind files).
95 98
#'
96 99
#' @export
97 100
download_data <- function(dirname = tempdir()) {
Files Coverage
R 86.49%
Project Totals (7 files) 86.49%
1
comment: false
2

3
coverage:
4
  status:
5
    project:
6
      default:
7
        target: auto
8
        threshold: 1%
9
    patch:
10
      default:
11
        target: auto
12
        threshold: 1%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading