sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
d7cf89fc3c2a748b6928972e9febc589e5d072d8a6f7257a185a9f2e4b63b42c | R | 2,963 | 68 | library("lme4")
library("car")
library("emmeans")
# Selection of time window decoding method.
classification_mode = "incremental" # "incremental", "sliding"
if (classification_mode == "incremental") {
cl_str = "tr"
} else if (classification_mode == "sliding") {
cl_str = "sl"
}
# Model 1: max decoding accuracy per d... |
18cbece58f4378d3884c63a72b02a2610af02fb98ba924d8117abffb98b4231d | R | 2,967 | 97 | ---
title: "Effect Directions"
author: "Jack Humphrey"
date: '2023-06-28'
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
```
```{r}
gwas <- read_tsv("data/farrell_psp_full_hits_1e6.tsv",col_names = c("chr", "end", "snp", "ref", "alt", "frq_a", "frq_u", "inf... |
992ef28def63755aa80d2f325b74c348d9249f709963a3a536b285234776ada2 | R | 2,970 | 57 |
library(data.table)
library(tidyverse)
#net_cols <- c("#0072B2", "#009E73", "#D55E00", "#56B4E9", "#E69F00", "#F0E442", "#CC79A7")
net_cols <- c("#009E73", "#E69F00", "#0072B2", "#F0E442", "#D55E00", "#56B4E9","#CC79A7")
plt_out = '/data/project/ukb_reliability_in_prediction/plots/Figures/'
# Empirical learning cu... |
a7d063f508447dc5c311a50cc033380e7fa39fc483b1d9ecbdb4c2971b6585f5 | R | 2,970 | 118 | # @title normalization for mixed colors
# Set generic ----------------------------------------------------------------
#' Normalize numbers to interval \[0, 1\]
#'
#' The input `x` is mapped to \[0, 1\] by subtracting the minimum and
#' subsequently dividing by the maximum. If all elements of `x` are equal,
#' 1 is ... |
324be15992d821def9a233eacd75a2af691cebcacd2fa5da1904cc107aef9744 | R | 2,971 | 81 | #remap genome if necessary...
library(Seurat)
library(dplyr)
library(readr)
library(Matrix)
library(MatrixExtra)
setwd(dirname(rstudioapi::getActiveDocumentContext()$path))
#need to find genome of all 3 experiments
#need to make sure we're using the same gene list as them (25419 genes)
#sathyamurthy: G... |
e0df2bd0d07ce610cb3f04b9488670b0be59d5b6f034e40895f6d87f931dbd02 | R | 2,974 | 86 | #' Groups are marked by colored rectangles as well as by their levels
#'
#' The dendrogram should be plotted separately, see the example.
#' @title Mark groups in [stats::hclust()] dendrograms
#' @param dendrogram the dendrogram
#' @param groups factor giving the the groups to mark
#' @param col vector with colors for ... |
cb08ad0c19207ac35577803b8f583e87df0aae40697e9facec0fdc59ce8140a0 | R | 2,978 | 107 | # Set generic ----------------------------------------------------------------
#' Function evaluation on `hyperSpec` objects
#'
#' Function `vanderMonde()` generates Vandermonde matrices, the `hyperSpec`
#' method generates a `hyperSpec` object containing the Vandermonde matrix
#' of the wavelengths of a `hyperSpec` o... |
96d2f269dfdaa07f74598139968768472b6eb6a5f29df607795dbe4b597dc63a | R | 2,983 | 95 | #' @name DEPRECATED-read.txt.Horiba
#' @concept moved to hySpc.read.txt
#'
#' @title (DEPRECATED)
#' Import Horiba Labspec exported ASCII files
#'
#' @description
#' These data input functions are **deprecated** and they will be removed in
#' the next release of \pkg{hyperspec} package.
#' Now functions in packa... |
eeda6d8b63d0f3357890ccdf6bad997a4cbb91f9c510666a7e662fed555eb813 | R | 2,983 | 66 | #' Gene by NIDP summary plot of neuroimaGene object
#'
#' Generate overview plot of the neuroimagene object according to gene/NIDP pair
#' @param ng_obj NeuroimaGene object
#' @param maxGns maximum number of genes to visualize. default=15
#' @param maxNidps maximum number of NIDPs to visualize. default=20
#' @param tit... |
5b4f119c0e57574839bc99b06ccc262f1a8193df523d7e5f0c31a936ca77d28a | R | 2,999 | 81 | library(data.table)
library(Biostrings)
library(rhdf5)
library(reshape2)
library(beeswarm)
h5dir = args[1]
file1 = "Roadmap_FantomAnnotations.InputData.pM10Kb.txt.gz"
file2 = "promoters_pM1.5Kb.FIMO_scanned.condensed.txt.gz"
kmerlen = 4
if (grepl("Mouse",h5dir)) {
file1 = "Mouse_FantomAnnotations.InputData.pM10K... |
672db5813c70470c12a46ba0efef1bae4a05b300fa84bf2b6436f59a8a3225a0 | R | 2,999 | 88 | # --------------------------------
# Load libraries and data
# --------------------------------
library(rstudioapi)
library(yaml)
library(tidyr)
library(dplyr)
library(ggplot2)
# Set working directory to script location
setwd(dirname(rstudioapi::getActiveDocumentContext()$path))
# Load configuration
config <- read_ya... |
6ff92c3c54a0b9ee1e1cd733162c4a0363d94dfda30572fa54fbc92857c90fc5 | R | 3,003 | 58 |
library(data.table)
library(tidyverse)
#net_cols <- c("#0072B2", "#009E73", "#D55E00", "#56B4E9", "#E69F00", "#F0E442", "#CC79A7")
net_cols <- c("#009E73", "#E69F00", "#0072B2", "#F0E442", "#D55E00", "#56B4E9","#CC79A7")
# EXTRA SUBS
d_subsample = read_csv('/data/project//ukb_reliability_in_prediction/input/test-pi... |
f74fcb5fc177712765d07ef260bfc63dd94abbf2025c4ab17a5319ed27058081 | R | 3,004 | 111 | #' Coerce to a data frame
#'
#' @description
#' The \code{as.data.frame} method returns a data frame containing
#' information on individual studies, e.g., estimated treatment effect
#' and its standard error.
#'
#' @param x An object of class \code{meta}.
#' @param row.names \code{NULL} or a character vector giving ... |
ed5336b53e618c31ffc6621aab80dbf3e98836aa1c843c29c995eb29450eb068 | R | 3,009 | 95 | library(ChIPseeker)
library(ggplot2)
library(clusterProfiler)
library(TxDb.Hsapiens.UCSC.hg38.knownGene)
library(DOSE)
library(org.Hs.eg.db)
txdb <- TxDb.Hsapiens.UCSC.hg38.knownGene
#EZH2_3 ='SRX186720.05.bed'
files <- c(REST_1 = 'SRX3010118.05.bed', REST_2 = 'SRX3010119.05.bed',
EZH2_1 = 'SRX103... |
cc96038091a3546f4891d8897febb32a33ccb2eba63372cbc2686aff414dd2c8 | R | 3,015 | 112 | #' Predicts features' scores from a model
#'
#' Under development. This function is meant to predict
#' the scores of features obtained from a trained model
#' such as one returned by the 'reduce_*' family of functions.
#' In particular, the function would ideally work with any
#' technique implemented so far (PCA, rPC... |
7ff5b1a57f13d7a9dc172c344d786503959ffcb452d437645e83e6f4c92cd44b | R | 3,026 | 85 | #
library(tidyverse)
subs = read_csv('/home/mgell/Work/reliability/text_files/HCP_YA_subs.csv')
tab = read_csv('/home/mgell/Work/reliability/text_files/HCP_YA_S1200_beh.csv')
ages = read_csv('/home/mgell/Work/reliability/text_files/HCP_YA_restricted.csv')
tab$Age_years = ages$Age_in_Yrs
tab$Family_ID = ages$Famil... |
fc469a7874f9e0ab6c515936b6a096ceca3fdb74040c0a5e8b78ff0c09ab3035 | R | 3,034 | 64 | #' print top features for specific state
#' @description print top features for specific state
#' @param stateName cell state to print
#' @param w1_file if set, stateName will be ignored
#' @param myStateName state name of w1_file
#' @param species human or mouse for now
#' @param showN show n features
#' @import dplyr... |
dc784a85586dc5605076e24e49d3a80b1dc2d8fba1306244a8faca2b6de49749 | R | 3,035 | 143 | # Function -------------------------------------------------------------------
.dimnames <- function(x) {
validObject(x)
list(
row = rownames(x@data),
data = colnames(x@data),
wl = colnames(x@data$spc)
)
}
#' Dimnames for `hyperSpec` objects
#'
#' `hyperSpec` objects can have row- and column nam... |
1fd12db0dc64400b629626962cde1a01c6cf3a8c0306c06c8a3fe2829ac9b1e2 | R | 3,038 | 80 | ---
title: "panel_interleaved"
author: "Franz Xaver Mittermaier"
date: "2023-10-11"
output: html_document
---
This script plots the data panel that makes the point, that the analog signaling effect is a short-term effect. To achieve this, I use the interleaved protocols. In brief, I performed paired patch-clamp... |
a8d51793a049c48901ca5a8c5ac480baa40d396633850dbb9bb2b47ba6648863 | R | 3,056 | 105 | ### -----------------------------------------------------------------------------
###
### write.txt.wide
###
###
#' @rdname DEPRECATED-write_txt
#' @concept deprecated
#'
#' @importFrom utils write.table
#' @export
write.txt.wide <- function(object,
file = "",
col... |
7c8ae7ca4af774faac68854b4a2af8af65474dc05a659db48c535c176170f0c8 | R | 3,057 | 64 | args <- commandArgs(trailingOnly = T)
filenamex=as.character(args[[1]])
source('./scripts/01_Setup.R')
all2= readRDS("./data/processed/rds/SignificantCells.rds")
picocells_passing_mad_conf=all2
unique(picocells_passing_mad_conf$id)
picocells_passing_mad_conf=picocells_passing_mad_conf$id
Pico_76_SegFixed <- r... |
48fc87d8ff72c7fcf5dadcbe6ef592efdfb23a534195c1b741d00d6d4373ccc9 | R | 3,065 | 83 | ---
title: "panel_multi_up_down"
author: "Franz Xaver Mittermaier"
date: "2023-10-31"
output: html_document
---
This script plots the summary panel for the multi_up_down experiments. In brief, I performed paired whole-cell patch-clamp recordings of synaptically connected pyramidal neurons.
I then used current ... |
9720f4b1cead4a269085e9501b7ae4a0f2eb6f49b556fb23208da21c508823e3 | R | 3,071 | 74 | #' viewBatch
#'
#' Generate image grid of mini-batch of image chips and associated masks created by a DataLoader.
#'
#' The goal of this function is to provide a visual check of a mini-batch of image chips and associated masks
#' generated from a DataLoader.
#'
#' @param dataLoader Instantiated instance of a DataLoader... |
ca0186690b556c23d1cf35dbe05bf2007506b04ec12a5acceb1212361047908c | R | 3,078 | 90 | #BiocManager::install("fgsea")
library(fgsea)
library(dplyr)
library(stats)
library(ggplot2)
setwd(dirname(rstudioapi::getActiveDocumentContext()$path))
data <- read.csv("../R/DESeq2/SDH_all/all_SDH_cells_sig_genes_nopseudo.csv")
GO_file <- "../R/GSEA_data/msigdb_v2023.1.Mm_files_to_download_locally/msigdb_v... |
0c88a23c6e16433939b74b283b8ec946a1e5b64a37f90846a11250c0f4f11e60 | R | 3,081 | 85 | # Functions to load DADA2-output (based on the standard output)
########################
## `create_tax_names` ##
########################
create_tax_names <- function(tax_table) {
tax_names <- apply(tax_table, 1, function(x) {
if(any(names(na.omit(x)) %in% "species")) {
name <- str_c(tail(na.omit(x), 2),... |
000e277f493eeb6dc63f4b65bd44fbe57d78befbfbbf2b4cc38052cbe9be1e93 | R | 3,088 | 57 |
#' mochims__define_confident_free_energies
#'
#' Call confident ddGs.
#'
#' @param input_dt data.table with model free energy estimates (required)
#' @param report_outpath output path for scatterplots (required)
#' @param highlight_colour colour for highlights (default:red)
#' @param energy_max_ci maximum energy confi... |
b57741189c84404f9d521856c81cae2d5d41b6a0308df9a084ad29dc405acc54 | R | 3,090 | 90 | ---
title: "Causal Conditional Distance Correlation"
author: "Eric W. Bridgeford"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{cb.detect.caus_cdcorr}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r setup, include = FALSE}
knitr::opts_chunk$set(
... |
0a358fa68770849663dce8c689bd8e6cc5dca77e797891e3cbf0fdabda1c26b4 | R | 3,093 | 122 | ---
title: "20230411_puncta_circularity"
output: html_document
date: "2023-04-11"
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r load packages}
#loaded RStudioAPI to use for selecting working directory
if("rstudioapi" %in% rownames(installed.packages()) == FALSE)
{install.packages("rstu... |
bb55809a75460416509c749185bb91a089950d4ea289c4322e37a0bf4172db01 | R | 3,094 | 129 | #' Plot a 3D scatterplot (based on plot3D) based on a reduce_rPCA object
#'
#' This function is under active development. It is
#' meant to depict the three scores of components obtained by reducing
#' pupillary time-series through rPCA.
#' There are some strong assumptions, first and foremost that the object is
#' fro... |
d90dff3f78ba0ae03d076cb70f3be0ba8e2ed15a2771a204f2bae2df5c6f3883 | R | 3,101 | 85 | # BIL Paper figure 5: showing what data is available (datasets, techniques, species)
library(ggplot2)
library(dplyr)
library(forcats)
library(pals)
## load file from BIL inventory
sum <- read.csv("summarymetadata.csv")
## manual clean of metadata
### species
{
sum[sum == 'mouse'] <- 'Mouse'
sum[sum == 'marmoset'] <- ... |
bf083e2140db7020642d088e6365c74d6475b522c6778a1072d9176294573a57 | R | 3,103 | 106 | # FNIH Project 2
# make AUC Forest plots
#### Coded: Kellen Petersen
#### Date as of commenting and documentation - 05/31/2024
# Load libraries
library(tidyverse)
library(data.table)
library(RVAideMemoire)
library(pROC)
library(RColorBrewer)
library(MuMIn)
library(here)
library(cowplot)
library(ggeasy)
library(scales)... |
e147a54e03f9893433606fc16d2799d41e2b27c14ec22cde4f0364f1a7b32fdd | R | 3,107 | 66 | #' @title Run consensus1
#' @description Using consensus1 method to clust single cell data.
#' @param norm.dat Single cell expression data input.
#' @param select.cells Numeric, use all or part of the cells for clustering, cells can be sampled to save running time in multi-round clustering. Using all cells by defau... |
d343f5ec65c4c4a3f487bf7945a4a3f9689f7f4fcb42cba7be8bbd7e0fb29161 | R | 3,110 | 97 |
#' mochims__pairwise_distances_from_PDB
#'
#' Calculate pairwise (side-chain) heavy atom distances or minimum thereof.
#'
#' @param input_file path to PDB file (required)
#' @param chain_query query chain id (default:A)
#' @param chain_target target chain id (default:B)
#' @param min_dist minimum distance (default:TRU... |
3695726100a690a670f51074532d363183145fda6ed330d442719a0e7f91921d | R | 3,117 | 75 | # Load and install missing packages ---------------------------------------
packages <- c("devtools", "Seurat")
package.check <- lapply(
packages,
FUN = function(x) {
if (!require(x, character.only = TRUE)) {
install.packages(x, dependencies = TRUE)
library(x, character.only = TR... |
80acf3bf76376fce9496c98ea68e6efdd6a7b5686578d93202f9cd3f5052c091 | R | 3,117 | 69 | #rm(list=ls())
# alzheimer data
library(dplyr)
library(SummarizedExperiment)
# reading data sets
phe = read.csv2(data.makepath("/ADNI/ADNI_datasets_from_Matthias/adni1go2.phenotypes.covariates.csv"), na.string="NA",header=T,sep=",",dec = ".")
bba = read.csv2(data.makepath("/ADNI/ADNI_datasets_from_Matthias/adni1go2.... |
de767b2e66f51074d7b752b0b5156b655fd297700ca13ac9f7d090486527b5fb | R | 3,118 | 76 | #' generate_type2_data
#'
#' This function generates data and plots for selected clusters.
#'
#' @param meta_data_file Path to the metadata file.
#' @param gene_count_file Path to the gene count file.
#' @param selected_clusters A named vector specifying the clusters to include.
#' @param Prefix Prefix for the output C... |
17d8c53f8759829ff3b2fc1c29a81e128194b03fe8ea297cbb92c956697011b3 | R | 3,120 | 89 | # If you need the original fragment files for quality control analysis, please contact: wuhaixu@mail.kiz.ac.cn
library(ArchR)
addArchRThreads(threads = 8)
addArchRGenome("hg38")
# Create ArchR Arrow Files
pathFragments = '../../Data/Human'
inputFiles = c('../../Data/Human/Human_fragments.tsv.gz')
names(inputFiles) =... |
3490d5e08acdb18934f392dcdd403a23c510f6483837ad9e1b7422bc6c2d79fb | R | 3,121 | 100 | #' Calculation of confidence intervals (based on normal approximation
#' or t-distribution)
#'
#' @description
#' Calculation of confidence intervals; based on normal approximation
#' or t-distribution.
#'
#' @param TE Estimated treatment effect.
#' @param seTE Standard error of treatment estimate.
#' @param level Th... |
5acf40794610552b8a1ffab6e1da48ebf39c854eeac89555f202ecb70b2391c7 | R | 3,121 | 94 | library(caret)
library(ggplot2)
library(plotly)
library(dplyr)
library(ggpubr)
library(ROCR)
#You will need to put the probabilites from your own path
Y<-data.frame(class = as.factor( c( rep("Sweep", 1000), rep("Neutral", 1000) ) ) )
df <- read.csv(paste0("Filename_and_directory_for_readling_wavelet_probabilities"),h... |
b83b254e3f2f482dcd549ebdd513d8e7a15b0955959759026e16a381983324a5 | R | 3,130 | 74 | library(Seurat)
library(dplyr)
library(ggplot2)
# Map clinical data to the metadata
merge_metadata <- function(sobj, metadata){
meta_data_sex <- inner_join(sobj@meta.data, metadata)
rownames(meta_data_sex) <- rownames(sobj@meta.data)
sobj@meta.data <- meta_data_sex
return(sobj)
}
# Assign the AD variable ... |
7356df46fadfc73943599467f40828d4ca13b90b3d42ea9fe0da87d48198f8c0 | R | 3,137 | 74 | suppressPackageStartupMessages(library(dplyr))
suppressPackageStartupMessages(library(ggplot2))
suppressPackageStartupMessages(library(ggridges))
## set _DEBUG_PARAMS = True in resquiggle.py
## example run for min_obs_per_base testing:
##for i in {0..2}; do
## testParam=`echo $i | awk '{print ($1 * 1) + 1}'`
## ... |
876dcabfc02d69e429753b30d78a1b177f6eb2de1e3a94dd3c68f1da352d3e39 | R | 3,142 | 89 | #' Convenience function to check series across IDs and Trials, and save a plot in the current path
#'
#' Convenience function to check series across IDs and Trials, which saves multiple
#' plots in the current path by creating folders and subfolders in a hopefully
#' meaningful way.
#' Note that with massive data this ... |
d322cbd4a355053ca43d2f2e0b74205210b665eef304058273dcfe2dd34bcd97 | R | 3,143 | 57 | #Using matlab
fname='/scratch/mshruv003/visium_08_10_21/Hockman_Visium/X201SC21082979-Z01-F001_01/raw_data/Visto/15_yr_old_DH1.tif';
N=5;
VNS(fname,N)
fname='/scratch/mshruv003/visium_08_10_21/Hockman_Visium/X201SC21082979-Z01-F001_01/raw_data/Visto/15_yr_old_DH1.tif';
M=5;
refineVNS(fname,M)
mask='/scra... |
9cd6adc2ecf03eb1da2ed18ed899ba39a01e03b2c6e33efec2799a763704e60e | R | 3,144 | 77 | ```{r load-config, incluse=FALSE}
source("config.R", local = knitr::knit_global())
```
```{r import-patients}
df_patient = read.csv("data/msb_patient.csv")
sprintf("Number of rows in patient datatable: %d", nrow(df_patient))
```
```{r echo=FALSE}
table(df_patient["MSCOURSE_2"])
```
```{r select-patients}
# Select R... |
dc8bc2335b5335f4b379fd5ff12b36619147c706d6832f4f2a4b62f4d2bb8e56 | R | 3,149 | 83 |
#' mochims_coefficient_size_distribution
#'
#' Coupling scatterplots.
#'
#' @param input_file path to MoCHI thermo model fit results (required)
#' @param outpath output path for plots and saved objects (required)
#' @param colour_scheme colour scheme file (required)
#'
#' @return Nothing
#' @export
#' @import data.tab... |
bca4100a0bbd76efd733c628180e6020c6576834614da3dc27bd75c5f941ff16 | R | 3,165 | 77 | test_that("metagen three-level robust example runs", {
skip_if_not_installed("metadat")
data(dat.konstantopoulos2011, package = "metadat")
dat <- dat.konstantopoulos2011
dat$idx <- seq_len(nrow(dat))
ma <- metagen(yi, sqrt(vi), studlab = study,
data = dat,
sm = "SMD",
... |
6cb16b5b2d8d842064e97fa552946af376695cc579182453ad77743f29b37c62 | R | 3,178 | 48 | assign_levels <-
# Takes UKB raw data and assigns the right labels to vactors
function(bd) {
# Reported sex
lvl.0009 <- c(0, 1)
lbl.0009 <- c("Female", "Male")
bd$f.31.0.0 <- ordered(bd$f.31.0.0, levels = lvl.0009, labels = lbl.0009)
# Genetic sex
bd$f.22001.0.0 <- ordered(bd$f.22001.0.0, l... |
2daeeecbc2b2a414f1b073ffb33d25266727a180f51ee5f73fccf36fdc90ce93 | R | 3,183 | 61 | library("lmerTest")
library("multcomp")
library("emmeans")
library("readxl")
options(max.print=1000000)
NEW_DATA$Injury = as.factor(NEW_DATA$Injury)
NEW_DATA$Time = as.factor(NEW_DATA$Time)
NEW_DATA$Mouse = as.factor(NEW_DATA$Mouse)
results = lmer(Amplitude ~ Injury * Time + (1|Mouse), data = NEW_DATA)
anova(results,... |
e17b1523239ea8a3b25ef016580fe1d9b12cc9653d7ec53432a5ac12796e36a7 | R | 3,195 | 100 | #' Helper Function to Harmonize Treatment of File Import Results
#'
#' This function provides two ways of post-processing imported spectra:
#'
#' - optionally remove empty spectra (some spectrograph software will produce
#' empty spectra when measurements are cancelled)
#' - optionally keep the filenames in column `s... |
39f25213c29c7b6b0280805ffc4787a64874cc85f17920c716f041d84801b395 | R | 3,198 | 65 | source('./scripts/01_Setup.R')
all2= readRDS("./data/processed/rds/SignificantCells.rds")
picocells_passing_mad_conf= all2$id
Pico_76 <- readRDS("./data/processed/rds/PTA_48_500kb_lift_SegFixed_cnv_stat_genome.rds")
Pico_76x= Pico_76[Pico_76$id%in%picocells_passing_mad_conf,]
Pico_76x= Pico_76x[!Pico_76x$chr%in%c('chr... |
ed980a7bde18b1ee9a94d5218a97444d7fecc397bb266dd11cdd3837752d3c03 | R | 3,200 | 96 | # --------------------------------
# Load libraries and data
# --------------------------------
library(rstudioapi)
library(yaml)
library(dplyr)
library(ggplot2)
# Set working directory to script location
setwd(dirname(rstudioapi::getActiveDocumentContext()$path))
# Load configuration
config <- read_yaml("statistics_... |
b05de1685e5d26216bdf23853cfbc88d1be8a4c69629922e23d5c6e5e3ae804a | R | 3,206 | 120 | #' @rdname palettes
#' @aliases palette_matlab colors,palette_matlab
#'
#' @title Matlab-like color palettes
#'
#' @description
#' Two palettes going from blue over green to red, approximately as the
#' standard palette of Matlab does. The second one has darker green values and
#' is better suited for plotting lines on... |
f6da8e0bc27439f703690c0e5ab2a630616c0db5be564e8a1f2fffe06fcf77d5 | R | 3,211 | 123 | # Copyright 2022 HYBRID Team INCIA, UMR5287, CNRS, Université de Bordeaux
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required b... |
53bb62fc9f06ff18283202e9f30bfe40149b0df5aef6194d06b72adc3ee1278d | R | 3,221 | 150 | # Formulas to fit
formula_unadj <- function(outcome,
SNP,
dual_delivery = FALSE) {
if (dual_delivery) {
formula(paste(outcome, "~", SNP, "+ delivery"))
} else {
formula(paste(outcome, "~", SNP))
}
}
formula_age_sex <- function(outcome,
... |
98e6057051b9b92198af3450f1cb7c37c360375b3d5b523b64a19246c742da1a | R | 3,223 | 100 | # The contents of "read.ENVI.Nicolet.R"
read.ENVI.Nicolet <- function(
file = stop("read.ENVI: file name needed"),
headerfile = NULL,
header = list(),
..., # goes to read.ENVI
x = NA, y = NA, # NA means: use the specifications from the header file if possible
nicolet.correction = FALSE) {
## the additi... |
94fcbd2af53a70bfd7625307996cb47e96ef6d863ecb72dd98aede1f316daf0d | R | 3,228 | 102 | library(geodl)
setwd("Your Working Directory")
# Accuracy Assessment Examples --------------------------------------------
#Example 1: table that already has the reference and predicted labels for a multiclass classification
#Read in table
mcIn <- readr::read_csv("data/tables/multiClassExample.csv")
#Calc... |
4db53879f3e05f92ec9f53c5979b3f97448dde5ee08b7e3cb51a898dd125a995 | R | 3,243 | 71 | library(data.table)
library(ordinal)
library(MASS)
library(readxl)
rosmap_clin <- setDT(read_xlsx("/data_global/ROSMAP/greg_20200109/dataset_843_basic_01-09-2020.xlsx"))
###### CpG #####
load("data/cpg.RData")
cpg = cpg[, .(IID, specimenID, conversion.efficiency, cg09613507, cg23422036)]
np_cpg = merge(rosmap_clin, c... |
0cfebf3cebeb73682b6d3e8d4cc9934b67cae8909e5860b6ee354aaac63e6779 | R | 3,245 | 74 | library(ROCR)
#### MOUSE ######
a=read.delim("all_crossvalidated_predictions_mESC.txt")
b=read.delim("all_crossvalidated_predictions_mouse.txt")
colnames(a)[2:3]=c("mESCPred","mESCActual")
a=merge(a,b,by=1)
a[a=='']="NA"
mouse = a
### HUMAN #####
a=read.delim(gzfile("57epigenomes.RPKM.pc.gz"))
a$E000=NULL
a[,2:ncol... |
8061a6dd29794ed122f481bf56afad7bea1dc6480ca72b4c6d2a2ba0c5b74c0c | R | 3,245 | 76 | rm(list=ls())
library(segmented)
library(ggplot2)
library(extrafont)
library(drc)
library(nlme)
library(R.matlab);
library(mgcv);
library(visreg);
project_path = 'G:';
rCBF_mat_path = paste0(project_path,'/rCBF.mat');
rCBF = readMat(rCBF_mat_path);
age_mat_path = paste0(project_path,'/age.mat');
age = readMat(age_mat_... |
12a378e9d04542247dbf863fd502631534dfb03483c565c9d57a9518e6a26a13 | R | 3,253 | 95 | #' Region-of-Interest mapping object
#'
#' A class for surface vertices mapping on atlas labels
#'
#' @slot data A matrix object with N vertices from a template and each parcellation number the vertices correspond to in 6 atlases (6 columns).
#' @slot atlases Each of the 6 available atlases and their corresponding ... |
941da9cfe5392497096c95afc61a25cb8760784f31ea2cdc12c4d34348b4cdd5 | R | 3,270 | 99 | library(dplyr)
library(tidyr)
library(ggplot2)
# Parse and check inputs
args <- commandArgs(trailingOnly = TRUE)
print(args)
if (length(args) < 3)
{
print("Requires arguments 1=Directory, 2=SampleId, 3=MsStatsTableFile")
stop()
}
outDir <- args[1]
sampleId <- args[2]
msStatsTableFile <- args[3]
if (!file.exists... |
6aac9f204f7fbc64a052863ee78c9542a4ecac1d1c63718df927fefda38d7063 | R | 3,274 | 92 | #' Auxiliary functions to calculate the dimensions of a forest plot
#'
#' @description
#' Extracts the exact width and height of a `meta` forest plot from its internal
#' grid layout. This is primarily used to determine the optimal dimensions for
#' saving the forest plot to a file.
#'
#' @details
#' Rather than using... |
d10833a9afa8a7fdde56f3d2ce51c94504cc4c9cbdc0decea1ee77f627923f56 | R | 3,276 | 74 | library(natverse);library(reticulate);library(neuprintr); library(hemibrainr); library(nat); library(natverse); library(nat.jrcbrains); library(fafbseg);
setwd(getSrcDirectory(function(){})[1])# set the working directory to where this code is
source("Connectomics_functions.R")#library(RConnectomicsAnalysis)
#
# ###... |
451a98478a91f0f4bc6993ad5fcd7a6a0fd7ecad10e2e4b9b63e34cb645724a4 | R | 3,277 | 78 | #/bin/Rscript
#
# This script will run Genomic SEM on example data
# and will generate Q indeces.
# Prep
library(GenomicSEM)
# load LDSC
load("/path/to/dir/GenomicSEM_LDSCoutput_dys_rhyimp.RData") # here set the path
# 1) Common Pathway Model
model = "F1 =~ 1*Dyslexia + 1*Rhythm_impairment
F1 ~ SNP
Dyslexia ~~ a*Dysl... |
2393474c85a56fa701328be06435522716279b0a531c8a9cff89a38331fb31e0 | R | 3,280 | 121 | #' Plot all (three) fingerprints of reduced time-series
#'
#' This function is under active development. It is
#' meant to depict the three eigenvectors/loadings/weights of components obtained by reducing
#' pupillary time-series, as to ease interpretation. Note that the
#' components and their names are re-ordered acc... |
2f6a9933071bf08e0d4f4f7597514d2a535804be5092ea0b3262558c6fbf1d59 | R | 3,280 | 98 | setwd("XXX")
set.seed(42)
library(limma)
# import raw
counts_mat = read.delim("PATH_TO_COUNTS")
meta = read.delim("PATH_TO_METADATA") # should contain: PRS, tx, line
## sanity check
# all.equal(rownames(meta), colnames(counts_mat))
# init DGE list
x <- DGEList(counts_mat)
## update sample info
all.equal(rownames(x$... |
d625413751ff31ce29aea37a14215d507400088e1f4a3b11bd08ee97cbd3b669 | R | 3,281 | 90 | # In this script we are creating a heatmap for the correlations between species abundance and GBM abundance in the dataset
library(tidyverse)
library(here)
library(Hmisc)
library(corrplot)
library(car)
#read in the gut-brain modules file
gbms <- read.csv(here("processed_data", "shotgun", "functional_other", "GBMs_KE... |
8e67ab089bd3374e2e481fd4ea039954b46006cbe799d3820d2a466f8d9d7dd3 | R | 3,284 | 98 | require(energy)
require(cdcsis)
require(causalBatch)
require(sva)
require(GeneralisedCovarianceMeasure)
# Conditional distance correlation from Wang et al., 2015
cond.dcorr <- function(Ys, Ts, Xs, R=1000, dist.method="euclidean", distance = FALSE, seed=1, num.threads=1) {
Xs <- as.data.frame(Xs)
if (isTRUE(dist... |
6c3f5361706992a8e7e7ea7d29f54392041f3252a00afc261f9308238c7c996d | R | 3,298 | 139 | require(data.table)
source("bin/All_Classes.R")
source("bin/obsolete.R")
source("bin/ora.R")
source("bin/heatmap.R")
source("bin/pca.R")
source("bin/tokenization.R")
#source("bin/differential_expression.R")
#source("auth/auth.R")
# Upload dataset ----
convertColumns <- c("UNIPROTID", "ENTREZID", "SYMBOL", "GENEID",... |
9ecc8d7e247dcceefd7a53aa044d308ee61a76d0f4aea85b3146015fc452eda9 | R | 3,305 | 93 | ### -----------------------------------------------------------------------------
###
### read_txt_wide
###
### Format:
### x y ... int (wl1) int (wl2) ... int (wl p) z ...
###
#' Import/export of `hyperSpec` objects to/from ASCII files
#'
#' @details
#' A detailed discussion of \pkg{hyperSpec}'s file import and e... |
e718798814be0544e6e8170f0f3c1ba0e889530c3a876aa14b34055969d8526a | R | 3,305 | 66 | ### Regulatory landscapes ###
### Figure 4 ###
library(GeneOverlap)
library(matrixStats)
REGtable <- read_excel("UU Dropbox/Ida Larsson/scTargetTranslator/revision/manuscript/supplement/supplementary_20240912/SourceData.xlsx", sheet = "Figure 4B")
REGtable <- as.data.frame(REGtable)
rownames(REGtable)<-REGtable[,1]
R... |
9ebf0c90f069fe5df093e1b58c4148fd2b85f013de73dca5183bff32fc25818a | R | 3,316 | 82 | ---
title: "panel_depol_hyperpol"
author: "Franz Xaver Mittermaier"
date: "2023-04-10"
output: html_document
---
This script creates the panel for the 'Depol+Hyperpol' paradigm. In brief, I performed paired patch-clamp recordings of synaptically connected pyramidal neurons. I then used presynaptic current injec... |
e8652055cdac266c4a744cd5d20fd2f11aa5cb9f158cd9cfb8432d38992fc509 | R | 3,323 | 83 | #This script processes a TIFF image file containing multiple frames. It reads the frames,
#performs thresholding to create binary images, and calculates the fraction of overlapping
#pixels between two measures (fm and sa). It then plots these fractions over time and saves
#the results to a text file. The use of t... |
e8a651db030c14ac2eb42de6746c023681265ce8815b6634a066715fc87883b8 | R | 3,327 | 102 |
#' @param new Name of replacement function.
#' @param package Name of the package the function is moved to.
#' @param url Homepage of the package.
#' @param old Function that is replaced
#'
#' @keywords internal
#' @noRd
hySpc_deprecated <- function(new = "", package = NULL, url = NULL,
o... |
f14cd7ed94a7ab4d7be06ced17d3bcbefe92e201da722598c4ac0b7783af049b | R | 3,328 | 108 | # Function -------------------------------------------------------------------
.sweep <- function(x, MARGIN, STATS, FUN = "-",
check.margin = TRUE, ...) {
validObject(x)
if (is(STATS, "hyperSpec")) {
validObject(STATS)
STATS <- STATS@data$spc
} else if (is(STATS, "function")) {
ST... |
b79c9a63d4ce345bc0c93615477ace541d91fd8217bb4cb969fc04197d86223c | R | 3,337 | 100 | ---
title: "Cell cycle scoring and UMAP generation"
output:
html_document:
df_print: paged
---
In this script, we use the CellCycle Scoring function of Seurat, generate a UMAP and cluster cells together.
```{r Librairies}
library(tidyverse)
library(dplyr)
library(clustree)
library(patchwork)
library(Seurat, lib... |
83e00e246027bce70218a77a2487d226341c7b3a69a23f32eb7501cda8e7ce65 | R | 3,339 | 73 | args <- commandArgs(trailingOnly = T)
filenamex=as.character(args[[1]])
source('./scripts/01_Setup.R')
raw_dMDA_5Mb = read.table(file.path('./data/processed',filenamex, 'data'), header=TRUE, sep="\t")
saveRDS(raw_dMDA_5Mb, file = file.path('./data/processed/rds', paste0('raw_', filenamex, '.rds')))
CNV1= read.table... |
8340f82d0c5ff0777ac119582e475536a11ded5371c5cb1f1296a535cc7a3ae7 | R | 3,340 | 132 | ---
title: "Direction of effect of FADS2 genotype on traits with a statistically significant main effect"
author: "Giulio Centorame"
date: "`r Sys.Date()`"
output:
rmdformats::downcute:
toc: 6
number_sections: yes
---
The aim of this notebook is to compare the direction of effect of traits with a statistical... |
64b9b1ddcedaac9e4e9fcbc5aa95816d8de1a5a997588d7ce4f87f6dbf6f462f | R | 3,343 | 61 | #' Annual Accumulated Growing Degree Days (°C) from SAGE
#'
#' A `raster` containing annual global accumulated growing degree days (°C) for the year with a base temperature of 5°C.
#'
#' @format An object of class `RasterLayer`.
#' @source \url{https://sage.nelson.wisc.edu/data-and-models/atlas-of-the-biosphere/mapping... |
210cc80deb7c2b9be8192c23c8c58adbabfe3fe99b99ae970b9cc4d6c996451e | R | 3,344 | 89 | library(data.table)
library(magrittr)
`%!in%` <- function(x, v) {!(x %in% v)}
pheno_ord <- fread("data/mega/mega_np_ord.pheno", na.strings = '-1')
pheno_bin <- fread("data/mega/mega_np.pheno")
phenotypes_ord <- colnames(pheno_ord)[3:ncol(pheno_ord)]
phenotypes_bin <- colnames(pheno_bin)[3:ncol(pheno_bin)]
phenotypes <... |
b19aff11796a5ec642dc5418b640f0f8ba77f67fefc9acdf726ba8dfe16d413f | R | 3,346 | 61 | ---
title: "TWAS_plot"
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(biomaRt)
library(qqman)
library(dplyr)
```
```{r readData}
twas_all_fdr = read.table("/data/clusterfs/lag/users/gokala/beat-dyslexiaevol/results/TWAS/twas_FDRall_results.csv", header = T)
```
```{r ... |
0001b1fcb4de91c9f32eec5139f71c8d5297a92c40839415af14a48b358b7ffd | R | 3,347 | 96 | ##-------------------------------------------
## Pull mRNA expression data from Synapse
## and prepare for analysis
##-------------------------------------------
library(data.table)
library(magrittr)
library(stringi)
##-----------------------------------------------------
## Connect the specimenIDs in RNA expression... |
3dccd44b0e7dee4aa06110b0b5455a93341efa8465499d257024964812b218a7 | R | 3,347 | 69 | library(WGCNA)
multiExpr = vector(mode="list", length=2)
multiExpr[[1]] = list(data=as.data.frame(t(CAU_datExpr[genes,])))
multiExpr[[2]] = list(data=as.data.frame(t(CNS_datExpr[genes,])))
#multiExpr[[3]] = list(data=as.data.frame(t(AA_datExpr[genes,])))
bsize = 5000
nSets = 2
#nSets = 3
powers = c(seq(1,19,by=1),seq(... |
252560132a01666790509ed6ded25e45c6321d6a031ad1703f18e142de96a4f3 | R | 3,348 | 85 | # File: get_pars.R
# Author: Kelly Chang
# Date: Oct 2017
# Version: 1.0
#
# Description: Helper R function that returns the model parameters for a
# specified simulation type (e.g. control, drug with fixed
# inputs, drug with uncertainty inputs, etc.).
#
get_pa... |
62ba0430d1b581c8215cf637ce080769b9252897f49326ff6212d714b3d91469 | R | 3,350 | 95 | ##----------------------------------------------
## create PCA plot of 1KG and adc NP subjects
##----------------------------------------------
library(pacman)
p_load(data.table, magrittr, ggplot2)
# groundhog.library("ggplot2", day)
# 1000g (otg) data population data
otg <- fread("/data_global/1000g/integrated_call_... |
f0014fad574e676d6ac31eabcbc34cc24080ecf0d3346c73ed208716c34dc8a6 | R | 3,352 | 80 | require(ks)
test_that("k-way matching with one odd-ball per-group", {
nrep <- 100
res <- sapply(1:nrep, function(i) {
Ts <- c(rep(1, 100), rep(2, 100))
Xs <- cbind(c(-4, runif(198), 5), c(-4, runif(198), 5), runif(200))
retained.ids <- suppressWarnings(cb.align.kway_match(Ts, data.frame(Covar=X... |
1c27f9db6ad9d762fe94f6136276f34f6fbd5402588b16121834f89d374c129e | R | 3,353 | 141 |
library(rstatix)
library(ggplot2)
library(ggpubr)
library(openxlsx)
library(dplyr)
library(RColorBrewer)
library(wesanderson)
library(lme4)
library(nparLD)
library(lmerTest)
library(jtools)
# Read the data
data = read.csv('../fMRI analysis/deltas.csv')[,2]
threshold = median(data)
group = ifelse(data>... |
bb319693e6658d7a4962aa5052044b395c0bb8ff0f247f1dc285b85438b71c3d | R | 3,355 | 90 | ---
title: "pre_drive_post_histogram"
author: "Franz Xaver Mittermaier"
date: "2023-06-28"
output: html_document
---
I performed multineuron patch-clamp recordings to identify convergent microcircuit-motifs. I then induced a 'Control' and a 'Depol+Hyperpol' condition followed by a train of 5 APs. I injected cur... |
b52a48ca6ec39d96ad3855ff748345971df8a53817384df0e4e38ae0c4950606 | R | 3,363 | 116 | # This script will run Model Averaged GWAMA on dyslexia and rhythm GWAS sumstats.
#
# Gokberk Alagoz - 04.03.22
#
#-----
# Libraries
source("https://github.com/baselmans/multivariate_GWAMA/blob/master/Test_Data/N_weighted_GWAMA.function.1_2_6.R?raw=TRUE")
library(data.table)
library(sp)
library(rater)
library(RcppArmad... |
c5d1e58738134c191013e460e590ffa03a4f66583ae5ca636983eff5b9ae0dc0 | R | 3,367 | 116 | ## -----------------------------------------------------------------------------
##
## Somatic variant detection in lesional focal epilepsy
## Depmap functional analysis; pairwise co-dependency
## ref: Gatto et al. 2023; Shimada et al. 2021
##
## Author: Dr. Christian Bosselmann
##
## Date Created: 2023-09-05
##
## Cop... |
dcd7addf568efced53d272f082ef5502e50bdcf9b1cd2da3f5c86084371f418e | R | 3,378 | 109 | ##----------------------------------------------
## create PCA plot of 1KG and adc NP subjects
##----------------------------------------------
library(pacman)
p_load(data.table, magrittr, ggplot2)
# groundhog.library("ggplot2", day)
# 1000g (otg) data population data
otg <- fread(
"/data_global/1000g/integrated_ca... |
fdbda2df735746d940b3b87b512d28078debbce8893137ff6c63fcd8030d1d12 | R | 3,381 | 80 | #### Markos et al 2024
#### Script used for analysis of 10X matrices
#### Prechordal plate vs Notochord markers
# load prerequisities
library(Seurat)
library(patchwork)
library(ggplot2)
# load output of AmphiN0stage.R
AmphiN0stage <- readRDS("../timepoints_rds/Amp_N0.RDS")
DimPlot(AmphiN0stage, reduction = "umap", p... |
157efe27aedaeeb9528c6835c3cfae22ac2ac640807edb5ea380f675b1fe5e26 | R | 3,390 | 70 | suppressPackageStartupMessages(library(rrvgo))
suppressPackageStartupMessages(library(org.Hs.eg.db))
suppressPackageStartupMessages(library(mgsub))
suppressPackageStartupMessages(library(ggforce))
suppressPackageStartupMessages(library(ggpubr))
suppressPackageStartupMessages(library(ggridges))
suppressPackageStartupMes... |
e38ff48a45bdbabb90112d151665dbc4dd3f419678411158042ce0c7d823d609 | R | 3,398 | 79 | #'@title run.multitest
#'@description
#'calls DEGage for every comparison necessary in the DEGage_complete workflow
#'
#'@param allcounts the entire matrix of counts for all cells
#'@param counts A dataframe with cells as columns and genes as rows.
#'@param group A factor which assigns conditions to cells as in D... |
1777e516d2656aaf53ffe5b15932d45557885481a7afe3f558c586f863dfa03f | R | 3,403 | 87 | #Data for the supplement
cor_boney_wm <- bones_ukb_WM %>% dplyr::filter(eid %in% old_id$eid)
cor_boney_wm <- cor_boney_wm%>%dplyr::select(
eid, sex, age, sit_height, VAT, ASAT, fat_percent, BMI,
BMD_head, BMD_total, T_BMD_total, femur_BMD,
... |
31ef6622bc13824f2018dd21e516ad0bfe585cefc0d2196ff315dfc77ee7db1c | R | 3,406 | 106 | ---
title: "power_analysis"
author: "mjp"
date: "6/2/2021"
output: html_document
editor_options:
chunk_output_type: console
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
setwd('/mnt/data/peaky_pitch/')
easypackages::libraries... |
e39228840d7ab3810e8d5ec8ff4fd27724f9da6eb5d313ac4f5d022612060b82 | R | 3,408 | 118 | # Function -------------------------------------------------------------------
.Compare_hh <- function(e1, e2) {
validObject(e1)
validObject(e2)
callGeneric(e1[[]], e2[[]])
}
#' @title Comparison of `hyperSpec` objects
#'
#' @description
#' The comparison operators `>`, `<`, `>=`, `<=`, `==`, and `!=... |
45f7266dc59181b3434c5b3a65670ba333bba7dddf1d64bae64b8dad6464dc14 | R | 3,412 | 90 | # format METAL results for downstream work
#!/usr/bin/env Rscript --vanilla
# Load the required packages
library(data.table)
library(stringi)
library(argparse)
# function for flipping direction of effect in Direction column (e.g. "++-" -> "--+")
flip_effect_directions_fast <- function(directions_vector) {
# Tempor... |
839d407ede1dd303bc520419bc9e03dda68239247551f6e882845c824376806c | R | 3,418 | 102 | #### Notes ####
#### Libraries ####
library(colorBlindness)
#### Sourced functions ####
#### Functions ####
# Permute values in each column
permute_by_cols <- function(input.matrix, seed=12345) {
set.seed(seed)
permuted.matrix <- input.matrix
for (s in colnames(input.matrix)) {
permuted.matrix[,s] <- ... |
918cd59dab01df2fd63d4f3e117d6d850c2d9c35e37037abcda33f1a28a0d6a4 | R | 3,422 | 124 | soft_power_thresholds <- c(seq(4, 9, by = 1), seq(10, 50, by = 5))
library(Seurat)
library(WGCNA)
library(hdWGCNA)
library(progressr)
library(foreach)
# Will be the dataset "wang" or "pbmc"
dataset <- commandArgs(trailingOnly = TRUE)[1]
output_path <- "output"
library(data.table)
source("../utils/0-indices.R")
cou... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.