sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
6fd8a2e6e569b80a479bf74f6883bccb720af0894e674d5c1f295fb3458ec866
R
223
10
context("Test wcs_sql") library(hBayesDM) test_that("Test wcs_sql", { # Do not run this test on CRAN skip_on_cran() expect_output(wcs_sql( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
88edeca564f2da3e2a993eea49e491b2c6cc7ed088933a9d36487e0e826a74e9
R
223
10
context("Test ts_par7") library(hBayesDM) test_that("Test ts_par7", { # Do not run this test on CRAN skip_on_cran() expect_output(ts_par7( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
8900346524867f85ad60240c5fd76193e3694cc9c4917a195db5b919e4a6b224
R
223
10
context("Test igt_vpp") library(hBayesDM) test_that("Test igt_vpp", { # Do not run this test on CRAN skip_on_cran() expect_output(igt_vpp( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
a569faf8339f63e329d1531aa06caca2edcbaaf19d2a226ded4f7bd1eaeefa53
R
223
10
context("Test cra_exp") library(hBayesDM) test_that("Test cra_exp", { # Do not run this test on CRAN skip_on_cran() expect_output(cra_exp( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
b988b7a4937cbab7b83a50d28d2a87dd0d413406e662ee688a7e74cb9794a07b
R
223
10
context("Test ts_par4") library(hBayesDM) test_that("Test ts_par4", { # Do not run this test on CRAN skip_on_cran() expect_output(ts_par4( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
98a2276422aee7c78b40e0470ac9510b61b4c369026f5d0e87f55948ceeabfe8
R
225
14
# Summer project - evolutionary trends in the elasmobranch chondocranium # # Load Packages # library(ape) library(geomorph) library(rgl) library(dispRity) library(phytools) library(strap) library(paleotree) # Load Data #
b7d22ef4ab2de6c44f4a17f973de4693b03e39f9c312a2b0b571baf81005134e
R
225
5
select<-dplyr::select learn <- rbind( learn.N, learn.A, learn.B) transfer <- rbind( cbind(transfer.N, condition="N"), cbind(transfer.A, condition="A"), cbind(transfer.B, condition="B"))
df06dcd7417fa34cd02a3d6ce92be6694d48019e45f2cfb26ff0cc7844548c0b
R
225
5
# anticipation/expectation of improvement fname=file.path("data","raw", "arousal.csv") arousal<-read.table(fname, header=T, sep=",", as.is = T, na.strings = c("na"))[1:29,1:7] arousal$Participant=factor(arousal$Participant)
2f2ae4ece4d89d13d9107c907abd99f250acd847f477a7779ea149a1c098290d
R
226
10
context("Test ug_bayes") library(hBayesDM) test_that("Test ug_bayes", { # Do not run this test on CRAN skip_on_cran() expect_output(ug_bayes( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
688d5746790ba8d777f57007e9a3eafb1462157a80fb5b711466f272ab879ee5
R
226
10
context("Test hgf_ibrb") library(hBayesDM) test_that("Test hgf_ibrb", { # Do not run this test on CRAN skip_on_cran() expect_output(hgf_ibrb( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
8596f425dbd677564ac06cfc181eb35b0b9b38cf0f746731d73d689416443c95
R
226
10
context("Test peer_ocu") library(hBayesDM) test_that("Test peer_ocu", { # Do not run this test on CRAN skip_on_cran() expect_output(peer_ocu( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
b6a9fcda3ff77764f83b8337b9d2959a291cca164d79aff195c487ded3e7620f
R
226
10
context("Test ug_delta") library(hBayesDM) test_that("Test ug_delta", { # Do not run this test on CRAN skip_on_cran() expect_output(ug_delta( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
2104abf42873bb752a999ef444993a204de305047f5251d09ca61ef749026814
R
229
10
context("Test pstRT_ddm") library(hBayesDM) test_that("Test pstRT_ddm", { # Do not run this test on CRAN skip_on_cran() expect_output(pstRT_ddm( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
8080d5a52f835da56b528b15857602d4af2a153a2d40617bd8f90644feafb03a
R
229
10
context("Test bart_par4") library(hBayesDM) test_that("Test bart_par4", { # Do not run this test on CRAN skip_on_cran() expect_output(bart_par4( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
9b75f3eb75e91b60c67c3cef521c3c7df81b270a9e8bd32a6c61d8efe7d88824
R
229
10
context("Test alt_delta") library(hBayesDM) test_that("Test alt_delta", { # Do not run this test on CRAN skip_on_cran() expect_output(alt_delta( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
addddd889b89b8c357093c6bf876b6131854688744c5ffecfca738aaa2bd7c97
R
229
10
context("Test bart_ewmv") library(hBayesDM) test_that("Test bart_ewmv", { # Do not run this test on CRAN skip_on_cran() expect_output(bart_ewmv( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
b3a8c0af0b838a3967d0962b73105f9830748b8d9978883bb7e302d09ab06cb5
R
229
10
context("Test alt_gamma") library(hBayesDM) test_that("Test alt_gamma", { # Do not run this test on CRAN skip_on_cran() expect_output(alt_gamma( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
fbb573d6892d37f127d27afdcfe7e652686f3fe837e720b58328a852bff80783
R
232
10
context("Test cra_linear") library(hBayesDM) test_that("Test cra_linear", { # Do not run this test on CRAN skip_on_cran() expect_output(cra_linear( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
93b92dab67eea8df113c11f86b7c70e1450e2e2be53faa6286dc015c6b91f9de
R
235
10
context("Test ra_prospect") library(hBayesDM) test_that("Test ra_prospect", { # Do not run this test on CRAN skip_on_cran() expect_output(ra_prospect( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
c7d80ff06965bf72750fa16738981b62bfbf882853a8dd21c76ed448eab2d4d2
R
236
7
#' MNAR demo data #' #' A toy example from Margarita Moreno-Betancur for checking NARFCS. #' #' A small dataset with just three columns. #' @source \url{https://github.com/moreno-betancur/NARFCS/blob/master/datmis.csv} "mnar_demo_data"
7d23f2473e4c3e4c35ec919ebf8959a0b1fc224931cf95ce7140a93055689a3e
R
238
10
context("Test pstRT_rlddm6") library(hBayesDM) test_that("Test pstRT_rlddm6", { # Do not run this test on CRAN skip_on_cran() expect_output(pstRT_rlddm6( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
7d88908654cf3a6c021bb484218e1a5e0005fedb72a2a287386a20c447557bdc
R
238
10
context("Test pstRT_rlddm1") library(hBayesDM) test_that("Test pstRT_rlddm1", { # Do not run this test on CRAN skip_on_cran() expect_output(pstRT_rlddm1( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
886a9c090742c3bebcb83b400c513cbbdfc998ac6a815d4e9da76e60ca97cc14
R
238
10
context("Test task2AFC_sdt") library(hBayesDM) test_that("Test task2AFC_sdt", { # Do not run this test on CRAN skip_on_cran() expect_output(task2AFC_sdt( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
a4d1c9200ce5e0d5fa1811ed27b23d84ce1e81bd3aca662d562d8fce064861a0
R
238
10
context("Test choiceRT_ddm") library(hBayesDM) test_that("Test choiceRT_ddm", { # Do not run this test on CRAN skip_on_cran() expect_output(choiceRT_ddm( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
a72d59e00899fedf4743388bbcbc4194511648aef9ec149ae6ec772c97792326
R
238
10
context("Test dd_cs_single") library(hBayesDM) test_that("Test dd_cs_single", { # Do not run this test on CRAN skip_on_cran() expect_output(dd_cs_single( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
867c15ff4354d2b68b322f4b07b112b3dd881d25a492fca8704559b0ab84c496
R
240
10
options(warn=-1) suppressPackageStartupMessages({ library(tidyverse) library(testthat) }) # load functions source("./workflow/scripts/utils.R") testthat::test_dir("./tests/testthat/", reporter=c("progress", "minimal", "location"))
2873e0f1fea54dada4e539e943c016d2049dd9dd5c7f8e47764cc39895e99186
R
241
10
context("Test igt_pvl_delta") library(hBayesDM) test_that("Test igt_pvl_delta", { # Do not run this test on CRAN skip_on_cran() expect_output(igt_pvl_delta( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
69eb481142efd8aa91ad668fec027187580b50052078b1420eefe53c25789590
R
241
10
context("Test rdt_happiness") library(hBayesDM) test_that("Test rdt_happiness", { # Do not run this test on CRAN skip_on_cran() expect_output(rdt_happiness( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
995267f08b142e773b0bc4867c1cdad97327d1d12935949169fe35954e683bff
R
241
10
context("Test igt_pvl_decay") library(hBayesDM) test_that("Test igt_pvl_decay", { # Do not run this test on CRAN skip_on_cran() expect_output(igt_pvl_decay( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
c89299a73215f44906a64b466ab02f6ead945eadd6fa30a8491455b17e983d0d
R
241
10
context("Test dd_hyperbolic") library(hBayesDM) test_that("Test dd_hyperbolic", { # Do not run this test on CRAN skip_on_cran() expect_output(dd_hyperbolic( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
4d2f8a60bb95f24f84dbe800f23514875f4b095ce9faf399416ce6ef29e355ae
R
244
10
context("Test pst_gainloss_Q") library(hBayesDM) test_that("Test pst_gainloss_Q", { # Do not run this test on CRAN skip_on_cran() expect_output(pst_gainloss_Q( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
7461afa8a9f7dea9878ad3e3b8da16958419a2778e102652dd005b418ca8f1f9
R
244
10
context("Test prl_fictitious") library(hBayesDM) test_that("Test prl_fictitious", { # Do not run this test on CRAN skip_on_cran() expect_output(prl_fictitious( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
a017422443c06565755d2cecdf84ee580ea649f559eacadaeb9062a51c27f8ba
R
245
12
#@Time : 2023/1/20 14:28 #@Author : Biao Zhang #@Email : littlebiao@outlook.com #@File : read_rhesus_2018s.R.r #@Description: This file is used to ... # packages # load('../brain_rhesus_2018s/Sestan.adultMonkeyNuclei.Psychencode.Rdata') ls()
899664250170cfea5e4a58e3ef7a3872d20c7d4683a346e3d206782a83f9b299
R
246
8
blocks1 <- make.blocks(c("bmi", "chl", "hyp", "age")) test_that("MAKE-PREDICTORMATRIX-001: errors on invalid data arguments", { expect_error( make.predictorMatrix(data, blocks = blocks1), "Data should be a matrix or data frame" ) })
2ac575341f1bbd959be20648fb074031f9f697cb3fff2b006941f6aa724b6b08
R
247
10
context("Test hgf_ibrb_single") library(hBayesDM) test_that("Test hgf_ibrb_single", { # Do not run this test on CRAN skip_on_cran() expect_output(hgf_ibrb_single( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
730dbc0f4db83606f5993ca75075d15464288300bc745c541a6e47f982955eee
R
247
10
context("Test banditNarm_4par") library(hBayesDM) test_that("Test banditNarm_4par", { # Do not run this test on CRAN skip_on_cran() expect_output(banditNarm_4par( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
907bfe56b4417b76210159faf9460d89f00d5e4d165d95c7cfd935a78098f2fa
R
247
10
context("Test bandit4arm_4par") library(hBayesDM) test_that("Test bandit4arm_4par", { # Do not run this test on CRAN skip_on_cran() expect_output(bandit4arm_4par( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
de1cf49d2fe473a54b288bbd14adba83ae925ca3e1ad2a3752f470f4e479b63c
R
248
7
# ---- resave the .rds files in data/ with compressed format ---- # # details: # The type of compression is chosen automatically by tools # This command need only be run once and may take several minutes. tools::resaveRdaFiles(paths = 'data')
1710a8c49635e60de79e7ef5de268d995379bb8c30c79469fb98ebda686db076
R
250
10
context("Test banditNarm_delta") library(hBayesDM) test_that("Test banditNarm_delta", { # Do not run this test on CRAN skip_on_cran() expect_output(banditNarm_delta( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
63620c4db55ac39c5e74cfe3a78d252b97759124b3143be666bbc04c6551fab1
R
250
10
context("Test bandit2arm_delta") library(hBayesDM) test_that("Test bandit2arm_delta", { # Do not run this test on CRAN skip_on_cran() expect_output(bandit2arm_delta( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
a44b2411047f3bd3a1db495684940b4bb2e02011da613e5b57694f142ba5447d
R
250
10
context("Test prl_rp_multipleB") library(hBayesDM) test_that("Test prl_rp_multipleB", { # Do not run this test on CRAN skip_on_cran() expect_output(prl_rp_multipleB( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
ca9c4bd9312181306c9fce11623ec127ad76ff21edae4e214165bb8fec6d8d8c
R
250
10
context("Test dbdm_prob_weight") library(hBayesDM) test_that("Test dbdm_prob_weight", { # Do not run this test on CRAN skip_on_cran() expect_output(dbdm_prob_weight( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
d508891e66a793ddcce3b1b81a3b893c6e8416d7e38f94890eed0ec83b8fa769
R
250
10
context("Test banditNarm_lapse") library(hBayesDM) test_that("Test banditNarm_lapse", { # Do not run this test on CRAN skip_on_cran() expect_output(banditNarm_lapse( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
d595dbabc4d5269c4ae21ee6bbb15886a173356a3ed3ea4d5bbba920a222cbf9
R
250
10
context("Test bandit4arm_lapse") library(hBayesDM) test_that("Test bandit4arm_lapse", { # Do not run this test on CRAN skip_on_cran() expect_output(bandit4arm_lapse( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
1a2240ee83a97c0fd8f140534dbe42f666fe545b4de304bf20a5b5723ade10a5
R
253
10
context("Test prl_fictitious_rp") library(hBayesDM) test_that("Test prl_fictitious_rp", { # Do not run this test on CRAN skip_on_cran() expect_output(prl_fictitious_rp( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
3dedf96181abf59a0487d8a0f3f835c841493a570341adec57b9df18b49a9d74
R
256
10
context("Test prl_fictitious_woa") library(hBayesDM) test_that("Test prl_fictitious_woa", { # Do not run this test on CRAN skip_on_cran() expect_output(prl_fictitious_woa( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
f82ff03541df58c73649423cf300d9fb851e84bb3316c372c5c40423b00f6e8a
R
256
7
## Authors: Gerko Vink, Stef van Buuren rm.whitespace <- function(string, side = "both") { side <- match.arg(side, c("left", "right", "both")) pattern <- switch(side, left = "^\\s+", right = "\\s+$", both = "^\\s+|\\s+$") sub(pattern, "", string) }
5e13bffbb1d8403ed4935d98f60d1fc8f52cbb735880a380f7a450dbc521aaa2
R
257
7
vl=fread(file="~/ncnb2_code/metadata/velocyto_libraries.csv") lib2G= Vectorize(function(x) dayrep.dataset.map[[x]], USE.NAMES=F) vl2=vl %>% mutate(orig.ident= lib2G(library_name)) fwrite(vl2, file="~/ncnb2_code/metadata/velocyto_libraries_withident.csv")
43b15bea1fbc60fe29d6891f809f1c2bc5e1a3a9b7afb588ca63c577c8e0ca1b
R
258
9
#!Rscript args = commandArgs(trailingOnly=TRUE) RNA = read.table(args[1],header=TRUE) RNA = RNA[,c(1,6:7)] RPK = RNA[,3]/(RNA[,2]/1000) RPM = sum(RPK)/1000000 TPM = round(RPK/RPM,3) write.table(TPM,file=args[2],row.names=FALSE,col.names=FALSE,quote=FALSE)
7b04ccb6a0dcef33bad3feebccb7b5bcce004769cbd88696c6ad6206d512a5da
R
259
10
context("Test choiceRT_ddm_single") library(hBayesDM) test_that("Test choiceRT_ddm_single", { # Do not run this test on CRAN skip_on_cran() expect_output(choiceRT_ddm_single( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
094ca653ccf0509540356054ecd1935637a93e1f2a4ef3fffb71e32621055840
R
262
10
context("Test dd_hyperbolic_single") library(hBayesDM) test_that("Test dd_hyperbolic_single", { # Do not run this test on CRAN skip_on_cran() expect_output(dd_hyperbolic_single( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
26491889679dbd0b3f171fa88ac283b73c72fb5127c417238911a823558094dc
R
265
10
context("Test bandit4arm_2par_lapse") library(hBayesDM) test_that("Test bandit4arm_2par_lapse", { # Do not run this test on CRAN skip_on_cran() expect_output(bandit4arm_2par_lapse( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
74000e4fa3df5a61297f3f160d06abdead0f4cfd642f60ec8f5cea7de6ee66c3
R
265
10
context("Test prl_fictitious_rp_woa") library(hBayesDM) test_that("Test prl_fictitious_rp_woa", { # Do not run this test on CRAN skip_on_cran() expect_output(prl_fictitious_rp_woa( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
b563971c10f05a9c89f641d56639bcc595ca2f5300017e318211d577d05628f3
R
265
10
context("Test banditNarm_2par_lapse") library(hBayesDM) test_that("Test banditNarm_2par_lapse", { # Do not run this test on CRAN skip_on_cran() expect_output(banditNarm_2par_lapse( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
6c5fdf773af270e4e028993edaaa2337775437c6993c9cb2d9d2dd64301b3370
R
268
10
context("Test bandit4arm_lapse_decay") library(hBayesDM) test_that("Test bandit4arm_lapse_decay", { # Do not run this test on CRAN skip_on_cran() expect_output(bandit4arm_lapse_decay( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
f71b653006e6ce9f445ba46d224b8b4b5a5b6e1320aa7eda370599fa1a6459fe
R
268
10
context("Test banditNarm_lapse_decay") library(hBayesDM) test_that("Test banditNarm_lapse_decay", { # Do not run this test on CRAN skip_on_cran() expect_output(banditNarm_lapse_decay( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
07cd301532f820969b125e6a30e142149e32c5cfe0f91a202cea2f126d7c5df5
R
274
10
context("Test bandit4arm_singleA_lapse") library(hBayesDM) test_that("Test bandit4arm_singleA_lapse", { # Do not run this test on CRAN skip_on_cran() expect_output(bandit4arm_singleA_lapse( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
8a06f944e648f71cf2669465b57019d7ca48cf45f2be392c133231790f95c1f3
R
274
10
context("Test banditNarm_kalman_filter") library(hBayesDM) test_that("Test banditNarm_kalman_filter", { # Do not run this test on CRAN skip_on_cran() expect_output(banditNarm_kalman_filter( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
a79bca73dec1d2f314dd881ba23acdcb0fc4e2842224996ff21fc4ce71b8f266
R
274
10
context("Test banditNarm_singleA_lapse") library(hBayesDM) test_that("Test banditNarm_singleA_lapse", { # Do not run this test on CRAN skip_on_cran() expect_output(banditNarm_singleA_lapse( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
e6344c56d69b824fb8f2efacfdba58f08fe9a8b5ba810966b36bd48be585815e
R
274
10
context("Test prl_fictitious_multipleB") library(hBayesDM) test_that("Test prl_fictitious_multipleB", { # Do not run this test on CRAN skip_on_cran() expect_output(prl_fictitious_multipleB( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
776f215804638f39c7da64af739bba4240c9cb70d6a24b62ea1a8ca22ed5a955
R
277
10
context("Test bandit4arm2_kalman_filter") library(hBayesDM) test_that("Test bandit4arm2_kalman_filter", { # Do not run this test on CRAN skip_on_cran() expect_output(bandit4arm2_kalman_filter( data = "example", niter = 10, nwarmup = 5, nchain = 1, ncore = 1)) })
c8764347490ad619fa03ca5c1c04c52f04ed4d88fa2e46d09141c2255d339eee
R
284
29
#' @export ggplot2::ggplot_add #' @export ggplot2::aes #' @export dplyr::`%>%` #' @export dplyr::filter #' @export dplyr::mutate #' @export dplyr::group_by #' @export dplyr::ungroup #' @export tibble::as_tibble #' @export tidygraph::as_tbl_graph #' @export igraph::as.igraph
139b1dd60e505ca139d2532867912a8220092dcad39dbbf086f68f5dda3a72d1
R
312
14
handles.arg <- function(f, a = "data") { # determine whether function f handles argument a if (!is.function(f)) { return(FALSE) } a %in% names(formals(f)) } handles.format <- function(fn) { # determine whether function fn handles the `format` argument f <- get(fn) handles.arg(f, "format") }
15f5ddccfb58a6718a20d06fe188995027507c4d020078c857b17ac98f1514b0
R
322
10
my_ggsave <- function(fname, plot, dpi = 300, ...) { ggsave(paste0(fname, ".pdf"), plot = plot, useDingbats = F, bg = "#FFFFFF", ...) embedFonts(file = paste0(fname, ".pdf"), outfile = paste0(fname, ".pdf")) ggsave(paste0(fname, ".png"), plot = plot, dpi = dpi, bg = "#FFFFFF", ...)...
ef60025a16befeb1fbe6c24aab21398bbae88fb9c9809c9ccb79e53cf859a2ee
R
324
11
suppressPackageStartupMessages({ requireNamespace("matrixStats") }) get_top_n_variance <- function(matr, ntop = 500, tol = 1E-9) { rv <- matrixStats::colVars(matr) select <- order(rv, decreasing = TRUE)[seq_len(min(ntop, length(rv)))] # Filter low variance: select <- select[rv[select] > 1E-9] matr[, select...
890748b98c5bf607dce88e91efcb206974540b2eeaf10a2da87130fe7e2c7633
R
331
11
library(GDCRNATools) context("gdcParseMetadata") test_that("Parse metadata automatically", { metaMatrix <- gdcParseMetadata(project.id = 'TCGA-CHOL', data.type = 'RNAseq', write.meta = FALSE) expect_equal(unique(metaMatrix$project),"TCGA-...
0c67b438a14d2465f9632268fa2f305dc371de99460bb792cf2495f6422e85d2
R
333
11
update_list <- function(ours, to_update, recursiveness = 0L) { for (el in names(to_update)) { element <- to_update[[el]] if (recursiveness > 0L && !is.null(names(element))) { ours[[el]] <- update_list(ours[[el]], element, recursiveness = recursiveness - 1) } else { ours[[el]] <- element } ...
802776c4118e4f47367722016da6f069a71f61f4d5108875b1075782f682720a
R
337
14
#Code for extracting gene sets from Gemma and GeneWeaver from the Hippocampus and Nucleus Accumbens to create a better .GMT file #Megan Hagenauer, June 2021 library(plyr) library(httr) library(RCurl) library(jsonlite) library(devtools) install_github("PavlidisLab/gemmaAPI.R") library(gemmaAPI) ?endpointFunctions ?hi...
67019a44909f6c636fb80613ea8c99f64b9724f6cf1a502bafb830f8f6aed163
R
342
10
library(TCGAbiolinks) query.met <- GDCquery(project = c("TCGA-ESCA", "TCGA-PAAD"), data.category = "DNA Methylation", legacy = FALSE, platform = c("Illumina Human Methylation 450"), sample.type = "Solid Tissue Normal") met <- getR...
cb52be52e787978a7fc50b0d31ebff690383e413601ad69aa303ae206c108841
R
346
10
barnard.rubin <- function(m, b, t, dfcom = Inf) { lambda <- (1 + 1 / m) * b / t dfold <- (m - 1) / (lambda^2) if (length(dfcom) == 1L && is.infinite(dfcom)) { return(dfold) } tmp <- (1 - lambda) * (1 + dfcom) * dfcom df_br <- (m - 1) * tmp / ((dfcom + 3) * (m - 1) + (lambda^2) * tmp) ifelse(is.infinit...
05d125b89715af603ed8350764316e2e0bc6f9fdeb7948559b2cc75fdb519e68
R
353
19
suppressPackageStartupMessages({ requireNamespace("argparse") }) get_args <- function() { # create parser object parser <- argparse::ArgumentParser() parser$add_argument( "--dataset-name", type = "character", default = NULL, help = "dataset name we apply the script to (e.g. sod1)" ) args...
20dc1c7ea7ce7850893f3cbee3b3fecabf278cf86e194a0c9d93da0592140ee7
R
356
12
cohort_to_factors <- function(cohort, cohort_factors) { out <- cohort for (cohort_factor in cohort_factors) { fac <- cohort_factor[["factor"]] if ("levels" %in% names(cohort_factor)) { out[[fac]] <- factor(out[[fac]], levels = as.character(cohort_factor[["levels"]])) } else { out[[fac]] <- f...
4206e1ecdfaee83f6a815da7b8256a40e66f21b81a47df297afb92d7a81cc70d
R
362
16
log.seq <- function(from,to,length.out) { exp(seq(log(from),log(to),length.out=length.out)) } log.sum.exp<- function(x) { # Computes log(sum(exp(x)) # Uses offset trick to avoid numeric overflow: http://jblevins.org/notes/log-sum-exp if ( max(abs(x)) > max(x) ) offset <- min(x) else offset <- max(x)...
94415143f357e995dab15babcc0db6855f6658c09c0b3d7f98bdd40def9bc964
R
363
9
blocks1 <- name.blocks(list(c("bmi", "chl"), "hyp")) blots1 <- list(B1 = list(donors = 10), hyp = list(donors = 1)) test_that("BLOTS-001: errors when mixing same global and local argument", { expect_error( mice(nhanes, blocks = blocks1, blots = blots1, donors = 7, print = FALSE), 'formal argument "donors" ma...
7e0abeb01357bc0b95fea092b3b95f249799eebac0d9001307ceccc442bdd01b
R
367
11
test_that("LOGGEDEVENTS-001: loggedEvents is NULL", { imp1 <- mice(nhanes, m = 2, print = FALSE) # copy of data, different names data2 <- cbind(nhanes, nhanes) colnames(data2)[5:8] <- c("age2", "bmi2", "hyp2", "chl2") imp2 <- suppressWarnings(mice(data2, m = 2, print = FALSE)) expect_null(imp1$loggedEvent...
8ba9756f2402be1e8dde31d622eaa24b4747073ae92a3c159d1ef928857fc1b5
R
372
17
d1 <- brandsma[1:200, c("sch", "lpo")] pred <- make.predictorMatrix(d1) pred["lpo", "sch"] <- -2 test_that("MICE-IMPUTE-2L-NORM-001: mice::mice.impute.2l.norm() runs empty model", { expect_silent( imp <- mice( d1, method = "2l.norm", print = FALSE, pred = pred, m = 1, maxit = ...
96edd436f157b9ed584b23fb1e7e47da59b5c128a8de4e525365bfc918838078
R
379
16
#' @noRd get_function <- function(pkg, fun) { if(!requireNamespace(pkg, quietly = TRUE)) { stop(pkg, " package has not been installed", call. = FALSE) } eval(parse(text = paste0(pkg, "::", fun))) } #' @importFrom ggnewscale new_scale #' @noRd new_scales <- function(...) { scales <- list(...) if(length(sc...
6611dac464a33d0e5fb205626d2b05f837b1ee111132541488ce0c335423c729
R
382
19
validate.arguments <- function( y, ry, x, wy, allow.x.NULL = FALSE, allow.x.NA = FALSE ) { # validate standard arguments of mice.impute functions if (!allow.x.NULL && is.null(x)) { stop("Cannot handle NULL value for `x`") } if (!allow.x.NA && anyNA(x)) { stop("Cannot handle NA in `x`") } ...
f296ca04a255294e97783a62fad8d6cec1f2437345066d050982be463e40cb18
R
384
16
#Brain.GMT #This project was created with the goal of making a better .gmt file for analyzing our HC and STR results. #Megan Hagenauer #Begun 2021-03-26 ################ #Working Directory #Old: #setwd("~/Documents/Microarray Gen/Angela_HRLR_EE_Stress/NAcc_Remove2outliers/11_FGSEA/UpdatedGMT_20210325") #New: #Now...
0b5ef59d7c5ca60f3b0dc0b4dc93189d48d1447ebcb35a353f4fa7051a29c986
R
388
18
#' Title #' #' @param libname #' @param pkgname #' #' @return #' @export #' #' @examples .onAttach <- function(libname, pkgname) { start_message <- c( "\t\t\t Welcome to FramebyFrame\ \t\t\t Need help? francois@kroll.be\n \t\t\t If you use FramebyFrame in your work, please cite:\ \t\t\t https://doi.org/10.7554/eLife....
ad787ea40df86f16f42b4e798640c0341c9c00cfa7e6a8a455f70d3496b07288
R
390
22
#' @export df.residual.mira <- function(object, ...) { fit <- object$analyses[[1]] df.residual(fit) } #' @export df.residual.lme <- function(object, ...) { object$fixDF[["X"]][1] } #' @export df.residual.mer <- function(object, ...) { sum(object@dims[2:4] * c(1, -1, -1)) + 1 } #' @export df.residual.multin...
f27e6d0e7e538ab1c6acecb687ee7076485acec425b44883c08f3112caa3aaa8
R
410
8
library("Rsmlx") initializeMlxConnectors(software = "monolix") project <- "loglogistic.mlxtran" covariateSearch(project, paramToUse = c("Te"), covToTest = c("tTrt", "mu", "alpha", "beta", "CD31", "CTC", "gMDSC", "mMDSC", "ki67", "ki67p_cd3...
9dc917f8c5485c90f052bd3eedc1e4d46e3603de56be81818e083e42de088053
R
412
14
#' Function to estimate mode of MCMC samples #' #' Based on codes from 'http://stackoverflow.com/questions/2547402/is-there-a-built-in-function-for-finding-the-mode' #' see the comment by Rasmus Baath #' #' @param x MCMC samples or some numeric or array values. #' @importFrom stats density #' @export #' estimate_m...
e52fee6d70181b86211aa9360546f5a9bf88958ed92f44afed127cbf28897f71
R
414
12
## This script extracts results from mash model library(mashr) library(dplyr) load("mashr_meta_results.RData") m2$result$lfsr |> as.data.frame() |> tibble::rownames_to_column("effect") |> data.table::fwrite("lfsr.strong_signals.tsv", sep='\t') m2$result$PosteriorMean |> as.data.frame() |> tibble::rownames...
80b89e0a579ae860da048eb7d1ee7a054a2bacee7c75acd7766d9b0e58f245cb
R
416
16
if(!exists("argv")) argv <- commandArgs(trailingOnly = T) argc <- length(argv) dat <- read.table(argv[1]) out <- argv[2] name <- if(argc >= 3) argv[3] else "data" col <- if(argc >= 4) as.integer(argv[4]) else 1 df <- data.frame(dat[[col]]) colnames(df) <- c(name) summary(df) cat(sprintf("Std.dev.:%.4g",sd(df[[name]]...
5dea3aeaf6ca44d62ee847547eb6eb56e22a2027b2f6cfd37ed093be9821e8c1
R
428
11
# Install GitHub-hosted R packages required by this pipeline. # Run after activating the conda environment: # conda activate DEA # Rscript install_packages.R if (!requireNamespace("remotes", quietly = TRUE)) install.packages("remotes") remotes::install_github("junjunlab/ClusterGVis") remotes::install_github("junj...
427db15b7d9d1c793483d873262dd50fcee2c13530c05e2a0d48f59a6406780f
R
431
16
#TODO: Check or refine this. Maybe change name select.factR <- function(object, ...){ samples <- object@colData samples$old.names <- rownames(samples) samples <- as.data.frame(t(samples)) samples <- tryCatch( samples[,...], error = function(e) dplyr::select(samples, ...)) ...
b7116a80d3a13c669185940c0e68ea54791069772a80b5730ea515eb9f1b06ca
R
433
12
test_that("POOL-VECTOR-001: pool(fit)$pooled and pool.vector(summary(fit)) are identical", { # conventional flow imp <- mice(nhanes2, m = 2, maxit = 2, seed = 1, print = FALSE) fit <- with(imp, lm(chl ~ age + bmi + hyp)) est1 <- pool(fit)$pooled # using pool.vector on tidy parameters par <- summary(fit)[, ...
57be3244766a21a1f5f7de7f939fc0b6a3ac4c663039d933c040d6b543452a78
R
442
7
# from https://github.com/MareesAT/GWA_tutorial args <- commandArgs(trailingOnly=TRUE) het <- read.table(args[1], head=TRUE) het$HET_RATE = (het$"N.NM." - het$"O.HOM.")/het$"N.NM." het_fail = subset(het, (het$HET_RATE < mean(het$HET_RATE)-3*sd(het$HET_RATE)) | (het$HET_RATE > mean(het$HET_RATE)+3*sd(het$HET_RATE))); he...
a301cdf7db46a8435b6c0ac18573df16d4ef3e768e74765a2f8b831d493ad332
R
474
16
#' Echoes the package version number #' #' @param pkg A character vector with the package name. #' @return A character vector containing the package name, version number and #' installed directory. #' @author Stef van Buuren, Oct 2010 #' @keywords misc #' @examples #' version() #' version("base") #' @export version <- ...
aec8f61b2c799a876c72d83c6a5ea84e0a29fbbabbf89ac6f249b6c12adf5803
R
497
14
data(nhanes) imp <- mice::mice(nhanes, maxit = 2, m = 2, seed = 10, print = FALSE) fit_mira <- with(data = imp, exp = lm(chl ~ age + bmi)) fit_mipo <- mice::pool(fit_mira) test_that("POOL-R-SQUARED-001: pool.r.squared mira", { result <- as.vector(pool.r.squared(fit_mira, adjusted = FALSE)[1, ]) expect_equal(length...
a0406868bce8d372802efc21563f3ff39f5798ec4abc0bdc6b7b02b6fdc0e033
R
501
12
## Download the supplementary data of Chen et al., Nature (2023) and convert to bed file library(tidyverse) d0 = data.table::fread('~/Dropbox/Resources/Papers_suppl/Chen_constraint_2022/constraint_z_genome_1kb.qc.download.txt.gz') class(d0$z) d1 = d0 %>% filter(z >= 4) d2 = d1 %>% dplyr::select(chrom, start, end, z)...
1a5e10439ea8f99fc891443575bda4efdd1aede23e1aec0b5e458eba9425f86e
R
509
14
library(readr) library(dplyr) raw_transitome_PanCancer = read_csv('data_PanCancer/1_original_data/feature_alignment_modB_trs.csv') raw_transitome_PanCancer[raw_transitome_PanCancer$Intensity %in% 0,"Intensity"]<-NA raw_transitome_PanCancer = raw_transitome_PanCancer %>% mutate(transition = paste(FragmentIon, Pro...
a18c567f60b5981cb0dbe6e6b3aaca9b057b3468cae104a48110e3ec1c4ea1e9
R
509
21
###DTS script to pool raw data traves in various ways for each group ##pool all data by period pooled.data<-list() for(i in 1:NofPeriods) { period.data<-data.frame() for (l in 1:length(xml_list)) { period.data <- rbind(period.data, grouped.data[[l]][[i]]) } pooled.data[[i]] <- period.data } ##create a...
8c9f9f437bab22c74bb10b591f16c0a2e6ced1f80639866caafd168a074f597e
R
510
18
install.on.demand <- function(pkg, quiet = FALSE, ...) { # internal function that checks whether package pkg is # in the library. If not found, it asks the user permission # to install from CRAN. if (requireNamespace(pkg, quietly = TRUE)) { return() } if (interactive()) { answer <- askYesNo(paste("P...
111ec85977321685779c467abb03d233f30f50d02aa2c24a62a8d2eea1564edc
R
511
23
--- title: "**Quality by cycle**" --- The following page displays the quality by cycle plots generated during the pipeline. ```{r Quality_by_cycle, results='asis', echo=FALSE} setwd("..") plots <- Sys.glob("Picard_stats.dir/*.picard_stats.quality_by_cycle.pdf") wd <- getwd() for (i in plots){ filename <- file.p...
4ab096c3ef6dd168e0c5f78d930eb708ce0697e51e7aba98d400fdc6cf513379
R
516
24
--- title: "**Quality distribution**" --- The following page displays the quality by cycle plots generated during the pipeline. ```{r Quality_dist, results='asis', echo=FALSE} setwd("..") plots <- Sys.glob("Picard_stats.dir/*.picard_stats.quality_distribution.pdf") wd <- getwd() for (i in plots){ filename <- f...
0a200c082bbb5948dec50077b14ba6efb368ebaf1a73e679810fae9d340495ef
R
517
23
--- title: "Base distribution" --- This page describes the base distribution of each of the samples. This is ran as part of picard metrics. ```{r Base_dist, results='asis', echo=FALSE} setwd("..") plots <- Sys.glob("Picard_stats.dir/*.base_distribution_by_cycle.pdf") wd <- getwd() for (i in plots){ filename <- ...
87abd79d759aeb4bbb1706ec1a7cc2a415f63a458ae9b20ea162e4427a6325f4
R
522
18
--- title: "README" output: github_document date: "`r Sys.Date()`" --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` ## Data Directory Structure Files in this directory are either generated using code from this project or downloaded from sources specified in our scripts. The contents of this dir...
713d1db0d44d96771af95831c4a54d063ba84b0c03a10b142a52e554674e7db8
R
526
19
--- title: "README" output: github_document date: "`r Sys.Date()`" --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` ## Data Directory Structure Files in this directory are either generated using code from this project or downloaded from sources specified in our scripts. The contents of this di...