sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
d18e0df2765508e3a8df01fd8e2600eac25c01f1dbdeef5f63deefa2bdf13e66
R
2,525
72
#' Merge multiple mafs into single MAF #' @description Merges multiple maf files/objects/data.frames into a single MAF. #' @param mafs a list of \code{\link{MAF}} objects or data.frames or paths to MAF files. #' @param verbose Default TRUE #' @param ... additional arguments passed \code{\link{read.maf}} #' @return \cod...
8f8efe832c0e7f6c012d27fa19560faf2bca8f7bfbacc0ba7e1decebd25d57d8
R
2,533
115
--- title: "LC analyses: cells per spot" author: "Lukas Weber" date: "`r Sys.Date()`" output: html_document: toc: true number_sections: true toc_depth: 2 toc_float: collapsed: false --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE, cache = TRUE) ``` # Introduction Investigat...
a72fea9a696360d235edeb23c9d16c19149c4288e088166cc581f056c3647e77
R
2,539
67
ss <- function(x, pattern, slot = 1, ...) { sapply(strsplit(x = x, split = pattern, ...), '[', slot) } options(stringsAsFactors = F) ## packages for data table processing/plotting library(data.table) library(tidyverse) library(RRHO2) library(here) library(msigdbr) DATADIR='data/tidy_data/compare_to_Alzheimers_stud...
b85ae05c7d64c8076af363d69edb650685fe7dec8ff316f2f6762ddf110c5d63
R
2,541
118
plot_log2_fpkm_dist = function (fpkm_files) { num_files = length(fpkm_files); data_list = list(); max_y = 0 xlim = c(0,0) for (i in 1:num_files) { file = fpkm_files[i] data = read.table(file, header=F) data = data[,6]; data = log2(data+1) den = density(data); data_list[[i]] = den ...
420d519ea9888d7f9ebb1676bca577421fbbfe245cf115a7b0f2342ae8650da4
R
2,542
64
#' Filter MAF objects #' #' @description Filter MAF by genes or samples #' @param maf an MAF object generated by \code{\link{read.maf}} #' @param tsb remove these samples (Tumor Sample Barcodes) #' @param genes remove these genes #' @param isTCGA FALSE #' @return Filtered object of class \code{\link{MAF-class}} #' @see...
9f726138fbc73e89d462e700f0c8e9bddb60431954acbffb6e34defaff51c1d2
R
2,545
64
"pwr.2p.test" <- function (h = NULL, n = NULL, sig.level = 0.05, power = NULL, alternative = c("two.sided","less","greater")) { if (sum(sapply(list(h, n, power, sig.level), is.null)) != 1) stop("exactly one of h, n, power, and sig.level must be NULL") if (!is.null(h) && is.character(h)) ...
45ca4d26a6a53398974b5348a7819e657acc5c788b3721ac3a5d80114d0d2477
R
2,548
73
##Create tables for info by cluster for lmmp ##Create tables for NMF pattern definitions and usage ##Create tables for info by cluster for gut cell atlas (nfh subset) library(tidyverse) library(monocle3) library(here) ### lmmp subset metadata---- lmmp <- readRDS(here("TC_LMMP.rds")) # pData(lmmp) <- pData(lmmp) %>...
c03799a91b1f285c763d95ac155c54eecc1a91b13dfa4d02f204336231c7039a
R
2,555
73
#' Transform the 'phyloseq' object of 'phyloseq' package to 'microtable' object of 'microeco' package. #' #' @param physeq a phyloseq object <doi:10.1371/journal.pone.0061217>. #' @param ... parameter passed to microtable$new function of microeco package, such as auto_tidy parameter. #' @return microtable object. #' @e...
8036594a3ce4cb895e7b6b7e18c57a026852adc9aa870d07882a1e66371ab7d0
R
2,556
54
#install and load packagaes install.packages("ggplot2") library(ggplot2) install.packages("ggrepel") library(ggrepel) install.packages("dplyr") library(dplyr) #read in input data - DEG by DESeq 2 output between 2 contrasts (ex. med vs low liver PAM) de_genes <- read.csv("DE_results_liver_MPvsLP.csv") #check ...
f6f4158003625b0938404ce7ec5250097a36d1447bb8696ee5632548d60038a5
R
2,560
78
invnorm <- function (x) { y = (rank(x,na.last="keep")-0.5)/sum(!is.na(x)) return (qnorm(y)) } dg = read.delim ("Exc-DG.combined.modalities.230623.txt") threshold = 40 # select out the transcripts we are interested in x = dg[dg$rna.logp > 1.3 & abs(dg$rna.log2fold) <= 2 & !is.na(dg$rna.logp) ,] x$mut.b6.strict = 0 x...
31dd544c6eb96f31675dd07e3d3be549571f63651abccd34b14904ad92fbc3ed
R
2,562
68
# from Lorena Pantano's original template: hbc_kressler_sRNAseq_anxiety_brain_mouse_hbc02185 # run: # interactive session with 20G of RAM # cd to project/final/project # conda activate r # Rscript 01.bcbio2sse.R library(SingleCellExperiment) library(Matrix) library(AnnotationHub) library(tidyverse) species = "Macaca...
eec29e5dfd489bdd0501b01dbbfdd5d37c01f4e3a15df1c50e3293e9853c26f4
R
2,563
74
library(tidyverse) library(Seurat) options(Seurat.object.assay.version = "v5") options(future.globals.maxSize = 5e9) library(SeuratObject) library(Matrix) Sys.setenv("_R_USE_PIPEBIND_" = TRUE) library(future) projdir <- here::here() rdir <- file.path(projdir, "package/R") import::from(.from = "cembav2env.R", .director...
65b5720a8a5d9f6fe3268cef5b94e36b208760f267f7aa40f9b0f7b9d4ff6922
R
2,564
69
# This code is to calculate time of day effect on the MRS data for sub2 # WANG. 25-April-2023 # Remove all objects created before to prevent clusing # Set the working directory to the path where your files are located setwd("/Users/wang/Desktop/Research_projects/BBSC/MRS/Output_v2_4/QuantifyResults") # create a ...
b6236357b67610cc10dbb8f91a1369d1cf0c32b0f0af4a7205e6b9310f30c936
R
2,566
70
# This code is to calculate time of day effect on the MRS data for sub1 # WANG. 25-April-2023 # Remove all objects created before to prevent clusing rm(list=ls()) # Set the working directory to the path where your files are located setwd("/Users/wang/Desktop/Research_projects/BBSC/MRS/Output_v2_4/QuantifyResults")...
86573946198b750b4f0a29d9461928967eda1d94fd0bee0d3438c295d653316e
R
2,570
68
library(ape) library(geiger) library(phytools) library(evomap) library(caper) library(ggplot2) library(nlme) library(stats) library(DescTools) setwd("your directory") ##Import tree and data data<-read.table("final_compilation with percentage values.R1.csv",header=T,sep=",",row.names=1) data<-data[whic...
aaad80b23876b95b5dcc2f626e0d1954f92ce9873fbcc5b4e98bc51e0d853a34
R
2,573
71
#!/usr/bin/env Rscript # I'm not currently using this script, because I'm interested in sumdiv and # these summaries aren't actually all that informative. # But, if you want to use them the following targets may be helpful: # @nest.add_target_with_env(localenv) # def test_sumrep(env, outdir, c): # test_sumrep_pat...
7ccfa64996a16fb135dc9c7448bad79ca8dfa2b6be852dec3a29fd22c4898313
R
2,577
81
# merFISH pipeline library(Seurat) library(ggplot2) library(data.table) library(SeuratData) library(dplyr) library(DoubletFinder) merFISH_pipeline = function(dir, proj){ # generate expr matrix expr1 = fread(paste0(dir, "/countsPerCellCorrectedIn.csv"), header = F, data.table = FALSE) expr2 = fread(paste0(dir...
25fd6c2e7c93d0b5bf2ee3579bfd6f27093cfcbcb6a7df41a6175f42e777a639
R
2,582
37
#' @title Principal Component Analysis #' @description A wrapper for irlba::prcomp_irlba(). Performs efficient computation of a principal component analysis of a given data matrix. #' @param m A numeric matrix or data frame. #' @param npcs The number of principal component vectors to return. Must be less than 'min(d...
265e15ac4f3951cd2f77f1028f9c64c59b44d929816923709d55799841759871
R
2,582
71
## packages for data table processing library(tidyverse) library(stringr) library(RColorBrewer) library(data.table) library(here) ss <- function(x, pattern, slot = 1, ...) { sapply(strsplit(x = x, split = pattern, ...), '[', slot) } options(stringsAsFactors = F) options(repr.plot.width=11, repr.plot.height=8.5) F...
59c9a5fcae597cf61c3c8a560dac8f863a7723c584b25c79b410d090cb99949c
R
2,594
53
#' Plots results from \code{oncodrive} #' #' @description Takes results from \code{oncodrive} and plots them as a scatter plot. Size of the gene shows number of clusters (hotspots), x-axis can either be an absolute number of variants #' accumulated in these clusters or a fraction of total variants found in these cluste...
962dc8c1515d3e991443681168cf3575ac1fa14e335132caa206f46847a800ec
R
2,596
94
#' @export splitByChunk <- function(nondecVec, chunkSize = 2012) { n <- ceiling(max(nondecVec) / chunkSize) r <- lapply(seq(n), function(i) { left <- chunkSize * (i-1) right <- chunkSize *i index <- (nondecVec > left) & (nondecVec <= right) if(sum(index) < 1) { return(NULL) } else { ...
24e030212d31ce30119a3d20ac4e0a5e10d7ad1727b70f313e5e806f214ece85
R
2,599
64
# function taken from TCGAbiolinks package #' @title Get hg19 or hg38 information from biomaRt #' @description Get hg19 or hg38 information from biomaRt #' @param genome hg38 or hg19 #' @param as.granges Output as GRanges or data.frame #' @importFrom biomaRt getBM useMart listDatasets useEnsembl #' @export getGRCh <-...
2d99d22a5e268be267e07cebfdcf55acc5da07f75218a19ad077243ec6623fa9
R
2,599
68
#### Check correlation of patterns with cell features #### One hot encoding method. ### For each pattern, compute correlation between two vectors. One is continuous (cell pattern weight) ### and one is binary (yes/no is that cell in that group) library(ComplexHeatmap) library(circlize) #as implemented, features shoul...
2ea1f1602781c731304d216d88acb8474c7a024fa4c8c25ef7bd4cd94d3af492
R
2,599
78
library(pls) library(mvdalab) library(dplyr) library(haven) library(rlist) options(max.print=1000000) rm(list = ls()) # load SPSS data set UJ <- read_sav("http://fizyka.umk.pl/~tpiotrowski/complexity/UJ_gf_complexity.csv") # sex==1 males, sex==2 females # for overall group (males+females), the foll...
2f5c82dabfbcff8a3016be52fc1fe6cbfdb45eb693b84fa3514344e843cbdf38
R
2,600
56
#!/usr/bin/env Rscript # Usage: # Rscript --vanilla GetDivergences.R file1.csv file2.csv [out_filename] # If out_filename is not specified, it saves the divergences to "divergences.csv" # Note that this does full NN distance calculation, an O(n^2) operation, so don't # try this for anything too big! args <- command...
5fc45a439bbf9efed5950418836de3195b1a9bffe94fed6d9881d5c83812610d
R
2,601
81
#----------------------------------------------- # LICENSE #----------------------------------------------- # Copyright 2018 Novartis Institutes for BioMedical Research Inc. # Licensed under the GNU General Public License, Version 3 (the "License"); # you may not use this file except in compliance with ...
b6051c512a53258109e4644b823d09da10daaae1901d19c779703c6b5fd98145
R
2,601
63
## Defines colors used for reference cell types plotting pbmc_colors = c("B" = "#66C2A5", "DC" = "#FC8D62", "HSC" = "#8DA0CB", "MK" = "#E78AC3", "Mono_CD14" = "#A6D854", "Mono_CD16" = "#f2ec72", "NK" = "#62AAEA", "T_CD...
2db3f8fa0ddf5934ef32f78c8ca97646a9455ba10f106cf74a4eeae967863bdd
R
2,608
77
#' Replace the names use match table #' #' @param match_table default NULL; character or data.frame; matching table used. #' @param abund_new default NULL; data.frame; the abundance table used. #' @return new abundance table. check_match_table <- function(match_table = NULL, abund_new = NULL){ # read according to the ...
602b8f32c2c36f97baa17d6987aad13f1384d5c145fa604f5d10aa54f048fed0
R
2,608
66
#' @title Functional enrichments #' @description Functional enrichments by hypergeometric test #' @param test_gene_sets (list of) character vector gene IDs #' @param ref_gene_sets (list of) character vector gene IDs #' @param universe all genes considered. If NULL, uses all genes in test_gene_sets. Default: NULL #' @p...
3acf26cd39e58213caf28507c5fd4640ff5df4f24326ce0ba0b19d6b7078bb06
R
2,609
64
# SCRATCH1=/mnt/g/scratch # docker run -it \ # --workdir $HOME \ # -v /mnt/g/ckd:$HOME/project \ # -v /mnt/g/cellranger_atac_counts:$HOME/cellranger_atac_counts \ # -v /mnt/g/reference:$HOME/reference \ # -v $HOME:$HOME \ # -v $SCRATCH1:$SCRATCH1 \ # -e SCRATCH1="/mnt/g/scratch" \ # -v /mnt/g/scratch:$HOME/scratch \ # ...
1d8c1f3e6a70d5cfb8201f26895214dc4aae5aff9bd254a870c6e9fa567e1a75
R
2,613
65
## conda activate r4 ## packages for data table processing library(here) library(tidyverse) library(RColorBrewer) library(rcartocolor) library(ggpubr) library(data.table) library(fgsea) ss <- function(x, pattern, slot = 1, ...) { sapply(strsplit(x = x, split = pattern, ...), '[', slot) } options(stringsAsFactors ...
97a4d8c920b9708dacb78f3cba67f7851802b921e08e4243bb1a174919a2ba7f
R
2,619
65
## conda activate r4 ## packages for data table processing library(here) library(tidyverse) library(RColorBrewer) library(rcartocolor) library(ggpubr) library(data.table) library(fgsea) ss <- function(x, pattern, slot = 1, ...) { sapply(strsplit(x = x, split = pattern, ...), '[', slot) } options(stringsAsFactors ...
98cf84a35b2cdffaf0e92a1f472f84395520005e8f4b2fa61e29bb06f455c400
R
2,619
71
# This code is to calculate time of day effect on the MRS data for sub3 # WANG. 25-April-2023 # Remove all objects created before to prevent clusing # Set the working directory to the path where your files are located setwd("/Users/wang/Desktop/Research_projects/BBSC/MRS/Output_v2_4/QuantifyResults") # create a ...
85b3c860be3c0160e8beb15a7c27a8b450e0b71f24f20b7389add1d05402dcf2
R
2,626
104
--- title: "R Notebook" output: html_notebook --- # Set Up ```{r setup} knitr::opts_knit$set(root.dir = normalizePath("../..")) ``` # Imports ```{r} library(lavaan) library(semPlot) library(paran) library(factoextra) library(RColorBrewer) source('functions/explained_variance.R') source('functions/heatmaps.custom.R')...
f206577c14f48bcfbe17835be0c1ebaacc4fe2786158a37d7d8a716b4980cb42
R
2,633
72
## conda activate r4 ## packages for data table processing library(here) library(tidyverse) library(RRHO2) ss <- function(x, pattern, slot = 1, ...) { sapply(strsplit(x = x, split = pattern, ...), '[', slot) } options(stringsAsFactors = F) options(repr.plot.width=11, repr.plot.height=8.5) DATADIR='data/tidy_data/...
a806dd519d48449fe52bf2dd0e33b92243dd2ce664c00e9e6cecc6fee793cd8b
R
2,635
86
# 05/23/2023 Fengyao Yan # Make a dot plot to show the change of pcc for NNLS cmp sensitivity test. library(tidyverse) library(ggplot2) pearson_dots <- data.frame(matrix(ncol=4, nrow=0)) colnames(pearson_dots) <- c('tissue', 'pcc', 'n_gene', 'model') pcc_nnls <- read.csv('../../data/cmp/pcc_all_cmp_nnls.csv', row.na...
7e728423ca402c77035d1b900c1487e2f46b41424c69228aa05448b9f82e0a47
R
2,637
103
# install.packages("ggplot2") # install.packages("tidyverse") # install.packages("ggsignif") # install.packages("RVAideMemoire") # install.packages("lawstat") # install.packages("ARTool") library(ARTool) library(lawstat) library(ggplot2) library(tidyverse) library(ggsignif) library(RVAideMemoire) library...
4e1269a11b964cc1421544f4d8d72192fcef15507cc94e9265164536cf22f05e
R
2,642
99
set.seed(321) x <- replicate(m <- 25, runif(10, 0, 1)) # Add an anticorrelated column x[, 24] <- seq(0, 1, length.out = 10) x[, 25] <- seq(1, 0, length.out = 10) rownames(x) <- paste0("spot", seq_len(nrow(x))) colnames(x) <- paste0("type", seq_len(ncol(x))) .checks <- function(p) { expect_is(p, "ggplot") expec...
4a74c3844b44e5614569d4a473faacafb1e00df18aa764e2a284bfe8030b3f5b
R
2,656
93
--- title: "Figure 1" author: "Joe Raymond" date: "April 2, 2021" output: pdf_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) knitr::opts_chunk$set(tidy = TRUE) knitr::opts_chunk$set(eval = TRUE) knitr::opts_chunk$set(fig.width = 8) knitr::opts_chunk$set(fig.height = 4) knitr::opts_chunk$se...
948d064f45ddec2dcb22896446918fa2ae73cfcb0bb091fc5a233f1f608fa20f
R
2,663
89
--- title: "MG A549 experiments - volcano plots" author: "Pierre-Luc Germain" date: "3/1/2022" output: html_document: toc: true toc_float: true code_folding: hide --- ```{r} suppressPackageStartupMessages({ library(SummarizedExperiment) library(sechm) library(ggplot2) library(cowplot) library(C...
2e8ca16fc6dde6ba579f1afc6332bd7bfaaa45ad18f411a84eaf291a8916c3f9
R
2,664
117
## approximate equality #' gmap wrapper #' #' @rdname ggmap ggmap = function(m, ...) { gmap(reshape2::melt(as.matrix(m)), ...) } #' sapply wrapper #' #' @rdname Sapply Sapply = function(X, FUN, ..., simplify = FALSE, USE.NAMES = TRUE) { sapply(X, FUN, ..., simplify = simplify, USE.NAMES = TRUE) } about_equa...
1b8657e7f34c4a7443f89fe9112aa99aab930590e64dfa8d8cc5cf5d0c6cac23
R
2,665
67
############################################################# # Generate Figure 4D # Plot 3D plots of Discrete 3D patterns ############################################################# library(plotly) library(scales) library(plot3D) InputData <- read.csv(".\\..\\..\\Data\\discrete\\Discrete_900by10_width2_qt88_N...
4afa9dcb00cb1bfc2c1556b8550486ef4807d1dd628abde0db52794af06fd531
R
2,668
95
library(igraph) ####GRAPH filename genedet='../OscopeData/GenesLabels/Mapping/SVZq.txt' netdirList=c('../OscopeData/dataAdjacencyMatrixe02/','../OscopeData/dataAdjacencyMatrixePiDiv9/','../OscopeData/FirstData/') outdirList=c('../Communities/Networks02/','../Communities/NetworksPiDiv9/','../Communities/FirstData/') fo...
673c61ec76dacbff97e01b418039c42ed163f7116f61722a0ad7729fe88bee23
R
2,670
64
#' Generates count matrix of mutations. #' #' @description Generates a count matrix of mutations. i.e, number of mutations per gene per sample. #' @param maf an MAF object generated by \code{\link{read.maf}} #' @param includeSyn whether to include sysnonymous variants in ouput matrix. Default FALSE #' @param countOnly ...
d2a84466620dccbd0a0664c901a65d92dcae425779e8d5c57d35c365a606ab91
R
2,671
103
# install.packages("ggplot2") # install.packages("tidyverse") # install.packages("ggsignif") # install.packages("RVAideMemoire") # install.packages("lawstat") # install.packages("ARTool") library(ARTool) library(lawstat) library(ggplot2) library(tidyverse) library(ggsignif) library(RVAideMemoire) library...
e670712415a22b766284843b1622870b5273d816b80bc96746d42985faada234
R
2,671
102
# load data from the MSK-IMPACT 2017 dataset library(tidyverse) library(fs) source("scripts/utils.R") Sys.setenv(VROOM_CONNECTION_SIZE = 500000L) # Load data --------------------------------------------------------------- # process command line arguments (1st argument = selected cancer type) args <- commandArgs(T...
180c59f53dfeeab053ef35de04e4c8eb6dd8be08bc49dad344571aacb4ffe30d
R
2,673
93
#source("https://bioconductor.org/biocLite.R") #biocLite("Mus.musculus") #biocLite("Homo.sapiens") #biocLite("categoryCompare") #biocLite("KEGG.db") require("categoryCompare") #require("Homo.sapiens") require("Mus.musculus") require("KEGG.db") do.GOEA = function(cls,univ) { univ = subset(select(Mus.musculus, keys=...
1e8ea856261d1f4c80b1d8bf70a5228516b5d626604c96d93c92a5f2a526f4dd
R
2,674
107
# For each HLA, # this code outputs the TCRs that appear at least twice among the subjects # with known HLA existing or not status # and their corresponding frequency among the subjects under consideration # the public TCR and HLA allele information used here are based on all 666 # Emerson HIP subjects args = com...
a6a8d346caebb8d2fd913f803e948e1e5a2268a259efdc860506f4e9de488ddd
R
2,676
115
--- title: "R Notebook" output: html_notebook --- # Set Up ```{r setup} knitr::opts_knit$set(root.dir = normalizePath("../..")) ``` # Imports ```{r} library(finalfit) library(mice) ``` # Load Data ```{r} brain.mri = read.csv("data/brain.mri.data.csv") brain.tracts = read.csv('data/brain.tracts.csv') ``` # Prepare B...
aab8abb5dd35d33051f96d39e7d8f91738921786e32be195d34e0b137aef9344
R
2,682
78
# figure qc snATACseq # supplemental figure qc metrics and lineage markers library(Seurat) library(Signac) library(here) library(ggplot2) # create a plot dir plots <- here("ckd","figures") dir.create(here(plots)) atac <- readRDS(here("ckd","atac_aggr_prep","step6_atac_loy.rds")) plotA <- VlnPlot(atac, features = "...
78e57ef04699223542f38fe06f12f2138c88cca132a6d86d957367233182be4f
R
2,683
102
--- title: "R Notebook" output: html_notebook --- # Set Up ```{r setup} knitr::opts_knit$set(root.dir = normalizePath("../..")) ``` # Imports ```{r} library(finalfit) library(mice) library(purrr) library(dplyr) ``` # Load Data ```{r} covs.final = read.csv('data_derived/cleaned/covs_cleaned.csv') vrfs.final = read.csv...
e4c01e10361f2162756613b4c86f708d9e25526d2ee464886bfee129f3a966a9
R
2,683
91
source('queryGo.R') library(igraph) netdir='../OscopeData/dataAdjacencyMatrixe02/' #filenet='WaterfallbootstrapSequential_CPUDPSF_TF_2000Boot_data_s45res_C28G8442_edgeNetwork.csv' filenet='SVZbootstrap_CPUDPSF_TF_2000Boot_data_aNSC_C32G7883_edgeNetwork.csv' Thresh=8 Dircom='../Communities/Networks02/' #file='Go_W45fast...
1a8bda6f0473a02ea3f34632dd0f9ce10d10d129cc5a5e52ca184331441b760f
R
2,685
70
# singularity exec --bind /lab-share/RC-Data-Science-e2/Public/Daniel/p147-scRNAseq-Koehler:/data/,/lab-share/RC-Data-Science-e2/Public/DST_software/pipeline_R_snapshot/:/snapshot/ r-monocle3:1.0.0--r42h9f5acd7_3 R snapshot <- "/snapshot/r4.2.3-20230324-bch-dst-v1" .libPaths(snapshot) library(Seurat) library(monocle3)...
6fab254e85a462b1e79d9392101cbff1f5bd80d4464ee0baad542314aec94702
R
2,686
57
#install packages/load libraries install.packages("DESeq2") library(DESeq2) install.packages("tidyverse") library(tidyverse) #if having trouble with DESeq2 installation in R 4.2.1, try: if (!require("BiocManager", quietly = TRUE)) install.packages("BiocManager") BiocManager::install("DESeq2") library("DESeq...
e64f863c83716e3169b091b85ee6da02acd5cbe9a9e3e515c1365fd0a2bd594e
R
2,686
107
--- title: "Cell cycle classification" author: Jared Slosberg output: html_notebook --- ```{r check_interactive} if(interactive()){ print(date()) print("This was run interactively. Please run with rmarkdown::render") }else{ print(paste0("This notebook was compiled on ", date())) } ``` ```{r} library(monocle3)...
50518757689560beb95f593e5764927cdd94a78ee83de1d28abe7c585ad2c2d0
R
2,687
98
library(Seurat) options(Seurat.object.assay.version = "v5") library(SeuratObject) library(stringr) library(purrr) # support R new feature in 4.2 Sys.setenv("_R_USE_PIPEBIND_" = TRUE) library(R6) library(future) options(future.globals.maxSize = 10e9) library(future.apply) plan(multicore, workers = 4) projdir <- here:...
26d34fda1d6f8c590861d00442d92f1e9077484b8571b93f13800d663a74910d
R
2,688
94
# install.packages("ggplot2") # install.packages("tidyverse") # install.packages("ggsignif") # install.packages("RVAideMemoire") # install.packages("lawstat") # install.packages("ARTool") # install.packages("effsize") library(ARTool) library(lawstat) library(ggplot2) library(tidyverse) library(ggsignif) library(RVAid...
80609329fdd0e71ad7da53a80771211845fa925d2ba18c09ce1c4a268d90d58c
R
2,705
108
--- title: "iPSC-DA MPP vs basal: " author: "J Monzón Sandoval" date: 'Last update: `r date()`' output: html_document: theme: lumen toc: yes number_sections: true toc_float: collapsed: yes smooth_scroll: yes --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TR...
5f4fbba00e7aa7c22c5036f56fc9b3630955de44a6a0a9154bc69c1e55f34c9f
R
2,707
99
plot_counts_matrix_log2_dist = function(matrix_file) { data = read.table(file=matrix_file, com='', row.names=1, header=T) conditions = colnames(data) colors = rainbow(length(conditions)) plot(density(log2(data[,1])), col=colors[1], main=matrix_file, xlab='log2(frag_counts)', ylab='density') for (i in 2:len...
885d64c7d879b649df0e3a44deed5e2e65bb8f9015cec912fd8ad3bbac940d29
R
2,707
96
--- title: "Marker identification" author: "Sergey Naumenko" date: "`r Sys.Date()`" output: html_document: code_folding: hide df_print: paged highlight: tango theme: default number_sections: true toc: true toc_float: collapsed: true smo...
97a5b0989a0487d301226eaf29b285b703a50c5b14276fd950f5622d7cc77225
R
2,712
79
# figure kpmp qc and dotplot library(Seurat) library(Signac) library(here) library(ggplot2) # create a plot dir plots <- here("ckd","figures") dir.create(here(plots)) rna <- readRDS(here("ckd","rna_aggr_prep","kpmp","kpmp_prep.rds")) plotA <- VlnPlot(rna, features = "nCount_RNA", group.by = "specimen_id", pt.size =...
7e74054d5d17c1846eb8e890b48698c02a139c55d148ad38ec3f946fa6d928d2
R
2,725
78
# Libraries snapshot <- "/lab-share/RC-Data-Science-e2/Public/DST_software/pipeline_R_snapshot/r4.1-20220803-bch-dst-v1/" .libPaths(snapshot) source('/lab-share/RC-Data-Science-e2/Public/Daniel/rFunctions.R') library(Seurat) library(dplyr) library(ggplot2) library(velocyto.R) library(velociraptor) # Setting WD setwd(...
e3a79f54824aaf03b03e7222ea2ea7ee3d4cfeb5d77e748919732984fed72a09
R
2,726
81
############################# # Create metadata spreadsheet ############################# # ------------------------- # Metadata for each dataset # ------------------------- # Spatially-resolved transcriptomics (SRT) dataset # saved as SpatialExperiment object df_Visium <- data.frame( Title = "WeberDivechaLCdata_V...
b2c19022aec19991759cec2cebe433eb8a5a10e7b9e643f8cd67474b1c7efe3f
R
2,729
54
# contributed by: Satyajeet Khare satyajeetkhare@gmail.com # May 3, 2018 # If you modified your gene count matrix or transcript count matrix to add functional annotations using ... # Trinity/Analysis/DifferentialExpression/rename_matrix_feature_identifiers.pl script, you will get an error # if you run Trinity/Analy...
8aabcb3bab82139b99cba15fa2ac2869163b597dff3c5d64bbb83955fe65a647
R
2,734
66
#' Compares identified denovo mutational signatures to known COSMIC signatures #' #' @description Takes results from \code{\link{extractSignatures}} and compares them known COSMIC signatures. Two COSMIC databases are used for comparisons - "legacy" which includes 30 signaures, and "SBS" - which includes updated/refined...
462e0392180d43bb78232003283aecd8b5270afd3a7f98cf607578df407f6857
R
2,735
74
library(monocle3) library(dplyr) library(ggplot2) #Within Monocle framework, do either LRT or Wald Test #Provide monocle object, method ("LRT" or "wald"), minimum percent of cells expressing a gene to consider, #and the linear models to be fit #Minimum number of cells expressing a gene for the gene to be tested for ...
814dc1aed25900db5e84727048b8d3b0585b72df53397690f1f7fbe182169664
R
2,736
114
#05/23/2023 Fengyao Yan #make the pie chart to show to change trend of genes from normal tissue to tumor. library(ggplot2) library(ggrepel) library(scales) library(tidyverse) df_tss <- read.csv('../../data/raw/TSS_genes.csv', row.names=1) tss <- unique(unlist(df_tss['gene'])) res_cancer <- data.frame(matrix(ncol=3,...
39258a57a9d01c74ef19d88e446a6d3d0eb2d9b888042e60a195205abdf9aec4
R
2,747
100
######################################################## # LC project # Script to plot top snRNA-seq markers in Visium samples # Lukas Weber, June 2022 ######################################################## # module load conda_R/4.1.x # Rscript filename.R # file location: # /dcs04/lieber/lcolladotor/pilotLC_LIBD001...
723cd03fc951e0d1b6f2b4aa0518a61b681eac31c0340aee2ac44cff1c6f2ecc
R
2,749
95
# install.packages("ggplot2") # install.packages("ggsignif") # install.packages("RVAideMemoire") library(ggplot2) library("ggsignif") library(RVAideMemoire) ###Setting of the Graph### #label lab_homo = expression(paste(italic({piezo ^ {"KO"}}))) print(lab_homo) lab_hetero = expression(paste(italic({piezo ^ ...
450170868f961b6667b51fa52e36819adaea572728b3a598ca902db76c97272a
R
2,750
95
# this script will analyze degs for pathway enrichment # to run locally: # SCRATCH1=/mnt/g/scratch # docker run -it --rm \ # --workdir $HOME \ # -v /mnt/g/reference:$HOME/reference \ # -v /mnt/g/cellranger_atac_counts:$HOME/cellranger_atac_counts \ # -v /mnt/g/cellranger_multi_counts:$HOME/cellranger_multi_counts \ # -...
4fe30a9183aba2ae45fc116a575177d3d409a934b05ba8c9fef2dca7733c9246
R
2,751
94
# install.packages("ggplot2") # install.packages("tidyverse") # install.packages("ggsignif") # install.packages("RVAideMemoire") # install.packages("lawstat") # install.packages("ARTool") # install.packages("effsize") library(ARTool) library(lawstat) library(ggplot2) library(tidyverse) library(ggsignif) library(RVAid...
e0343802faeaa6d7c6d9b3c82aa0c93313455f99d467f6c3730e545bdffa5075
R
2,752
73
## conda activate r4 ## packages for data table processing library(here) library(tidyverse) library(rlang) library(writexl) ## main differential gene expression package library(limma) library(SingleCellExperiment) library(edgeR) library(swfdr) library(jaffelab) ss <- function(x, pattern, slot = 1, ...) { sapply(s...
2e38babf61aaa92f42ed4a634f0f77dcee764bfa8b112e9b3d5a2c3d442a8063
R
2,755
77
##functions to take cell data set and prepare expression and annotations matrices for ##heatmap visualization with scrattch.vis sparklines plots ###Define functions to prepare matrices for sparklines plots ---- prep_annotation_matrix <- function(cds_obj, facet_by, colors = NULL, labels = NULL){ if(is.null(labels...
832659f42b9222a04e004eac311e964ebaf1a57723ddd5688b9cc8d48c0df0c4
R
2,755
108
#####you need to install Biomart if you dont have it and load the library #source("https://bioconductor.org/biocLite.R") #biocLite("biomaRt") #source("http://bioconductor.org/biocLite.R") #biocLite("GO.db") library(GO.db) ###################### library(biomaRt) #####################Read the file name containing the gen...
cd6078a9e5c495c73692da09a189f1e479b74fea17e22cf4048f995394611bd6
R
2,756
99
######################################################## # LC project # Script to plot top snRNA-seq markers in Visium samples # Lukas Weber, June 2022 ######################################################## # module load conda_R/4.1.x # Rscript filename.R # file location: # /dcs04/lieber/lcolladotor/pilotLC_LIBD001...
16e770af29a31f493f5beadbae3e4fe393c3d202f6b3e18bdb1b99ab8ce32714
R
2,761
98
set.seed(321) # mock up some single-cell, mixture & marker data sce <- mockSC(ng = 200, nc = 10, nt = 3) spe <- mockSP(sce) mgs <- getMGS(sce) # Create SpatialExperiment spe1 <- SpatialExperiment::SpatialExperiment( assay = list(counts = SingleCellExperiment::counts(spe)), colData = SummarizedExperiment::colDat...
dbc6b698e74defe3d8f783df847541608a9a17748ffe5df45d79c803de248cf3
R
2,775
70
library(ggplot2) library(hrbrthemes) library(splines) data <- read.table("site2.txt",head=T) color <- c("grey30", "grey50", "#00CC66","#339933") ggplot(data = data,aes(x = name/1000000, y = num,group=group)) + geom_point(aes(fill = group,size=4),shape = 21,alpha=.8,size=4)+ #color = "transparent")+ #...
c82924d6304b521d1223e98071a1eb7ac87bf83d49a8f4732c6a22c2df77fb64
R
2,781
108
#####you need to install Biomart if you dont have it and load the library #source("https://bioconductor.org/biocLite.R") #biocLite("biomaRt") #source("http://bioconductor.org/biocLite.R") #biocLite("GO.db") library(GO.db) ###################### library(biomaRt) #####################Read the file name containing the gen...
aea4d73e92c08b12ffb561f3d98ed0f26f711a4ff2e671b12c812114b067cbf4
R
2,784
55
#' Sex Ratio Heatmap #' #' Given the data frame obtained after apply the \code{sexRatio} function, a #' heatmap representing the sex ratio results is obtained. #' #' @param input Data frame obtained after applying the \code{sexRatio} function. #' @param maleColor Determines the heatmap color for those comorbidities...
3649430ee20b5e3ab6384b1fdd13c71a26afd1f2cbf698f3d6d6efed25d6a760
R
2,793
91
--- title: "ENCODE cCRE Analysis" author: "Stephen P Plassmeyer" date: "12/18/2020" output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) source('../../code/mpra_tools/mpra_tools.r') ``` Prepare variants as BED format to upload to ENCODE SCREEN ```{r} variants <- fread('../../libr...
086a27a8916dbab4889144101a8e60b1c45a0f17e156f103e93e2d59645f8967
R
2,794
57
#R script for extracting mean fold-changes and deltaSVM scores args<-commandArgs(trailingOnly=T) input_prefix<-args[1] # "MPRA_minP.norm" threshold<-as.numeric(args[2]) # q-value threshold: 0.01 inputfile1<-paste(input_prefix, "txt", sep=".") inputfile2<-paste(input_prefix, "diff.pvalues.combined.sig", threshold, "t...
fb45a72080bbc96499ab39348c1afd5f5b9e26a775ab9fed8316a2337864c86d
R
2,796
74
library(dplyr) library(RColorBrewer) library(gplots) load("sc_exp.RData") load("celltype.RData") load("cell1_64.RData") load("cell1_64_2.RData") load("Single_copy_genes.RData") load("cluster_1_2_3.RData") mean2 = function(x){ mean(x,na.rm = T) } cell_list = list() for(i in 1:nrow(cell1_64)){ cur =...
72db9e229d2d3ca173e8e5199f9344c304b2f6c690879b3510a36a388e72c41b
R
2,801
72
"pwr.r.test" <- function (n = NULL, r = NULL, sig.level = 0.05, power = NULL, alternative = c("two.sided", "less","greater")) { if (sum(sapply(list(n, r, power, sig.level), is.null)) != 1) stop("exactly one of n, r, power, and sig.level must be NULL") if (!is.null(r) && is.character(r)) ...
6820c288b8ebb85b549fe92cd7a6a1f2e0209c4b126dc68d28b829306bb6e1b4
R
2,804
84
##################################################################### # LC analyses: spot-level deconvolution using cell2location: plotting # Lukas Weber, Apr 2022 ##################################################################### library(SpatialExperiment) library(here) library(ggplot2) library(viridis) # direc...
e6ac688d9274f927f93c67edca995484c062139051e5b1cc54eff2df946e6927
R
2,809
66
library(tidyverse) library(knitr) library(effects) library(psych) library(candisc) #1 = Less than $5,000 ; 2 = $5,000 through $11,999 ; # 3 = $12,000 through $15,999 ; 4 = $16,000 through $24,999 ; # 5 = $25,000 through $34,999 ; 6 = $35,000 through $49,999 ; #7 = $50,000 through $74,999 ; 8 = $75,000 through $99,999 ...
b76233db41e6df1975e9cde0558ca63ee71b7264292137c909a8a46c561790d1
R
2,812
57
## packages for data table processing library(tidyverse) library(data.table) library(here) ss <- function(x, pattern, slot = 1, ...) { sapply(strsplit(x = x, split = pattern, ...), '[', slot) } options(stringsAsFactors = F) options(repr.plot.width=11, repr.plot.height=8.5) DATADIR='data/tidy_data/compare_to_neura...
adabddb3678c8e63f64937460cd055a7b4140a87d8186c2716d5b006a1bd80d5
R
2,817
76
packages <- c("data.table","tidyverse","plyr","progress","parallel","doParallel","foreach","patchwork","lme4") # Install packages not yet installed installed_packages <- packages %in% rownames(installed.packages()) if (any(installed_packages == FALSE)) { install.packages(packages[!installed_packages],repos='http://c...
146000ae1d9ca52ec86dbe9c2c0c44bc78eeb98eb54669f63ad3cdfae306fa6b
R
2,824
71
## conda activate r4 ## packages for data table processing library(here) library(tidyverse) ## main differential gene expression package library(SingleCellExperiment) library(DelayedArray) library(HDF5Array) library(limma) library(edgeR) ss <- function(x, pattern, slot = 1, ...) { sapply(strsplit(x = x, split = p...
215ee297d1755f08663b3ec1e42da21914b3a3877ad6a51f784787356ab9b77e
R
2,834
72
#Impute with 9022 patients #Update on 7/24/21: for der_tri_rt_dx,create der_tri_rt_dx.v2, collapse the "Jan-Apr" and "May-June" # b/c one missing in age, impute with age_center instead of der_age #Update on 8/27/21: use New data library(Hmisc) library(rms) library(kableExtra) load("~/Box/CCC19_TS/48...
e7a428f89ab038e67bebfd1445149df6bc8d1b17c643b39a8bf856b2823d07f7
R
2,834
94
# install.packages("ggplot2") # install.packages("tidyverse") # install.packages("ggsignif") # install.packages("RVAideMemoire") # install.packages("lawstat") # install.packages("ARTool") # install.packages("effsize") library(ARTool) library(lawstat) library(ggplot2) library(tidyverse) library(ggsignif) library(RVAid...
9f3d5897506cae7f82f374ace81abd0ea0378c1327c2b3d1c7ea0278ed514659
R
2,850
97
# helper to record base R plot # plotNetwork() ---- # record base R plot . <- \(.) { pdf(NULL) dev.control(displaylist = "enable") set.seed(1) . . <- recordPlot() invisible(dev.off()) return(.) } # mock up some data set.seed(321) x <- replicate(m <- 10, rnorm(n <- 100, runif(1, -1, 1))) # A...
ed4f22a38bfc286d92105280b00e289249d75dc633d0bc1b6a94fb490f0b56fb
R
2,851
103
#This script reannotates spatial data by DE gene labels. Annotation is #limited by the small number of genes in the dataset, #and not all labels are fully representative, specific markers ## ----receive input from nextflow---------------------------------------------- #Get parameters args <- commandArgs(TRUE) path...
2ea45398d4cdc1649135562954b6c0be28e971f6d405b150c2df0bd30548d7e4
R
2,854
71
## conda activate r4 ## packages for data table processing library(here) library(tidyverse) ## main differential gene expression package library(SingleCellExperiment) library(DelayedArray) library(HDF5Array) library(limma) library(edgeR) ss <- function(x, pattern, slot = 1, ...) { sapply(strsplit(x = x, split = p...
11f32c26d9fdf54747e65ff3bf14e793229e149ecc9612d6e7c5883104080d93
R
2,855
50
# Import necessary libraries library(tidyverse) library(readxl) library(plotly) library(ggbeeswarm) library(cowplot) library(rvg) library(svglite) library(openxlsx) library(gridExtra) library(extrafont) library(reticulate) # Function to determine whether row is not outlier in group based on Tukey's fences isnt_out_tuk...
8ea94aa4ae3c443272ff27d0991371064e799b144d9caa28e187b6dd25808d94
R
2,857
73
#' Loads a TCGA cohort #' #' @description Loads the user mentioned TCGA cohorts #' @param study Study names to load. Use \code{\link{tcgaAvailable}} to see available options. #' @param source Source for MAF files. Can be \code{MC3} or \code{Firehose}. Default \code{MC3}. Argument may be abbreviated (M or F) #' @param ...
27db35624a559ae58267a12f9a096023b67f65f5e24124b7a301753b6734d207
R
2,861
116
#################################################### # LC project # Script for downstream analyses: thresholding spots # Lukas Weber, May 2022 #################################################### # module load conda_R/4.1.x # Rscript filename.R # file location: # /dcs04/lieber/lcolladotor/pilotLC_LIBD001/locus-c/ l...
69b4a784c3994eeb79a762bc0feb4e4d1210ff7aa80f84839cec3c7092ccbf68
R
2,861
71
## conda activate r4 ## packages for data table processing library(here) library(tidyverse) ## main differential gene expression package library(SingleCellExperiment) library(DelayedArray) library(HDF5Array) library(limma) library(edgeR) ss <- function(x, pattern, slot = 1, ...) { sapply(strsplit(x = x, split = p...
cd702da1ccdeb055baec6788bba5adcbeeb2af1aa775b0bd20594c5b06b8eb2f
R
2,862
70
#' Creates a Genotype Matrix for every variant #' @description Creates a Genotype matrix using allele frequcies or by muatation status. #' #' @param maf an \code{\link{MAF}} object generated by \code{\link{read.maf}} #' @param genes create matrix for only these genes. Define NULL #' @param tsb create matrix for only th...
8451a9bb919b0dd4b52ede330c330cb6f6a3c860039723a073ac2cdb48bc3979
R
2,866
58
#' @title FUNCTION_TITLE #' @description FUNCTION_DESCRIPTION #' @param title.size PARAM_DESCRIPTION, Default: 16 #' @param text.size PARAM_DESCRIPTION, Default: 14 #' @param axis.title.size PARAM_DESCRIPTION, Default: title.size #' @param legend.title.size PARAM_DESCRIPTION, Default: title.size #' @param strip.text.s...
c71e36151d01bc63bd797eaeb83a86da6617d929db26d3858f62ba53a82b8a4b
R
2,868
82
#' Convert gene-wise fasta files to species-wise fastas #' #' Function converts gene-wise fasta files to species-wise fastas #' (e.g., multiple sp. per one gene file) #' Relies on faSomeRecords #' Download at http://hgdownload.soe.ucsc.edu/admin/exe/linux.x86_64/faSomeRecords #' Put in /bin folder #' Add execute permi...