sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
55f2a00521fb00cf0da4bb40b3bae99483f86e72459ac2e2d881ce20b2379b5a | R | 1,228 | 43 | #' Message on attach
#'
#' Direct user to indicate Connectome Workbench path and check gifti package version.
#'
#' @param ... Not used
#'
#' @return \code{NULL}, invisibly
#'
#' @keywords internal
.onAttach <- function(...) {
ciftiTools.setOption("EPS", 1e-8)
ciftiTools.setOption("suppress_msgs", TRUE)
# Appl... |
7ca23a9cd638614c97791b23375d277b302f3a089bb071c55a635c5fcf6bdd66 | R | 1,257 | 42 | #' Fix a \code{"xifti"}
#'
#' Make adjustments to a putative \code{"xifti"} so that it is valid. Each
#' adjustment is reported.
#'
#' Right now it: coerces the data to numeric matrices; adds the
#' "Other" level to the subcortex labels.
#'
#' @inheritParams xifti_Param
#' @param verbose Report each adjustment? De... |
58371164f9276efbdd03368536c29f4e1a8175d7ff9dc166ff90e43e4cd90afd | R | 1,263 | 15 | source("/home/pdemange/CogNonCog/Annotations/Mouse_annotation/Basefiles/make.LDSR.annot_v2_4_6.R")
type.num<-as.numeric(commandArgs(trailingOnly=T)[1])
type.name<-commandArgs(trailingOnly=T)[2]
geneCode<-fread("/home/pdemange/CogNonCog/Annotations/Mouse_annotation/Basefiles/Geneloc_duplicated_excluded.txt",heade... |
c9683e7c85a31aada9ee924e5eb4dcb8a3c82beb853ce2e57c586d2002adf77b | R | 1,268 | 32 | library(neurobase)
tf_vis <- reticulate::import("tf_keras_vis")
load('/Users/willi3by/Desktop/ASNR_Abstract/master_PVS_dataset.R')
test_set_orig <- lapply(master_pvs_dataset, function(x){x <- x[-train_ind]})
model_modifier <- function(m){
reticulate::py_set_attr(m$layers[[length(m$layers)]], "activation", ... |
88b667960e71e03d43e0a283a9c4ca1b6fd8ffa951b07da61bc842a19ee54750 | R | 1,277 | 41 | ##################################################
## Project: CogNonCog 2018
## Script purpose: Functions to estimate the covariance between our latent factors Cog and NonCog and a latent variable corresponding to another trait.
## Date: April 2020
## Author: Perline Demange
####################################... |
f9e7b102ca7e35ac0a40b5e06570a6a9f7221cffbf2a08692841bea9447d06ac | R | 1,284 | 41 | ##################################################
## Project: CogNonCog 2018
## Script purpose: Functions to estimate the covariance between our latent factors Cog and NonCog and a latent variable corresponding to another trait.
## Date: April 2020
## Author: Perline Demange
####################################... |
fac5030b0ba907a62dccce236f01b5de6b1f033290b088effd614dff6bc118f9 | R | 1,289 | 41 | ## Example 1 Facetted Scatterplot
names(iris) = gsub("\\.", "", names(iris))
p1 <- rPlot(SepalLength ~ SepalWidth | Species, data = iris, color = 'Species', type = 'point')
p1
p1$show(cdn = T)
# p1$show(static = F)
## Example 2 Facetted Barplot
hair_eye = as.data.frame(HairEyeColor)
p2 <- rPlot(Freq ~ Hair, color = '... |
1f28d4a1a599eb600981a09179edfc9be43e4a063ca39efe3e5a8cca921e1a89 | R | 1,321 | 45 | #' Set \code{"xifti"} column names
#'
#' Change the column names of a \code{"dscalar"} or \code{"dlabel"}
#' \code{"xifti"} object.
#'
#' @param xifti A \code{"dscalar"} or \code{"dlabel"} \code{"xifti"} object.
#' @param names The new column names, as a character vector with length
#' equal to the same number of ... |
bbfba7b41d4134ea6f8055bad77a6b8d01676febe8d98f4a82ed208616647827 | R | 1,322 | 32 | #' Expect these \code{"xifti"}s to match
#'
#' Raise an error if the \code{"xifti"}s do not match.
#'
#' \code{cifti$intent} is only compared if it
#' exists for both files. \code{cifti$brainstructures} and \code{cifti$misc} are not compared.
#'
#' @param xii1 The first \code{"xifti"}
#' @param xii2 The second \c... |
7b285cf88a825b03a85cf45a15e4babd0dc56fe722142ecab76d2dac53f8cfff | R | 1,347 | 42 | residual_layer <- keras::Layer(
classname = "ResidualUnit",
initialize = function(filters=1, strides=1){
super()$`__init__`()
self$main_layers = list()
self$skip_layers = list()
self$filters = filters
self$strides = strides
},
build = function(input_shape){
self$main_layers <- ... |
d09da144761d63492e8c87d094d833071cd10e5a88eefcac6a0166130a0ba5c4 | R | 1,354 | 36 | ### R script to run genetic cor with genomic SEM on lisa
### Infos on the method https://github.com/MichelNivard/GenomicSEM/wiki/
#!/usr/bin/env Rscript
args = commandArgs(trailingOnly=TRUE)
sumstats_list = as.character(args[1])
outputName = as.character(args[2])
#packages
library(devtools)
require(Genom... |
26e59224944f87c33659e71164447e8d3f950ed0f55b98c5ee530fff04ced216 | R | 1,355 | 69 | ---
title: "Feedback"
date: "`r format(Sys.time(), '%d %B, %Y')`"
output: html_document
---
```{r setup, include = FALSE}
knitr::opts_chunk$set(echo = FALSE,
message = FALSE,
warning = FALSE)
library(markr)
```
```{r, eval=F}
# set eval=T to knit this example for debu... |
213ec7798317c056e4b6b484172aaeccdae339c89dffcac7ddb4eb831897ea6a | R | 1,370 | 34 | ##################################################
## Project: CogNonCog 2018
## Script purpose: Munge the statistics and run the multivariable LDSC (Step 1 and 2)
## With the metanalysed 23andMe+lee eduyears GWAS and CP (lee et al)
## https://github.com/MichelNivard/GenomicSEM/wiki/3.-Models-without-Individual-SN... |
c33f8f8bbac434d35718c7544970f549376e6d90986ec7108051201f1dd89c91 | R | 1,410 | 45 | ##################################################
## Project: CogNonCog 2018
## Script purpose: Mediation analysis of the rG
## Date: August 2019
## Author: Perline Demange
##################################################
LDSCoutput_rG_mediation <- function(data1, data2, data3, sample.prev_trait, populatio... |
fba27b1f7a370aa3e94fb25de99f0cc2162e61443d61102bd1b64585dd3431db | R | 1,451 | 64 | h = Timeline$new()
h$main(
headline = 'Sh*t People Say',
type = "default",
text = "People Say Stuff",
startDate = "2012,1,26"
)
h$event(
startDate = "2011,12,12",
endDate = "2012,1,27",
headline = "Vine",
text = "Vine Text",
asset = list(
media = "https://vine.co/v/b55LOA1dgJU",
credit = "",
... |
c6af63fc3abd9a5dd60343cd1b8a8853f4b10a1d9168b0da15730ad03482c3f9 | R | 1,470 | 48 | suppressMessages(library(stringr))
suppressMessages(library(Biostrings))
get_closest_motif<-function(x){
transid=bed[x,1]
pos=as.integer(bed[x,3])
seq=trans_seq[[transid,exact = FALSE]]
if(length(seq)==0){
return(c(NA,NA,NA))
}
base=as.character(as.data.frame(subseq(seq, start=pos,end=pos))[1,1])
tmp=matchP... |
91c9abbfcb0ae0bbed84b9e5aab2d49c3da35c60b514e67bde271f642ce2bc09 | R | 1,480 | 57 | #' Make A matrix
#'
#' Make A matrix
#'
#' @param spatial See \code{BayesGLM}
#' @return The A matrix
#' @keywords internal
make_A_mat <- function(spatial){
nV <- get_nV(spatial)
### `A`. -----
# [TO DO]
# A_sparse <- make_A_mat_rs(
# spatial$surf,
# ciftiTools::mask_surf(spatial$surf, spatial$mask)
#... |
90e3a7a3816b02a58b25bd63e6d4c050f11a7ef506d644357f96a069a2132605 | R | 1,494 | 49 | #' SPDE from mesh model
#'
#' @param spatial See \code{BayesGLM}.
#' @param qc_mask QC mask.
#' @param logkappa,logtau vector of min, max and initial value for prior on log kappa and log tau. Min and max are extreme quantiles, not hard constraints.
#' @return List: \code{spde} and \code{spatial}.
#' @keywords internal
... |
7548efe6fff85b2a1e8150e7b4e50d0ef01ec62388219491d7f71f2cf8802c5d | R | 1,501 | 56 | ##################################################
## Project: CogNonCog 2018
## Script purpose: Normalize cell expression (data from Zeisel et al. 2018)
##################################################
mouseatlas_matrix <- read_delim("mouseatlas_matrix.txt","\t", escape_double = FALSE, col_names = FALSE,trim... |
03730dc2c07aa3aab20cadf1e5022f153568cdc55eb2ac0ac8bbc1aacef46e84 | R | 1,526 | 47 | #' Builds ResNet 151
#'
#' @param input_shape
#'
#' @return ResNet model
#' @export
#'
#' @examples
#' resnet <- build_ResNet(input_shape, num_classes, loss, optimizer, metrics = c("accuracy"))
build_ResNet <- function(input_shape, num_classes, loss = "binary_crossentropy", optimizer = optimizer_adam(lr=0.001)... |
333f1753d60e91d3d84134a60b2fc8ed489bbf595f14f65abcadc267c26ffaa9 | R | 1,549 | 38 | ##################################################
## Project: CogNonCog 2018
## Script purpose:
## calculate the effective sample size of our GWAS, following Mallard et al. 2019
## Date: April 2019
## Author: Perline Demange
##################################################
library(data.table)
cog <- ... |
8399ead03fa29261564578bed475bbc9f28508b437fcc47bbc7aa0ae7ef513c0 | R | 1,600 | 49 | #' Resample a \code{"surf"} object
#'
#' Resample a \code{"surf"} object by writing it to a GIFTI, using the Connectome
#' Workbench to resample it, and then reading the new file. The barycentric
#' resampling method, which is recommended for anatomical surfaces, will be
#' used.
#'
#' @param surf A \code{"surf"}... |
888924da94fda0553dbefeea8010057bcd9c9f099f6ea48a55cc2008239ac73f | R | 1,626 | 54 | #' Summarize a \code{"fit_bglm"} object
#'
#' Summary method for class \code{"fit_bglm"}
#'
#' @param object Object of class \code{"fit_bglm"}.
#' @param ... further arguments passed to or from other methods.
#' @export
#' @return A \code{"summary.fit_bglm"} object, a list summarizing the properties
#' of \code{object... |
103f6e0c2b3e1909b5f2e5cf3fb77493904448a6607f8d2be135d39225e14a48 | R | 1,664 | 47 | #' Rotate a \code{"surf"} object
#'
#' Rotate a \code{"surf"}. Can be used to adjust the mesh orientation prior
#' to \code{\link{view_xifti_surface}}.
#'
#' @param surf The \code{"surf"} object: see \code{\link{is.surf}}.
#' @param r1,r2,r3 Angle to rotate along the first, second, and third column's
#' axis, in \c... |
92d2b0d96422aa042bac98293b92f4331f446987015c78a9c72752819ad75d1d | R | 1,675 | 29 | # Preparation functions ---------------------------------------------------
#' Creates file templates, for the user to edit
#'
#' @return Creates .csv files on the filesystem
create_templates <- function () {
setwd(variables_environment$directories$setup$working_dir)
if (file.exists(variables_environment$files$lut... |
403200a13f90481d703a15d81e8282bcba0def2f6a1aaa184a3630d17b968b18 | R | 1,685 | 47 | #' Select columns of a \code{"xifti"}
#'
#' Select column indices to keep in a \code{"xifti"}. Can also be used to
#' reorder the columns.
#'
#' Note: for selecting brainstructures to keep, use \code{\link{remove_xifti}}
#' instead.
#'
#' @inheritParams xifti_Param
#' @param idx The column indices to keep, in ord... |
cc74fd3010ba9a577e53526988be0a171ca3e8e4710e5ceda51b0ea0003c967b | R | 1,695 | 38 | library(DESeq2)
library(ggplot2)
group<-read.delim("EAT_group_cluster.txt",sep="\t",row.names=1)
df<-read.delim("counts.txt",sep="\t",skip=1,row.names=1)
colnames(df)<-sub('\\_.*.bam','',colnames(df))
colnames(df)<-sub('X','',colnames(df))
dd<-df[,6:ncol(df)]
dds<-DESeqDataSetFromMatrix(dd,DataFrame(condition),~conditi... |
c9f55f099fd0876abfc2750db3e0cc519c731dcf51c299684e054220d7cff6a6 | R | 1,704 | 71 | #' Make a template \code{"xifti"} object
#'
#' Make a \code{"xifti"} object with all terminal entries \code{NULL}. Useful for
#' seeing the structure of a \code{"xifti"} object or creating a new one.
#'
#' Additional metadata depends on the type of CIFTI file:
#'
#' \describe{
#' \item{"dtseries"}{
#' \des... |
f699b6a3b0a908d8c102a3efe62586ec1ceea673483b0ab76a65db92c04a14e3 | R | 1,727 | 42 | #' Get `session_names` for GLM
#'
#' @keywords internal
BayesGLM_session_names <- function(nS, session_names, BOLD_names, design_names){
# In order of priority:
# 1) the session names argument
# 2) the BOLD data
# 3) the design (quickly check if it's a list)
if (!is.null(session_names)) {
stopifno... |
7a6aa602e654669cf8ec54d786acb15e1abcbd22dcd841a80570dbb5ee87539e | R | 1,751 | 42 | ##################################################
## Project: CogNonCog 2018
## Script purpose: Create the gene sets for MAGMA bioannotation
# Data comes from mice so the genes names are changed to human names.
## Date: January 2018
## Author: Perline Demange, adapted from Hill Ip, helped by Matt... |
7790ee03789b113329647dc2a4f8a4cf581b4490ab6e92c923a15a5930a1d6d7 | R | 1,763 | 67 | draw_confusion_matrix <- function(cmtrx) {
total <- sum(cmtrx$table)
res <- as.numeric(cmtrx$table)
# Generate color gradients. Palettes come from RColorBrewer.
greenPalette <- c("#F7FCF5","#E5F5E0","#C7E9C0","#A1D99B","#74C476","#41AB5D","#238B45","#006D2C","#00441B")
redPalette <- c... |
442d6b5a54e3083f53069b871d777c852bc820b9fbde07e251d6ca4b5d58da80 | R | 1,775 | 52 | check_wb <- function() {
if (is.null(ciftiTools.getOption("wb_path"))) {
skip("Connectome Workbench is not available.")
}
}
test_that("Reading CIFTI and GIFTI files is working", {
check_wb()
fnames <- ciftiTools.files()
for (cii_fname in fnames$cifti) {
cat("\n\n"); cat(cii_fname); cat("\n\n")
... |
1aef3e8fbf4b7152a56197fbf3abef9efe4af4b59046c771f44d7e218d15ce95 | R | 1,796 | 56 | ###Three pop calcs
#threepop ran in treemix package "threepop -i input.treemix.gz > threepop.raw"
#tidied up in command line to tab separate and label pops to regions (i.e. NPAG, SPAG...)
#Purpose is to calculate prop of significant to total test for each region_region comparison
setwd("/path/to/directory")
pop3=read.t... |
b0419faf3fb24e1e89b7e280ea00608c4de0ba7357a80223eacfde972ca6bf48 | R | 1,809 | 62 | ##################################################
## Project: CogNonCog 2018
## Script purpose: Run model and GWAS with EA->CP
## Date: August 2020
## Author: Michel Nivard
##################################################
#Michel's computer: R3.6.2, Lavaan 0.6.7, Genomic SEM 06 August 2020
require(GenomicSEM)
#... |
3b8181c683d611a2e4ff48a4a11edae5e2d504f0c294a0725f3b1347dc021d4b | R | 1,812 | 39 | # Keyboard Shortcuts
This list is not yet complete.
## Command
* <span class="cmd">0</span>: Zoom to original size (Delineate window)
* <span class="cmd">2</span>: Show Finder window
* <span class="cmd">3</span>: Show Delineate window
* <span class="cmd">4</span>: Show 3D window
* <span class="cmd">5</span>: Show Av... |
4d9de5df984622fb85119d1be3b02b95702276b7e12f6266530395c263c0919b | R | 1,865 | 67 | #' Summarize a \code{"BGLM"} object
#'
#' Summary method for class \code{"BGLM"}
#'
#' @param object Object of class \code{"BGLM"}.
#' @param ... further arguments passed to or from other methods.
#' @export
#' @return A \code{"summary.BGLM"} object, a list summarizing the
#' properties of \code{object}.
#' @method su... |
ac6d6f46f77e62853fcff51002ebe1b072934b707dc24d9b5260d5023e02af2c | R | 1,873 | 60 | #' \code{ciftiTools} files
#'
#' CIFTI and surface GIFTI files included in the \code{ciftiTools} package
#'
#' The CIFTI files are from NITRC: cifti-2_test_data-1.2.zip at
#' https://www.nitrc.org/frs/?group_id=454
#'
#' The surfaces are from the HCP and are included according to these data use
#' terms: Data were ... |
e24b3e456a379639a46bf6424f97f59954e827d6becb4ffa8e99a19b61912368 | R | 1,884 | 70 | # general functions - these are used at different points of the script
options(readr.num_columns = 0)
options(width = 320)
#' Create folders from (list of) filenames
#'
#' @param list_of_files filename, list of filenames containing path
#'
#' @return Nothing - creates folders for these files on the system
#' @example... |
9e918c2bb512fcaa6b9f0b901bb88ecd185519ae58556eaf19c576d86baaa4c2 | R | 1,895 | 69 | #' Summarize a \code{"prev_fit_bglm"} object
#'
#' Summary method for class \code{"prev_fit_bglm"}
#'
#' @param object Object of class \code{"prev_fit_bglm"}.
#' @param ... further arguments passed to or from other methods.
#' @export
#' @return A \code{"summary.prev_fit_bglm"} object, a list summarizing the
#' proper... |
6d5c76821d91b6c632ddefcf73b40093fce23cec4f544739c9c33a227a63acd3 | R | 1,943 | 30 | #Figure 3
setwd("path/to/folder")
#Plot Fst - can use data frame from Figure 2 (scaffold27 plots)
library(egg) #for ggarrange
#function to make sure yaxis is 2decimal places
scaleFUN <- function(x) sprintf("%.2f", x)
all.fst=read.table("./SNP.msp.recode.fst_INS-OUT.rehead.tsv",header=TRUE)
s441.fst=all.fst[which(all... |
8b727e85434390ce1fc8254af7061dafb2e951159a72e91968332e2984d2eb74 | R | 1,957 | 40 |
# FIR Model ------------------------------------------------------------------
# result_FIR <- vector('list', length=nS)
# for (ss in seq(nS)) {
#
# #check whether to proceed with FIR modeling
# FIR_ss <- data[[ss]]$design_FIR
# if(is.null(FIR_ss)) next()
# nFIR <- ncol(FIR_ss)
... |
2b7c744e63d7afa308b55bed150168b3e5f91064ced73b799a2ee39bfca3b93a | R | 1,970 | 52 | #' Replace \code{NA} values in dlabel \code{"xifti"} with a new label.
#'
#' \code{NaN} values will be converted to \code{NA} and also replaced.
#'
#' @param xifti The \code{"xifti"}
#' @param NA_value The new label value for \code{NA} values. If \code{NULL}
#' (default), use -1 if all existing label values are non-... |
b9452ceb1a7b772f8a100d945880985460f9582fd0cb37aef9941b163662d85c | R | 1,997 | 39 | ##################################################
## Project: CogNonCog 2018
## Script purpose: Correction of the genecode file which contains duplicated genes
## Date: January 2018
## Author: Perline Demange
##################################################
library(data.table)
library(dplyr)
library(strin... |
dedfd40cb55e11b847ae46fca5574d0a60d73ba4cf0a43e738ed4afc5397c762 | R | 2,007 | 71 | #' Summarize a \code{"prev_fit_bglm"} object
#'
#' Summary method for class \code{"prev_fit_bglm"}
#'
#' @param object Object of class \code{"prev_fit_bglm"}.
#' @param ... further arguments passed to or from other methods.
#' @export
#' @return A \code{"summary.prev_fit_bglm"} object, a list summarizing the
#' proper... |
24e5fa7b383c0c694e8e60d5123b2a260a1e942aba7e4d51d8fefb5789c7ff08 | R | 2,012 | 67 | # Example 1
p1 <- Rickshaw$new()
p1$layer(~ cyl, group = 'am', data = mtcars, type = 'bar')
# Example 2
require(rCharts)
# options(RCHART_TEMPLATE = 'Rickshaw.html')
require(RColorBrewer)
data(economics, package = 'ggplot2')
datm = reshape2::melt(
economics[,c('date', 'psavert', 'uempmed')],
id = 'date'
)
datm <- ... |
ba68d501763bc90739a1ef395fa0e67acf4b915923ec4534098480f0d8b89e0b | R | 2,097 | 55 | check_wb <- function() {
if (is.null(ciftiTools.getOption("wb_path"))) {
skip("Connectome Workbench is not available.")
}
}
test_that("plot_xifti_surface and related functions are working", {
check_wb()
plot2 <- function(...){plot(...); rgl::close3d()}
fnames <- ciftiTools.files()
for (cii_fname in ... |
7a35b04f2abfa48cd4a3eec4d7dd8f40e92db054b75a8df767fa2f6cb575472f | R | 2,109 | 52 | #' Flatten a \code{"xifti"}
#'
#' Concatenates the data in a \code{"xifti"} object row-wise to form a single matrix.
#'
#' If all brain structures are present, and if
#' \code{is.null(medial_wall)} and \code{subcort_order=="alphabetical"}
#' (the default arguments), then the result will be identical to the matrix
#... |
730b277a18741bef6fce433d431491c181230e1cc21004c58391bc9db1840e0c | R | 2,118 | 53 | #' Load a \code{"surf"} included in \code{ciftiTools}
#'
#' Load a \code{"surf"} object from one of the three 32k fs_LR anatomical
#' surfaces included in \code{ciftiTools}.
#'
#' The surfaces are from the HCP and are included according to these data use
#' terms: Data were provided \[in part\] by the Human Connecto... |
0e5135b94b0a6a3fdb5301857df18bf3b04e1909c203c22581c8eeec5ed7a0f0 | R | 2,162 | 56 | library(tensorflow)
library(keras)
source('build_ResNet.R')
source('custom_residual_layer.R')
art <- reticulate::import("art")
tf$compat$v1$disable_eager_execution()
load('x_test.R')
load('y_test.R')
source_model <- build_ResNet(input_shape = dim(x_test)[2:5], num_classes = 2,
optimize... |
291f6d96a1b25ae436feb69c9cfee981a48b13db0f001250c78cee51e1469853 | R | 2,212 | 69 | ##################################################
## Project: CogNonCog 2018
## Script purpose: Function to run the genetic correlations with Genomic SEM, adapted from the file GenCor_GenSEM_function.R
## Date: December 2018
## Author: Perline Demange
##################################################
CogNo... |
51b7ece84f5535440e5fc1393dbb7ff334d41cfc98f7a425ea17331e254eb70c | R | 2,238 | 50 | ###This is the script for Site#2 and Site#3 test
### other two script used same command with different group name
##load packages
library(methylKit)
library(genomation)
##get filenames
filenames<-list.files(pattern="*.sam")
rufile=as.list(filenames)
##read sam files
ruobj<-processBismarkAln(location=rufile,sample.id=li... |
255e9924418b6d842aa6ea73854d41dee5744a715f0cc8d9764320a0828d7218 | R | 2,255 | 57 | # add BIDS metadata (dataset.json, CHANGES, README)
#' Title
#'
#' @return
#' @export
#'
#' @examples
add_BIDS_metadata <- function(){
add_participants_tsv <- function(){
# Select columns from json dataframe, mutate relevant columns
patient_tsv <- diagnostics$json_data %>%
select(subject, session, grou... |
e7859b1296254d9f45d23bb123050569703c95b115111e124d098ef0d962d41a | R | 2,260 | 65 | ##################################################
## Project: CogNonCog 2018
## Script purpose: Clean results of the genetic correlations with the Causal EA-CP model
## and make the Supp Figure 17
## Date: August 2020
## Author: Perline Demange
##################################################
cor <-read.csv("gen... |
556bb30c8285e5789ccd653e39bcb7e5b187a765ba9d6d59ca55de9f4458be13 | R | 2,280 | 72 | #!/usr/bin/env Rscript
args <- commandArgs(trailing=T);
outdir <- ".";
my.colour <- "#29A6C9";
input.size.unit <- "bytes";
sqlite.file <- NA;
i <- 1;
while (i < length(args)) {
if (args[i] == "--outdir") {
outdir <- args[i+1];
i <- i +2;
} else if (args[i] == "--colour") {
my.colour <... |
f7c4b48e9743fefb71231637965d625e841e9145af80e7cdef30c854b0496c6b | R | 2,294 | 65 | #' Fix GIFTI medial wall
#'
#' Replace implicit medial wall values (not indicated in ROI, but are in
#' \code{mwall_values}) with explicit medial wall values (indicated in ROI)
#' in a metric GIFTI file.
#'
#' @param metric_fname File path to the data GIFTI
#' @param fixed_metric_fname File path to the revised data G... |
edf855d201cee34a61a689391836c6eb0af662d9beccfdddd2e8c5ee33668786 | R | 2,316 | 79 | #' Classical GLM for multiple models
#'
#' Classical GLM for multiple models
#'
# @param data,spatial,spatial_type,session_names,field_names,design_type See \code{fit_bayesglm}.
# @param valid_cols,nT,nD,var_resid,sqrtInv_all See \code{fit_bayesglm}.
# @return A list of results
#' @keywords internal
GLM_compare <- func... |
10f2616ff4bdd69510795037761df3076e1e2810956cdb52a2ebaaed279afd9f | R | 2,370 | 84 | # [Build --> Install and Restart]
# Setup ------------------------------------------------------------------------
# [Edit these]
doINLA <- TRUE
resamp_res <- 9000
my_wb <- "~/Desktop/workbench" # path to your Connectome Workbench
dir_results <- "tests/results_notInPackage"
dir_resultsThis <- file.path(dir_results, "... |
33d623ddab94f08bb9f419f014d38db0c0983b9adf62b3c61d5f83f64b8b849f | R | 2,408 | 62 | #' Scale the BOLD timeseries
#'
#' @param BOLD fMRI data as a locations by time (\eqn{V \times T}) numeric
#' matrix, where \eqn{V} is the number of locations and \eqn{T} is the number
#' of timepoints.
#' @param scale Option for scaling the BOLD response.
#' @param v_means Original means of the BOLD data. ONLY provi... |
84360a2a642e9098a27b86f8d43acc9d0dc3c028881d78f4a239726c27516451 | R | 2,413 | 58 | #' Classical GLM
#'
#' Classical GLM for fit_bayesglm (internal function)
#'
#' @param BOLD BOLD timeseries in vector form (TVx1), result of \code{sparse_and_PW}
#' @param design List of large sparse design matrices (each TVxV), one per regressor, result of \code{sparse_and_PW}
#' @param nK2,nV_input,field_names,design... |
54f0313768b02f24a64ee5456737d91c6d8975452c7cc5f51d2e74055052fa3e | R | 2,485 | 55 | # Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
#' Find the log of the determinant of Q_tilde
#'
#' @param kappa2 a scalar
#' @param in_list a list with elements Cmat, Gmat, and GtCinvG
#' @param n_sess the integer number of sessions
#'
.lo... |
94551115d4b63ee05760ab1088d0797b09877d5411055db6b0259e00cd2aaf71 | R | 2,505 | 57 | # dcm2niix conversion functions -------------------------------------------
#' Creates the dcm2niix system commands for the conversion
#'
#' @param input Folder path(s) containing dicoms
#' @param output Folder path(s) where the nii images should be exported to
#' @param scanner_type MRI scanner vendor type
#' @param... |
c3ba261534649253f37df791dfa28d1890967c3c62607ea0e91bdb43cf587efd | R | 2,517 | 58 | #' Remap GIFTI metric or label data
#'
#' Remap GIFTI metric or label data between two different spaces, such as
#' between FreeSurfer fsaverage group data and fs_LR group data. This function
#' is a wrapper to \code{\link{resample_gifti}}.
#'
#' @param original_fname The GIFTI file to remap.
#' @param target_fname... |
c81cf8bdac161f4cb4bf68acd4b5a3547abd1f453ef748dec3b4e8b16bc6add8 | R | 2,563 | 68 | ##################################################
## Project: CogNonCog 2018
## Script purpose: Clean results of the genetic correlations with the model Cogent -UKB
## and make the Supp Figure 14
## Date: August 2020
## Author: Perline Demange
##################################################
cor <-read.csv("gencor... |
9b1f18930757b82502dfb47dc1b0a5cefd773f7d895933d804cfd85b01466681 | R | 2,649 | 77 | #' Apply a function along the rows or columns of a \code{"xifti"}
#'
#' Apply a many-to-N function (e.g. mean) to the rows or columns of a
#' \code{"xifti"}. If applied row-wise, a \code{"xifti"} with N data column(s)
#' is returned. (If the \code{"xifti"} had the dlabel intent, and values that
#' are not labels a... |
64fc5d4ba1983968a2f8828a28e4d76eb6bd860fe0639a438faa98c1dbe87e60 | R | 2,739 | 54 | ##################################################
## Project: CogNonCog 2018
## Script purpose: Compare the MAGMA results with the results from LDSC
## Date: February 2019
## Author: Perline Demange
##################################################
rm(list=ls())
library(data.table)
library(ggplot2)
setwd("... |
2f37c06efaf4436e781449b9d2a2f6349b98c0eb11482041835feba8c0552942 | R | 2,799 | 66 | #' Concatenate \code{"xifti"}s
#'
#' Concatenate \code{"xifti"} objects along the columns. They must have the same
#' brainstructures and resolutions. The first \code{"xifti"}'s metadata will be
#' retained, including its intent.
#'
#' @param ...,xifti_list Provide as arguments the \code{"xifti"}s to
#' concate... |
5812b5104ae57fbdeded6503c35fad29ed736ef3205a1ba2d0c6f8f742c7be99 | R | 2,805 | 95 | #' Summarize a \code{"fit_bglm2"} object
#'
#' Summary method for class \code{"fit_bglm2"}
#'
#' @param object Object of class \code{"fit_bglm2"}.
#' @param ... further arguments passed to or from other methods.
#' @export
#' @return A \code{"summary.fit_bglm2"} object, a list summarizing the
#' properties of \code{ob... |
21c79c20e2b90b83dbb1304e057fbfd6f453ca165f5e1c7aeeb632bccddf7abb | R | 2,806 | 77 | #' Remove a component from a \code{"xifti"}
#'
#' Remove a brain structure, surface, or subcortical structure from a
#' \code{"xifti"}.
#'
#' @inheritParams xifti_Param
#' @param remove A character vector containing one or more of the following:
#' \code{"cortex_left"}, \code{"cortex_right"}, \code{"subcortical"},... |
6b278a6021252e95186b13016945929baf4c210be9c02c1d247c01151d76d0dc | R | 2,810 | 73 | #' Organize data for Bayesian GLM
#'
#' Transforms the usual TxV BOLD data matrix Y into vector form, and
#' the usual TxK design matrix X into big sparse matrix form for use in
#' Bayesian GLM.
#'
#' The Bayesian GLM requires \code{y} (a vector of length TV containing the BOLD data)
#' and \code{X_k} (a sparse TVxV... |
1109f1ea193b6bbc537e6f6fad1ca9996f7e26f66fba3e1854a6020ad5a98430 | R | 2,815 | 91 | #' Intersection mask for BayesGLM or activations result
#'
#' @param x The list of \code{"fit_bglm"}, \code{"BGLM"}, or \code{"act_BGLM"} objects.
#' @return The intersections masks
#'
#' @keywords internal
intersect_mask <- function(x) {
what <- if (inherits(x[[1]], "fit_bglm")) {
"fit_bglm"
} else if (inherit... |
ce2197b1489ca3d8c9bc9eac2c2f513c954212466f28f0b3f305aedb69223a4d | R | 2,861 | 82 | #' Surface area calculation
#'
#' Calculate surface area of a \code{"surf"} object by vertex or face. Surface
#' area calculation by vertex matches the Workbench command
#' "-surface-vertex-areas".
#'
#' @param surf The \code{"surf"} object.
#' @param by \code{"vertex"} or \code{"face"}. For \code{"vertex"}, the r... |
375830665824330086c5ec97c42f51dd2b0bc3ca5fea7129e0578d89f180dad8 | R | 2,880 | 91 | # Tests for the web-render (Tahoe / opt-in) backend.
# Add new web-render regressions here rather than a new file per bug.
# Each test uses with_web_render() below to force the backend on regardless
# of host platform, so these run anywhere with Connectome Workbench.
check_wb <- function() {
if (is.null(ciftiTools.g... |
f8198f73a4f1eb85cdfb079c33a0da4b3035c3da752f3c30ba93e5de3db1ca5c | R | 2,940 | 76 | #' Format fit_bayesglm results into \code{"xifti"} objects
#'
#' Format beta estimates or RSS of the \code{fit_bayesglm} results into list of
#' \code{"xifti"} objects for each session.
#'
#' @param BGLMs The list of \code{"BGLM"} objects, from \code{fit_bayesglm}.
#' @param do,spatial,submeta,session_names,field_name... |
d99b76500a92e9ee1844b7f7bcbce5742ab4c4125e4486ae3d7e90b077384955 | R | 2,992 | 113 | datatable_setting <- function(df) {
DT::datatable(
df,
extensions = c('Buttons', 'Scroller'),
options = list(
search = list(regex = TRUE),
searchHighlight = TRUE,
pageLength = 25,
dom = 'Bfrtip',
buttons = c('copy', 'csv', 'excel', 'print'),
deferRender = TRUE,
sc... |
d0add47f970c07cca683a4b938b9516de74b470b48981175fffcd6a204438696 | R | 3,046 | 97 | #' List \code{ciftiTools} options
#'
#' @return \code{data.frame} describing the options
#'
#' @export
#'
ciftiTools.listOptions <- function() {
OptionName <- c('wb_path', 'EPS', 'suppress_msgs')
CurrentValue <- lapply(OptionName, ciftiTools.getOption)
CurrentValue[vapply(CurrentValue, is.null, FALSE)] <- "NU... |
27f93607fa0b9ed740d8a791d9fb23ddb204f735f6fcc433a2c67d01258b3e6f | R | 3,066 | 84 | #' Add HCP surface(s) to a \code{"xifti"}
#'
#' Add left or right cortical surface geometry from the HCP S1200 release
#' to a \code{"xifti"} object.
#'
#' \code{surfL} will be added to \code{xifti$surf$cortex_left} and \code{surfR}
#' will be added to \code{xifti$surf$cortex_right}. Any existing surfaces will
#' b... |
4a09767cd788c50c670faf462b03c4677cc8c4390bd1ab6dd825500d37b8e743 | R | 3,070 | 75 | # copy2BIDS ---------------------------------------------------------------
#' Copies files, if they don't exist in target
#'
#' @param from list: File source
#' @param to list: File destination
#' @param string Which step?
#'
#' @examples copy_files(path_input, path_output, "Copy files to output.")
copy_files <- fun... |
b2e9a74a83c66471a34c0c53e025c3f4a7c1f59503d3f6ff05415ed5ee57e0bc | R | 3,145 | 96 | # [Build --> Install and Restart]
# Setup ------------------------------------------------------------------------
# [Edit these]
doINLA <- TRUE
saveResults <- TRUE
overwriteResults <- TRUE
# my_pardiso <- "~/Documents/pardiso.lic" # INLA PARDISO license
my_wb <- "~/Desktop/workbench" # path to your Connectome Workben... |
9a445f98a72df3292d755a55e8692307938edf7467d358334d61e86caed9ba02 | R | 3,202 | 101 | ##################################################
## Project: CogNonCog 2018
## Script purpose: R script to run the GenomicSEM for Multivariate GWAS in Lisa
## Follows https://github.com/MichelNivard/GenomicSEM/wiki/5.-User-Specified-Models-with-SNP-Effects
## Author: Perline Demange
############... |
7dc2b2ad1a5a3fcef12fd163fa2189a3ca3d5bf401a91d0e3f6a47647a8dd3a5 | R | 3,229 | 86 | # July 20, 2020
# Katia Lopes
# Small heatmap
#This command clean all variables. BE CAREFULL!!!
rm(list = setdiff(ls(), lsf.str()))
# install.packages("wesanderson")
library(venn)
library(ggsci)
library(factoextra)
library(reshape2)
library(ggplot2)
library(Hmisc)
library(stats)
library(RColorBrewer)
library(vir... |
e506337aabff3cf113ad0dea7753d0b5132f3411f6b251490628b2efc19f97a4 | R | 3,251 | 100 | ##################################################
## Project: CogNonCog 2018
## Script purpose: Run model and GWAS with CP UKB and CP Cogent separately
## Date: August 2020
## Author: Michel Nivard
##################################################
# Michel's computer: R3.6.2, Lavaan 0.6.7, Genomic SEM 06 August 20... |
9178b3fd47f06f633521c4c33e2c0b0c5ccf451d8d8641631dea304c389df6ec | R | 3,254 | 96 | #' Resample a CIFTI from a template
#'
#' Resample a CIFTI from a template, ensuring the new CIFTI's resolution matches
#' that of the template.
#'
#' @param original_fname A CIFTI file to resample.
#' @param template_fname A CIFTI file to use as the template.
#' @param target_fname The file name to save the resample... |
50f4a893e2319ad6a463ef968d5344cd89dbe9f02a25beadfd3a2817ad79ba97 | R | 3,267 | 91 | #' Smooth a metric GIFTI file
#'
#' Smooths metric GIFTI data along the cortical surface. The results are written
#' to a new GIFTI file.
#'
#' @param original_fname The GIFTI file to smooth.
#' @param target_fname Where to save the smoothed file.
#' @param surf_fname Surface GIFTI files cortical surface along which t... |
abef76c6dd19c3081a7189e2364ae1b72796d1ac5e24761d8cedc74bff398c93 | R | 3,334 | 91 | ---
title: "qvalue sharing"
author: "Jack Humphrey"
date: "09/06/2020"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
```
```{r}
eGene_numbers <- data.frame(
set = c("Microglia MFG", "Microglia STG", "Microglia THA", "Microglia SVZ", "Microglia all regi... |
75c87595c9ceedb5907b62988962dfa7841575544febb060d9d49a99690d96a2 | R | 3,488 | 92 | check_wb <- function() {
if (is.null(ciftiTools.getOption("wb_path"))) {
skip("Connectome Workbench is not available.")
}
}
test_that("Resampling CIFTI and GIFTI files is working", {
check_wb()
tdir <- tempdir()
fnames <- ciftiTools.files()
for (cii_fname in fnames$cifti) {
cat("\n\n"); cat(cii_... |
4502714f292dd4a0db1988c82f824a64c62089f224838a802eecc1d657a929b9 | R | 3,493 | 121 | #' Derive transformation matrix from \code{qform} metadata in NIFTI header
#'
#' Sources: afni.nimh.nih.gov/pub/dist/doc/nifti/nifti1_h.pdf,
#' brainder.org/2012/09/23/the-nifti-file-format/,
#' nipy.org/nibabel/nifti_images.html,
#' brainvoyager.com/bv/doc/UsersGuide/CoordsAndTransforms/CoordinateSystems.html
#'
#'... |
f4edb8920e9c71b4c7050c4ccd4dc68524defdb7edce94c5dff9a2d5b97e0035 | R | 3,511 | 81 | library(rCharts)
# Example 1
hPlot(Pulse ~ Height, data = MASS::survey, type = "scatter", group = "Exer")
## Example 2
a <- hPlot(Pulse ~ Height, data = MASS::survey, type = "bubble", title = "Zoom demo", subtitle = "bubble chart", size = "Age", group = "Exer")
a$chart(zoomType = "xy")
a$exporting(enabled = T)
a
## ... |
1405f695e71c02fffa3bbdd3dd5811aa231ad1932c882a39fa5ee86f5a2d9bff | R | 3,531 | 99 | # BIDS-Direct-ConverteR
#setwd("/home/niklas/Coding/GITHUB-BiDirect_BIDS_Converter/")
# args = "/home/niklas/BIDS_test/"
## general setup
source("functions/functions.R")
render_asci_art("asci/logo.txt")
# pre-installation step
install_dcm2niix()
## settings
variables_environment$directories$setup$working_dir <- f... |
f7732d2764b9bc032c4ec406d0a96f116e466c4e6bbb0faed6c6f621a4cd780e | R | 3,565 | 95 | # devtools::install_github('rCharts', 'bbest') # tweak to make var geojsonLayer available
require(rCharts)
json = '{"type":"FeatureCollection","features":[
{"type":"Feature",
"properties":{"region_id":1, "region_name":"Australian Alps"},
"geometry":{"type":"Polygon","coordinates":[[[141.13037109375,-38.7883453... |
fcfa48b8b40071145f48c2811f4ad17ad2d62fc496fad5bbe8daeaed994650a8 | R | 3,583 | 104 | #' Write a CIFTI file from NIFTI and GIFTI files
#'
#' Make a CIFTI file from component NIFTI/GIFTI files using the
#' \code{-cifti-create-...} Connectome Workbench commands.
#'
#' Every provided component will be included. The ROIs are only used if the
#' corresponding cortex is provided. Either both or none of the ... |
f2033cb2ac9f8736e4421bbc1b6af0111ad6817cd1f1cb9ff8eac300897b18a8 | R | 3,601 | 109 | check_wb <- function() {
if (is.null(ciftiTools.getOption("wb_path"))) {
skip("Connectome Workbench is not available.")
}
}
test_that("Writing CIFTI and GIFTI files is working", {
check_wb()
tdir <- tempdir()
fnames <- ciftiTools.files()
for (cii_fname in fnames$cifti) {
cat("\n\n"); cat(cii_fna... |
8041a887fadcf5deb13ba31f7825454860362b84dc6026abe700ba28c5b2440c | R | 3,636 | 165 | ---
title: "BiDirect BIDS Viewer"
params:
wd: "working_dir"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
runtime: shiny
source_code: embed
runtime: shiny
---
```{r setup, include=FALSE}
source("../functions/libraries.R")
source("../dashboard/dashboard_functions... |
a11e08bc649118c0272042fd9d37293fafdf155187445b3f7e467a4e70d6fed3 | R | 3,657 | 60 | ---
title: "Spectral parameterization for studying neurodevelopment: How and why"
subtitle: "Setting up Python in R Studio using the *reticulate* package"
author: "Brendan Ostlund, Thomas Donoghue, Berenice Anaya, Kelley E. Gunther, Sarah L. Karalunas, Bradley Voytek, & Koraly E. Pérez-Edgar"
output: html_document
---
... |
45aa7f458af2abf5d2fce899830a83662b4b0c4b21a3c90baa2d5ca9d98b07fc | R | 3,758 | 120 | ---
title: "Quality Control Analysis - after QC"
subtitle: "Microglia data"
author: |
| Katia de Paiva Lopes
| Raj Lab
| Department of Neuroscience
| Icahn School of Medicine at Mount Sinai
| NYC, New York
date: "`r Sys.Date()`"
output:
rmarkdown::html_document:
theme: united
highlight: tango
code_fol... |
f4ff9e0bd0c82b3ac3a583a0c93309768722eb9945ec577922c629239ba3514a | R | 3,765 | 104 | #' SPDE from voxel model
#'
#' @param spatial See \code{BayesGLM}.
#' @param qc_mask QC mask.
#' @param logkappa,logtau vector of min, max and initial value for prior on log kappa and log tau. Min and max are extreme quantiles, not hard constraints.
#' @return List: \code{spde} and \code{spatial}.
#' @keywords internal... |
e51a1904fc231267a390265d14f005e66556b36074c8c141076136f89074d73f | R | 3,770 | 69 | ## usethis namespace: start
## usethis namespace: end
#' ciftiTools: Tools for Reading and Visualizing CIFTI Brain Files
#'
#' Here are groups of commonly-used functions in \code{ciftiTools}:
#'
#' Functions for reading in CIFTI or GIFTI data:
#'
#' \describe{
#' \item{\code{read_xifti}:}{ Read in a CIFTI file as ... |
9fa12392039638ef1304c30a25193d707fbf758d7fd9d07e12834e8214de0c0c | R | 3,777 | 54 | ---
title: WebMorph Manual
date: "`r Sys.Date()`"
author: "Lisa DeBruine"
site: bookdown::bookdown_site
documentclass: book
bibliography: [bib.bib]
biblio-style: apalike
link-citations: yes
description: "Manual for WebMorph, a web-based version of Psychomorph, with several additional functions."
---
# Overview {-}
[... |
d70db56e9d7c555ffc1d7367edc03d1a5fc73eee97ba1299d1a7ab2bb6203ee3 | R | 3,885 | 103 | library(DESeq2)
library(edgeR)
library(dplyr)
library(data.table)
setwd("C:\\Users\\Gebruiker\\Documents\\Neuroscience and cognition\\Minor Research Project\\RNA sequencing microglia\\differential expression analysis")
#read in covariate file and count file
pheno <-read.table("covariates_24samples.txt", header=T, row... |
88e821d9cee1f42ceca2b3411d7723be8fcf0c3ecc916cf961560daa5e6a1715 | R | 3,887 | 63 | ---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
# BayesfMRI <img src="man/figures/logo.png" align="right" height="139" alt="BayesfMRI sticker" />
<!-- badges: start -->
[](https://cran.r-project.org/p... |
7f71ed8708b4b46be0df900c0a40ae1d3fa15f53fd0abfacfc3f866e31f99a59 | R | 3,892 | 104 | #' Combine \code{"xifti"}s with non-overlapping brain structures
#'
#' Combine two to three \code{"xifti"}s with non-overlapping brain structures into
#' a single \code{"xifti"}. The names, intent, and surfaces of the first will be used,
#' if present. To add more surfaces to the result, use \code{\link{add_surf}}.
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.