sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
0411b6775876a2ebf4e1878fa06c99ff0b7f621ff35e6e5ac7f99fcba0744974
R
1,934
73
#### Find spatial neighbors #### ## ----------------------------- setMethod("spatialDists", "ANY", function(x, y, coord, r = 1, byrow = TRUE, metric = "euclidean", p = 2, weights = NULL, neighbors = findNeighbors(coord, r=r), neighbors.weights = spatialWeights(coord, r=r), verbose = getCardinalVerbose(), chu...
2de6c43f88873d8ea659087ac71cfd59f47f385419ee95f36e3c3e1a290c6864
R
1,936
76
#cd /mnt/scratch/quanjian/BS/OriginalRef/MethylationExt #module purge #module load GCC/11.2.0 OpenMPI/4.1.1 R/4.1.2 #R library(methylKit) library(stringr) library(dplyr) files <- list.files(pattern="_OriRef.deduplicated.sortbyName.CpG_report.txt.gz") file.list <- list() for(i in 1:47){ file.list[i] <...
a437514390784b5fe0835588b2d7037effd772fc05fbaf4737a38e031119dc21
R
1,936
62
--- output: pdf_document geometry: margin=0.5in --- ```{r, echo = F, warning = F, message = F} library(dplyr) library(cowplot) library(ggplot2) library(reshape2) knitr::opts_chunk$set(echo = F, warning = F, message = F) ``` ```{r} plot.ci.coverage <- function(df, title='') { df %>% group_by(n) %>% summarise...
2eb12353a9a31c87a4ca847d8d35e6ac00589828e7023af4b74b827877d212a2
R
1,937
59
library(dplyr) library(logger) library(purrr) library(tidyr) library(stringr) ## params to specify ##### ####### phenotypes = snakemake@params[['phenotypes']] linear_model_res_path = snakemake@params[['input_res_path']] phenotype_suffix = snakemake@params[['phenotype_suffix']] out_dir = snakemake@params[['out_dir']]...
3ca29bce17c890be15f6b0ea6f244469e33cc8b25970fe68c9b31ab4216f9708
R
1,938
67
library(fmri.pipeline) # note that HPC settings like nodes and batch_code are ignored for local scheduler w <- R_batch_job$new( batch_directory="~/batch_test", job_name="step1", n_nodes=1, n_cpus=1, cpu_time="10:00", r_code=c( "Sys.sleep(1)", "print('hi')", "x <- 2+2" ), r_packages=c("lme4")...
58a0827123097998ac292d166ef7282df83d3510c9ad4fc97773b0b033a43ecc
R
1,941
38
#!R #!/usr/bin/env Rscript # This script is used to modify the output scores metrics for common (freq > 50%) SVs. # Sets scores to 0.51 (ie passing) for sites that passed at in at least one of SR_sum_log_pval, PE_log_pval, or PESR_log_pval library("optparse") option_list <- list( make_option(c("-c","--cutoff...
05bbd37321db8857afe70c7dad5042a80ab3216d8bdef57fd93045a3e68c0d28
R
1,946
69
parseargs <- function(required=character(0), ..., silent=F, include.others=TRUE, test=NULL) { #' @title Function to parse arguments from command line #' @keywords internal opts <- list(...) if(!interactive()) { text <- commandArgs(trailingOnly = FALSE) # str(text) start <...
d2fe49ed2618f13ff44c584312178dd6aaa2b045c14bdaa2234e42f2f73f1ba9
R
1,947
67
library(ggplot2) library(dplyr) library(stringr) stage <- c("40","70","115","168") tissue <- c("Br", "Li", "Mu", "Pl") ##set color color <- c("#8DD2C6", "#FFFFB3", "#BDB9DA", "#FA8071", "#80B0D2", "#FCB461", "#B3DE69", "#FBCDE4", "#D9D9D9", "#BB80BC", "#CCEBC5", "#FFEC6E") ###Br Li,Mu for(i in 1:4){ fo...
a142d59ba7a5396c2d9aa65d49cb10e7498f0169f3c2e5b9d3ef457a8f4bf270
R
1,949
66
require(GenomicSEM) library(data.table) NAME <- "MetS_firstorder_F3_independent" ldsc.out <- "../2_ldsc/ldscout/MetS_noUKB_ldscout.RData" sumstat.out <- "../7_sumstat/MetS_noUKB_sumstat.RData" load(ldsc.out) load(sumstat.out) model <- "F1 =~ 1*BMI_GIANT18 + WC_Watanabe_UKB F2 =~ 1*T2D_meta_FinR7_Mahajan22_M...
a9be602d8711f9647968a6df6d912a933aa0717c174cfff83f31b905d2bcff79
R
1,949
74
test_that("mixed_by does not mutate caller-owned data or external_df", { data_df <- data.frame( row_id = seq_len(8L), id = rep(c(2L, 1L, 4L, 3L), each = 2L), split = rep(c("b", "a"), 4L), y = seq_len(8L) ) external_dt <- data.table::data.table( id = c(4L, 2L, 3L, 1L), external_value = c("d...
ec206fafd5f5e73c541c8e86bf50ceca9bf22b6d97c2a8c0b358ada217c61e30
R
1,950
73
#' @title Spectral smoothing by splines #' #' @description #' Spectral smoothing by splines. #' @param spc `hyperSpec` object #' @param newx wavelength axis to interpolate on #' @param ... further parameters handed to [stats::smooth.spline()] #' @return `hyperSpec` object containing smoothed spectra #' @rdname spc-spl...
1863d8744bf52125f968cd59240f71ae2acacfc5ac99cb67209685e00df9169b
R
1,958
47
#!/usr/bin/env Rscript args = commandArgs(trailingOnly=TRUE) ID=args[1] EXP=args[2] print(ID) .libPaths("~/miniconda3/envs/R/lib/R/library") library(rtracklayer) library(stringr) remap<-read.table(paste0("/cluster/home/aanderson/allele_bias/Mapping/vg/",ID,"/trial/",EXP,"_remapped.txt"), sep="\t") orig<-read.tab...
9267fab6af61c3e96a76f7d24fcdd415c72a925de40705af1bf079a264a1a38a
R
1,961
56
# Compares parcel similarity between chimp and human OPNMF solutions # # chimpanzee OPNMF solutions have been registered to human MNI space # # using 03_Chimp_opnmf_def_batch.m SPM batch script # # working project directory # wd <- "~/projects/chimp_human_opnmf/" setwd(wd) # load in libraries needed for script # # ne...
0f5f09906552650ebb3047986d4fe74854d6b09c688a1bb1d274c1d3efb66f07
R
1,963
75
### ----------------------------------------------------------------------------- ### ### .paste.row ### ### #' @importFrom utils head tail .paste.row <- function(x, label = "", name = "", ins = 0, i = NULL, val = FALSE, ...) { .print.val <- function(x, range = TRUE, digits = getOption("digit...
2efd4d222fe9cf4839709e53b3a579ae5106f75cc5e0c2914dd3e1942cce2e81
R
1,963
66
require(GenomicSEM) library(data.table) NAME <- "MetS_firstorder_F1_independent" ldsc.out <- "../2_ldsc/ldscout/MetS_noUKB_ldscout.RData" sumstat.out <- "../7_sumstat/MetS_noUKB_sumstat.RData" load(ldsc.out) load(sumstat.out) model <- "F1 =~ 1*BMI_GIANT18 + WC_Watanabe_UKB F2 =~ 1*T2D_meta_FinR7_Mahajan22_M...
3ecf78f1dcf53c8d1ce66d32b874ef86df8e58487bc00382afd18b912ae4b1d6
R
1,973
53
library(ggplot2) library(ggseqlogo) library(Biostrings) # Neg_Xs for (x in 2:100) { for (target in c("up", "down")) { if (target == "up") { fasta_file <- paste("/ccb/cybertron/khchao/splam-analysis-results/train/results/Negs/Neg_", x, "/INPUTS/800bp/input_neg_", x, "_0.5_up.fa", sep = "") } else { ...
67846daec8e1fd04b32c01f477b44e5b4654c1a415639b15a3e06749cc668939
R
1,974
52
#' archstabms__plot_ddPCAvalidation_scatter #' #' Plot correlation with validation data. #' #' @param input_dt data.table with model free energy estimates (required) #' @param ddPCA_inpath path to ddPCA free energies (required) #' @param trait trait name to plot: folding or binding (required) #' @param report_outpath ...
48836069e5299d24a085fe807d0030aff64dc0b321c280a76a5b312dc23ff307
R
1,975
54
#' archstabms_fit_linear_model_datasets #' #' Fit linear models to multiple datasets. #' #' @param dataset_names character vector of dataset names (required) #' @param seq_position_offset list of sequence position offsets (required) #' @param base_dir Base directory (required) #' @param output_dir Output directory (re...
12cc981493af5e73838f2e1dd6ec6beb1679dbf5c1e9c8a6fe705de03448b5b9
R
1,977
41
library(data.table) library(dplyr) library(tidyr) ##generate .esd file for SMR tests args <- commandArgs(T) tis <- args[1] n_chr <- args[2] Phe1 <- args[3] Phe2 <- args[4] chr_file <- paste0("~/2SMR/", Phe1, "2", Phe2, "/", tis, "_", Phe1, "2", Phe2, "_pairs/", tis, ".", Phe1, "2", Phe2, "_chr", n_chr, ".txt") if(Phe...
16d38b444730654a35b56dcb4d44cb42cef4b888ef7e562b7a1c78c238e762f2
R
1,979
64
```{r init} library(Matrix) library(tidyverse) library(biomaRt) library(monocle3) library(rgl) library(tricycle) library(SignacX) library(princurve) library(ggplot2) library(Hmisc) library(pheatmap) library("ComplexHeatmap") library(circlize) library(dplyr) library(ggrepel) library(latex2exp) ``` ```{r loadData} cds<-...
4227278a76ac875691fb8da5288309a9f9cdeeef84e0aed0af543bcb1ec99937
R
1,981
50
PeakCount_Analyser = setRefClass( "PeakCount_Analyser", contains = "Analyser", methods = list(initialize = function() { callSuper( description = "Counts Peaks within user defined CalculationWindow and returns resulting paired or unpaired boxplot. Grouping is done according to user-defined...
7a52907fc406d255598b79c44158d6917532086894c6556bdc558a00e5f7901d
R
1,987
67
library(chromVAR) library(SummarizedExperiment) library(Matrix) library(BSgenome.Hsapiens.UCSC.hg38) library(motifmatchr) library(chromVARmotifs) # parse arguments argReader = commandArgs(trailingOnly=TRUE) base_dir <- argReader[1] print(paste0("Loading files (peaks.bed, sampling_depth.txt, counts.txt, peak_names.t...
acc28621a49c7966b44a7ea2889b987120118a40770037939a9fa0703fdcf05b
R
1,989
41
library(data.table) library(dplyr) library(tidyr) ##generate .esd file for SMR tests args <- commandArgs(T) tis <- args[1] n_chr <- args[2] Phe1 <- args[3] Phe2 <- args[4] chr_file <- paste0("~/2SMR/", Phe1, "2", Phe2, "/", tis, "_", Phe1, "2", Phe2, "_pairs/", tis, ".", Phe1, "2", Phe2, "_chr", n_chr, ".txt") if(Phe...
fd7ac3a1d25097e0b48ab0aebeae4c75f3ba0835563cfc9fc0d0ff06920dab78
R
1,994
43
library(Seurat) library(DAseq) library(ggpubr) library(SingleCellExperiment) options(future.globals.maxSize = 4000 * 1024^20) Sys.setenv('R_MAX_VSIZE'=2500000000000) Oli<-readRDS("Oli.rds") Idents(Oli) <- "updatedDX" Oli_DEG.DX<-FindMarkers(Oli, slot = "data", assay = "RNA", test.use = "MAST", ident.1 = "AD", ident....
211835c5ab4226c7bca31b5df6bca391a6f63dedc25342f3138e39cee286b18b
R
2,005
42
test_that("cache_stan_model parameter works correctly", { # Skip if cmdstanr is not available skip_if_not(instantiate::stan_cmdstan_exists()) # Test that cache_stan_model parameter is available in all relevant functions expect_true("cache_stan_model" %in% names(formals(sccomp_estimate))) expect_true("cache...
83d5a40a84f85c1171e7146f7f1950e1627cd4997febb73813acc01ff17500a1
R
2,015
76
library(Signac) library(Seurat) setwd("~/multiome") seuMulti <- readRDS('multiome-signac-noArchR.rds') #### R2 atac fragpath <- "~/nextseq/Multiome_CMN347SMN_e11-5_R2/outs/fragments.tsv.gz" metadata <- read.csv( file = "~/nextseq/Multiome_CMN347SMN_e11-5_R2/outs/singlecell.csv", header = TRUE, row.names = 1 ) %...
551f57738710d7fe0ba125584d3e74bcb037237faeacb89f440617dc3cb87865
R
2,016
52
InputPath="F:\\RNA_20221101\\02_ModifiedGenome\\A_GeneExpressionMatrix\\" OutputPath="F:\\RNA_20221101\\02_ModifiedGenome\\B_SampleEvaluation\\a_MappingBias\\Figure\\" library(ggplot2) library(ggrepel) library(dplyr) library(stringr) library(ggsci) RawReadCount <-read.table(paste(InputPath,"AutosomeGeneCount...
b6b1f37da228f53efe5f9c2ddc1ca367e223383bed7e8364601a5703626a0719
R
2,024
74
#!/usr/bin/R # ---------------------------------------- # Plot neuron counts in entorhinal cortex: # Updated: 12/06/2021 # ---------------------------------------- library(cbrbase) set_proj('DEVTRAJ', 'multiRegion') if (!exists("cellmeta")){ source(paste0(sbindir, 'load_metadata.R')) } source(paste0(sbindir, 'auxiliary...
bf6324a5fb10726872015b85a79b7d25ad7af2f757fd55eca38457e1e2abcdf5
R
2,027
60
#! /usr/bin/env Rscript ##meant to generate cutoffs for different copy states## ##first input is a Rd-test generated median_geno file from genotyping command on a set of know sites## ## second input is how many copy states to assess## ## third input is output filename for final matrix of cutoffs## args <- commandArgs...
a030231607bdb52dd7a099c10d713d14ffa49ced2952e305a0e01d321161dbf2
R
2,037
41
library(Seurat) library(SeuratObject) # file <- "C:/Users/mauri/Desktop/scRNAseqR/results/Bas test/BL_C.qs" # data <- qs::qread(file) # FeaturePlot(data, features = markers) # DotPlot(data, features = markers) markers <- c("SLC17A7", "SNAP25", "SYT1", "SLC1A2", "SLC1A3") file <- "C:/Users/mauri/Desktop/scRNAseqR/re...
11ae0138fb4491a212495019374296c109202d0bbb0f34a5beeee4094071c295
R
2,040
49
exDir = '/path/to/along-tract-stats/example' subID = 'subject1' trk_info = read.table(file.path(exDir, 'tract_info.txt'), header=T, sep='\t') trk_avgs = read.table(file.path(exDir, 'trk_avgs.txt'), header=T, sep='\t') library(ggplot2) #############################################################################...
d514d887ca2a4e2d68e320765e963c50ccfe1323ae87184dc59279da8ab70ac5
R
2,040
42
##------------------generated data ------------------ cd /f/Manuscript/ATAC/figure/POE05112023/ATAC_POE/method2/FilterDistal ls *nodistal.csv|while read file do paste <(echo $file) <(cat $file|tr ',' '\t'|awk 'NR>1'|awk '$6<=0.05'|awk '$2>0'|wc -l) <(cat $file|tr ',' '\t'|awk 'NR>1'|awk '$6<=0.05'|awk '$2<0'|wc -l)...
d51ac4ddd58663e0edf55e704001e3698d7747b8d9eb76cc171cee811a0e0574
R
2,046
71
# Cluster and density plots over KMNN graphs # # input: # data/06_DS1gdf_xy.txt: Layout computed using the ForceLayout2 algorithm in Gephi # # output: # data/06_DS1_MKNN_partition.pdf # data_figs/06_DS1_MKNN_cohort_*_.pdf options(bitmapType = 'cairo') # (0) Load data ---- data <- read.csv('data_aux/06_DS1gdf...
13cdb307600b102b5d4b7c4cd548eccff593a96147b31335d7f2d5ca07e12258
R
2,048
51
if (!require("BiocManager", quietly = TRUE)) install.packages("BiocManager") BiocManager::install("VariantAnnotation") library(VariantAnnotation) # Function to read VCF and extract allele depth information along with chromosome and sample information extract_allele_depth_chrom_and_samples <- function(vcf_path) { ...
6d0e3f27c0a86723bb183ab5acd4b0376afdcd422b09191b08deda6a77231a93
R
2,058
83
--- title: "CS stats" output: html_document date: "Cazalé-Debat et al. 2023" --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` ```{r include=FALSE} rm(list=ls()) data<-read.delim("/Users/cazaledl-admin/Library/CloudStorage/OneDrive-UniversityofBirmingham/Post_doc/XP/data/courtscape/sc...
3508e7bea6e38e6b2549510d169dbd5b499a382fed4fd8d03a0032e243612bb2
R
2,060
66
library(Seurat) library(DAseq) library(ggpubr) options(future.globals.maxSize = 4000 * 1024^20) Sys.setenv('R_MAX_VSIZE'=2500000000000) cluster<-readRDS("combined.sct.dx.rds") meta<-cluster@meta.data meta.dx<-meta[,c(1,36)] labels_res <- meta.dx[meta.dx$updatedDX == "AD", "orig.ident"] labels_nores <- meta.dx[meta.dx...
cbf1231303c8dc7c81a47620321caf1150c691d45e4d1b235dadd319fe5bbd83
R
2,060
65
biomart <- read.table("./mart_export_human_mouse.txt", header=T) biomart$link = paste0(biomart$Mouse_ID,"-",biomart$Human_ID) pseudobulk_mouse_by_embryo <- function(obj,gene_id,liftover=T){ obj_mtx <- obj[['RNA']]@counts if(liftover){ df_mouse_human = biomart[biomart[[gene_id]] %in% rownames(obj_mtx),] ...
a750bea85a12dba9359aada2c819ecb89facb41b1070f2d159ecf910d7d0fecd
R
2,063
91
options(bitmapType='cairo') args <- commandArgs(TRUE) name<-args[1] dataColumn<-as.numeric(args[2]) skip<-as.numeric(args[3]) minY<-as.numeric(args[4]) maxY<-as.numeric(args[5]) fileArray=args[6:length(args)] nFiles=length(fileArray) cat("found ",nFiles," files.\n") for (i in 1:nFiles) { arg<-fileArray[i] cat("\t"...
9892f883d910623bfb01f185a0e12303846e614d2eeeb99cd1ebbdcb610e96ee
R
2,064
72
# Expensive pre-fitted sccomp objects shared by plot and association tests. # Helpers run before any `test_*.R` file so objects exist regardless of # alphabetical test order. if (requireNamespace("instantiate", quietly = TRUE) && instantiate::stan_cmdstan_exists()) { data("seurat_obj", package = "sccomp", envir = en...
b51b7bbc314c35d6527ed96ffda568201f493d1a57fa66016d41be7c0205fbcc
R
2,068
67
require(GenomicSEM) library(data.table) NAME <- "MetS_firstorder_F2_independent" ldsc.out <- "../2_ldsc/ldscout/MetS_noUKB_ldscout.RData" sumstat.out <- "../7_sumstat/MetS_noUKB_sumstat.RData" load(ldsc.out) load(sumstat.out) model <- "F1 =~ 1*BMI_GIANT18 + WC_Watanabe_UKB F2 =~ 1*T2D_meta_FinR7_Mahajan22_M...
00bf9c200a5c8ac4092cc8ea90a325d56818dddb5229e0bf0b71be9653386095
R
2,073
67
#' @name DEPRECATED-orderwl #' @concept deprecated #' #' @title (DEPRECATED) #' Sorting the wavelengths of a `hyperSpec` object #' #' @description #' These \pkg{hyperSpec} functions are **deprecated** and not maintained any #' more. You should not use these. #' Currently they are present due to back-compatibilit...
4c14b4b2a98beff12178560d3f390be0e349b9cf71fcd1f4bce3c025c21579bc
R
2,074
92
# Get functions library(monocle3) source("/net/trapnell/vol1/home/readdf/trapLabDir/sharedProjectCode/utility/singleCellUtilFuncs.R") # modStatus <- loadMonoclePackages() # library(tidyr) library(cicero) library(ggplot2) library("optparse") # Get the passed parameters option_list = list( make_option(c("-c", "--cds...
8c2efea5ab8931ccc6d0f41596f39bebdd7d91b31e86e55fe30fc7d8c16a896a
R
2,074
79
library(data.table) library(dplyr) dir.result <- "./cml_ma_dp_result" result.list <- list.files(dir.result, pattern = "*.rds") ### Result to dataframe df.combined <- NULL for (idx in 1:length(result.list)){ filename <- result.list[idx] phecode <- strsplit(gsub(".rds", "", filename), "_")[[1]][5] cML_dp_...
f721d03d67f5426fddce04bb4b8be060d6a7474f78350b53f951cce48317feef
R
2,075
92
# Get functions library(monocle3) source("/net/trapnell/vol1/home/readdf/trapLabDir/sharedProjectCode/utility/singleCellUtilFuncs.R") # modStatus <- loadMonoclePackages() # library(tidyr) library(cicero) library(ggplot2) library("optparse") # Get the passed parameters option_list = list( make_option(c("-c", "--cds...
5b71af301e0ad2a536b9be97e4e1287d3b8fbd9dd0d22dc173cee7654ef22b42
R
2,076
66
require(plyr) library(data.table) library(tidyverse) args = commandArgs(trailingOnly=TRUE) input_gd <- args[1] proband_gd <- args[2] parents_gd <- args[3] ped <- args[4] chromosome <- args[5] df_ori <- as.data.frame(read.table(input_gd, header = FALSE, sep="\t",stringsAsFactors=FALSE, quote="")) colnames(df_ori) <- ...
9b8d452fca15f4f1d59ff2bcb8eff3adee1dc84d910276513d039e2e08c1ed4f
R
2,088
68
## usage: Rscript topGO.R [gene ids] [CC/BP/MF] library("topGO") # this is the file containing gene IDs args = commandArgs(trailingOnly=TRUE) ids <- read.table(args[1], header=F) #ids <- read.table("pzq.genes", header=F) myGenes <- as.character(ids$V1) ndSize <- 5 goCat <- args[2] #'CC', 'BP' and 'MF' nTerms <-50 # ...
438fe67cc5897d6cfb5a946e4c104949010a273bc33e9c08fa1e54e5987ccf35
R
2,100
50
#' archstabms__predict_fitness #' #' Predict fitness from folding and binding energies for 3-state model. #' #' @param mochi_outpath path to MoCHI thermo model fit results (required) #' @param dataset_name dataset name (required) #' @param folding_energy folding energies for 3-state model (required) #' @param binding...
d86240746607ecbd50e178c6a905c3c4785e78b73161d8a9d44aa457dd4a6346
R
2,106
57
## input two table, each is from one rep ##table1 and table2 are the filenames with data organizeExp <- function(table1,table2,col1,gene1=NA,tx1=NA,align=c("gene","tx"),col2=col1,gene2=gene1,tx2=tx1){ align <- match.arg(align) t1 <- read.delim(table1,header=T,stringsAsFactors=F) t2 <- read.delim(tabl...
9011eac106d4955fc0e744898268835797c5560b84ccabc6facb82a0da0f58a4
R
2,121
72
#' @title Elastic net using summary statistics #' @description Coordinate descent algorithm to solve: #' 0.5 x'X'Xx - x'b + lambda1 ||x||_1 + 0.5 lambda2 ||x||_2^2 #' Function to get elastic net solutions given X, a reference panel, and #' b, regression coefficients #' @keywords internal elnetR <- function(lambda1, la...
7123c0404c419c9dad44d4f2221a93453f89d03f700f8ebd7a51ed31b7f8bbe3
R
2,122
70
cohens_d <- function(x, y, DIM=1, SIGN=TRUE, na.rm=TRUE) { # # Function will compute cohen's d effect size. # Generalized to work on either matrices, data frames, vectors # # INPUT # x <- matrix or numeric vector # y <- matrix or numeric vector # DIM <- specify the dimension which samples are along # # Example usage # ...
00b27122ca9ee72dca5622a67c5c8da53d66bf41341b4cedc3b193f0d6415ff9
R
2,124
84
options(bitmapType='cairo') args <- commandArgs(TRUE) inputFile<-args[1] signalColumn<-as.numeric(args[2]) nBreaks<-as.numeric(args[3]) skip<-as.numeric(args[4]) minX<-as.numeric(args[5]) maxX<-as.numeric(args[6]) if(is.na(skip)) { skip<-0 } inputFileName<-basename(inputFile) myData<-read.table(input...
959c6af00aead56e6e80a99dbdda1bc4e28046b3fd94235bf4e44172af2a0817
R
2,124
62
cat("Reading PRS...\n") prs_file <- "../PRS-CS/PRS_MetS_noUKB.csv" df1 <- read.csv(prs_file, sep=',', header=TRUE) colnames(df1) <- c('FID', 'eid', 'PHENO', 'CNT', 'CNT2', 'PRS') df1 <- df1[, c("eid", "PRS")] df1$PRS <- scale(df1$PRS) # Normalize PRS cat("Reading covariates...\n") covariates_file <- "UKB_covariates.c...
621bb8feede3ad08dff4e357ea5434ba49ecabb02ed58d35ffab06dd91e8644f
R
2,126
68
#' @name DEPRECATED-read.asc.Andor #' @concept moved to hySpc.read.txt #' #' @title (DEPRECATED) #' Import Raman spectra/maps from Andor cameras/solis ASCII files #' #' @description #' These data input functions are **deprecated** and they will be removed in #' the next release of \pkg{hyperspec} package. #' Now...
556e988119a4e5364354d75e7b4c4a21d2a314edf27f07ee32b47c6e3c525c35
R
2,128
58
library(Matrix) motifMatFile = "/net/trapnell/vol1/home/readdf/trapLabDir/hubmap/results/2022_03_24_reprocessHeartAlone_nobackup/analyze_out/W145.heart.apex.s1/motif_matrices/W145.heart.apex.s1-peak_motif_matrix.mtx.gz" motifMat = readMM(gzfile(motifMatFile)) matrixCol = read.table("/net/trapnell/vol1/home/r...
6703f4faecf6bf6867086ee30ffdff6ecaaebd14c129692a72a6591799513ee3
R
2,128
59
library(data.table) library(dplyr) library(TwoSampleMR) dir_out_har <- "tsmr_harmonized_data/" dir.create(dir_out_har, showWarnings = FALSE) dir_out_tsmr_res <- "tsmr_ivw_result/" dir.create(dir_out_tsmr_res, showWarnings = FALSE) # Exposure data df_exp <- fread("exposure_data.MetS_noUKB.txt", sep=" ...
4694517ae8c7b709bc3a687986001c35ab0e7de3c40c12231a3d1b484f66b63a
R
2,130
90
options(bitmapType='cairo') args <- commandArgs(TRUE) name<-args[1] dataColumn<-as.numeric(args[2]) skip<-as.numeric(args[3]) minY<-as.numeric(args[4]) maxY<-as.numeric(args[5]) fileArray=args[6:length(args)] nFiles=length(fileArray) cat("found ",nFiles," files.\n") for (i in 1:nFiles) { arg<-fileArray[i] cat("\t"...
9cfb7762cc594c76e4a5b3275b31462bef1d861a0ff395b2d65e8d319198b432
R
2,135
42
test_that("correct calculation, unpaired", { pdf(NULL) # to prevent generating an empty RPlots.pdf yaml = get_testyaml_object("dir", analyser = "PeakCount", changes = c("DataSettings$CalculationWindow$Start = 3", "DataSettings$CalculationWindow...
9c37ca9caea4f88b3e602952ecaf8d9c0513278e3765c608e1ac782c41d74089
R
2,136
66
#!/usr/bin/R # --------------------------------------------------------- # Run all of the modules resource creation steps, in order: # Updated 11/29/2021 # --------------------------------------------------------- library(cbrbase) set_proj('DEVTRAJ', 'multiRegion') # Scripts prefix and location: modbindir = paste0(sb...
3a6ad4f5d20625fe8aca8ebfbf6e700b9b1cf892f4912136cbc50ae5a6aea394
R
2,143
61
cat("Reading PRS...\n") prs_file <- "../../PRS-CS/firstorder/PRS_MetS_F3.csv" df1 <- read.csv(prs_file, sep=',', header=TRUE) colnames(df1) <- c('FID', 'eid', 'PHENO', 'CNT', 'CNT2', 'PRS') df1 <- df1[, c("eid", "PRS")] df1$PRS <- scale(df1$PRS) # Normalize PRS cat("Reading covariates...\n") covariates_file <- "../UK...
97d5dc3e779b3e73242c68d5dee65ad7711eb666df40ec43f60f40512899a5c3
R
2,143
62
cat("Reading PRS...\n") prs_file <- "../../PRS-CS/firstorder/PRS_MetS_F2.csv" df1 <- read.csv(prs_file, sep=',', header=TRUE) colnames(df1) <- c('FID', 'eid', 'PHENO', 'CNT', 'CNT2', 'PRS') df1 <- df1[, c("eid", "PRS")] df1$PRS <- scale(df1$PRS) # Normalize PRS cat("Reading covariates...\n") covariates_file <- "../UK...
e83c200cbb822ca846197c1d33bf22aa02cf706cf85dde337072b6050b555e1e
R
2,143
61
cat("Reading PRS...\n") prs_file <- "../../PRS-CS/firstorder/PRS_MetS_F1.csv" df1 <- read.csv(prs_file, sep=',', header=TRUE) colnames(df1) <- c('FID', 'eid', 'PHENO', 'CNT', 'CNT2', 'PRS') df1 <- df1[, c("eid", "PRS")] df1$PRS <- scale(df1$PRS) # Normalize PRS cat("Reading covariates...\n") covariates_file <- "../UK...
15b4ef5820598b4b689018294b8bbd71fe78ffdeaff87fba8abe7c14fe619cd0
R
2,148
62
test_that("create_new_hi_model stops before contrasts for aliased higher-level terms", { subject_data <- data.frame( id = rep(sprintf("sub%d", 1:4), each = 3), session = rep(1:3, times = 4), session_label = rep(c("analgesic", "placebo", "opioid"), times = 4), stringsAsFactors = FALSE ) session_day...
4b07b4b1f3438c73f15cfeac59ffef7d353cb00ef01feca5cbfe804bab170cad
R
2,150
48
#' archstabms__predict_fitness_ddPCA #' #' Predict fitness from folding and binding energies for 3-state model. #' #' @param mochi_outpath path to MoCHI thermo model fit results (required) #' @param folding_energy folding energies for 3-state model (required) #' @param binding_energy binding energies for 3-state model...
8c0706f9f696a07e56cb9466530274ab29e3d1f741ae093dd68a7debb4852ca2
R
2,151
61
#!/usr/bin/env Rscript # Helper script to write list of variant IDs, genotypes, and GQs per sample ###Set parameters options(stringsAsFactors=F) ###Read arguments args <- commandArgs(trailingOnly=T) #Checks for appropriate number of positional arguments if(length(args) != 3){ stop("Incorrect number of required pos...
09c2fea02b59e44b8ad2374a98fa253ece218cde893d32929f8dcd6fae8a5989
R
2,163
50
rm(list=ls()) data<-read.delim("/Users/cazaledl-admin/Library/CloudStorage/OneDrive-UniversityofBirmingham/Post_doc/XP/data/courtscape/screen/text/soundxp_all.txt", h=T,sep="\t",na.strings = "NA", stringsAsFactors=T) attach(data) library(beeswarm) quartz() line1 <- factor(line, levels = c("...
c7a18ca6f16ef6e5c17260bce1a8598ba37bda5169e6909e4573aa8b2fba4891
R
2,166
71
--- title: "clean_data_for_classifier" author: "Veronica Mandelli" date: "10/11/2023" output: html_document --- # in this script I clean UCSD data before use the WEB APPLICATION to classify the subjects into theis subtypes ```{r} work_dir = "..." codepath = file.path(work_dir,"code") data_long_path = file.path(work_d...
84f932661f84df2f85dde504e9eeb032ded2a4f08f1ef9eb6fd708721c5dd60b
R
2,169
82
# Function ------------------------------------------------------------------- .split <- function(x, f, drop = TRUE) { validObject(x) hyperlist <- split(seq(x, index = TRUE), f, drop) for (i in seq_along(hyperlist)) { hyperlist[[i]] <- x[hyperlist[[i]], ] } hyperlist } #' Split a `hyperSpec` object ...
266661068bbc745a4fae7f0275ac595f40bf4949af0f26c0e126a626b73f0a5f
R
2,171
101
suppressPackageStartupMessages({ library(Seurat) library(tidyverse) }) mk_seurat <- function(dir_path) { meta <- paste(dir_path, "meta.csv", sep = "/") |> read.csv( row.names = 1, numerals = "no.loss" ) |> mutate( condition = ifelse(isKO == "True", "ncko", "nchet"), within.bb...
bccd30dd47557ff0904a21f2a384ebbbb24e4341e27abb20ee309ef39d6017e7
R
2,176
75
#' archstabms__relative_angle_from_PDB #' #' Get relative angle of c-beta to c-alpha vector w.r.t. center of mass to c-alpha vector from PDB file. #' #' @param input_file path to PDB file (required) #' @param chain chain id (default:A) #' #' @return data.table with relative angles for all residues #' @export #' @impo...
11385c65029221ed6e5733cce4671daa85f9464e44e02d22c70c8c31ad3c2b77
R
2,177
85
################################################ ### Sanzhen Liu ### 1/27/2024 ################################################ args <- commandArgs(trailingOnly=T) miniscan_file <- args[1] # miniscan output chrlen_file <- args[2] # chromosome lengths (2 columns) outdir <- args[3] # output directory prefix <- args[4] if...
66b9046405a0c09662d0aeb9d4054130deb798697acf74dded1b0a0925fd423c
R
2,179
54
# Define reusable variables TR <- 2 n_vols <- 100 onsets <- seq(1, 80, by = 5) # Unit tests for fmri.stimulus # 1. Basic functionality - volume units test_that("fmri.stimulus returns correct length for volume units", { stim <- fmri.stimulus(n_vols = n_vols, onsets = onsets, durations = 1, un...
f648337afb79860e2e2e5d38d694420447dee8bdb104e1f1aed345e80df831ef
R
2,185
67
#!/usr/bin/env Rscript print("Hello world") loadMonoclePackages <- function(){ modStatus <- tryCatch({ suppressPackageStartupMessages({ # Adding this 5-14-21 # .libPaths('2') library(argparse) library(Matrix) # library(dplyr) ...
480bdfafe1cda728bf6dc4d47047ad939a1b005d8a459802cd72a2f3bb84daba
R
2,189
72
# load the reshape2 package library(reshape2) library(dplyr) library(lme4) library(lmerTest) #metadata setwd("D:/PFC_427_WS/Vanshika") meta=read.csv("dataset_652_basic_04-23-2020.csv") meta=meta[,c("projid","age_death","pmi","msex","gpath")] setwd("D:/home_wkstn/F/Brain_region_project/LIANA/Analysis_aggreg...
7661cbb098b41a08ba48689cf4c1d74a4bb8208fbea26aa4bd447d27a4961f76
R
2,190
105
#Third script to launch load(file = "sctransv2_pd_annotated_new.Rdata") library(Seurat) library(dplyr) require('openxlsx') library(ggplot2) # Differential analysis - all cell-types combined sctransv2 <- PrepSCTFindMarkers(object = sctransv2) Idents(sctransv2) <- "cond" table(Idents(sctransv2)) #DimPlot(sctransv2,...
42bf69551344e12dc6667270271e7c3bfad8cc2bec2efcf1846b996e3dda5dfe
R
2,191
68
#!/usr/bin/env Rscript # Talkowski SV pipeline downstream analysis helper script # Merge AF tables across batches ###Set global parameters options(stringsAsFactors=F,scipen=1000) svtypes <- c("DEL","DUP","INS","INV","CPX","BND") allpops <- c("AFR","ASN","EUR","HSP") ################### ###HELPER FUNCTIONS #######...
589acbb587bb7ec7177e9e79334ef5fd273f00a3b302a9828e4f1e93ae0cdea2
R
2,199
79
#### Principal components analysis #### ## ------------------------------------ setMethod("PCA", "ANY", function(x, ncomp = 3, center = TRUE, scale = FALSE, verbose = getCardinalVerbose(), chunkopts = list(), BPPARAM = getCardinalBPPARAM(), ...) { ans <- prcomp_lanczos(x, k=max(ncomp), center=center, scale...
947609e6723e03cae20887629ee1043f382f5772381d89804006e55ea27f5aec
R
2,201
66
#!/usr/bin/R # ------------------------------------------------------- # Plot UMAP resources for figure panels + other analysis: # Updated: 12/02/2021 # ------------------------------------------------------- library(cbrbase) set_proj('DEVTRAJ', 'multiRegion') source(paste0(sbindir, 'load_metadata.R')) library(tidyr) ...
309ae2c410bf7d25274180b82ff789159f595d241deceac42ef2524aa8b13816
R
2,204
72
library("tidyverse") library("clusterProfiler") library('data.table') library("BiocParallel") # prepare from GMT files download from gprofile ReadGMT_GSEA <- function (gmt.file) { pathwayLines <- strsplit(readLines(gmt.file), "\t") pathways <- lapply(pathwayLines, tail, -2) fetchName <- function(x){ unlist(...
37889091264c8de6e22c818a7be88f972dd5f7338b9d137fd78dabd46c28f0c7
R
2,207
47
options(bitmapType='cairo') library(fBasics) library(qvalue) args <- commandArgs(TRUE) inputFile<-args[1] inputName<-basename(inputFile) loessData <- read.table(inputFile,header=TRUE) print('attemping to model null ZSCOREs') print('Assuming all negative zScores are true NULLs') quant <- quantile(loessD...
4e19d790772fc312a4df0ecc9b293d741fc5aa42ad6ae7981e06461858f051ba
R
2,209
47
normalized_to_dna <- function(dir_filtered, network_inference, lp_set = c(1, 2), dir_label = "New results") { if(is.null(dir_label) | dir_label == "") { stop("dir_label cannot be null nor an empty string.") } # Load...
87677f5a8c453d13322d64c6865e255d65e0b8429a57d6d72ed7b1b7ac377048
R
2,217
62
test_that("concat_l1_confounds unions spikes and pads zeros", { skip_if_not_installed("data.table") tmp_dir <- tempfile("confound_concat_") dir.create(tmp_dir, recursive = TRUE) sqlite_db <- file.path(tmp_dir, "test.sqlite") gpa <- create_mock_gpa(n_subjects = 1, n_runs = 2, include_l1_models = FALSE, outpu...
7016307959542bd9c2bee797d1ff31c546d2c8dfc4bee6d3f80eba65d54db872
R
2,220
71
test_that("run_feat_sepjobs returns an empty character vector when nothing needs execution", { gpa <- create_mock_gpa(include_l1_models = TRUE) gpa$output_locations$sqlite_db <- NULL gpa$parallel$fsl <- list( l1_feat_time = "0:10:00", l1_feat_memgb = 1, l1_feat_cpus_per_job = 1L, l1_feat_runs_per_...
325e1884b0f754e7c5c0a5b4f87845ff1e7b3e79fc9320faf81d9516b598904d
R
2,230
74
#!/usr/bin/env R #.libPaths("/cluster/home/bmoyers/R/x86_64-pc-linux-gnu-library/4.1") library(GenomicRanges) library(VGAM) # read in all counts tables files=as.list(readLines("/cluster/home/aanderson/allele_bias/Counts_WASP_noMAPQ0/path_counts.txt")) n=sapply(strsplit(unlist(files),"[/]"),"[[",7) n<-gsub(".txt",""...
6d117a109ab582a2788104b1e454a669ece33ab67d4b03fe414042575b0a5635
R
2,232
57
# Title: SV nested nearest neighbor analysis # # Description: # This script performs a nested nearest neighbor analysis of synaptic vesicles. # # Author: Daniel Parthier # Date: 19.04.2024 # Last modified: 19.04.2024 # Version: 1.0 # Load libraries #### library(readxl) library(data.table) library(ggplot2) library(ggbe...
0897a878d8bcdf25f140de30e5b5f085f917d6f19c34663b9abd200e6dffe21b
R
2,235
87
--- title: "SEM Guide for NosaAnalysis" author: "Julia Thüringer" date: '`r Sys.Date()`' output: html_document: default pdf_document: null vignette: > %\VignetteIndexEntry{SEM Guide for NosaAnalysis} %\VignetteEngine{knitr::rmarkdown} \usepackage[utf8]{inputenc} --- ### Description ```{r description, eval=T...
feab8f6ce0a4815cfa0156b7d1ac710d2b423188f2bd7c0c3a7789efa7611ec9
R
2,239
61
# Title: Nested SV density analysis # # Description: # This script performs a nested SV density analysis. # It calculates the density of synaptic vesicles within each nested bouton. # # Author: Daniel Parthier / Felicitas Brüntgens # Date: 03.04.2024 # Last modified: 09.04.2024 # Version: 1.0 # Load libraries #### li...
2b9bcf901d3cf6cff4896d83f74018aeb2817de194ae9510e68cddc3073c7d55
R
2,241
54
#' @keywords internal "_PACKAGE" #' sccomp: Differential Composition and Variability Analysis for Single-Cell Data #' #' @description #' The sccomp package provides comprehensive tools for differential composition #' and variability analysis in single-cell RNA sequencing, CyTOF, and microbiome data. #' It implements...
300cbd263cffe23131262b60730f4030caecccf6ae9c42fe30592a703a60ebb2
R
2,241
75
library(colorspace) library(doParallel) library(dplyr) library(foreach) library(magick) library(readr) library(stringr) num_to_sample = as.numeric(commandArgs(trailingOnly=TRUE)[1]) out_dirpath = commandArgs(trailingOnly=TRUE)[2] out_filepath = commandArgs(trailingOnly=TRUE)[3] alreadysampled_filepath = commandArgs(tr...
8097bdad9a94490d97be1026ce115dc3c2076d57a19462684f09137b2d567a29
R
2,246
48
#' @title Obtain the SNP-wise standard deviations from the PLINK bfile #' @details \code{keep}, \code{remove} could take one of three #' formats: (1) A logical vector indicating which indivduals to keep/remove, #' (2) A \code{data.frame} with two columns giving the FID and IID of the indivdiuals #' to keep/remove (ma...
dbeb31614e59d581c99c7d1d1f0576e1efdbbef3f05fa0aca3fc7586c72a9546
R
2,250
49
## ----------Script----------------- ## ## Purpose: Compare and characterise Iso-Seq vs ONT targeeted datasets ## ## Author: Szi Kay Leung (S.K.Leung@exeter.ac.uk) ## ## ---------- Source function and config files ----------------- # source all general scripts related to long-read sequencing LOGEN = "/gpfs/mrc0/proj...
5ee290714fa8af5e30fd8c7bfba0e3a834208f1aed3757197ac14a66fc36364d
R
2,251
69
options(bitmapType='cairo') args <- commandArgs(TRUE) dir<-args[1] inputFile<-args[2] name_1<-args[3] name_2<-args[4] correlationMode<-args[5] outlierFraction<-as.numeric(args[6]) ymin<-as.numeric(args[7]) ymax<-as.numeric(args[8]) xmin<-as.numeric(args[9]) xmax<-as.numeric(args[10]) if(is.na(outlierFra...
10cc5cbccf0ae3f4da975bdb46927430b198c27849482d60347458956a9c558e
R
2,255
74
library(scrattch) library(scrattch.io) library(scrattch.hicat) library(scrattch.vis) search_file_for_functions <- function(file, funs) { lines <- readLines(file) found <- logical(length = length(funs)) names(found) <- funs for(i in 1:length(funs)) { search_str <- ...
27fd3e55edee8499cc502941ab7ce99844a32b79ccd8496070db80019d384e35
R
2,255
75
#' Print method for sccomp objects #' #' @description #' Print method for sccomp objects. #' #' The print method for sccomp objects provides a summary of the model specifications, #' data dimensions, and convergence diagnostics. #' #' The output is formatted to be easy to read and understand. #' #' @importFrom magri...
025223b7af876e32b1318a8c8050a9a106443c750181cbf2478b0266fd728612
R
2,256
83
#### Find spatial neighbors #### ## ----------------------------- setMethod("spatialWeights", "ANY", function(x, coord = x, r = 1, byrow = TRUE, neighbors = findNeighbors(coord, r=r), weights = c("gaussian", "adaptive"), sd = ((2 * r) + 1) / 4, matrix = FALSE, verbose = getCardinalVerbose(), chunkopts = list...
bc16759575bd8548479063b03282ee36062add67e2302f0bef22dd2d34ceead3
R
2,257
54
log <- file(snakemake@log[[1]], open = "wt") sink(log) sink(log, type = "message") library(ggplot2) library(readr) library(ek.plot) # Github koncina/ek.plot suppressPackageStartupMessages(library(dplyr)) message(paste("Reading in a list of", length(snakemake@input), "tsv")) # Read in the tsv after flattening the inp...
0e1b46dcfab48b6fa593ca2f60c667da322af6e4e503847b7e46701c795ab049
R
2,258
57
rm(list=ls()) options(stringsAsFactors = F) library(dplyr) library(ggalluvial) read.table("GBM_TCGA/HT_HG-U133A",header=T,row.names=1,sep="\t") -> U133A_exp U133A_exp <- U133A_exp[,-(grep("11$",colnames(U133A_exp)))] library(ssgsea.GBM.classification) source("~/ssgseaMOD.r") Wang_score <- as.data.frame(mod.analyze2(U13...
5904552f851a6cfcdcbd854039995a31cab8c6ad8f38229fb0ba995f369a57d0
R
2,260
54
library(data.table) library(spacexr) library(Matrix) library(dplyr) library(tidyr) library(tibble) hippo_ref <- readRDS('../inst/extdata/reference_scrna/scRefSubsampled1000.rds') celltypes_hippo <- hippo_ref@meta.data$liger_ident_coarse levels(celltypes_hippo)[levels(celltypes_hippo)=='Denate'] <- 'Dentate' hippo_cou...
606ac6a1b6b30429e913e1ad3a0da8b0c0a47c95dbaff60f2b4653ff16cfa88a
R
2,267
72
# Simulate Deutan Image suppressPackageStartupMessages(library(magick)) suppressPackageStartupMessages(library(tidyverse)) suppressPackageStartupMessages(library(colorblindr)) convert_hex_vector_to_image <- function(hex, dimensions) { x = col2rgb(hex) r = matrix(as.raw(x[1,]), nrow=dimensions[2], ncol=dimension...
4e2e5116a4a65e0ebd5ebeb16579edd23c9114c8e22abfe86b16dd279337e312
R
2,268
67
--- title: "Deduplicating large datasets" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{deduplicating-large-datasets} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) ``` ## **Setup** First,...
e15d77d34390b061bbfb5b583b41fdfa217e7962e5741401ce74a44e89769592
R
2,268
67
## ---------- Script ----------------- ## ## Purpose: input variables for characterising QC of ONT targeted mouse transcriptome datasets ## ## Author: Szi Kay Leung (S.K.Leung@exeter.ac.uk) ## ---------- Packages ----------------- suppressMessages(library("dplyr")) ## ---------- LOGEN modules ----------------- L...