sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
5e97bc11f09fe2d7624260cc0e43a2e1952821350196099100ca15b012dc1047 | R | 1,431 | 60 | # Calcuate meta.
# args[1]: The input matlab .mat file. Has: 'TVal','N1','N2','nTests','Regressor'
# args[2]: The name for the output matlab .mat file.
# install the following R packages:
#
# install.packages("metafor")
# install.packages("R.matlab")
#
# More details about 'metafor' R package can be found at
# https... |
2f8fb7bcc05106a73079e4507ca5d80f2e6a8adcf73cce46944b8d78de763e61 | R | 1,438 | 50 | per_lm_rates <- function(shape.data, phy){
data.2d <- two.d.array(shape.data)
phy.parts <- geomorph:::phylo.mat(data.2d, phy)
invC <- phy.parts$invC
D.mat <- phy.parts$D.mat
C <- phy.parts$C
global<-sig.calc1(data.2d,invC,D.mat,Subset=TRUE)
###have to get the dim of shape data to replace this ppppppp
global.array1<-ar... |
3b9e9c28afba8648dddfe7a4f49e21bb6d0a7462802ca9f3090b8b1876fa0422 | R | 1,445 | 51 | ---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# Pupilla
<!-- badges: start -->
<!-- badges: end -->
An R packag... |
d70384957f87eae671acf5eaaf9954f4cd2e7b9ad978a075514252611be2b1ab | R | 1,446 | 55 | library(Seurat)
library(zellkonverter)
library(Rhdf5lib)
library(HDF5Array)
library(scater)
library(dplyr)
#library(GenomicFeatures)
# prepare Amp data ####
coarse_annot<-read.csv('amp_coarse_annot.csv')
amp_rds<-list.files('../../../timepoints_rds',full.names = TRUE)
for (amp_path in amp_rds) {
amp_name<-gsu... |
bce96b81fd4d5484402135246f32c7c63f03b384cb5afa6947b6d07ec90f98f1 | R | 1,452 | 36 | library(ggplot2)
scaleFactor <- 4
scaleFactor2 <- 3
scalePower <- 0.2
firstMean <- 0
secondMeans <- seq(0.05, 0.8, 0.05)
constVar <- 0.12
xlims <- c(-2,2)
pdf('llr_test.pdf', width=10)
for (secondMean in secondMeans){
secondMean <- firstMean + secondMean
test_vals <- seq(xlims[1], xlims[2], 0.05)
ref_d... |
12e377ec036ab246217d9c59baf21d81fe81dce858dea5a2c3a3ef2d46d08aae | R | 1,459 | 51 |
###Script 3
#Identify clusters on integrated dataset
require(Seurat)
require(sctransform)
require(patchwork)
require(dplyr)
timestamp()
parallel::mclapply
dt.combined.sct <- readRDS("output/atlases/1_seurat_integrated.rds")#load integrated dataset
print("dataset is loaded")
timestamp()
print(gc()... |
6bf4e6dd073c2310f997180ee78ced7b2b568ae7eb8ead41157426a97a7d2a2c | R | 1,472 | 43 | library(ArchR)
addArchRThreads(threads = 8)
addArchRGenome("hg38")
# Load ArchR object
adata = loadArchRProject('HumanBrain')
# Add Union Peaks
peak_df = read.delim('../Union_Peak_Info.txt', sep='\t')
peak_df = peak_df[, c('hg38_chr', 'hg38_start', 'hg38_end')]
colnames(peak_df) = c('chr', 'start', 'end')
adata = ad... |
e8216973f5ebf46ce755b706ebad50f6c951a841067b72fd08da193de1ebe100 | R | 1,475 | 43 | #! /use/bin/Rscript --vanilla
#=============================================
# Reformat and subset .pheno files for MAGMA
#=============================================
library(data.table)
library(argparse)
parser <- ArgumentParser()
parser$add_argument('-p', '--pheno', help = 'path to phenotype file')
parser$add_a... |
e39f5d5cc340075d27455467eeb3e2d1ba8c4bfb3d820ac5c49ddae5da3faa1f | R | 1,480 | 50 | # R code for entering the data and fitting the Bugs model for 8 schools
# analysis from Section 5.5 of "Bayesian Data Analysis".
# To run, the Bugs model must be in the file "schools.txt" in your working
# directory and you must load in the functions in the bugs.R file (see
# http://www.stat.columbia.edu/~gelman/bugsR... |
0ca34d5a737eb0c03e2f5f8885ed91835c7a98b35da9ec9727e19327d71557b2 | R | 1,481 | 37 | args <- commandArgs(trailingOnly = T)
filenamex=as.character(args[[1]])
options(scipen=999)
outpath= file.path("./data/processed")
source('./scripts/01_Setup.R')
setwd(file.path(outpath, filenamex))
aa= read.table('analysis', header = T)[,1]
delimiters <- ".bowtie|.bt2"
aa2= strsplit(aa, delimiters, per... |
4a1518ea0350003b03884c460642de6e9cb9c14c0cb95699feca2f7d5f07af42 | R | 1,482 | 47 | ## process AFM data obtained from experiment and calibration to apply to CafeMol calculation
## Usage: Rscript process_afm_data.R afm.txt dimer_template.txt
## afm.txt is the AFM data file in Angstroms unit, dimer_template.txt is a template header file
## the output will be an input file (.inp) for cafemol
#!/usr/bin/... |
959f1f2d54ab7f019a2b38e8c9187eb24ef6d465d98def602c69589fa209561c | R | 1,485 | 24 | # singleDeep performance by cell type - Figure 5a -------------------------
MCCClust <- read.delim("Dementia/results_Dementia/Status_clusterResults.tsv", row.names = 1)[,"MCC",drop=F]
cellTypes <- rownames(MCCClust)[order(MCCClust$MCC, decreasing = T)]
phenoDementiaMTG <- read.delim("Dementia/dataMTG/Phenodata.tsv")
... |
57220528ee7fa465b2e157e3b5112d6549251d9847efc48daab98e9e6d5a71da | R | 1,488 | 39 | data <- read.csv('data/el_behav_vars.csv')
p.explicit <- ggplot(data, aes(x = Explicit)) +
theme_classic(base_size = 15) +
xlab('Explicit') + ylab('') +
geom_vline(xintercept = c(-45,45), linetype = 'dashed') +
geom_vline(xintercept = c(0), linetype = 'solid') +
geom_histogram(fill = '#1e991e') +
... |
adffc700081819de1e999ee27b9e919ab48eb6a93fe92e8340b84b5c25fa408b | R | 1,490 | 50 | options (warn = -1)
library(Seurat)
library(ggplot2)
library('Matrix')
Args<-commandArgs()
RNAfile = Args[6]
RNA <- read.table(RNAfile,sep = '\t',header = TRUE,row.names = 1,quote = "")
RNA <- CreateSeuratObject(counts=RNA, project='RNA', min.cells=0, min.features=0)
Spatialfile = Args[7]
Spatial_orig <- t(read.table... |
c121843dbd3a6f3445d7c0bc4c4f6131d25095d7f0bc13c98cba9b42b7693681 | R | 1,491 | 48 |
subs = tibble(read_csv('/home/mgell/Work/Preprocess_HCP/code/subs/subs_HCP_A.txt', col_names = c('src_subject_id')))
age_prediction = tibble(read_csv('/home/mgell/Work/Prediction_HCP/text_files/rel/interview_age.csv')) # after removing super old subjects
age_prediction = filter(age_prediction, src_subject_id %in% ... |
073fddf149e9a4abc62e4a1f5eb9c7a904ea2459a615b75579eefb6a3c60f58e | R | 1,495 | 25 | #----Figure_06_C----------------------------------------------------------------
#-------------------------------------------------------------------------------
# This is the code for Figure 06 Panel C for the connectivity analysis for
# Reinhard and Fukuda et al. 2024
#-------------------------------------------... |
658807e33354f938292438f2475cffa2ad79ef104b3645593582137b194a7ef7 | R | 1,497 | 55 |
#' Sorting the wavelengths of a `hyperSpec` object
#'
#' @description
#' Rearranges the `hyperSpec` object so that the wavelength vector is in
#' increasing (or decreasing) order.
#'
#' The wavelength vector is sorted and the columns of the spectra matrix are
#' rearranged accordingly.
#'
#' @param x The `hyperSpec` o... |
2d5c6f190853b4e127453c17a60874636095dcba2428b039862ede73b8c5defe | R | 1,498 | 40 |
library(data.table)
library(tidyverse)
### Figure 4 ###
# AGE
#net_cols <- c("#0072B2", "#009E73", "#D55E00", "#56B4E9", "#E69F00", "#F0E442", "#CC79A7")
net_cols <- c("#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7")
plt_out = '/data/project/ukb_reliability_in_prediction/plots/Figures/'... |
c203462a1010255783c4f6d6ede0bd3070ff18496118dc9d0403fc4ccdde543e | R | 1,498 | 65 | #' Interprets easily the results of 'lmem_test'
#'
#' This is a helper function. It takes an object
#' created by 'lmem_test' and spits intervals
#' with significant effects.
#'
#' @param lmems An object returned by 'lmem_test'.
#' @param p defaults to "corrected" to use adjusted p values
#' @param sig_thresh Threshold... |
78b65b578656b2f49458908ce2569c8770f42049a0f624a68625664fd05af6ad | R | 1,499 | 37 | plotSingleRead <- function(sigDat, vlineDat, hDat, hrDat, stDat){
sigDat$Position <- sigDat$Position / 1000
vlineDat$Position <- vlineDat$Position / 1000
p <- ggplot(sigDat) +
geom_vline(aes(xintercept=Position),
data=vlineDat, color='red', size=5) +
geom_path(aes(x=Positi... |
b3f83a216a8e0032cc43772349cb35a45c9058024952232a8991e739adb6b341 | R | 1,500 | 36 | #' nodelabels_bootstrap_depth_df
#'
#' Helper function for tree manipulation.
#' Adds node labels if they do not exist in the tree.
#' Bootstraps values that were stored in labels are shifted to own column.
#' Calculates the depth of each node.
#' Returns a tibble with the bootstraps, old labels,
#' and node depths.
#'... |
c9cb8b97185784214931e8ee5e5c1ba603982e78a58fa76e10dd0d088e577359 | R | 1,505 | 39 | require(causalBatch)
require(reticulate)
reticulate::use_virtualenv("~/.virtualenvs/neuroharm/", required=TRUE)
reticulate::py_config()
neuroharm <- reticulate::import("neuroHarmonize")
ComBat.GAM <- function(X, batches, covariates, nh.args=NULL, ...) {
covars <- cbind(data.frame(SITE=batches), covariates)
res_cg... |
215ee42ef38b555a59383fa5c99278f2831a177f7a6deed3da370e65f8f41296 | R | 1,506 | 34 | library(ChIPseeker)
library(TxDb.Hsapiens.UCSC.hg19.knownGene)
txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene
library(clusterProfiler)
peak1 <- readPeakFile('GSM803365_hg19_wgEncodeHaibTfbsH1hescNrsfV0416102PkRep1.broadpeak')
covplot(peak1, weightCol = 'X128.460')
peak2 <- readPeakFile('GSM803365_hg19_wgEncodeHaibTf... |
4045d96fa739448ba2181602a4c965a36a27c9af073ece0235291925c57434cb | R | 1,507 | 52 | #' @name DEPRECATED-read.mat.Witec
#' @concept moved to hySpc.read.mat
#'
#' @title (DEPRECATED)
#' Read `.mat` file into `hyperSpec` object
#'
#' @description
#'
#' These data input functions are **deprecated** and they will be removed in
#' the next release of \pkg{hyperspec} package.
#' Now functions in packa... |
6903ae8462bfebacad9292131a04b45ae411cf5534ac8a7a5e17af2a4f5afa9e | R | 1,510 | 45 | #' Transport a tangent vector
#'
#' Transports a tangent vector from one tangent space to another.
#'
#' @param x A tangent vector (a symmetric matrix)
#' @param from The SPD matrix to whose tangent space x belongs
#' @param to The SPD matrix to whose tangent space to move x
#' @param method See details
#' @param nstep... |
3bccd81b05a50aa8a5a7c7794faecb241a7b1377b8d3ad48681087127ec35093 | R | 1,511 | 64 | #' Distance based on Pearson's \eqn{R^2}{R squared}
#'
#' The calculated distance is
#' \eqn{D^2 = \frac{1 - COR (`x`')}{2}}{D^2 = (1 - COR (x')) / 2}
#'
#' The distance between the rows of `x` is calculated. The possible
#' values range from 0 (perfectly correlated) over 0.5 (uncorrelated) to 1
#' (perfectly anti-cor... |
6a1b3816818edcb079595e8a8463e82af4202ebbe52b63493686b78eb07699c4 | R | 1,511 | 62 | # load libraries
library(tidyverse)
library(SingleR)
library(SingleCellExperiment)
library(WGCNA)
set.seed(1234)
args = commandArgs(trailingOnly = TRUE)
sample_path = args[1]
model_path = args[2]
pred_path = args[3]
threads = as.numeric(args[4])
# get path for other output
out_path = dirname(pred_path)
#-----------... |
647c04b8acd2d7f472cbcd93b6879d150be777113cfa30b71b2d56dfba93cdad | R | 1,514 | 62 | library(tidyverse)
library(Seurat)
library(singleCellNet)
library(tidyverse)
library(data.table)
library(WGCNA)
set.seed(1234)
args = commandArgs(trailingOnly = TRUE)
sample_path = args[1]
model_path = args[2]
pred_path = args[3]
threads = as.numeric(args[4])
# get path for other output
out_path = dirname(pred_path)... |
b4d9af3d75a00c66834fb90ca00af3770a9fef2a855c5a6dd964bf844cb50f5c | R | 1,514 | 40 | #!/usr/bin/env Rscript
chr <- c(1:20, 22, 23)
qcdir <- '/home/tl483/rds/rds-rd109-durbin-group/projects/cichlid/cichlid_g.vcf/main_set_2019-07-10/fAstCal1.2/GenotypeCorrected/depth_filter/malawi_variants/qc/'
outplot <- '/home/tl483/rds/rds-rd109-durbin-group/projects/cichlid/cichlid_g.vcf/main_set_2019-07-10/fAstCal1... |
21373b37d388117df076e48f5a5eaaba6039f0e80efdd9d98bdda8b359d541e2 | R | 1,516 | 44 | ##-------------------------------------------
## Pull mRNA expression data from Synapse
## and prepare for analysis
##-------------------------------------------
library(data.table)
library(synapser)
library(magrittr)
library(stringi)
# array metadata: syn23569440
# login to synapse
synapser::synLogin()
# download... |
5c486dc4329d29529fd2f052ef19e70d37c118fb2b81662436c7eb4d22094e56 | R | 1,517 | 59 | # load libraries
library(tidyverse)
library(SingleR)
library(SingleCellExperiment)
library(WGCNA)
set.seed(1234)
args = commandArgs(trailingOnly = TRUE)
ref_path = args[1]
lab_path = args[2]
model_path = args[3]
threads = as.numeric(args[4])
#--------------- Data -------------------
# read reference matrix and trans... |
93b7a642faee519000960e73c4803305d936614bc018f30bda0465ecd05435ad | R | 1,519 | 39 | #!/usr/bin/env Rscript
# This script is used to extract the queries cropped in frame from an query-references alignment obtained using vsearch
# vsearch is run on with an in-frame reference sequences dataset on a set of queries
# the optained alignment is cleaned by removing the sequences - to optain only the queries i... |
c791e614d72db2361a480156b8165e38803781a43081c3d27893444dc3b35dcd | R | 1,520 | 40 | #variables Juelich for Boney validation
library(dplyr)
library(naniar)
library(janitor)
if (!exists("ukb_validation")){
#import the Juelich data
UKBJuelich <- read_tsv('/Users/polona/Downloads/UKB_November_2022/ukb670018_fieldset2_MRI.tsv')
exclusion_UKB <- read.csv('/Users/polona/Downloads/exclusion_UKB.cs... |
42d3d4099aa717a4aab69ba7f52bb6fe8e85df055b93ec7c0609704196113a2a | R | 1,526 | 61 | #' Extract parts of pairwise object
#'
#' @description
#' Auxiliary function to extract parts of \code{\link{pairwise}} object.
#'
#' @param x An object of class \code{\link{pairwise}}.
#' @param \dots Additional arguments (passed on to [.data.frame).
#'
#' @aliases [,pairwise
#'
#' @name [.pairwise
#'
#' @usage \... |
060f461960794862918e626060e104b8bae1ff23f12780afd731119c2e9a11e0 | R | 1,537 | 35 | #' check_in_var
#'
#' HELPER
#'
#' This function allows testing if a factor takes values according to test criteria in the nested dataframe, and returns bolean a bolean, in a non nested column of the dataframe
#'
#' @param data The input data frame or tibble.
#' @param var The name of the column to check within the nes... |
127d41e6f59f25d26a1f060a1600c4ecf04aa8553803e817ef9f0f8aaf8b190c | R | 1,547 | 30 | source('./scripts/01_Setup.R')
setwd("./data/processed/rds")
filenamesx <- readRDS("./data/processed/rds/filenamesx.rds")
aa2= paste0('CNV1_', filenamesx)
all_data=list()
for (i in 1:length(aa2)){
fname = file.path('./data/processed/rds/',aa2[i])
all_data[[i]] = readRDS(fname)}
all2= data.table::rbindlist(all_data... |
1ab5ae5b7765c17ee8b8575b91249c4b74db45175eb05dfd8ed09c370e98ea96 | R | 1,547 | 43 | library(ArchR)
addArchRThreads(threads = 8)
rheMac10_UCSC = createGenomeAnnotation(genome='BSgenome.Mmulatta.UCSC.rheMac10')
# Load ArchR object
adata = loadArchRProject('MacaqueBrain')
# Add Union Peaks
peak_df = read.delim('../../Union_Peak_Info.txt', sep='\t')
peak_df = peak_df[, c('rheMac10_chr', 'rheMac10_start'... |
7b2a877d9126509b2b8a35551ded8dd53169f3ab1c4f29cfe4e07d4c829d519d | R | 1,548 | 57 | library(Cardinal)
# setCardinalBPPARAM(SnowParam(4))
# setCardinalBPPARAM(BPPARAM=SerialParam())
# getCardinalBPPARAM()
convert_imzmls <- function(path_in,path_csv,folder_out,out_name,res_ppm = 3,mass_range = c(50,650), normalize_peak = 208.1140,matrix_peak=157.0771){
files <- list.files(path=path_in, pattern... |
86895fc4240acd2d03ebedb65c965df6a75cdfd59c9a307c9026f3ed9555a2fa | R | 1,549 | 56 | library(Matrix)
setwd(dirname(rstudioapi::getActiveDocumentContext()$path))
matrix <- read.table(file = "../raw_data_full/sathyamurthy/GSE103892_Expression_Count_Matrix.txt", header = TRUE)
rownames(matrix) <- matrix[,1]
matrix <- matrix[,2:18001]
cells <- colnames(matrix)
genes <- rownames(matrix)
dat... |
873d13c5245190eba4350ce752f1caddffcd8bb92c54318f9883f36243dfaced | R | 1,551 | 69 | ---
title: "News"
#author: "Martin Rydén"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
##### April 28, 2022
Version 1.1.0
* Added support for the following species:
- Homo sapiens
- Bos taurus
- Caenorhabditis elegans
- Canis familiaris
- Danio rerio
- Drosophila... |
5e359cb423d50ffec8569ea7fb398f91ff50047b2f79a1150b90730172303148 | R | 1,556 | 45 | .libPaths("~/Rlibs")
library(GenomicRanges)
library(GenomicFeatures)
library(rtracklayer)
library(dplyr)
library(Biostrings)
gtf <- '/fast/AG_Ohler/frederick/projects/mpra/library_design/annotations/human_gencode/gencode.v44.primary_assembly.annotation.gtf'
fafile <- '/fast/AG_Ohler/frederick/projects/mpra/library_de... |
ecca068ca075a7fa9f852ad295530c48314e159c0176c16c677f9cfc9401ffd1 | R | 1,556 | 41 | rm(list=ls())
library(segmented)
library(ggplot2)
library(extrafont)
library(drc)
library(nlme)
library(mgcv)
library(visreg)
temp <- read.csv("G:/globalCBF.csv", header=T)
cbf=temp$cbf
age=temp$age
gender=factor(temp$gender)
site=factor(temp$site)
my.lm <- lm(cbf~age, data=temp)
my.seg <- segmented(my.lm,
... |
f54093a325601c2df949341d7a663f31e36ce9078b423c1a07bb71ab3990333c | R | 1,559 | 69 | # Function -------------------------------------------------------------------
.cov_h_ <- function(x, y, use, method) {
validObject(x)
cov(x@data$spc, use = use, method = method)
}
#' Covariance matrices for `hyperSpec` objects
#'
#' @rdname cov
#'
#' @param x `hyperSpec` object
#' @param y not supported
... |
2de62598745df1968a63fbd83c180301c96cbd59a85ebdf65ff945840ed0c5c0 | R | 1,562 | 57 | # Load dtplyr
library(data.table)
library(dtplyr)
library(dplyr, warn.conflicts = FALSE)
library(readr)
save.image("debug.RData")
clean_phenotypes <- function(data_path,
field_ids_path,
std_exclusions_path,
withdrawals_path,
... |
bbde8611b10c7669fe9d9e58c2470e141fbdfa118323a6ed107b590085a1d4ed | R | 1,563 | 38 | #' Distance between two symmetric, positive-definite matrices
#'
#' Function implements several distance measures between symmetric,
#' positive-definite matrices.
#'
#' @param x,y Symmetric, positive-definite matrices
#' @param method The distance measure. See details.
#' @details Allowable distance measures are
#' \i... |
6dc5192f70bf186d115c2edb7f3327f72965720507d64958e63c71db649aef31 | R | 1,564 | 54 | #!/usr/bin/env Rscript
# filtering multifasta by length
# ouput sequences that are shorter to lenght
require(optparse)
library(tidyverse)
library(seqinr)
option_list = list(
make_option("--fasta", action = "store",
type = 'character',
help = "references sequences for initial alignmen... |
5d16029bf023f39f9b1c6b9c3ef78a42136ce54b00e8d3b945d4bf2c214f77b3 | R | 1,565 | 43 | options (warn = -1)
library(liger)
library("plyr")
library('Matrix')
Args<-commandArgs()
RNAfile = Args[6]
rna = read.csv(RNAfile,sep = '\t',header = TRUE,row.names = 1,quote = "")
spatial_origal = as.data.frame(t(read.csv(Args[7],quote = "",sep = '\t',header = TRUE)))
Genes = scan(Args[7],what = 'character',nlines=1)
... |
fd95662333a799f1ccb0bf32fd7026e7de0f15e0fe139d9983e379a46d6b7f03 | R | 1,565 | 52 | #' Mental Health Treatment
#'
#' @description
#' Meta-analysis on the Effect of Mental Health Treatment on Medical
#' Utilisation.
#'
#' Data example in Fleiss (1993) for meta-analysis with continuous outcomes.
#'
#' @name Fleiss1993cont
#' @aliases Fleiss93cont
#'
#' @docType data
#'
#' @format A data frame with ... |
150b7194d144520353d3fa91365a8e2dba6bfb20c7608b999623ee15ad33eea0 | R | 1,572 | 53 | #' Meta-analysis on Prevention of First Bleeding in Cirrhosis
#'
#' @description
#' Meta-analysis on Prevention of First Bleeding in Cirrhosis
#' comparing beta-blocker or sclerotherapy with placebo.
#'
#' @name Pagliaro1992
#' @aliases Pagliaro1992
#'
#' @docType data
#'
#' @format A data frame with the following ... |
82cfb1bea4c35f1261b2eb445570c5cdd90168e4414b3537d46c561c20c28231 | R | 1,574 | 47 |
library(ggplot2)
library(ggrepel)
# Load the confound data
setwd('D:/fmri_sugar/other/movements')
Nsubs = length(dir(pattern='.tsv'))
fd = c()
for(i in 1:Nsubs){
thisFile = read.table(paste('sub-',i,'_task-narrative_desc-confounds_timeseries.tsv', sep=''), header = T)[-1,] # Slow
thisFD = as.nu... |
e4ee96f49fc116f348233f3b07b5b4214e93ef0ae661a4641496d487d2a500ad | R | 1,574 | 36 | library("lme4")
library("lmtest")
library("phia")
library("car")
library("emmeans")
# First model: burst waveforms vs power, without aperiodic activity subtraction
class_res_1_nfs <- read.csv("~/Codes/bebop_test/class_res_1_all__nfs_sel.csv", header=TRUE, stringsAsFactors=FALSE)
class_res_1_nfs$Feature<-as.factor(cla... |
0cc97b43fc125615d55887aae7b4bdfadbb168d810a5577d5f2a4e7aa803056e | R | 1,575 | 33 | source('./scripts/01_Setup.R')
setwd("./data/processed/rds")
filenamesx <- readRDS("./data/processed/rds/filenamesx.rds")
aa2= paste0('SegStats_', filenamesx)
for (i in 1:length(aa2)){
fname = file.path('./data/processed/rds/',aa2[i])
readRDS(fname)}
all = lapply(aa2, function(x) readRDS(x))
all2= data... |
59c8f72dd99a07bd41b309622c00cd578f483b9042c9b7db55dc3c898de71e01 | R | 1,577 | 38 | library(Seurat)
## first read in raw gene expression matrix downloaded from GEO
tnbc.counts <- read.table('/storage/yhhuang/research/mito/copyKAT/tnbc1/GSM4476486_filtered_UMIcount_TNBC1.txt')
## keep tumor cells only
# use copyKAT results and remove clone 2 (normal cells)
copykat <- read.table('~/data/reproduced_res... |
5570c37bcf71fed00dbe7af140f112fc0723923b093dd769f0491ce877ba82da | R | 1,583 | 32 | source('./scripts/01_Setup.R')
setwd("./data/processed/rds")
aa2= grep("preseq",list.files(), val=T)
aa2= aa2[!aa2%in% c("Merged_preseq_xlsx.rds","Pico_SN_preseq.rds",'dMDA_101_10Mb_lift_preseq.rds',
"dMDA_101_10Mb_preseq.rds","dMDA_101_10Mb_t2t_preseq.rds",'Merged_preseq_xlsx_dup.rds' )]
for (i i... |
6bd821549a5c960b9587540821fd7ff9bb0c7f18e1a6a8acd943b5bb5e4da8e4 | R | 1,586 | 57 | #set threads
library(BiocParallel)
register(MulticoreParam(progressbar = T, workers = 8), default = T)
BiocParallel::bpparam()
# Load library
library(copykit)
# Run pre-processing module.
#Bin size (resolution) can be “50kb,” “110kb,” “195kb,” “220kb,” “280kb,” “500kb,” “1Mb,” “2.8Mb”
name_data <- runVarbin("/path_to... |
9a1f353d4c2a7e8d66af0bad4364a13f95e299d93cabca62b35d3dfd8c6d5df3 | R | 1,594 | 38 | #==========================================
# create linker file for rsids
#==========================================
library(data.table)
library(stringi)
bim <- fread("tmp/adc_np_uniq_varid.bim")
rsid <- fread("raw_data/common_snps.txt", skip = 2)
rsid[, V1 := as.integer(stri_replace_first_fixed(V1, "chr", ""))]
rsi... |
c4b5d03fe1c4195b1f538d52faac376730e49f4a5785e6ebe607bf06087f3445 | R | 1,596 | 24 | source('./scripts/01_Setup.R')
SignificantCNVs <- readRDS("./data/processed/rds/WriteTable_SignificantCNVs.rds")
msa= SignificantCNVs[SignificantCNVs$Samples%in%c( "MSA-1","MSA-2"),]
########################################
ensembl = useEnsembl(biomart="ensembl", dataset="hsapiens_gene_ensembl")
genes_df <- getBM(attr... |
f5f0b63ac3f16ba6be7ce5e51359fa9a1a1980f709253e806e377d26b1a7478a | R | 1,596 | 38 | #==========================================
# create linker file for rsids
#==========================================
library(data.table)
library(stringi)
bim <- fread("tmp/act_no_dup.bim")
rsid <- fread("raw_data/common_snps.txt", skip = 2)
rsid[, V1 := as.integer(stri_replace_first_fixed(V1, "chr", ""))]
rsid[, V2 ... |
784d16956479c146537b648e738ea60420b56bab7899d14c4b3d951efe23a520 | R | 1,598 | 50 | ### R-4.3.1
# library
library('Guitar')
library(RColorBrewer)
# colors
colors = brewer.pal(8, "Set2")
### Figure3D HEK293
# Bed
stBedFiles = list('../data/m6atm_hek293.bed', '../data/gt_sac_hek293.bed', '../data/gt_cims_hek293.bed')
# Guitar Plot
png('Figure3D.png', units = 'in', width = 12, height = ... |
f98daa38befac04bc959af6e6f67ebffb36c1f0dc9e748667ecf2d184ed9f893 | R | 1,602 | 57 | #' Guess wavelengths from character vector
#'
#' character vectors used for names (e.g. colnames for matrices or data.frames)
#' are often treated by [base::make.names()] or similar functions that
#' produce suitable names (e.g. by prepending "X" to numbers). Such names
#' cannot be directly converted to numeric.
#'
#'... |
ce15b18815ba4f1fa943291193b95caf08da0a92d214fae55e9f271883750923 | R | 1,605 | 65 | library(Seurat)
library(scregclust)
library(data.table)
path <- "data/pbmc_granulocyte_sorted_3k_filtered_feature_bc_matrix.h5"
if (!file.exists(path)) {
url <- paste0(
"https://cf.10xgenomics.com/samples/cell-arc/2.0.0/",
"pbmc_granulocyte_sorted_3k/",
"pbmc_granulocyte_sorted_3k_filtered_feature_bc_ma... |
a8b1c8ba3adb3f70b70a777ed7df5bc07233473f29f73b88c82c08f937cf415e | R | 1,608 | 63 | #' @name DEPRECATED-count_lines
#' @concept moved to hySpc.read.txt
#'
#' @title (DEPRECATED)
#' Count lines (of an ASCII file)
#'
#' @description
#'
#' These data input related functions are **deprecated** and they will be
#' removed in the next release of \pkg{hyperspec} package.
#' Now functions in package \p... |
ebf1f90611f6f31d1e5244b70b02b09d242a821c89a1b0b1f0530e29d6605720 | R | 1,608 | 63 | #' @name DEPRECATED-count_lines
#' @concept moved to hySpc.read.txt
#'
#' @title (DEPRECATED)
#' Count lines (of an ASCII File)
#'
#' @description
#'
#' These data input related functions are **deprecated** and they will be
#' removed in the next release of \pkg{hyperspec} package.
#' Now functions in package \p... |
961de679cd34b82097db8d1bfdcebb03ab3b10ca7e4ce106962bd0e299a0d644 | R | 1,610 | 50 | #' Vectorize and unvectorize a matrix
#'
#' Function converts between a square symmetric matrix and a vector of the
#' lower triangular elements + diagonal. Allows optional scaling of the off-diagonal
#' entries in order to preserve the norm.
#'
#' @param x Either a square matrix, or a vector contains the lower triangu... |
5d73a4ae8cdb3e45c3ebee40f81b9dcbddff272e3a57cf6b1b6c66371c9000a8 | R | 1,611 | 44 | #!/usr/bin/env Rscript
# This script is used to extract segments from NVI consensus files insaflu
# from cath naming
# renaming segt_isolate.fasta
require(optparse)
library(tidyverse)
library(seqinr)
option_list = list(
make_option("--fasta", action = "store",
type = 'character',
he... |
d7657921dd07b3e547de6af86d169b7cac8ce890297488528acbc05e225d4238 | R | 1,614 | 61 |
library(tidyverse)
library("ggpubr")
HCP = read.csv('/home/mgell/Work/reliability/res/HCP_YA_reliability_accuracy.csv')
HCP = HCP[,c(-1,-17,-18)]
HCP$dataset = 'HCP-YA'
UKB = read.csv('/home/mgell/Work/reliability/res/UKB_reliability_accuracy.csv')
UKB$dataset = 'UKB'
colnames(UKB)[c(14,15)] = c('reliability_r', ... |
dcbf4cd1372d101e339ddd0cd2b2e33f7f17ce9a02310b096b54dab18bc4ce6a | R | 1,617 | 41 | options(stringsAsFactors = FALSE)
options(warn=-1)
list.of.packages <- c("ggplot2", "RColorBrewer", "dplyr")
new.packages <- list.of.packages[!(list.of.packages %in% installed.packages()[,"Package"])]
if(length(new.packages)) install.packages(new.packages)
library(RColorBrewer)
library(ggplot2)
library(dplyr)
argv <-... |
4345583fadfdef4582581a5459197a6ca281c3a6bdf5636f426fa81461998a8d | R | 1,628 | 56 | #' Detect a change in a column, and returns an incremental counter
#'
#' Mostly used, e.g., in case the ET file does not provide a Trial number column.
#' The function monitors the occurrences of a 'key' value and, when this value appears
#' for the first time, increases a counter by 1. For example, this will return
#'... |
90bc12af2367ab77a95162f5d57e37d3ee62e96526d7a5f7931c6514c5a9fa2f | R | 1,631 | 38 | #----------------------------------------------------------------------------------------------------------
# 5) Combine the summary statistics and LDSC output and run the user-specified GWAS - This one is a very
# memory intensive step, thus RUN THIS STEP ON THE GRID!
#-------------------------------------------------... |
194c0f5a4d5a4f9b223f595972b378c2a709a8a99d44e094a5f9bfd3a1c1b76d | R | 1,632 | 46 | # Parse the arguments
args = commandArgs(trailing = T)
ratioFile = args[1]
column = args[2]
pcfFile = args[3]
gamma = as.numeric(args[4])
kmin = 1
library(dplyr)
ratio = read.table(ratioFile, header = TRUE, stringsAsFactors = T)
chromosomeLevels = levels(ratio$chromosome)
chromosomePrefix = ""
if (any(grepl("chr", ch... |
f2aa087646e76b45a878f7f32943b0c4304d798721e8b4d592f0d3c6c55b19e0 | R | 1,635 | 63 | ---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# hot.dots
<!-- badges: start -->
[
plotdata <- ddply(data, c('Axis', 'Network', 'Coarsenet'), summarize,
'Loading' = mean(Loading))
# Factor ordering for ggplot
plotdata$Axis <- factor(plotdata$Axis, c('Explicit', 'Performance', 'Implicit',
'Late Explici... |
f8c903b4c207387cb4803e9c8c30f8735b390f0c071d2700d78df628db023bdb | R | 1,644 | 36 | # FLANKING DINUCLEOTIDE ######################
##############################################
##### NEUROG2
# Detect flanking dinucleotide.
neurog2_extended_peaks_motifs<-flanking_dinucleotides(neurog2_extended_peaks_motifs)
neurod2_extended_peaks_motifs<-flanking_dinucleotides(neurod2_extended_peaks_motifs)
# Filte... |
689585081b277a86ee128ee1d1c9c370800b29a82a70bd4d1697873322680b18 | R | 1,649 | 47 | library(Matrix)
library(data.table)
library(Seurat)
library(dplyr)
library(SPOTlight)
library(igraph)
library(RColorBrewer)
library(SeuratDisk)
library(future)
# check the current active plan
plan("multiprocess", workers = 8)
options(future.globals.maxSize= 3*1024*1024^2)
args<-commandArgs(T)
scrna_path = args[1]
spat... |
d1143cee8e77008aecd7fb76e7fb3e0df7c9d10ade3748e671e55d504fc13a48 | R | 1,660 | 65 | #' Extract parts of longarm object
#'
#' @description
#' Auxiliary function to extract parts of \code{\link{longarm}} object.
#'
#' @param x An object of class \code{\link{longarm}}.
#' @param \dots Additional arguments (passed on to [.data.frame).
#'
#' @aliases [,longarm
#'
#' @name [.longarm
#'
#' @usage \metho... |
b3fe81d97544388ad28965623586e64ce82692f24580024ee4d7090caf49ea1e | R | 1,666 | 49 | rm(list=ls(all=TRUE))
# Load packages
library(lme4)
library(data.table)
library(ggplot2)
library(emmeans)
library(lmerTest)
####################################
# 1) load data
df = read.csv(file="W:/Behavior_LMM/ICV_Behavior_table.csv");
df$age_c <- (df$BL_age-mean(df$BL_age,na.rm=TRUE))/365 # (age-mean)/365
df$sex.... |
f5fa870bb78272ce87948f82114c528c757d5263095ccb635b707b1d14ffce5e | R | 1,668 | 51 | ---
title: "Dcx classes creation and irradiation ratios"
output: html_document
---
Here we define DcxHigh and DcxLow cells amongst s-iNB and examine their relative abundance
```{r Libraries}
library(tidyverse)
library(dplyr)
library(patchwork)
library(Seurat, lib.loc = "/opt/rstudio-server_conda/conda/envs/rstudio-ser... |
07f5f482b8729878f127ceabdefda9be7d14929eb280aef8c99cc685fb3af56d | R | 1,672 | 61 | # create NACC phenotyp file for POLMM analysis
library(data.table)
np = readRDS("data/adc/np_qced.Rds")
# TDP-43 ordinal var
# Stage 1: Amygdala only
# Stage 2: + Hippocampus
# Stage 3: + Middle frontal gyrus or cortex
np[NPTDPB == 0 | NPTDPC == 0 | NPTDPD == 0 | NPTDPE == 0, late := 0]
np[NPTDPB == 1, late := 1]
n... |
e8c26ca5b2d5a29d600558a2e92479e08b7b456746ecd8b54ac136eaf4450f81 | R | 1,672 | 42 | #' test_plot_fun
#'
#' This function generates a test plot for data exploration.
#' It takes a tree object, metadata, point color, and point shape as inputs.
#' The function plots the tree using ggtree package,
#' with a rectangular layout and ladderize option set to True.
#' It adds metadata to the plot and overlays p... |
1d965f87d014ee8ee99c903550f68529004e8bb2774540dc2c1ff90b22bcb3ea | R | 1,673 | 57 | ## Process the CG model of PDB file generated by cafemol initial run
## Does coordiante centering based on cafemol input afm and pdb formatting
## for preparing the pdb file for Cafemol AFM fit run
## Usage: Rscript process_pdb_cg.R input.pdb cafemol_input_file
# install.packages("bio3d")
library(bio3d)
library(dplyr... |
e71944f729b0c5e7eb1e282d4d038dd08fbea627c8840a3b4b9c77931631757a | R | 1,674 | 71 | library(progressr)
library(foreach)
library(doFuture)
plan(multisession)
# Will be the dataset "wang" or "pbmc"
dataset <- commandArgs(trailingOnly = TRUE)[1]
output_path <- "output"
library(data.table)
source("../utils/0-indices.R")
expression <- fread(file = sprintf("data/%s-pearson-resid.csv", dataset))
genesymb... |
dd32a27a35df68a0c474d53547a9d54787514a0688434dd6d73461dd2a4b04a3 | R | 1,675 | 65 | ---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# hot.dots
<!-- badges: start -->
<!-- badges: end -->
This paack... |
eb758596afa9a5b6dbf8849ee0fd4db3aed1fc3c4ddb13b00cd127e1b5ae8cc7 | R | 1,678 | 51 | library(Seurat)
library(sctransform)
library(patchwork)
library(dplyr)
#Load dataset
dt.sct <- readRDS("datasets/1_seurat_integrated.rds")
#cluster
dt.sct <- RunPCA(dt.sct)
dt.sct <- RunUMAP(dt.sct, reduction = "pca", dims = 1:50)
dt.sct <- FindNeighbors(dt.sct, reduction = "pca", dims = 1:50)
dt.sct <- F... |
c60dcab17441de5aba80b4818e616867ebeef90796a0aa524bcc809d50ed5430 | R | 1,689 | 32 | source('./scripts/01_Setup.R')
SignificantCNVs <- readRDS("./data/processed/rds/WriteTable_SignificantCNVs.rds")
msa= SignificantCNVs[SignificantCNVs$Samples%in%c( "Control"),]
dim(msa)
# 6 15
########################################
ensembl = useEnsembl(biomart="ensembl", dataset="hsapiens_gene_ensembl")
genes_df <... |
f000fd3f9fde4565aa665deafe9ef3b5d25d74db83b580cad1ce6989d3284148 | R | 1,689 | 66 | #' Interprets easily the results of 'bayesian_test'
#'
#' This is a helper function. It takes an object
#' created by 'bayesian_test' and spits intervals
#' with evidence for either the null or alternative models.
#'
#' @param bfs An object returned by 'bayesian_test'.
#' @param evidence_thresh Threshold to judge evide... |
96692b6c7e84885e3b057754d9425e5df3c25ac9a8f4a7a4d4d7ce4353ae5a25 | R | 1,691 | 43 | #' @name palette_colorblind
#' @aliases palette_colorblind colors,palette_colorblind
#'
#' @title Color suggestions for `hyperSpec` users
#'
#' @description
#' In \pkg{hyperSpec} the user may use any color name/format known to `R`.
#' An important fact to keep in mind is that most people with normal vision
#' cannot di... |
95ddacfccf66b6f8927adbd060ad43ee77ce20f26253762c348b920dbb95ffb5 | R | 1,693 | 59 | test_that("metainf selects random effects when prediction intervals are requested", {
data(Fleiss1993bin)
ma <- metabin(d.asp, n.asp, d.plac, n.plac,
data = Fleiss1993bin, studlab = study, sm = "RR",
method = "I", prediction = TRUE)
mi <- metainf(ma)
expect_identical(mi$... |
be69c74fa2cb6bfb493a87ff228d66295c6739ccaff8459c6cc70f8a5624c08e | R | 1,693 | 59 | test_that("metacum selects random effects when prediction intervals are requested", {
data(Fleiss1993bin)
ma <- metabin(d.asp, n.asp, d.plac, n.plac,
data = Fleiss1993bin, studlab = study, sm = "RR",
method = "I", prediction = TRUE)
mc <- metacum(ma)
expect_identical(mc$... |
c3379250f1e4a73889560ef4c1abcc540015e2b6f9bcc5f087c5e5ad0d501113 | R | 1,699 | 47 | ## -----------------------------------------------------------------------------
##
## Somatic variant detection in lesional focal epilepsy
## Helper functions
##
## Author: Dr. Christian Bosselmann
##
## Date Created: 2023-09-05
##
## Copyright (c) Christian Bosselmann, 2023
## Email: bosselc@ccf.org; christian.bossel... |
dc468d464df2b252a1290476cbe792cc58a17b1b9dde46df6e2801506276e25d | R | 1,704 | 70 | #' Return subset of longarm object
#'
#' @description
#' The \code{subset} method returns a subset of a longarm object.
#'
#' @param x An object of class \code{longarm}.
#' @param subset A logical expression indicating elements or rows to
#' keep: missing values are taken as false.
#' @param \dots Additional argume... |
4336ebc61230829c7c412ea64ddc3acf50faf60b3756cfa3d05a52ea27efa880 | R | 1,705 | 54 | #==================================
# categorize the act NP variables
# by outcome type, coding, etc.
#==================================
library(data.table)
library(readxl)
library(magrittr)
act <- setDT(read_xlsx("raw_data/ACT_235_2023_08_21/np_2023_08_21.xlsx"))
act_fam <- fread("data/act/act_np.fam") %>%
setn... |
1decd811538395ca48092576527b275392a7a9ac10041fca2be3ceb6d54fba7f | R | 1,708 | 53 | # Citation/Bibliography ======================================================
#' Create package citation code for Rmd files.
#'
#' [cite_pkg()] - cites all references provided in a package.
#'
#' @param ... (character) Names of packages to cite.
#' @param bib bibliography as returned invisibly by [knitr::write_bib()]... |
9c93c0b7afc5654c79049a3ae3beab365545c62ad56e7e08d2dc3fb3ec6bcdb3 | R | 1,712 | 40 | source('./scripts/01_Setup.R')
top=8
L11 <- readRDS("./data/processed/Pico_101_500kb/L11_Exp1.8.1B_sn3_10_FC_CellRaft_v3_S38.bt2.hg38.sorted.dup_marked.bam.rds")
L11$labels$title <- 'Control'
L11$labels$x <- NULL
A29 <- readRDS("./data/processed/Pico_76_500kb/A29_v2_Exp9.1_sn10_06_CC_S29_R.bowtie.hg38.sorted_dup_ma... |
57706678fda02d0b31d65ab5de77a854b5b2d6e3d3ac4a716641e71e689b21f5 | R | 1,714 | 72 | soft_power_thresholds <- c(seq(4, 9, by = 1), seq(10, 20, by = 5))
library(WGCNA)
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")
expression <- fread(file = sprintf("... |
052d0a4451dedfece2e3f2cf9110c05d2dd101812e15ce679b1220dbd92aaee8 | R | 1,715 | 33 | #written by menggeliu 2023.10.1
arg = commandArgs(T); info = arg[1]; outdir=arg[2];
library(LAVA)
### Read in data
sum.id<-read.table(info,header=T)
loci = read.loci("shared_loci")
n.loc = nrow(loci)
input = process.input(input.info.file=info, # input info file
sample.overlap.file=NULL, ... |
5f7b65fb4e1334a95ce67ed21f7f7b878657ea6564608a6e96813b62e8a60f69 | R | 1,719 | 45 | ####################################
#
# This function used to extract intra-
# and inter- connectivity among SMN,
# VN and DMN
ExtractConnectivity <- function(file_name, net_annotation) {
# define the position of each network
id_smn <- which(net_annotation$network_new == "somMot")
id_visual <- which(ne... |
0eb5a4923acd0ea704ce1abe0ce43a4c05281ab1be496c0b5cb336c81e7f5e1a | R | 1,731 | 64 |
#=================================
# create ACT .covar file
#=================================
# sex, age of death, ACT cohort, PCs 1-10
library(data.table)
library(GENESIS)
library(SNPRelate)
library(stringi)
library(readxl)
act <- as.data.table(
read_xlsx("raw_data/ACT_235_2023_08_21/demo_2023_08_21.xlsx",sheet ... |
853ad8cbab04169b12a3f3d5c9b654f71092a691be3fb79eb3a6cdc4938014d9 | R | 1,733 | 58 | #' @name DEPRECATED-guess.wavlength
#' @concept deprecated
#'
#' @title (DEPRECATED)
#' Guess wavelengths from character vector
#'
#'
#' @description
#'
#' These \pkg{hyperSpec} functions are **deprecated** and not maintained any
#' more. You should not use these.
#' Currently they are present due to back-compat... |
cadf05f06bd0f5b5d46bc1a0abfda2bbf8458b867804900451add9b08e0e8d76 | R | 1,736 | 55 | test_that("merge_legacy maps and removes legacy list arguments", {
dots <- list(fs.main = 3, graphical = TRUE)
expect_warning(
res <- meta:::merge_legacy(list(heading = 2), dots,
list(main = 1, heading = 4), "fs", warn = TRUE),
"deprecated"
)
expect_equal(res$res[c("main... |
fa5e63fd221b68ce7a07940826daf6d4e5114d412e85d63bf490c6aa1a421edf | R | 1,742 | 63 |
heatmapUI <- function(id) {
ns <- NS(id)
fluidRow(
column(width = 3,
box(title = "Heatmap settings",
width = NULL,
status = "warning",
selectInput(ns("corMethod"), "Corr. method", choices = list("Pearson" = "pearson",
"Spearman" = "spearman"),
selected =... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.