sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
c8fe60c392043203e0834950317625b2a5f4d2fdaa32b8dec51330b7a1f13df1 | R | 1,336 | 38 |
### -------------------------------------- ###
# Create an annotated phylogenetic tree
# N. Magielse, 2022
### -------------------------------------- ###
#------------------------------------
# Set-up
#------------------------------------
setwd("~/Documents/PhD/EvolutionPrimates/Final_code/")
outputdir <- "6.phylogen... |
2d554d6c1a39cfa6e377e4897437f120f7acb0ab6e2e41d3a8c8ba62aa567e6e | R | 1,337 | 22 | ## code to prepare `mouse_to_human_orthologs` dataset
# Get all ensembl IDs, with corresponding HGNC_symbol and entrez ID. Using latest (GRCh38.p13).
library(biomaRt)
human <- useMart(biomart = "ENSEMBL_MART_ENSEMBL", dataset = "hsapiens_gene_ensembl")
hgnc_symbols <- getBM(attributes=c("hgnc_symbol","ensembl_gene_id... |
a76d196b06f8d0efa515f82f6a7e66a56a90aab12aa42af142d1bb2331d61b79 | R | 1,337 | 36 | suppressPackageStartupMessages({
library(tximport)
library(SummarizedExperiment)
})
t2g <- read.delim("/reference/Homo_sapiens/Ensembl/GRCh38.p13/Annotation/Release_105-2021/tx2gene", header=FALSE)
lf <- list.files(pattern="quant\\.sf", recursive=TRUE, full=TRUE)
names(lf) <- basename(dirname(lf))
ti <- tximport(... |
143f4b44ab816691061491925f24a63f56cfdc71b23dabd70ad502f8a13fb2db | R | 1,339 | 26 | #' @title Assign Rows and Sample
#' @description Assign rows to columns of a matrix with maxcol_strict and subsequently sample from each column's group.
#' @param mat a matrix
#' @param size sample size
#' @param min minimum value required for a row to be assigned to a column. Default: 1
#' @param diff minimum differe... |
f66723a5ab3de6514c7ff00876d396fa411bfa8af5b5ded78a02c1f51f944f56 | R | 1,339 | 61 | ##################################################
# LC Visium analyses: SPE object for ExperimentHub
# Lukas Weber, Oct 2022
##################################################
# module load conda_R/4.2
# Rscript filename.R
# file location:
# /dcs04/lieber/lcolladotor/pilotLC_LIBD001/locus-c/
library(here)
library(... |
3bcd86cfa8c3148c1ceb40ad6d9ccc0cfcf10ae0d7e215a4b73c391e2973a9f5 | R | 1,341 | 44 | #=========================================================================
#
# Copyright NumFOCUS
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/license... |
a4660701745df5f6b0200cca01fcb7e2a1cc519efeeb3aac9f11a8041e30c10d | R | 1,341 | 60 | ## Code to run and deploy Shiny app
## Code provided by Leonardo Collado-Torres
## Available at:
## https://github.com/LieberInstitute/Visium_IF_AD/tree/master/code/05_deploy_app
library(spatialLIBD)
library(markdown)
library(here)
## spatialLIBD uses golem
options("golem.app.prod" = TRUE)
## Required to enable sh... |
5f545afd8d9176e40ab7fcbbc29aedcf28ec20986947c1a5fd736cc440744b55 | R | 1,346 | 52 | library(Seurat)
library(dplyr)
library(patchwork)
library(R.utils)
library(rhdf5)
library(hdf5r)
library(Matrix)
library(igraph)
library(SeuratObject)
library(RcppCNPy)
library(reticulate)
np <- import("numpy")
method <-'Seurat'
t<-c('10X_PBMC','mouse_bladder_cell','mouse_ES_cell','human_kidney_counts',
'Adam'... |
7d7e43cc8d49773287cef8abcd04dbf7aaee2d93abf0239788b37884280a3f47 | R | 1,349 | 44 |
#' @export
gene_id2refseq = function(ids) {
AnnotationDbi::select(org.Hs.eg.db::org.Hs.eg.db, ids, c("REFSEQ"), "ENTREZID")
}
#' @export
gene_refseq2many = function(ids) {
AnnotationDbi::select(org.Hs.eg.db::org.Hs.eg.db, ids, c("ENTREZID", "SYMBOL"), "REFSEQ")
}
#' @export
gene_id2symbol = function(ids) {
... |
e3769e372a004089772415453398c2f450833563a05ae1b84cffa6aaace8ebb2 | R | 1,349 | 31 | ---
title: "Selecting Variants for CRISPR Validation in SY5Y"
author: "Stephen P Plassmeyer"
date: "11/23/2020"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(data.table)
library(tidyverse)
```
Checking first to see which genes are expressed in SY5Y at the current pr... |
e0d281dc0981322c667bfdb23524d5f4dafe637b1c7de7e719cbefe8e917c329 | R | 1,362 | 48 | #############################
##set working directory
setwd("/restricted/projectnb/singlecell-rl/Logan_BU_Striatum_snRNA-seq")
## Milo is available from Bioconductor (preferred stable installation)
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("miloR")
#... |
fc6ece82148a0b12a437bcc4bf6a636a2b17c4de0ab06231c2b8ea5ddcaf745e | R | 1,362 | 38 | ##### load libraries #####
library(data.table)
##### get commnad line arguments #####
args <- commandArgs(TRUE)
filedir <- args[1]
if(grepl("\\/$", filedir)==F){
filedir <- paste(filedir, '/', sep="")
}
##### read files #####
eqtl <- fread(paste(filedir, "eqtl.txt", sep=""), data.table=F)
if(nrow(eqtl)>0){
snps <-... |
e1116f9a2cedc53149338c61588bfee2b387633e9d762c63f1f53b423450361d | R | 1,366 | 39 | # This model is written so that errors are appropriately trapped and
#handled when running
# using a shared memory multiprocessor
library(lme4)
# Note that lme4 functions do not report p-values. This package incorporates p-values into the output of the functions lmer and anova.
library(lmerTest)
processVoxel <-functi... |
45b5a18358084ea47fd7e5695f355b4cba12476d81e98286e03112b5dc3b5b9b | R | 1,370 | 35 | library(phylostratr)
library(tidyverse)
weights=uniprot_weight_by_ref()
focal_taxid = '85445'
strata =
# Get stratified relatives represented in UniProt
uniprot_strata(focal_taxid, from=2) %>%
# Select a diverse subset of 5 or fewer representatives from each stratum.
strata_apply(f=diverse_subtree, n=5, weight... |
8d6753e59848bd8394384f3be32455d340bc76a87ce7c26a002ed49cb55da40c | R | 1,370 | 32 | ## For prettier violin plots with the aesthetics we typically go for
library(ggplot2)
plotExpressionCustom <- function(sce, features, features_name, anno_name = "cellType",
point_alpha=0.2, point_size=0.7, ncol=2, xlab = NULL,
exprs_values = "logcounts"... |
15207def828157ddc846203a81d1de97fe02d86edf83410004ba5265255bc58a | R | 1,371 | 41 |
# Constants ---------------------------------------------------------------
# files that will be mounted into the PNET Docker container
MOUNTED_FILES <- list(
mutations = "pnet_data/mounted/mutations.csv",
cnvs = "pnet_data/mounted/cnvs.csv",
labels = "pnet_data/mounted/labels.csv",
training_set = "pnet_data/... |
622ee1ab8910da72163896b1477bcb56a87715b7de06480beddc3e8c77ca5247 | R | 1,374 | 47 | suppressMessages(library(Seurat))
suppressMessages(library(Signac))
library(ggplot2)
library(argparse)
parser <- ArgumentParser(description = "process input arguments")
parser$add_argument('--atac', action = "store", type = "character",
help = "path to snATAC-seq rds file")
parser$add_argument("--rna", action = "sto... |
521904dc4241fa5c3db145fe774911615400e8490a2dd86e7cfb3f6f2588c21d | R | 1,376 | 33 | filterCopyNumber = function(seg, tsb.dat, tempCheck, tsb){
if(nrow(seg) < 1){
stop(paste('No copynumber data found for sample', tsb, sep = ' '))
}else{
#Overlap variants with segment data
tsb.dat = data.table::foverlaps(x = tsb.dat, y = seg, by.x = c('Chromosome', 'Start_Position', 'End_Position'))
... |
a8201abba1e21a45bf319c15156c3d0978c02061fd804d1eac96e65f6a7b25ee | R | 1,379 | 57 | # load the counts of each sample
DMSO<-read.table(file = "DMSO_gene_count.tsv",header = TRUE,row.names = 1)
imatinib<-read.table(file = "imatinib_gene_count.tsv",header = TRUE,row.names = 1)
DMSO_imatinib<-cbind(DMSO,imatinib)
DMSO_imatinib<-DMSO_imatinib[-(60672:60682),]
# rename the colname to the group name
grou... |
f695a681e7b4bc08e4f51f5ca7888f152fbbe617dec1157b0b9b4d43c741e044 | R | 1,379 | 57 | # load the counts of each sample
DMSO<-read.table(file = "DMSO_gene_count.tsv",header = TRUE,row.names = 1)
Riluzole<-read.table(file = "Riluzole_gene_count.tsv",header = TRUE,row.names = 1)
DMSO_Riluzole<-cbind(DMSO,Riluzole)
DMSO_Riluzole<-DMSO_Riluzole[-(60672:60682),]
# rename the colname to the group name
grou... |
ab5b0a9008e9934353f2d54d7f9f21ca2eece21e94d9dca1754184e6018d24f6 | R | 1,387 | 35 | #' @title Quality control statistics for single cell RNA seq data
#' @description Quality control statistics for single cell RNA seq data
#' @param m expression matrix of genes by cells in non-log2 space e.g. CPM or TPM.
#' @param mito.genes character vector of mitochondrial gene names. Default: rownames(m)[startsWith(... |
395e4787d2f050ebb0f5fd86ed2538c5ea098705a978bc445d09a5d6f27c2f26 | R | 1,390 | 58 | # load the counts of each sample
DMSO<-read.table(file = "DMSO_gene_count.tsv",header = TRUE,row.names = 1)
Metformin<-read.table(file = "Metformin_gene_count.tsv",header = TRUE,row.names = 1)
DMSO_Metformin<-cbind(DMSO,Metformin)
DMSO_Metformin<-DMSO_Metformin[-(60672:60682),]
# rename the colname to the group nam... |
8bd0c7527123607c223504c5cf38793023bdc630c8f0f205af523399ab3d69e0 | R | 1,390 | 37 | suppressMessages(library(GenomicRanges))
suppressMessages(library(dplyr))
suppressMessages(library(rtracklayer))
suppressMessages(library(Signac))
library(GenomeInfoDb)
library(argparse)
parser <- ArgumentParser(description = "process input arguments")
parser$add_argument("--dapeaks", action = "store", type = "charact... |
954608d508d6795faba904de0f368181e42bc9e93c66a0b9d51bfcb1a71c06b6 | R | 1,391 | 59 | # load the counts of each sample
DMSO<-read.table(file = "DMSO_gene_count.tsv",header = TRUE,row.names = 1)
rapamycin<-read.table(file = "rapamycin_gene_count.tsv",header = TRUE,row.names = 1)
DMSO_rapamycin<-cbind(DMSO,rapamycin)
DMSO_rapamycin<-DMSO_rapamycin[-(60672:60682),]
# rename the colname to the group nam... |
a76c4b0729ed0e610a2de14b0b12676249ad494004fea6cdf42062fdf2a17c9c | R | 1,395 | 44 |
top = function(x, ...) {
UseMethod('top', x)
}
top.default = function(...) NULL
top.data.frame = function(x, n = 0.1, index = FALSE, decreasing = TRUE) {
x = as.data.frame(x)
if (n <= 1 && n >= 0) n = n * nrow(x)
ords = sapply(x, function(col) order(col, decreasing = decreasing)[1:n], simplify = F)
... |
c029db7756a2c6bc0399cbcff6c2020ebcae8d866931f188f808791631a79371 | R | 1,395 | 47 | library(data.table)
library(stringr)
library(dplyr)
packdir <- file.path(here::here(), "package/R")
import::from(.from = "cembav2env.R", .directory = packdir,
cluSumBySa2)
Sys.setenv("_R_USE_PIPEBIND_" = TRUE)
# * load L3 clustering result
L3Sums <- cluSumBySa2$loadL3Sums()
L3Resos <- cluSumBySa2$loadL3Resos()
barco... |
0c2cb7a46c79298f2e32caeec6edaad22255505274972d154bc1151180fafdb0 | R | 1,396 | 52 | # scatterplot between predicted expression from sequence and observed expression
args<-commandArgs(trailingOnly=T)
cvfile<-args[1]
d<-read.table(cvfile, stringsAsFactors=F)
svr<-d[[2]]
expr<-d[[3]]
#setup for figure
wd <- 3
ht <- 3
fig.nrows <- 1
fig.ncols <- 1
pt <- 8
cex.general <- 1
cex.lab <- 1
cex.axis <- 1
ce... |
86692741c6fdae480ead372293156df185b31cba21f1e55643f1ad2781d4bb3a | R | 1,399 | 42 |
filename1='../OscopeData/dataAdjacencyMatrixe02/WaterfallbootstrapSequential_CPUDPSF_TF_2000Boot_data_s123res_C73G9200_edgeNetwork.csv'
filename2='../OscopeData/dataAdjacencyMatrixePiDiv9/WaterfallbootstrapSequential_CPUDPSF_TF_2000Boot_data_s123res_C73G9200_edgeNetwork.csv'
filename3='../OscopeData/FirstData/Waterfal... |
21032ab08eb8e3af5a826a0d2b81ce02767198f1a35d62de19e074fd52c966d7 | R | 1,411 | 42 | com.distance <- function(old, cur) {
## Compare old and new COM distance.
delta <- old - cur
dists <- apply(delta, 1, function(x) {sqrt(sum(x**2))})
mean(dists)
}
scatter.grad <- function(x, y, z, lo, hi, ncols=20, main, leg.title='title', ...) {
## Plot 'z' at irregular x,y locations by circles of varying g... |
647130c5743535ffb39eaa5147b62b905ac21a5b79bcba82869ce55ec709e9b9 | R | 1,413 | 43 | projroot <- here::here()
rdir <- file.path(projroot, "package/R")
import::from(.from = "cembav2env.R", .directory = rdir,
cembav2env, Sa2Integration, Sa2PeakCalling)
import::from(.from = "utils.R", .directory = rdir,
fastread.csv)
allenMeta <- Sa2Integration$loadAllenAnnot()
subclassMap <- unique(data.frame(
s... |
348f3c6f89f8d01ef9bdf6fe55fe5c100f22e2612efb3c8bff841ffece8fb275 | R | 1,415 | 45 | # for HLA-B08:01, based on the patients with known existing or not information of this HLA
# plot histograms of frequency of positive TCRs and that of negative TCRs
# overlay the two histograms
library(ggplot2)
pos_file = "../data/intermediate_data/t12_HLA_I_associated_TCR_v_alleles.csv"
df_pos = read.csv(pos_file, h... |
384237fd295aa2c8975a4dae65655191071e37c0eec16f7ecbe70d22fda46322 | R | 1,420 | 44 |
# Dircom='../Communities/Networks02/'
# file='W45fastgreedy.txt'
# ont='BP'
# Nlimit=2
# plim=0.05
queryGo<-function(Dircom,file,ont,Nlimit,plim){
######
#
#Input Dircom: Directory base for the communities annotated
# file is the name of the community annotate file
# ont is the term to show enrichment (BP,... |
dc84dcf195b93bbf1bd657c5eb3e0333f6e51b3c9bc9a49bae39c89477379d46 | R | 1,424 | 48 | #############################################
# Code to load data
# old version from Space Ranger documentation
# not converting directly to VisiumExperiment
#############################################
# to run on cluster
# module load conda_R/4.0
# R
# ---------
# load data
# ---------
# Using "filtered" featur... |
b33d68212602c50956f4801ebc13d4c05bf77399da77f1c398870bee7b6741d6 | R | 1,425 | 35 | ---
title: "Sumary of results: LC Visium project"
author: "Lukas Weber"
date: "19 Nov 2020"
output:
html_document:
toc: true
number_sections: true
toc_depth: 3
toc_float:
collapsed: false
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
# Introduction
Summary of sets of... |
6884879416dcca72eda579758a9e52bd32c317ecdc685190010beb06fcb03ea3 | R | 1,440 | 25 | #' Class GISTIC
#' @description S4 class for storing summarized MAF.
#' @slot data data.table of summarized GISTIC file.
#' @slot cnv.summary table containing alterations per sample
#' @slot cytoband.summary table containing alterations per cytoband
#' @slot gene.summary table containing alterations per gene
#' @slot c... |
682b0b38aad5fbf865c94ba142803eb1335d483c02092b243c9322c076b7bc78 | R | 1,442 | 43 | library("ggseg")
library("readr")
library("dplyr")
library("ggplot2")
library("svglite")
# Author: Tobias Kaufmann, Dominik Kraft
setwd("/path/to/correlation_tables")
hbn <- read.csv("hbn_feature_embedding_corr.csv", row.names = NULL)
d1 <- hbn %>% group_by(group)
baseline <- read.csv("abcd_feature_embedding_corr_... |
7e76df04161350db2bb9d74948682d5dc3a796c9e8c0b40aea614ca99466ade7 | R | 1,442 | 34 | # set working directory
setwd("/Users/alanx/Downloads/fastqc_raw/multiqc_data")
# load library
library(ggplot2)
library(ggthemes)
library(scales)
library(gtools)
# Read in Multiqc Report
df <- read.table("multiqc_fastqc.txt", sep = "\t", header = TRUE)
df <- df[mixedorder(df$Sample),]
df <- df[seq(1,nrow(... |
56b013867dc31a2733eeaa395c1ced11fbb5d28ef0886b914b1cabf9454c97bf | R | 1,446 | 41 | rm(list=ls())
library(tidyverse); library(RCurl); library(ez); library(lme4); library(car);
library(lmerTest);library(ggeffects); library(ggplot2);library(stringr);library(devtools);
library(ggiraphExtra);library(RColorBrewer);library(MuMIn)
DATA <- read.csv(str_c('fnfa246_6-13.csv'),
stringsAs... |
3ceb77c90b2b6779faba6d4aa98a2668d49185692150f28c70f2d5f144bb2604 | R | 1,448 | 38 | # R script that calculates p-values for differential activity between alleles
#
# This script is based on "RBC_MPRA_CELLv1.Rmd" and optimized by Dongwon Lee
args<-commandArgs(trailingOnly=T)
inputfile<-args[1] # MPRA_minP.norm
exptype<-args[2] # CTRL or GATA
output_prefix<-gsub(".txt$", "", inputfile)
MPRA_minP.mel... |
4c406d7066ff9ff49987a5620dd8792a02a3698c9fc5f8a74f1efff03261181c | R | 1,449 | 26 | #Code to create SNP6 loci used by `gtSNPs()`
#Files are located at: https://github.com/CompEpigen/ezASCAT/blob/main/inst/extdata/GRCh*_SNP6.tsv.gz
library(data.table)
#hg38
download.file(url = "https://api.gdc.cancer.gov/data/77fbfff6-2acc-47ca-a5f6-c488beb46879", destfile = "snp6.na35.liftoverhg38.txt.zip")
unzip(zi... |
206ffc8302269a49d2cb1aa8a4eeffb45c6ab2fe3976091b15ec401487dba759 | R | 1,452 | 42 | cwd = '/home/knight/PRJ_Error'
setwd(cwd)
library(mlogit)
#library(hdf5r)
library(R.matlab)
library(stringr)
library(ordinal)
data_file <- 'data/GRP/stats/EpnRPE_DifFB_mLME_st0t6_WL05_WS25_HGm_F25t121_zbtS_sm0_l1_wn50_hfa_chancoef.mat'
beta.chan <- readMat(data_file)$beta.chan
chancat.ix <- beta.chan[[13]]
chancat.l... |
870d220cb27fe264f4cb6ea27f58ef7e371abe4c18a853533ab1aee116c4a5ef | R | 1,453 | 51 | set.seed(321)
# x_path <- paste0(system.file(package = "SPOTlight"), "/extdata/image.png")
# x_path <- "../../inst/extdata/SPOTlight.png"
x_path <- paste0(system.file(package = "SPOTlight"), "/extdata/SPOTlight.png")
# plotImage() ----
test_that("plotImage path", {
# image
x <- x_path
plt <- plotImage(x = ... |
3a4dbe8e826297967df221d3146c56a752fcb0290d7345ddf5df5353bc3a78fa | R | 1,461 | 45 | rm(list=ls())
library(Oscope)
library(SingleCellExperiment)
customlib='/OscoNet/R/CustomLibrary.R'
source(customlib)
####Setting Input Parameters
options(stringsAsFactors = FALSE)
OsconetInputdir="/OscoNet/YourDataset/OsconetInput"
meancutlow=1
alpha=0.2 #when alpha=alphacut=0.95 zero filtering does not filter out an... |
1864f281707b89ef4450d7dfe1fa47d1eccdef390fe67d4e84a778806817c144 | R | 1,464 | 52 | suppressMessages(library(Seurat))
suppressMessages(library(Signac))
library(ggplot2)
library(argparse)
parser <- ArgumentParser(description = "process input arguments")
parser$add_argument('--atac', action = "store", type = "character",
help = "path to snATAC-seq rds file")
parser$add_argument("--rna", action = "sto... |
8fe3f8e1329305e94d6c50f61e8d0a90442f0329192f481bf0b0ba5ed1525be7 | R | 1,490 | 47 | library(ape)
#doanloading eleven Caenorhabditis species from WormBase Parasite website
species = list.files("path",pattern="fa")#eleven species protein file
fa <- list()
for(i in 1:length(species)){
fa[[i]]<- as.character(read.FASTA(paste0("path",species[i]),type="AA" ))
}
fanames <- list()
fanames2 <- list... |
5fe599fc9e54c7c6f664b0944b67f8672148183ef044fd565fd469833904cf27 | R | 1,493 | 36 | plot_MA = function(featureNames, logCounts, logFoldChange, FDR, xlab="logCounts", ylab="logFC", title="MA plot", pch=20, top_gene_labels_show=20) {
plot(logCounts, logFoldChange, col=ifelse(FDR<=0.05, "red", "black"), xlab=xlab, ylab=ylab, main=title, pch=pch);;
text(logCounts[1:top_gene_labels_show], logFold... |
dbb7aad8a5e2e2bd0d07f6734c45fe5b136b67be5192f178d7ec496b3a424c1a | R | 1,493 | 46 | genome <- 'mm10'
chrom_sizes_f <- '/home/hpc/bonev/annotations/mm10/mm10.chrom.sizes'
outdir_f <- '/home/hpc/bonev/projects/hic/test/data/extractedBins/washU/'
sample <- 'ES'
trackdb <- paste0("/home/hpc/bonev/trackdb/",genome,"/")
require(misha)
require(plyr)
require(dplyr)
gsetroot(trackdb)
gdb.reload()
chrs <- c(1... |
7cd8badaeebcb53d5f983b64d0bdeca3069716bde930ecefd272ce661568226c | R | 1,503 | 34 | ##################Principle Component Analysis##################
setwd("/Users/adityanatu/Library/Mobile Documents/com~apple~CloudDocs/Project_2023/Juliet_Data_Analysis/BV2_Juliet_Cell_Proteome_Analysis/R Code File/")
cleanDat.original_test <- as.data.frame(cleanDat)
cleanDat.original_test <- apply(cleanDat.original_te... |
aa5a1e9b37ea9dba8a9b8ddef3606b40e3a176a8c87cc59c2be4d8fe2f131e9e | R | 1,504 | 33 | # Read buildings or the road network from one PBF with osmextract and print "seconds,features".
#
# osmextract_benchmark_scaling.ipynb runs this as a separate process wrapped with /usr/bin/time
# so its peak memory (peak resident set size) can be measured the same way as the Python readers
# in benchmarks_scaling.ipynb... |
b38b39740e47b23bb5404e31edfa475f50278247bd2ac967d464a095d64ed453 | R | 1,504 | 65 | library(ggplot2)
# load the data
#load the phenotype table
pdata=read.table("phenotype_dopamine.txt",sep = "",row.names = 1)
# load the expression data
edata=read.table("expression_dopamine.txt",sep = "",row.names = 1)
# table for factor/character variables
pdata$group=as.factor(pdata$group)
table(pdata$group)
# re... |
cd06c6cc977947af1baa7ae4bc81ce2e33f9c24245031379ad53301161f76379 | R | 1,515 | 46 | #' @rdname plotImage
#' @name plotImage
#' @title Plot JP(E)G/PNG/Raster/RGB images
#'
#' @description This function takes in an image-related object - path to
#' JP(E)G/PNG file, raster object, RGBarray. It returns a ggplot object with
#' the selected image.
#'
#' @param x A variety of objects can be passed: chara... |
01cb078191eba8eb54f3fb6f9ece041db41e746d333280d192c942a25b8f5460 | R | 1,516 | 61 | pValueEstimation <- function(input, nboot = 100, ncores = 1, verbose = FALSE) {
url<-"https://www.disgenet.org/api/gene/source/CURATED?format=tsv"
dataTsv <-
RCurl::getURLContent(
url )
myTextConnection <-
textConnection( dataTsv )
res <-
read.csv(
myTextConnection, header... |
f2580ec67e0a1b4e2fc5db85a83d7cf6f2935871795b85feaddf306e8396d837 | R | 1,517 | 39 | # This function is copied from this repository:
# https://github.com/BioSysLab/deepSIBA
# This repository is part of this publication:
# https://doi.org/10.1039/D0MO00129E
# It is not modified or changed apart from
# adding some comments for explanation.
# This function takes as input: (i) a numeric table (num_table... |
f86d14257f82f908142e7c8b44dc88f200f8bd0cf4f1f798905787eb720d7466 | R | 1,526 | 54 | library(Seurat)
library(dplyr)
library(patchwork)
library(R.utils)
library(rhdf5)
library(hdf5r)
library(Matrix)
library(igraph)
library(SeuratObject)
method <-'Seurat'
t0<-c('10X_PBMC','mouse_bladder_cell','mouse_ES_cell','human_kidney_counts',
'Adam','Human_pancreatic_islets','Macosko_mouse_retina')
for ( i i... |
d8e5810eac68e99eb7de7a0001bdc837531d5e19a433cd7f5a7203d788245e54 | R | 1,539 | 33 | library(data.table)
# Feedback from Hanqing
## {"AMY-1": "AMY-2", "AMY-2": "AMY-1"}, {"ACB-2": "CP-1", "CP-1": "ACB-2"}
## 1. AMY那个我不确定是我们谁反了,因为cell-type 比较像,但我们肯定是不一样的。
## 2. CP那个应该是ATAC 反了
# For current sample data we have
## ACB-2: 4E, CEMBA180110_4E and CEMBA180111_4E
## CP-1: 4D, CEMBA171214_4D and CEMBA171219_4... |
3123bec7bfb661ed21e244aeb4980e14e73fae6f194dd2f06c2cde6f1fcc6b5f | R | 1,559 | 52 |
#' @title FUNCTION_TITLE
#' @description FUNCTION_DESCRIPTION
#' @param group PARAM_DESCRIPTION, Default: NULL
#' @param m PARAM_DESCRIPTION, Default: NULL
#' @param p PARAM_DESCRIPTION, Default: c(0.01, 0.001, 1e-04)
#' @param center.rows PARAM_DESCRIPTION, Default: TRUE
#' @param lfc PARAM_DESCRIPTION, Default: log2... |
a94113d476f525be85cf45fa3aa95978f56a2d0ae5f65f5dcf62e513d65b35fa | R | 1,559 | 38 | #' @title Get unique sample names
#' @description Extract unique sample names from cell ids
#' @param x character vector of cell ids
#' @param sep separator Default: '-|_'
#' @param pos position of sample name given separator. First position is 1. Default: 1
#' @param max.nchar maximum number of characters to take as s... |
05708b093f00c8f1b6a0508d72fd8a2443e6e12f0b55ab613092d4a99f8f4d6c | R | 1,577 | 57 | newSleepDataEtho <- function(data, sleep.def = 5, bin = 60, t.cycle = 24) {
pre.raw <- data[,-c(1)]
raw <- pre.raw[,colSums(is.na(pre.raw)) != nrow(pre.raw)]
raw[,1:length(raw[1,])][raw[,1:length(raw[1,])] < 1] <- -1
raw[,1:length(raw[1,])][raw[,1:length(raw[1,])] >= 1] <- 1
raw[,1:length(raw[1,])][raw[... |
1fc52b044e7b5fdf1801130184bdfa8e4a32a863a315f800ee4b20d3897ebe97 | R | 1,577 | 50 | # this code does survival curves for clusters from step8_dist_cluster.ipynb
# with method = wald and
# (1) height cutoff at 1.6 for DePTH set-based distance matrix
library(survival)
library(survminer)
# (1) height cutoffs 1.6 for DePTH set-based distance matrix
set_file = "../results/depth_draft/step8_chowell_20... |
106434a00836c9b8eeab30301f0a47470370fd36ac2e332fb27e9667e50446ec | R | 1,580 | 44 | #' The CHOCOPhlAn_taxonomy data
#'
#' The CHOCOPhlAn_taxonomy data is used for the parsing the 'HUMAaN' metagenomic results and add the taxonomy hierarchical information to the 'tax_table'.
#'
#' @docType data
#' @keywords data.frame
#' @name CHOCOPhlAn_taxonomy
#' @usage data(CHOCOPhlAn_taxonomy)
NULL
#' The ncyc_map... |
daad350766263837cd95ef22ea9cf4ac106a771f0d6b980086bd4f41aaa3c4a4 | R | 1,581 | 37 | library(dplyr)
library(ggplot2)
library(ggnewscale)
library(cowplot)
# Calculate the count of rows per Age and Dataset
pop_norms_count <- pop_norms %>%
group_by(Age, Dataset) %>%
summarise(count_rows = n(), .groups = "drop")
# Merge the count_rows data with the original dataset
pop_norms <- left_join(pop_norms, p... |
dcf2565cd441cbfc5d86ec7ee856e0684329994e365f37f91b190ecfe4d1af1e | R | 1,583 | 44 | #' Function to align raw reads to reference genome
#'
#' TODO: add description
#'
#' @param ref path to reference genome (genome will be indexed if not already)
#' @param reads path to raw reads file (PE)
#' @param cores how many cores to use for BWA MEM
#' @param ram how much RAM (GB) to allot to BAM file output
#' ... |
a4493c22507bc028bbf348edae7a82909df155221dc9cf88fb86b642415b6df7 | R | 1,592 | 43 | ##########################################################################################################################
# Analysis using nnSVG in the comparison
#
# Ref: https://bioconductor.org/packages/release/bioc/html/nnSVG.html
# https://bioconductor.org/packages/release/bioc/vignettes/nnSVG/inst/doc/nnSVG.html... |
0fa0241d714455580de607d3941c93406ff0a4e928e0a77866f0df439488ec8c | R | 1,598 | 63 | .overlap = function(x,y) {
length(intersect(x,y))
}
#' @title FUNCTION_TITLE
#' @description FUNCTION_DESCRIPTION
#' @param x PARAM_DESCRIPTION
#' @param y PARAM_DESCRIPTION, Default: NULL
#' @param simplify PARAM_DESCRIPTION, Default: TRUE
#' @return OUTPUT_DESCRIPTION
#' @details DETAILS
#' @examples
#' \dontrun{
... |
00a812e2a4f706e301efab999a0ecc3780dd10fe65155047a7ad375c4acd8cba | R | 1,599 | 41 | args<-commandArgs(trailingOnly=T)
input_prefix<-args[1] # "MPRA_minP.norm"
threshold<-as.numeric(args[2]) # q-value threshold: 0.01
controls <- c("1 155271258",
"X 55054634",
"X 55054635",
"X 55054636",
"10 127505272")
library(qvalue)
fn1<-paste(input_prefix, ... |
5623a41ae04db51035a47930c55a93d8c0df3c3b198766705315019417cc9457 | R | 1,599 | 28 | #' Writes GISTIC summaries to output tab-delimited text files.
#'
#' @param gistic an object of class \code{GISTIC} generated by \code{readGistic}
#' @param basename basename for output file to be written.
#' @return None. Writes output as tab delimited text files.
#' @seealso \code{\link{readGistic}}
#' @examples
#' a... |
bcef7179ac70dc07b0e193914d2211ebfb107d5278093fc168b59d9a715fb799 | R | 1,601 | 55 |
.check_arg <- function(arg) {
# x should contain one character vector only.
if (is.list(arg) & all(lengths(arg) >= 1)) {
stop('Please provide a single character vector.')
}
}
.arg_is_args <- function(arg) {
# TRUE if there is more than one char. vector in arg
arg = ifelse (is.list(arg) & all(lengt... |
8531cfbb999ddaab331587e51fd2b59ee15937bb0f9917cde9681907cdaffb0a | R | 1,608 | 51 | ---
title: "Bed_file_Genes_and_DEG_generation"
author: "F Mastropasqua"
date: "10/5/2022"
output: html_document
---
```{r}
knitr::opts_chunk$set(echo = TRUE)
```
```{r}
library(dplyr)
library(ggplot2)
library(BiocManager)
```
```{r}
genes <- read.delim("./HiC_files/genes_annotated_GRCh37.bed")
gene_bed="./HiC_file... |
e891362e99056d6924cfda176df1a1600a8f39d971b0d08cf4941f88d967581c | R | 1,608 | 61 | #!/usr/bin/env Rscript
# to run locally:
# SCRATCH1=/mnt/g/scratch
# docker run -it \
# --workdir $HOME \
# -v /mnt/g/ckd:$HOME/ckd \
# -v $HOME:$HOME \
# -v $SCRATCH1:$SCRATCH1 \
# -e SCRATCH1="/mnt/g/scratch" \
# p4rkerw/sctools:R4.1.0 R
library(Signac)
library(Seurat)
library(JASPAR2020)
library(TFBSTools)
librar... |
2184b32fecf685936f0f4c2316bc1775a09374f544da0dd98fc6aaed45f6d255 | R | 1,612 | 46 | ##########################################################################################################################
# Analysis using SPARK in the comparison
#
# Ref: https://xzhoulab.github.io/SPARK/
# https://xzhoulab.github.io/SPARK/02_SPARK_Example/
#
# Usage:
# Rscript spark.r /home/wangjue/svgGranularity/By... |
08c1d01e8410392d391f376a9b1c4579f7f77bbe0de900d9646c4307c1259b40 | R | 1,615 | 61 | ###Function to compare expression signatures
#Reference signature will be gene vector with avg expression
#Query signatures will be a gene by sample matrix (r x c)
#Sample could be age, binned pseudotime...
#Query and reference ids should be same format
#center and scaling occurs within genes
require(lsa)
signat... |
783941ab2cacab9354689b8779270366f2a5341e4a87fad86e9fa5726e274f5c | R | 1,618 | 45 | library(tidyverse)
library(rlang)
Sys.setenv("_R_USE_PIPEBIND_" = TRUE)
projdir <- here::here()
rdir <- file.path(projdir, "package/R")
import::from(.from = "cembav2env.R", .directory = rdir,
cembav2env)
atacMeta <- readRDS(cembav2env$sa2metaFile)
rownames(atacMeta) <- atacMeta$barcode2
barcode2pL4_nn_fnm <- file.p... |
59da0d1b72a1882f71b7329d5670c2abefd4be9dbb8a22a1b989658f08ec634e | R | 1,619 | 44 | context("Deconvolution methods")
test_that("Deconvolution methods", {
# load data
load_ABIS()
for(m in get_decon_methods()){
# tpms
mat <- round(matrix(rexp(200, rate=.01), ncol=20))
len <- round(matrix(rexp(10, rate=.001), ncol=1))+10
tpm <- get_TPM(mat,as.vector(len))
... |
bc26a6f7faf38ee149868618a8a09b26cfdbed6895dfaf6139dd75aaf44ca9e5 | R | 1,621 | 26 | #' @title Strict Column Assign
#' @description For each column, returns a vector of the rownames whose values were highest. The "snobby" part comes if the user provides values for min and diff, which require that a row's max value be higher than or equal to <min> and with a difference greater than or equal to <diff> in... |
df3de132570fdf3f674364007d67522b0393519eac9551037aa7324ca39e081c | R | 1,626 | 41 | # This model is written so that errors are appropriately trapped and
#handled when running
# using a shared memory multiprocessor
library(nlme)
processVoxel <-function(v) {
BRAIN <- voxeldat[,v]
e <- try(mod <- lme(BRAIN ~ Finger+Foot+Lips+WhiteMatter+X+Y+Z+RotX+RotY+RotZ, random=~1|idnum, method=c("ML"), na.a... |
585ac70d99dea24eaf190a1e9e66bd1c263fdf63de6f20b57943a35ced0d3859 | R | 1,627 | 47 | library("splatter")
library(rhdf5)
set.seed(0)
# ----------------Generate the simulation data using Splatter package------------------
# Set the number of cells to 5000
# Set the number of genes to 6000
# Set the number of groups to 5
params = newSplatParams()
cells = 5000
genes = 6000
d = 3.15 #0.8 # d=3.9 #0.85 # ... |
209612a2d9a8f49b195aabd168688f8e5843fbb564e7237b11bb517c3795d46b | R | 1,629 | 44 |
#' @title Convert sc-matrix to simulated bulk
#' @param m non-row-centered logTPM or TPM matrix.
#' @param groups if not NULL, return a simulated bulk column per group in groups. Default: NULL
#' @param isLog set to FALSE if 'm' is in TPM form. Default: TRUE
#' @return simulated bulk matrix. If groups is NULL, one co... |
2231ca58ce4d67ecd3032179a511ae217a9f6d9f063e055a50f920a543a7565d | R | 1,629 | 56 | # density plots for autosomal chromosomes
library(dplyr)
library(ggplot2)
library(here)
library(gridExtra)
multi_counts <- readRDS(here("ckd","multi_aggr_prep","step3_multi_counts.rds"))
# select barcodes that passed qc
meta <- readRDS(here("ckd","multi_aggr_prep","step3_meta_multi_loy.rds"))
multi_counts <- multi... |
97e8d0d2a06302c5189b73fd098fa080d75d8101d7c9b7f1e3a0524047b4a082 | R | 1,635 | 67 | # Demo for running ALRA.
source('../pkgs/ALRA/alra.R')
library(dplyr)
library(magrittr)
library(hdf5r)
library(rhdf5)
library(Matrix)
library(RcppCNPy)
library(reticulate)
np <- import("numpy")
set.seed(0)
t <- c("0.9","0.95","0.8","0.85")
method <- "ALRA"
for ( i in 1:length(t)) {
print(t[i])
name <-t[i]
#A's ... |
641a69b20a0dd57079450dbfb251e680e1fe882673557d322c1b10b58ae96803 | R | 1,637 | 44 | # 05/18/2023 Fengyao Yan
# Plot the prediction results for patient 2224 with Deep Learning and NNLS
library(ggplot2)
dat_nnls <- read.csv('../../data/2224/res_2224_nnls.csv', row.names=1)
dat_deep <- read.csv('../../data/2224/patient_2224_v2/res_2224_dl.csv')
tissues <- c('Brain', 'Lung', 'Skin')
months <- c('0 mont... |
7067130ad7b108fff6f60715a26eeb25d420878dbb1f67884e410234ae46562d | R | 1,643 | 58 | library("lme4")
library("mediation")
dat <- read.csv("~/forstatfile.csv",
colClasses = c("numeric","numeric","numeric","numeric",
"numeric","numeric","numeric","numeric"))
dep_vars = list('attention', 'memory', 'executive')
# loop for latency
coeffs = matrix(, nrow = 3,... |
83bbcaece53183053726d186e73fa48c9645ab9d6e350d2e9c287b1daa785fbc | R | 1,652 | 39 | "pwr.chisq.test" <-
function (w = NULL, N = NULL, df = NULL, sig.level = 0.05, power = NULL)
{
if (sum(sapply(list(w, N, df, power, sig.level), is.null)) !=
1)
stop("exactly one of w, N, df, power, and sig.level must be NULL")
if (!is.null(w)){
if (is.character(w))
w <- cohen... |
68142920a9cca20c9fa8dcb0ec6f863bbaf2e27ee4daf63c4a25f3cf123cc65c | R | 1,654 | 85 | ####################################
# LC Visium analyses: gene filtering
# Lukas Weber, Oct 2022
####################################
# module load conda_R/4.2
# Rscript filename.R
# file location:
# /dcs04/lieber/lcolladotor/pilotLC_LIBD001/locus-c/
library(here)
library(SpatialExperiment)
# ---------
# load da... |
c002804fa92a679a2748b2dc984f9eedad140f8ec7c661bc991028db1c7e1b82 | R | 1,665 | 45 |
# This code is to calculate the CV of the MRS data
# WANG. 24-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")
# Read in the tsv fi... |
ea14342b05e87832c2b0f7a331a9873d726ebb65e50887c84dcd8d98c44029c6 | R | 1,669 | 38 |
#' @title Cell state hierarchy coordinates
#' @description Cell state hierarchy coordinates
#' @param m matrix of cell state scores (cell rows; state columns)
#' @param quadrants option to find pmax of a subset of columns and use this as a state quadrant. pass argument in the form of a list of character vectors (colum... |
5f1ea3a3cd96ffef129ac4f188d4da95fc6b2447fd74f0164193a1a0268035fa | R | 1,670 | 55 | # Prepare data for nmf.
# TODO: This script can be generalised.
# Currently, I use it case by case.
library(data.table)
library(hdf5r)
packdir <- file.path(here::here(), "package", "R")
import::from(.from = "cembav2env.R", .directory = packdir,
cembav2env)
# * configs
outdir <- "data"
outh5 <- file.path(outdir, "cp... |
8b605b85b0a31c8f05a9f1a8cd81bb79b3880609e17465494d08a3dc6a61d8f4 | R | 1,673 | 49 |
# This code is to calculate the CV of the MRS data
# WANG. 24-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")
# Read in the tsv... |
511d4cd8f333347d2df62f8a1d776eb73c8654510449f79643d73075f5ff44b4 | R | 1,677 | 18 | #' 205 Signatures for Normal Cell Types
#'
#' Signatures were derived from 5 publications (below). Clusters were taken from each publication, and differentially expressed genes were computed for each cluster using scalop::dea. If the publication had subclusters, then scalop::dea was computed for that subcluster against... |
a15476e33736d66d5f0b826c03f5b067d866ecf2caea82b4a8945303a4d73f9a | R | 1,677 | 48 |
# This code is to calculate the CV of the MRS data
# WANG. 24-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")
# Read in the tsv ... |
7e6c42b337f850aba8361e14e9aa4e80585798eea493afc259d2f403314acd43 | R | 1,683 | 67 | QC-Report
========================================================
```{r echo=FALSE}
args<-commandArgs(TRUE)
input=args[1]
suppressPackageStartupMessages(library(geneplotter))
suppressPackageStartupMessages(library(RColorBrewer))
data = read.table(input, header = FALSE, sep="\t")
data[, 11] <- as.numeric(... |
b97f614f4c07c4c24f27745f90e60d1b1b0d1419831620a3011b044939774dc6 | R | 1,684 | 51 | #-----------------------------------------------
# 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 ... |
4a51b685fdef7f1e045c2c1d4d4295fe5629eefcecc993ab4812e6b443d5e62f | R | 1,688 | 18 | #' 98 Signatures for Normal Brain Cell Types
#'
#' Signatures were derived from 5 publications (below). Clusters were taken from each publication, and differentially expressed genes were computed for each cluster using scalop::dea. If the publication had subclusters, then scalop::dea was computed for that subcluster ag... |
53ddac317653652d91cd2b096a11f38506205b98a190776f152df15ce08cda5c | R | 1,690 | 58 | #' Extracts Tumor Sample Barcodes where the given genes are mutated.
#'
#' @description Extracts Tumor Sample Barcodes where the given genes are mutated.
#'
#' @param maf an \code{\link{MAF}} object generated by \code{\link{read.maf}}
#' @param genes Hogo_Symbol for which sample names to be extracted.
#' @param justNam... |
86d31a61ddd309f131abea2a87e176cfdab0da74daebe0ca89bd6cc7a9ff12f9 | R | 1,701 | 61 | # found at: http://augix.com/wiki/Make%20trees%20in%20R,%20test%20its%20stability%20by%20bootstrapping.html
# modified slightly to return tree and bp in list, and default to NJ method.
boot.tree <- function(data, B = 100, tree = "nj") {
library(phangorn)
if (tree == "upgma") {
func <- function(x) upgma... |
58fa1efa80b8a77c8325e274acff87dd65316fdf8dcb63ad23b9d2b7897a590f | R | 1,705 | 62 |
library("SingleCellExperiment")
library("iSEE")
library("shiny")
library("paletteer")
library("scuttle")
library("SpatialExperiment")
sce <- readRDS("LC_singleNucleus_SCE_EHub.rds")
## Make unique gene names
rownames(sce) <-
uniquifyFeatureNames(rowData(sce)$gene_id, rowData(sce)$gene_name)
source("initial.R", pr... |
418b12c7fb76a595be9fabb31f26192ddefb19c4c72de212b5c645d984b4d3b5 | R | 1,708 | 64 | ---
title: "R Notebook"
output: html_document
---
Patterns were learned on the 6mo MENs and the gut cell atlas was projected into them. Now look at the subset of non-fetal healthy samples and visualize the pattern usages
```{r, message = FALSE, results = 'hide'}
library(monocle3)
library(dplyr)
library(here)
source(... |
9044c1e7c2439a6cf6878d7a67a4422b6b994f9a687b7e7b7500186b8ac0c40d | R | 1,713 | 45 | ### summary statistics for dealing with duplicated gene names in exprssion matrix
#' @title Aggregate duplicate gene rows
#' @description Aggregate duplicate gene rows. Duplicate rows are collapsed into one by taking the colSums, colMeans, colMaxs or colMedians.
#' @param m matrix with genes as rows
#' @param stat sta... |
e0729eea5bbeae67950fb76d585406ffb421601057a529ca5b23a93af59dc7aa | R | 1,715 | 49 | library(enrichR)
library(viridis)
dbs <- c('GO_Biological_Process_2023','GO_Cellular_Component_2023',
'GO_Molecular_Function_2023', 'KEGG_2019_Mouse')
wrapText <- function(x, len) {
sapply(x, function(y) paste(strwrap(y, len), collapse = "\n"), USE.NAMES = FALSE)
}
celltype <- "all"
ranked <- read.csv("~... |
c617224ad7ff5d1b3b58b042705af3cafb6aa974dc625c0f4c6c8e33def71fcc | R | 1,727 | 56 | #!/usr/bin/env Rscript
suppressMessages(library(argparse))
suppressMessages(library(devtools))
suppressMessages(library(pROC))
parser = ArgumentParser(description="Calculate AUC for Pgen or Pvae in a cross-fooling comparison.")
parser$add_argument('--pvae', action='store_true', help="We are processing Pvae, rather t... |
9a806e71ee8c8deb5554c836b0b5c6c5f6adaed685b3b2fcae8e3652a4af736e | R | 1,738 | 65 | library(parallel)
library(doParallel)
library(doRNG)
library(foreach)
nCore = 4
#nCore = Sys.getenv("SLURM_CPUS_ON_NODE")
registerDoParallel(cores=nCore)
options(mc.cores=nCore)
RNGkind("L'Ecuyer-CMRG")
data_dir = "../../data/intermediate_data/"
tcr_file = "t5_public_allele_level_tcr_filtered_wrt_vf_and_aa.csv"
h... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.