sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
ca0a6cd5fd5dfbe8aa1798fed4d692d218475f9a8fce50fd7bb80e6e7a538243
R
1,568
53
#################################### ## Reverse MR - tier #2 and tier #3 traits ## William Reay (2023) #################################### library(dplyr) library(data.table) library(TwoSampleMR) setwd("~/Desktop/Retinol_GWAS/MR_all_cis_acting_SNPs/") Tier_3 <- fread("Processed_output/Tier_3/Passing_traits_tier_3...
bd49a17d5c2c85a61d543079aedf8cc77fbd8a74d07c58b6038139991d00b042
R
1,576
81
#' @include FamiliarS4Generics.R #' @include FamiliarS4Classes.R NULL setClass( "familiarRandomVimp", contains = "familiarVimpMethod" ) setClass( "familiarNoneVimp", contains = "familiarVimpMethod" ) setClass( "familiarSignatureVimp", contains = "familiarVimpMethod" ) setClass( "familiarNoFeaturesVimp...
4569800220dc0e8e99787ce23a3ae4b6636b5b0fa8297836d6f1ddd8c6511720
R
1,590
41
# NOTE: please create a '.Rprofile' file in your project directory in the same location as your '.Rproj' file. # Include a single line with the following code: `R_PROFILE_USER=""` # This will address any normalizePath warnings looking for the home directory which is not bound within the container # This script is cale...
7c6acf395e53318320416192728403406686420fe4cbd7c8156190fcfecfced6
R
1,613
33
library(stringr) align2='human' input_path=paste0('/scratch/users/banwang3/celllines/analysis/ASE/',align2,'/') output_path=paste0('/scratch/users/banwang3/celllines/analysis/ASE_norm/',align2,'/') humangenes=read.csv('/scratch/users/banwang3/celllines/scripts/RScripts/All_Human_Genes.csv',sep=',') samplenames<-c('RNA3...
0443f560ec9d627eb2e34c2d12723e20e89a2cf1e9e179d9d5d40721ae4b1282
R
1,617
36
iDeepViewLearn_train <- function(python_path, myseed=1234L, X_train, y_train=NULL, X_tune=NULL, y_tune=NULL, search_times=0L, best_comb=NULL, impt=NULL, outtype = NULL, top_rate=0.1, edged=NULL, vWeightd=NULL, ...
344d8342c9f79ac3adaa1eecbe674083275d3ba8cb142dec405cabbc4febf2b6
R
1,643
43
# peak identify.peak.events = function(dt, t, x, sd.peak.n = 3, sd.peak.width = 1, prefix="peak", ...) { n = round(sd.peak.width / dt[, shift(get(t), n = -1) - get(t)][[1]], digits = 0) .x = as.vector(dt[, get(x)]) .xs = as.vector(dt[, shift(get(x), n = round(-n/2))]) .mean = frollmean(.x...
0019a0a7bd9cebe928b064c989a5fb038d440e6f127bac338afe9ba492177e6e
R
1,646
89
#' @include FamiliarS4Generics.R #' @include FamiliarS4Classes.R NULL # add_feature_info_parameters (NULL, ANY) -------------------------------------- setMethod( "add_feature_info_parameters", signature( object = "NULL", data = "ANY" ), function( object, data, ... ) { # This is when ...
8e4bf5c521be48688180f012bc186912e7bb1b2718f68a7274493971bdf6c54e
R
1,654
41
#' compare_ucobias #' #' Compares taxa by codon usage bias. #' @export compare_ucobias<-function(featuredata=NULL, contigsdata=NULL, taxlevel="LKT", taxaofinterest=NULL, ucobias=NULL, method="tSNE", frac=0.25){ taxlevels<-colnames(opt$LKTdose)[colnames(opt$LKTdose) %in% c("Domain", "Kingdom", "Phylum", "Class", "...
89462762a8a19fe2afad0b3fb61c29a6cd2955ae769af75c674e08a5f96a26d5
R
1,659
42
context("Dissimilarity calculation") test_that("Dissimilarity calculation", { data(GlobalPatterns, package="mia") tse <- GlobalPatterns # Test if Unifrac dissimilarity works with external tree expect_equal(getDissimilarity(tse, method = "unifrac"), getDissimilarity(tse, tree = rowTree(tse), metho...
30b3e93d1f27049559e35e606736876442f43925d0ef945e71cae293c30d5ed0
R
1,663
61
library("muxViz") library(igraph) #Or build by specifying layers Layers <- 10 Nodes <- 100 NodeTensor <- list() g.list <- list() g.list[[1]] <- barabasi.game(Nodes, m = 1, directed = F) #generate additional layers with increasing % of overlapping edges, while preserving degree distribution ov.fractions <- seq(0.1, 0...
7ce566167d2c8bb8c33ea51823dab02e3588ea72d409d5c26f311daecb2a31f5
R
1,690
31
library(ggplot2) library(Seurat) library(harmony) library(dplyr) library(Matrix) library(patchwork) # outdir <- 'output/' #Read in pre-merged count matrix data SeuratObject <- readRDS("PD.paper.seuratObject.RDS") #data available at https://www.synapse.org/#!Synapse:syn52911948 SeuratObject@assays$RNA@data <- SeuratObje...
bf596cdae74f0c939034688c8545c5cdb328304b31e02d38d44adb44955ee76a
R
1,700
47
test_that("Test getReducedDimAttribute", { data(GlobalPatterns) tse <- GlobalPatterns # res <- getReducedDimAttribute(tse) |> expect_error() # Calculate MDS tse <- runMDS(tse, assay.type = "counts") # Get reference values mat <- reducedDim(tse, "MDS") ref <- attributes(mat) ref ...
1faa07ad3a9421df93c15496467025f0acc1e22eb410aa9d7b331dce72fd04f5
R
1,702
16
#' glom_completeness(completeness_df = NULL, taxlvl = NULL) #' #' JAMSalpha function #' @export glom_completeness <- function(completeness_df = NULL, taxlvl = NULL, HQ_completeness_threshold = 90, HQ_contamination_threshold = 5, MHQ_completeness_threshold = 70, MHQ_contamination_threshold = 10, MQ_completeness_thresh...
37ffc41ee1f15467151b44b59753f3809b4b766d5447bc482528cbbe79046569
R
1,705
42
library("limma") setwd("/Users/hongbin/Desktop/r work document") #10.3 limma分析需要 行为待测物、列为样本 df <- read.csv("完整数据.csv",header = TRUE,row.names = 1) df <- as.data.frame(lapply(df,as.numeric),row.names = rownames(df)) #要把rownames带上,否则会乱 #过滤含有0的行 row_sub <- apply(df, 1, function(row)all(row !=0)) df2 <- df[row_sub,] #...
73e0861244caff9e8f322276ecd9d84d0cad3a53938ecd52d70165c516b03282
R
1,708
42
setwd("/Users/zhangyuan/Google Drive/2021_HCP_Gender_DNN") rm(list=ls()) library(dplyr) library(ggplot2) library(ggpubr) library(ggforce) hcp_sessions = c("LR_S1","LR_S1","RL_S1","RL_S1","LR_S1","RL_S1") test_sessions = c("LR_S1","LR_S2","RL_S1","RL_S2","nki_645","nki_645") #i = 1 for(i in 1:6){ fname1 = paste("...
8386c9eb3ee0202328859d01679c36d3089187192765f2fbe973893e2affc604
R
1,714
42
#' plot_readscatter(opt = NULL) #' #' Makes a scatterplot of percentage of reads assembled into contigs by sequencing depth. #' @export plot_readscatter <- function(opt = NULL){ readdata <- opt$readdata phenotable <- opt$phenotable phenolabels <- opt$phenolabels readdata <- readdata[opt$phenotable$Sam...
ce615ef3d3a659e1cbcb1c9f7dadc704697ea116acc5edb2f985eaee2feb7c45
R
1,717
54
library("muxViz") #Or build by specifying layers Layers <- 3 Nodes <- 100 NodeTensor <- list() #Generate an edge-colored network g <- barabasi.game(Nodes, m=1, directed=F) g.list <- list() for(l in 1:Layers){ g.list[[l]] <- delete_edges(g, sample( E(g), floor(0.2*length(E(g))) ) ) NodeTensor[[l]] <- get.adja...
a3c0f7c00b386219ea5309f54ddf8b99693ebe5d4d8c88a8aeb4a726bd7025b0
R
1,721
39
test_that("getQC and addQC", { data(GlobalPatterns, package = "mia") tse <- GlobalPatterns mat <- assay(tse, "counts") # Samples res <- getQC(tse) expect_s4_class(res, "DataFrame") expect_identical(rownames(res), colnames(tse)) expect_equal(res[["total"]], unname(colSums(mat))) expec...
59c2cacecf6ff60cc5a84cba4d921afee304ee738c0a001f305f56252d983734
R
1,740
45
df = read.csv('/scratch/users/banwang3/celllines/analysis/ASE_norm/human/filtered/ASE_value_fromrawcounts.txt',sep='\t') rawcounts = read.csv('/scratch/users/banwang3/celllines/analysis/ASE_norm/human/filtered/rawcounts.txt',sep='\t') idxa=grep('total',colnames(rawcounts)) rawcounts=rawcounts[,-idxa] genenamesall=df$ge...
b2beeb01d2077b1a5168a0f9d96cf7641c6c0967a1e1655906a0137e34540660
R
1,741
75
#' mini Giotto object for spatial single-cell resolution data #' #' Mini Giotto object created from the seqFISH+ data. #' #' @docType data #' #' @usage data(mini_giotto_single_cell) #' #' @format An object of class \code{"giotto"}; see \code{\link[Giotto]{createGiottoObject}}. #' #' @keywords datasets #' #' @referenc...
952f439b2a304382e07030703b20b96fe036099deaabd90460fdf4274b7857da
R
1,746
53
# Don't perform any further tests on CRAN due to time of running the complete # test. testthat::skip_on_cran() testthat::skip_on_ci() debug_flag <- FALSE familiar:::test_plots( plot_function = familiar::plot_shap_dependence, data_element = "shap", shap_max_iterations = 10L, outcome_type_available = c("continu...
7405926e4f1f6fc8037e00a9e5f743b1812d655806e63aa2cd0077be9655805a
R
1,776
37
#' #' Calculates the sPCC as proposed in the iENA paper #' #' @param y the dataframe with preprocessed expression data; the rows are genes and the columns samples #' @param sample for which sample (number according to the columns in y) must the sPCC be calculated iENA <- function(y, sample){ sample_name ...
f749d728410c75e56ca84771e08a6d6f63c65c775155b79cfcc492d9719cdc9d
R
1,778
47
setwd("/Users/zhangyuan/Google Drive/2021_HCP_Gender_DNN") rm(list=ls()) source("scripts/brainbeh/2022CCA/myRFunc_updated.R") library(ggplot2) # library(ggrepel) # library(reshape2) #### load existing results for plotting #### midfix = "HCP_LR_S1_CCA_msubjs_sFC_cognition" fname = paste("results/brain_behav/sFC_PCvers...
508208228f996d0fb08015cb1fb8a99ff7d1c0af558838425b3c28e49e370afa
R
1,787
45
getARvsDiff <- function( tmpMatI, tmpMat , n_row, n_col){ tmpAR <- vector() tmpLatDiff <- vector() tmpMatrix<- matrix( 0 , n_row, n_col ) for( i in 1:dim( tmpMat)[1]){ if( is.na( tmpMat[ i, 2])){ if( length( tmpAR ) == 0 ){ tmpAR[ length( tmpAR ) + 1 ] <- tmpMat[i,1] } else{ ...
f6e4690fd7d748ae618d571ad2e6cb8f33cfcb5219baccdbb80443b25b6ff92b
R
1,801
64
combine=function(lst, alpha = 0.05, collapse = F){ n=length(lst) seed=do.call("c",lapply(lst, function(x){x$seed})) nperm=do.call("c",lapply(lst, function(x){x$nperm})) nlocations=do.call("c",lapply(lst, function(x){x$nlocations})) alternative=do.call("c",lapply(lst, function(x){x$alternative})) if (leng...
ba46e22c3c9a20d996afd30c1f273553a8ffc3c9e6bac8492affc91ba88ab9a5
R
1,803
30
##################### ## ROSE - super enhancer detection code ##################### #This function calculates the cutoff by sliding a diagonal line and finding where it is tangential (or as close as possible) calculate_cutoff <- function(inputVector, drawPlot=TRUE,...){ inputVector <- sort(inputVector) inputVector[...
398a29cb343cace338ebed87ca4ad0b3409b97d428f349c20c3c62eca1906b34
R
1,807
61
# Stability selection methods, as in Wald R, Khoshgoftaar TM, Dittman D, Awada # W, Napolitano A. An extensive comparison of feature ranking aggregation # techniques in bioinformatics. 2012 IEEE 13th Int. Conf. Inf. Reuse Integr., # IEEE; 2012, p. 377-84. These methods are based on Haury AC, Gestraud P, Vert # JP. The ...
8b4e962b741577c2fa8372067270c7fb58a18663a28d42905a87bf9358150c06
R
1,808
68
.get_available_rank_aggregation_methods <- function() { return(c( "none", "mean", "median", "best", "worst", "stability", "exponential", "borda", "enhanced_borda", "truncated_borda", "enhanced_truncated_borda" )) } .optimise_feature_occurrence_threshold <- function(vim...
98c7dc0401f050f0d01ce52cbba87747e9dabdd74b77d33ecfb5ec2d291e9051
R
1,824
47
# shiny stuff for saving a dataset in the data tab shinyFileSave(input, "data_save", root=c(`Working Directory`='.', getVolumes()()), filetypes=c("csv", "xlsx")) shinyFileSave(input, "data_saveall", root=c(`Working Directory`='.', getVolumes()()), filetypes=c("xlsx")) observeEvent(input$data_save, { if (is....
eed5cdc638a7dc0ecafcf1bdf12c5e0cbfec7ca76c4ac9e9f585e13d420b3ba3
R
1,858
59
################################################# ## Retinol gene priortisation - ABF finemapping ## William Reay (2022) ################################################# library(dplyr) library(data.table) ## Load ABF function from GitHub - https://github.com/Williamreay/Pneumonia_meta_GWAS/blob/master/Finemappin...
0deb6436635506d62043c7114b05c0c277f59fc42389fece4be479b5b280ad55
R
1,865
76
#################################### ## Retinol ~ protein colocalisation ## William Reay (2022) ##################################### setwd("~/Desktop/Retinol_GWAS/ARIC_MR_and_coloc/") library(dplyr) library(data.table) library(readxl) library(coloc) ## Read in retinol GWAS Ret_GWAS <- fread("../Meta_analyses/Co...
7050aa2136f3f853bfc3ae464d5ef15f908bac199a1d1e579748febf62567736
R
1,871
71
testConditionValid = function() { t = T tryCatch({ .test = data$raw[[input$events_dataset]][, eval(parse(text=input$events_conditions))] }, error = function(e) { t = F }, warning = function(e) { t = F }) t } condition.events = function(.dt, .el, .t, c, if.al...
de443906ac4f17b80c2eda05afdc4da001d17b4a610310945e881146890c4e71
R
1,882
58
library(ggplot2) library(plotly) library(tidyverse) cases <- c("RB-1745-2486", "RB-1745-2911", "RI-1933-1142", "RI-1933-2449", "RI-1933-2462", "RI-1933-2463", "RI-1933-2470", "RI-1933-2487", "RI-1933-2611", "RI-1933-2630", "RI-1933-2687", "RI-1933-2701", "RI-1933-2712", "RI-1933-2852", "RI-193...
4d4a1e62947d667a047ea3fb0e6772f9d4de326a6f2179ddd4eb20c1fe905d9b
R
1,896
38
#' process_MAGs(opt = NULL) #' #' JAMSalpha function #' @export process_contig_LKTs <- function(opt = NULL){ if (opt$analysis == "isolate"){ opt <- evaluate_LKTs(opt = opt, contigsdata_name = "contigsdata", output_list_name = "taxonomic_completeness_and_counts", taxlvls = "LKT") } else if (opt$analy...
55bb0d9af337743166406038e4cc3669600d67f6bbe85df34b0ea5a69d44b938
R
1,907
54
library(stringr) #library(dplyr) foldername='FABP7' input_path=paste0('/scratch/users/banwang3/references/outputs/',foldername,'/') align2='hg38' #align2s=c('hg38','pantro6') filename=paste0('SNPlist_',align2,'_4096bp.bed') SNPs=read.csv(paste0(input_path,filename),sep='\t',header=F) SNPs=SNPs[,1:4] colnames(SNPs)=c('c...
2c644fc867393a93b16e0e2da1b4c309f8661ada6938527a23c0c4cf4cdc068f
R
1,910
84
# Simple ensemble aggregation, as in Wald R, Khoshgoftaar TM, Dittman D, Awada # W, Napolitano A. An extensive comparison of feature ranking aggregation # techniques in bioinformatics. 2012 IEEE 13th Int. Conf. Inf. Reuse Integr., # IEEE; 2012, p. 377-84. .compute_rank_mean_score <- function(x) { # Aggregate using m...
2cca03e0bdb7ce59ffa62acdb639bbd9b668d594ab88d2b5d2bccb2b47d89e83
R
1,911
44
--- title: "Setup Infomap Fanmod executables" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Setup Infomap Fanmod executables} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) ``` In order to ...
d2bd0127331a89f2d48f838a7cc0b7d266d4a963ca1ef446db60b2debf05000f
R
1,914
66
library(shiny) library(pheatmap) library(grid) library(stringr) library(RColorBrewer) library(circlize) library(ggplot2) # Load Data load("data.Rdata") #object called data # tf names all_tfs <- rownames(data) # Server server <- function(input, output) { # Reactive values to store the selected tfs selected_tfs_da...
b75c4df245779695ff7ba1e509eb35aaa34dd9c9b6d1c2e9bbb3127be02e67da
R
1,916
54
library(stringr) #library(dplyr) foldername='GAD1_centeratHAR' input_path=paste0('/scratch/users/banwang3/references/outputs/',foldername,'/') align2='pantro6' #align2s=c('hg38','pantro6') filename=paste0('SNPlist_',align2,'_4096bp.bed') SNPs=read.csv(paste0(input_path,filename),sep='\t',header=F) SNPs=SNPs[,1:4] colna...
64938dc7bd2eb5a6deaf0921c2d1009c80cd3ba8725d53d82c278d7b2ce7c9ea
R
1,921
39
library(argparse) parser <- ArgumentParser() parser$add_argument("--generator", default="FABP7") args <- parser$parse_args() foldername=args$generator input_path=paste0('/scratch/users/banwang3/references/outputs/',foldername,'/') for (align2 in c('hg38','pantro6')){ filename = paste0(input_path,'SNPlist_',align2,'...
8a0e80f63cef5a59fd79edfe34a6298c5e3c3d1a4d864b53643bcd16fb022578
R
1,928
44
#' filter_sample_by_class_to_ignore(SEobj = NULL, variables = NULL, class_to_ignore = NULL) #' #' Filters a SummarizedExperiment object by several criteria. #' @export filter_sample_by_class_to_ignore <- function(SEobj = NULL, variables = NULL, class_to_ignore = NULL){ ptb <- as.data.frame(colData(SEobj)) all...
762889656438bcc7d22d7411dcd1f54bd0bcf0d7485f66e7cd0e807f0ae7af7a
R
1,929
74
# buildNNmatrixDist=function(distMat, max.radius=20){ # p=nrow(distMat) # dist_range = sort(c(ceiling(min(distMat, na.rm=T)),ceiling(min(c(max(distMat,na.rm=T),max.radius),na.rm=T)))) # dist_range_sequence = seq(dist_range[1], dist_range[2], by=1) # different radii to consider # # out=foreach(i=1:p,.combine=...
dced432e9203f4ebc693671733ca4cb94e471de1f18e8e68da7126329376444a
R
1,962
59
# Generated by using Rcpp::compileAttributes() -> do not edit by hand # Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 set_seed <- function(seed) { invisible(.Call('_CLEAN_set_seed', PACKAGE = 'CLEAN', seed)) } CleanMeanC <- function(ymat, NNmatrix, nperm, s) { .Call('_CLEAN_CleanMeanC', PACKAGE = 'CLE...
dd7b5dd8257f1b42b7d6a594f53c72bd4bdcd094e48ce04f6fb01b23f48943e4
R
1,982
53
# This script conducts testing & plotting on ROI-based MVPA rm(list = ls()) source('Setup.R') usedir = dirname(getwd()) figDir = file.path(usedir,'Figs') SubInfo = read.xlsx(file.path(usedir,'SourceData.xlsx'),'SubjectConds') Corr_diff_vals_df_summary = read.xlsx(file.path(usedir,'SourceData.xlsx'),'Fig6d') #######...
e4ebf3103b02544d12f61eb16f77c5d33f6649a2f2f085844dd374fec9ce5ea9
R
1,993
68
library(data.table) library(ggplot2) library(ggtext) library(tidyverse) ## https://danielroelfs.com/blog/how-i-create-manhattan-plots-using-ggplot/ args <- commandArgs(T) gwas_data <- fread( args[2], sep="\t", ) unique(gwas_data$CHROM) gwas_data$CHROM <- as.numeric(recode(gwas_data$CHROM, X = "23")) gwas_d...
4b7f8bde53b667dbeab7d25d40a8e24c05aae3ff1fd452b7155ee407d73cae3c
R
1,996
64
familiar:::test_all_vimp_methods_available( familiar:::.get_available_correlation_vimp_methods(show_general = TRUE) ) # Don't perform any further tests on CRAN due to running time. testthat::skip_on_cran() testthat::skip_on_ci() familiar:::test_hyperparameter_optimisation( vimp_methods = familiar:::.get_available...
f7c70ff0c3913e5a43f40144a8b153cc77677f13b63e78d469355179f4aaa074
R
1,997
58
context("addNMF") test_that("addNMF", { skip_if_not_installed("NMF") data(GlobalPatterns, package="mia") # set.seed(123) tse <- GlobalPatterns tse <- agglomerateByPrevalence(tse, rank = "Phylum") tse <- addNMF(tse, k = 2, seed = 123) expect_named(reducedDims(tse),"NMF") expect_true(is.matrix(reducedDi...
b516f0c33b2f738798de1a9a695473f28d4083fb37e5344d935eceace3893b2a
R
2,001
55
# Load necessary packages library(mia) library(stringr) library(S4Vectors) ### Defining FILE PATHS ### path_to_assay <- "Tito2024QMP_assay.csv" path_to_coldata <- "Tito2024QMP_coldata.csv" path_to_rowdata <- "Tito2024QMP_rowdata.csv" ### Importing FILES ### Tito2024QMP_assay <- read.csv(path_to_assay, row.names = 1...
e208a6eb2a21ba881ed3a36adadbc2c3762f988a3ba816deefe1ddd31a6243e9
R
2,001
75
rm(list=ls()) library(openxlsx) library(R2jags) library(plyr) # source data sourceDir = '~/Desktop/SourceData' # modeling dir behmodelDir = '~/Desktop/BehavioralModeling' dat = read.xlsx(file.path(sourceDir,'OdorPredRes.xlsx')) datinfo = read.xlsx(file.path(sourceDir,'SubjectConds.xlsx')) # exclude 4 subs: only ...
79e803b0522d580650038d9ac4fb5407e22bad9c8f2a7b1031d5456589bdedf3
R
2,002
43
#' kraken_classify_taxonomy #' #' JAMSalpha function #' @export kraken_classify_taxonomy <- function(opt = NULL, fastafile = NULL, confidence = 0){ #Default is kraken2 #Count kmers flog.info(paste("Counting k-mers of query sequences with kraken2 and using confidence score", as.character(confidence))) ...
99f9f5c0ac5ead791f82a31540a49fbea12dfeaa780779be6663118ccd7202ca
R
2,011
56
library(stringr) #library(dplyr) foldername='FABP7_centeratpromoter' input_path=paste0('/scratch/users/banwang3/references/outputs/',foldername,'/') align2='pantro6' #align2s=c('hg38','pantro6') filename=paste0('SNPlist_',align2,'_4096bp.bed') SNPs=read.csv(paste0(input_path,filename),sep='\t',header=F) SNPs=SNPs[,1:4]...
edf89ecc378b9f399d74642cd19fa2548d81f99f93f1914a7e05b7c4602b6947
R
2,028
54
rm(list = ls()) source('Setup.R') usedir = dirname(getwd()) figDir = file.path(usedir,'Figs') SCdat = read.xlsx(file.path(usedir,'SourceData.xlsx'),'SFig1') # this only contains 31 subjects # 3 plea ratings are corresponding to 3 odors # same for the intensity ratings # what are the scales of the ratings? # pleasant...
b3a7909f4467f955c4dc1d2d2fe8b56d27a5af17bd79ae3d0b402ac510e72037
R
2,051
68
library("muxViz") #Remind to comment this line to have different results set.seed(123456) Layers <- 10 Nodes <- 100 cat("####################################\n") cat("# Layer-Layer correlations\n") cat("####################################\n\n") layerCouplingStrength <- 1 networkOfLayersType <- "categorical" g.lis...
8a4a3c027b3ebf624e80880e637485cfc12310b053df8145e48c758e078316cd
R
2,060
58
############################################################# ##################### NETWORK FEATURES ###################### ############################################################# ####################################################### #### Auxiliary function to compute network features ## Main function to cal...
2a9704e0cc265fba58e49849decac746a8009191b06550e8a9c5a4c1fb839dcd
R
2,103
54
library(ggplot2) library(stringr) library(dplyr) library(patchwork) align2='human' TPM = read.csv('/scratch/users/banwang3/celllines/analysis/ASE_norm/human/filtered/rawcounts.txt',sep='\t') idx =grep('total',colnames(TPM)) TPM = TPM[,-idx] idx = grep('RNA',colnames(TPM)) CPM = sweep(as.matrix(TPM[,idx]), 2, as.doubl...
59836d9ec9c801d039691cbbcb6d66a4f85517e8ed8fbc3931dace607d514657
R
2,106
59
############################################################################### #################### GenR: residualization & weighted PCA ##################### ############################################################################### library(doParallel) library(permute) ################################...
312a22b68f121839cde8f19af4cfc35e9616c706c1b581d8f2e1f6f8c9c1fd3b
R
2,110
43
#library(UpSetR) library(ggplot2) library(ComplexUpset) output_path= '/scratch/users/banwang3/celllines/scripts/RScripts/suppplots/' input_path='/scratch/users/banwang3/celllines/scripts/RScripts/figscripts/suppfigscripts/ATAC_counttable/' celltypes = c('CM','SKM','HP','PP','MN') df = read.csv(paste0(input_path,'Peakl...
a329f4a1bf0cbc2e0c9ef8c6e166341e51d3329dcc0082b18134a5d802870111
R
2,126
61
################################# ## Partitioned h2 - GTEx/Franke tissues and cell types ## William Reay (2022) ################################# library(dplyr) library(data.table) library(ggplot2) library(ggpubr) setwd("~/Desktop/Retinol_GWAS/Partitioned_h2/") ## Read in all three Stouffer meta partitioned h2 A...
05ecf034b773afddd33c80ed24c8d12bd44bc3a75a7b249296c9aa5a1259d980
R
2,127
47
#' make_classes_df(curr_pt = NULL, compareby = NULL, wilcox_paired_by = NULL) #' #' This function makes a data frame with sample to class mapping for use by calculate_matrix_stats. #' @export make_classes_df <- function(curr_pt = NULL, compareby = NULL, wilcox_paired_by = NULL){ #Create a standard data frame mapp...
15c8be2244eeb9bba05502cfdca6b43217f46571e6319aedd97dde72cff9f441
R
2,128
78
# Don't perform any further tests on CRAN due to time of running the complete # test. testthat::skip_on_cran() testthat::skip_on_ci() debug_flag <- FALSE # Without setting the number of important features. results <- familiar:::test_export_specific( export_function = familiar:::export_permutation_vimp, data_eleme...
c6d78f34f3407097d0e41f172f09cc0cb990b40f13bc789e5a2315cd9df61a2d
R
2,131
74
library(MODifieR) library(tidyverse) library(biomaRt) library(DOSE) library(clusterProfiler) top_results <- read.csv("local_data/burden_results/burden_vf_threshold_full_results.tsv", sep = "\t") top_results <- top_results[order(top_results$p), ] top_genes <- top_results[1:(nrow(top_results)*0.01), "gene"] mart = use...
7c61aa73a064705dce3e6f77061d99480ec87752c929ba92aac50b16f08030b6
R
2,142
64
# Don't perform any further tests on CRAN due to time of running the complete # test. testthat::skip_on_cran() testthat::skip_on_ci() debug_flag <- FALSE # Generic test familiar:::test_plots( plot_function = familiar:::plot_sample_clustering, not_available_all_predictions_fail = FALSE, not_available_some_predic...
17aa56a262ec830eefced80a871a901ceddb84a9b3fce6aee5eb3a0999688952
R
2,176
54
#' find_accession_from_keyterm(expvec = NULL, analyses = NULL, SEobj = NULL, keyterms = NULL) #' #' Returns the accession number(s) of a feature(s) matching a general expression present in a SummarizedExperiment or metagenomeSeq object. #' @export find_accession_from_keyterm <- function(expvec = NULL, analyses = NULL,...
62aca33bfd806f6e26454bfae2eb091657bcde6d63e04fa86c55f5d8c32ad00a
R
2,176
76
# First test if all selectable learners are also available familiar:::test_all_learners_available( learners = familiar:::.get_available_cox_learners(show_general = TRUE) ) # Don't perform any further tests on CRAN due to time of running the test. testthat::skip_on_cran() testthat::skip_on_ci() # Generic test famili...
02fbfcb83e5963afc6a6589ccc9039f14466e5656eb266f7979f53e38c42d227
R
2,181
53
# import-rds.R shinyFileChoose(input, "data_import_file_r", root=c(directories, `Working Directory`='.', getVolumes()()), filetypes=c("rds")) observeEvent(input$data_rds, { output$data_import_r_filename = renderText("select a *.Rds file from a previous session") showModal( modalDialog(title = "...
6b65aeff124b16d4c494e554467368124c145e4a63f2012bb840b61e9c77b332
R
2,185
57
library(xlsx) basePath = "/data/bcu_projects/MelBrainSys_PostdocProject_Gruetzmann/publications/2022-my-MelBrainSys-paper/scripts-etc-for-publication/" setwd(basePath) immunePWs = read.xlsx(file = "annotation/pathway-definitions.xls", header = T, sheetName = "ImmunePathways") colnames(immunePWs) = gsub("\\."," ",coln...
cfa328fc5eed4dac5bdd084f0d1375254efe4628e9f77adf450d59c3bed809f6
R
2,194
84
spLeverage=function(data, distmat=NULL, mod0=NULL, sacf="exp", nngp=T, nngp.J=50){ if (!is.null(mod0)){ data=t(lm(t(data)~mod0)$residuals) q=ncol(mod0) } else{ q=0 } covreg.fit=CovReg(data, distmat, n.covariates=q, kernel=sacf) if (nngp & nngp.J<nrow(distmat)){ NNGPinfo=constructNNGPinfo...
44e4fb1204d89b3a0035d24e3b3d1ff68565b5e8da57398308327c741343ef6b
R
2,199
62
############################################################# ################# READ EMPIRICAL DATASET #################### ############################################################## ## load datasets reats_url <- "http://www.timeseriesclassification.com/Downloads/Archives/Univariate2018_arff.zip" download.file(rea...
735b1df599bf987cfe2ab7b124b9384e4a7b277c342dc48d1653e882c3b10e46
R
2,216
60
#' Create a \code{TreeSummarizedExperiment} object from \sQuote{DADA2} results #' #' @param ... Additional arguments. For \code{convertFromDADA2}, see #' \code{mergePairs} function for more details. #' #' @details #' #' \code{convertFromDADA2} is a wrapper for the #' \code{mergePairs} function from the \code{dada2} pac...
9a7d86201646956bc810297dd2b4f335d2e5022eeebd76ed73f6a67acaa09deb
R
2,222
48
# Inference about theta( 4Nu) from an observation of the number of segregating # sites at a locus with recombination. # # The following script will generate independent draws from the # posterior distribution of theta conditional on the observed # number of segregating sites is equal to 14 (nsam=10) and assuming...
c13555bc363ce0520b8aea43e49e9a7559c91a1e8423fa4aff3b56c69c155eda
R
2,223
56
library(ggplot2) backup_path='/scratch/users/banwang3/celllines/data_backup' align2='human' TGF = c('NGF','BDNF','NTF3','NTF4','NTRK1','NTRK2','NTRK3','NGFR') length(TGF) TGF = data.frame('gene'=TGF) final=c() for (celltype in c('CM','MN','PP','HP','SKM','RPE')){ deseq2 = read.csv(paste0(backup_path,'/scratch/use...
c574734b9c56cd99f56e303ba73295cdce3514d8ff8356b32b5274848b4c02a3
R
2,226
102
#' @include FamiliarS4Generics.R #' @include FamiliarS4Classes.R NULL setClass("familiarCoreLearnVimp", contains = "familiarVimpMethod" ) setClass( "familiarCoreLearnGiniVimp", contains = "familiarCoreLearnVimp" ) setClass( "familiarCoreLearnMDLVimp", contains = "familiarCoreLearnVimp" ) setClass( "fami...
998f3120999206c9f4e3b21f2d9f7c8c7f95cab79731657109ff9cdfc0112b50
R
2,233
86
get_newp <- function(perm_stat, tref){ p.perm <- length(perm_stat[abs(perm_stat) >= abs(tref)])/length(perm_stat) return(p.perm) } grouped_perm_glm <- function(tbl, formla, var_to_perm, permNum = 1000, seed = 42){ require(modelr) require(dplyr) set.seed(seed) perms <- modelr::permute(tbl, permN...
2be3c6a2dd37eb9e0d0d83beb8b1e082f1e29e9b04b7a67fa6058794b74aa97d
R
2,242
56
#################################################################################### ###################### Read the data, residualization, weighted PCA ################ #################################################################################### library(doParallel) library(permute) ############### read the d...
45c2fc2643ecd7444eeb369e28ef42c60c1444c9ed6fc7f2db7d1b4b729d587e
R
2,242
48
#library(UpSetR) library(ggplot2) library(ComplexUpset) output_path= '/scratch/users/banwang3/celllines/scripts/RScripts/suppplots/' input_path='/scratch/users/banwang3/celllines/scripts/RScripts/figscripts/suppfigscripts/ATAC_counttable/' celltypes = c('CM','SKM','HP','PP','MN') peaks=c() for (celltype in celltypes){ ...
4d5f86c08b768f670452e1f5f73b963676bad8be961636e52e742ebfb600ec06
R
2,245
42
#' rename_MAG_Accession(MAG_Accession = NULL, Cluster_Number = NULL, mag2species = NULL) #' #' Builds a Contextualized/Consolidated Species Bin (CSB) name for a MAG given its functional #' cluster number. Used internally by contextualize_taxonomy (q.v.). #' #' Hoisted to package top-level (see cluster_strains for the r...
409b3dea3aa9feee9e2f6dd989573411775cfb96be14d1564169a83c617f3f38
R
2,247
53
# Gina Norato; gina.norato@nih.gov library(plyr) library(dplyr) library(tidyr) # separate() library(stringr) # str_pad() library(ggplot2) read.csv(file="source.data.supp.fig.9e-9g.csv") ############ ## Supp Fig 9E ############# d<-subset(t2,timepoint!="Cross-sectional",select=c("analysisID","Group",...
12330cda0bdff5db4168e30782ba1eaafe7707c05062ba02c6b7aeb63cb58855
R
2,248
59
# Codes for two-dimensional projection of patient malignant cells by cell state # Can be run in R library(ggplot2) # Read rds file contained results of cell state signature scores (can be obtained using example codes in "MalignantCellStateAssignment.R"), cell state assignment (can be obtained using example codes in "...
58e255a1ff2a4b037509d3f89522ae94adcf2f03d2405c8744309daa3bf8d301
R
2,249
33
#' gather_run_info #' #' JAMSalpha function #' @export gather_run_info <- function(opt = NULL){ flog.info("Gathering information on JAMS analysis run.") useful_parameters <- c("analysis", "verstr", "JAMS_Kdb_Version", "krakenconfidencescore", "prefix", "threads", "contigs", "assemblyaccession", "readorigin", ...
d78c1ac9afedfa36fa731688016b6d0adfc7a08778ad9adf32d70b65e12e23bf
R
2,256
63
context("addLDA") test_that("addLDA", { skip_if_not_installed("topicmodels") data(GlobalPatterns, package="mia") # tse <- GlobalPatterns tse <- addLDA(tse) expect_named(reducedDims(tse),"LDA") expect_true(is.matrix(reducedDim(tse,"LDA"))) expect_equal(dim(reducedDim(tse,"LDA")),c(26,2)) red <- reduced...
4805751a8a53bd0429b21123288686ff6b158522992d26eb938cd7fc7d8794aa
R
2,268
57
library(ggplot2) library(stringr) backup_path='/scratch/users/banwang3/celllines/data_backup' df = read.csv(paste0(backup_path,'/scratch/users/banwang3/celllines/analysis/ASE_norm/human/filtered/TPM.txt'),sep='\t') output_path='/scratch/users/banwang3/celllines/scripts/RScripts/Rplots/' idx =grep('total',colnames(df)) ...
bef160f47a0dd94bea638f8c4dde0ccb0c312fdf8045b0e5f5759772ef60e74e
R
2,272
50
#' make_featuredata_from_bedfile #' #' JAMSalpha function #' @export make_featuredata_from_bedfile <- function(opt = NULL, bedfile = NULL){ if (is.null(bedfile)){ bedfile <- opt$bedfile } featuredata <- fread(file = bedfile, header = FALSE, stringsAsFactors = FALSE, fill = TRUE, sep = "\t") ...
a07cd438cad915b45deac03526aed1b1a3ff9cc12afa99d20dddaf33337f3e68
R
2,275
52
# load libraries ----------------------------------------------------------- library(data.table) library(Seurat) library(ggplot2) library(dplyr) library(viridis) # read in bulk RNA-seq data ------------------------------------------------ PBRAclusters<-read.delim("input_data/PBandRA_clusters.tsv") RAvControl<-read.d...
11fb65045c952c4e5bae8bc1dabd278602744ecb21c93ad22440ddf2e9dc5756
R
2,276
56
library(JAMS) #Read classes into list atbclasses <- scan("antibiotic_classes.txt", what="", sep="\n") atbclasses <- strsplit(atbclasses, "\t") names(atbclasses) <- sapply(atbclasses, `[[`, 1) atbclasses <- lapply(atbclasses, `[`, -1) #Read phenotypes into table atbphenotypes <- read.table(file = "phenotypes.txt", hea...
05397906a0ab6933ab2c958779a126d412558019ddd048f8852a0bd4ee0444e6
R
2,280
78
# Don't perform any further tests on CRAN due to running time. testthat::skip_on_cran() # power.transform and other packages are required. if (!rlang::is_installed("power.transform")) testthat::skip() # Create data.table. data <- familiar:::test_create_good_data( outcome_type = "binomial", to_data_object = FALSE ...
acb81923ef2d50a109fefa180ae5b26878af991c89d11a22b1013ca433696d8c
R
2,280
80
########################### ## CAUSE creatinine and retinol ## Retinol IVW ## Dr William Reay (2023) ########################### library(data.table) library(dplyr) library(cause) library(genetics.binaRies) library(tidyr) library(ggplot2) library(ieugwasr) setwd("~/Desktop/Retinol_GWAS/") Retinol_df <- fread("Met...
c5bec66376b020c739d708b7da22534195ef1cf3fc110c74213d3ecc06337587
R
2,288
74
# Don't perform any further tests on CRAN due to time of running the complete # test. testthat::skip_on_cran() testthat::skip_on_ci() debug_flag <- FALSE familiar:::test_plots( plot_function = familiar::plot_shap_force, data_element = "shap", shap_max_iterations = 10L, outcome_type_available = c("continuous",...
d8479f3bd163c7c1f67b0da2e8aba3fc7204f0fe8bcfef55ac400508be3ff7a8
R
2,292
65
get_zdFF <- function(reference, signal, smooth_win=10, remove=200, lambda=5e4, itermax=50, differences=1) { # Calculates z-score dF/F signal based on fiber photometry calcium-idependent # and -dependent signals. # # This program is a translation in R of the Python source code of get_zdFF.py # # Input # ...
2b6836f55ff01a34851cc2ff7f01f9831c02f695ad5b23ef5c552740b7f25b83
R
2,309
62
context(".estimate_evenness") test_that(".estimate_evenness", { test_internal_.estimate_evenness <- function(tse){ # Check that every index is calculated by checking the column names from # colData. # Check that the order of indices is right / the same as the order # in the input ...
687e9829a1c583cec58cc03b7657a795edb9a0581e7e0f0a0f8f194334abb458
R
2,322
70
# Don't perform any further tests on CRAN due to time of running the complete # test. testthat::skip_on_cran() testthat::skip_on_ci() debug_flag <- FALSE # FDR-corrected p-values. Note that failure to predict survival probabilities # does not influence the produced plots. familiar:::test_plots( plot_function = fami...
1b51cbb6328edb4f711f2a16ec805971da81cbcbd2a6cebe05c2baea210d49a7
R
2,336
84
testthat::skip_on_cran() testthat::skip_on_ci() debug_flag <- FALSE # Simple test vimp_methods <- c("none", "mim", "mim") experimental_designs <- c("fs+mb", "fs+mb", "mb") for (ii in seq_along(vimp_methods)) { familiar:::integrated_test( experimental_design = experimental_designs[ii], vimp_method = vimp_met...
071962459f572600315668110ab95e7724042cda91e8713cbe365befa3ce0e86
R
2,341
75
setwd("/Users/zhangyuan/Google Drive/2021_HCP_Gender_DNN") rm(list=ls()) source("scripts/brainbeh/2022CCA/myRFunc_updated.R") #library(vegan) # for cca library(CCP) # for cca statistical test library(reshape2) library(ggplot2) library(psych) # for pca ################################ ########## LOAD DATA ########### ...
8fdb307afe8a7b7ceb268871dae91a60c954d6e41aee518600135483a4921d77
R
2,347
91
#' @include FamiliarS4Generics.R #' @include FamiliarS4Classes.R NULL # promote_detector ------------------------------------------------------------- setMethod( "promote_detector", signature(object = "familiarNoveltyDetector"), function(object) { learner <- object@learner if (learner %in% .get_availab...
2c4131ad19778c701ef06810e30df3fe626ba4881dd6303eb2e8469b73fa40ea
R
2,355
64
library(stringr) #library(dplyr) foldername='GAD1_centeratHAR' input_path=paste0('/scratch/users/banwang3/references/outputs/',foldername,'/') align2='hg38' #align2s=c('hg38','pantro6') filename=paste0('SNPlist_',align2,'_4096bp.bed') SNPs=read.csv(paste0(input_path,filename),sep='\t',header=F) SNPs=SNPs[,1:4] colnames...
0634d981e991e70abcd5f8d49520ad1f7575ed880f422c16cb3a759aaa47c8ef
R
2,357
75
# First test if all selectable learners are also available familiar:::test_all_learners_available( learners = familiar:::.get_available_survival_regression_learners(show_general = TRUE) ) # Don't perform any further tests on CRAN due to time of running the complete # test. testthat::skip_on_cran() testthat::skip_on_...
6b60883b846267d5af4109971db9abd6cc19850b75c1beb088c0c07e1088426f
R
2,371
80
################################################# ## Retinol RapidoPGS style ABF calculation for PGS weighting ## William Reay (2023) ################################################# library(dplyr) library(data.table) library(RapidoPGS) ## Load ABF function from GitHub - https://github.com/Williamreay/Pneumonia_m...
1bdb33f7b45360b80240f300616bdd4ebfdb6d84d130a8a994dd896758bb045b
R
2,376
77
# Shiny server definitions server = function(input, output, session) { # markdown help documentation #observe_helpers(help_dir = "help", withMathJax = T) data = reactiveValues( # metadata meta = list(), # data raw = list(), # model history mo...
35ce57c35401a32c071e0c9b8d3b173a10b4238dadc9941ee514796337cb9312
R
2,380
86
#################################### ## Reverse MR - FinnGen ## William Reay (2023) #################################### library(dplyr) library(data.table) library(TwoSampleMR) setwd("~/Desktop/Retinol_GWAS/MR_all_cis_acting_SNPs/FinnGen_r8_MR/") Ret_GWAS <- fread("../../Meta_analyses/Common_var/IVW_METSIM_INTERV...
246d732c7d124ee4397d443cc070194f7d036dde25ebd756c7f601ac09d27a24
R
2,385
33
#' rate_bin_quality(completeness_df = NULL, HQ_completeness_threshold = 90, HQ_contamination_threshold = 5, MHQ_completeness_threshold = 70, MHQ_contamination_threshold = 10, MQ_completeness_threshold = 50, MQ_contamination_threshold = 10, LQ_completeness_threshold = 0, LQ_contamination_threshold = 10, High_contaminati...
d22c046018bbe83c78884c938e485014a4d1067ad078a936372cb09f3fbb65de
R
2,406
61
library(ggplot2) input_path='/scratch/users/banwang3/celllines/scripts/RScripts/figscripts/suppfigscripts/EE/' output_path='/scratch/users/banwang3/celllines/scripts/RScripts/suppplots/' keyword='RNA' includeRPE=T if (includeRPE){ celltypes=c('CM','HP','MN','PP','RPE','SKM') endname='includeSKM' }else{ cell...