sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
a9f98a0b8eb79515fafcd350f9d9bdb672ed14cbd9571882390c4d36fb701c8d | R | 3,149 | 131 | #!/usr/bin/Rscript
#Rscript script common-path jaspar-dir id output
#example:
#Rscript pwmmatch.r /cluster/thashim/basepiq/common.r /cluster/thashim/basepiq/pwms/jaspar.txt 141 /cluster/thashim/basepiq/tmp/pwmout.RData
options(echo=TRUE)
args <- commandArgs(trailingOnly = TRUE)
print(args)
commondir = args[1]
jaspard... |
635fe204157058dcd1894af4025c23a6be1195295c04ee20b9fd6c006e0e5810 | R | 3,151 | 74 | setwd('Z:/Documents/sdata_backup/Shen/iv.ABCD/release2.0.1/AdolescentMDD/')
source('FUNs/PheWAS_style_p_plot.R')
source('FUNs/wholeB_correction.R')
# Settings
load('result/x.Supplementary_materials/YouthDepree_WM_subcor_FS_CovMRImanufacturer.RData')
res.1=result.YouthDepre.region.covWholeB
load('result/i.Main... |
8ab3cc147c8e9601356a175833ddc88015a446347d31d71ede8d47c39a5961a8 | R | 3,167 | 74 | setwd('/gpfs/igmmfs01/eddie/GenScotDepression/shen/ActiveProject/ImagingProject/Adolescent_MDD_brain')
source('FUNs/PheWAS_style_p_plot.R')
source('FUNs/wholeB_correction.R')
# Settings
load('result/x.Supplementary_materials/YouthDepree_WM_subcor_FS_covCBCLotherConditions.RData')
res.1=result.YouthDepre.region... |
68706d4c8bcec3d76ee858e6faa99924c042696f65dcf35419728b4c3cca6f9c | R | 3,178 | 76 | #' Import function to read the output of picrust2 as phyloseq object
#'
#' Import the output of picrust2 into phyloseq object
#'
#' @param feature_tab character, file path of the prediction abundance table of
#' functional feature.
#' @param sam_tab character, file path of the sample meta data.
#' @param trait cha... |
0e08c866f982714288a7372b112edea9c37a0e99d289eeed6edb32130b230916 | R | 3,182 | 65 | library(dplyr)
setwd('/exports/igmm/eddie/GenScotDepression/shen/SData/UKB/iv.ABCD/release2.0.1/FamilialRisk_PGRS_MDD')
tab.dat.dir='/exports/igmm/eddie/GenScotDepression/shen/SData/ABCD/release2.0.1/iii.data'
# merge and save the master file ----------------------------------------------------------------------
di... |
8034da922fd30fb2f55aec00eab50fc28a260c6ff8c0b09ff5c21dd1fa3f44db | R | 3,231 | 81 | run_model <- function(ls.mod,mod.dat_short,mod.dat_long){
# define vars
mod.dep = as.character(ls.mod[1])
mod.factor = as.character(ls.mod[2])
mod.covs = as.character(ls.mod[3])
mod.type = as.character(ls.mod[4])
# run model
if (mod.type=='lme'){
# model.expression
fh_r=1:... |
462914daf311c5e742100eeaa0142ed8286a7902df77f229d6e56c1cc23dd0ba | R | 3,268 | 69 | # Basic setups ------------------------------------------------------------
library('dplyr')
library('pbapply')
library('nlme')
library('stringr')
setwd('/exports/igmm/eddie/GenScotDepression/shen/ActiveProject/ImagingProject/Adolescent_MDD_brain')
# Load data ---------------------------------------------------------... |
11e4f47571eaf14244551ea45dd11f04fb869b1adee1b06f7eea84a7c2e4687d | R | 3,326 | 134 | library(lubridate)
library(DT)
library(zoltr) ## devtools::install_github("reichlab/zoltr")
library(scico)
source("../processing-fxns/get_next_saturday.R")
library(tidyverse)
library(htmltools)
library(covidHubUtils)
theme_set(theme_bw())
library(crosstalk)
library(plotly)
print(sprintf("weekly report generation, %s",... |
ebfe3a29b9b8d8c402bff8a433d2bac1ac35c8ad63f5cd645b3ef8dab32664c3 | R | 3,328 | 72 | reg_phewasStyle <- function (ls.models,dat_short,dat_long,correctByFactor=F){
run_model <- function(ls.mod,dat_short,dat_long){
# define vars
dep = as.character(ls.mod[1])
factor = as.character(ls.mod[2])
covs = as.character(ls.mod[3])
mod.type = ... |
35dd04da5a695de9521c6a9cd3d804752e4232f73fae11afacaa6d6bff1af73d | R | 3,360 | 113 | ions.to.spectra.loss.budding = function(ions, carbamidomethyl = TRUE, charge = NA, lossRatio = 0.9, budding = 5e-3, budding.type = c('b', 'y', 'bp', 'yp'), budding.charge = c(1, 2), ...) {
lapply(ions, function(x) {
if (is.null(x$charge)) {
x$charge = charge
}
mz = fragment.ions.mz.1(
x$p... |
be95b73e1a6f5345334bd29dda4ed6251fb5e164efdb455cccbaa50cd53c2438 | R | 3,384 | 83 | library('ggplot2')
library('Hmisc')
library('ggpubr')
library('dplyr')
setwd("Z:/Documents/sdata_backup/Shen/iv.ABCD/release2.0.1/AdolescentMDD")
load('result/x.Supplementary_materials/bidirectDiffs_YouthDepression_envVariable.RData')
fig.result=filter(result,p.corrected<0.05)
fig.result=fig.result[order(fig.result$b... |
d87dbd6ed0cac915e82f6441b95bfa45b674aaf2406366cf8afdac2d19ea499e | R | 3,469 | 88 | library("lme4")
library("ggplot2")
library("lsmeans")
library("car")
library("doBy")
# Read gaze data
data_file<-'./data/all_facial_gestures_gaze_summary.csv'
data<-read.csv(file=data_file,header=TRUE,sep=',')
#Only consider trials where proportion onscreen is more than 0
n_trials_pre<-nrow(data)
data<- data[data$Pro... |
f7220714067c386692efaeaf79295d1191ccb4c5cdb21b02796b07c367cfe845 | R | 3,473 | 85 | library("lme4")
library("ggplot2")
library("lsmeans")
library("car")
library("doBy")
dropbox_dir='C:/Users/Holly Rayson/Dropbox/'
# Read gaze data
data<-read.csv(file=paste0(dropbox_dir,'/joint_attention/juvenile_monkeys/pref_gaze/data/year1/all_facial_gestures_gaze_summary.csv'),header=TRUE,sep=',')
data<-read.csv(fi... |
0b1144a5015c2dcce5369ac4b77dc017a4379ae2b6848cf3be174ef4071d5936 | R | 3,565 | 80 |
setwd("/exports/igmm/eddie/GenScotDepression/shen/ActiveProject/ImagingProject/Adolescent_MDD_brain")
library(dplyr)
library(ggplot2)
library(magrittr)
library(ggpubr)
library(cowplot)
library(shape2)
# Settings
load('result/x.Supplementary_materials/meanYouthDepree_WM_subcor_FS_noSocialCov.RData')
tar... |
d227beae0ce0af295ac581e85f56403ea94e5c41398dc3b2dea467e0de849716 | R | 3,594 | 67 | table.report=result.defs_totalscore[result.defs_totalscore$factor=='depression_bioMother_noManiaVision',]
table.report=table.report[,c(1,2,4,7)]
rownames(table.report)=table.report$dependent
table.report=table.report[c('KSADS.MDD.y','KSADS.Broad_depression.y',
'KSADS.Depressive_symptoms_... |
9d4f6362a856af5016af8d88978f477570a8810695543ea7911f339972550ffb | R | 3,620 | 82 | # by XShen
# 16/5/2019
# Aims: remove parents with other major psychiatric conditions,
# clean up depression-related phenotypes in parents,
# remove adolescents with severe substance use conditions,
# add some key covariates: SES, ADHD condition in children and recent social deprivation.
# Before runn... |
ca61b6879b273f747b9f7526a9f3d742530aca2c88e71a1d44ed2864ecb9e242 | R | 3,626 | 94 | library('dplyr')
library('pbapply')
library('nlme')
library('reshape2')
setwd('Z:/Documents/sdata_backup/Shen/iv.ABCD/release2.0.1/AdolescentMDD/')
# Depression --------------------------------------------------------------
load('result/i.Main_result/YouthDepree_WM_subcor_FS_noSocialCov.RData')
source('FUN... |
59e898882ce11a069f592b136cc6e89cb95aad4dffbde60558b125cd6d3b5dd4 | R | 3,639 | 82 |
setwd('/exports/igmm/eddie/GenScotDepression/shen/ActiveProject/ImagingProject/ABCD_MDD_brain/')
# Dot plot ----------------------------------------------------------------
library(dplyr)
library(ggplot2)
library(magrittr)
library(ggpubr)
library(cowplot)
# Settings
load('result/x.Supplementary_materi... |
e7c49768c595c2e6dbddf309ddf6bef0054d3d03665133ca4b0dbad5d4150fe6 | R | 3,640 | 95 | fragment.ions.mz.1 = function(sequence, type = c('b', 'y'), charge = c(1, 2),
modification = NULL, loss = c('NH3', 'H2O', 'H3PO4'),
carbamidomethyl = FALSE, monoisotopic = TRUE, ...) {
if (nchar(sequence) <= 1) {
stop('invalid sequence')
}
sequence ... |
2f0e6d1f3eb972f639f5c58ccaa5d81f6f3642bf2e0d2ae22098ac13d42a56a6 | R | 3,642 | 81 | setwd('/exports/igmm/eddie/GenScotDepression/shen/ActiveProject/ImagingProject/ABCD_MDD_brain/')
# Dot plot ----------------------------------------------------------------
library(dplyr)
library(ggplot2)
library(magrittr)
library(ggpubr)
library(cowplot)
library(shape2)
# Settings
load('result/i.Main_re... |
401338214f0d3de88f0c675fa73b6831c3305ce5f2d2865c61a9c0a6c12fa9b3 | R | 3,680 | 105 | #assert existence of
#commonfile
source(commonfile)
#bamfile
load(bamfile)
#pwmfile
#load(paste0(pwmdir,pwmid,'.pwmout.RData'))
#tmpdir
bamnames = names(allreads[[1]])
obschrnames=names(allreads)
preads=allreads[[obschrnames[1]]][[1]]$plus
cutat=10
#stablize the variance (helps when there are few high coverage sites... |
2d90f92b4590638fb20e7f3ccc881ed4d32cb39761cedfe1eb370f75da005731 | R | 3,702 | 56 | # Basic setups ------------------------------------------------------------
library('dplyr')
library('pbapply')
library('nlme')
setwd('/gpfs/igmmfs01/eddie/GenScotDepression/shen/SData/UKB/iv.ABCD/release2.0.1/FamilialRisk_PGRS_MDD')
# Load data ---------------------------------------------------------------
... |
53b66768de3a61e864e178ffdffd921e4c6046a0ab4d7b68c371c4bc271f3a7b | R | 3,717 | 105 | library(data.table)
library(ggplot2)
setwd("~/work/ibs")
save_zip = function(object,path){
fwrite(object,path)
zip(paste0(path,".zip"),path)
}
#Load sample QC data
sqc = fread("qc/ukb_sqc_v2.txt")
#Find Brits passing initial QC
sqc[, in.PC.outlier.check:=
het.missing.outliers==0 &
excluded.from.ki... |
b92b4b8df32e4acc475141511a325adaa1d8e5935d02991bcf201a74329ba8e3 | R | 3,736 | 96 | library(data.table)
setwd("~/work/ibs")
save_zip = function(object,path){
fwrite(object,path)
zip(paste0(path,".zip"),path)
}
grep_start = function(col,code){
grepl(paste0("^",code),col)
}
check_code = function(code,P,cols,col_prefix="has",starts_with=FALSE){
if((code=="") | is.na(code)){return(NULL)}
i... |
42fd3aefa196427e7a8f0013478aa7719bb30be0469564641dee38f5cca4d4f6 | R | 3,808 | 93 | #!/usr/bin/env Rscript
library(DESeq2)
library(ggplot2)
### Load DESeq2Constructor
initial.options <- commandArgs(trailingOnly = FALSE)
file.arg.name <- "--file="
script.name <- sub(file.arg.name, "", initial.options[grep(file.arg.name, initial.options)])
script.basename <- dirname(script.name)
other.name <- file.path(... |
5e0d46920d31d46abb1fb648f8812e38da21e69ed1a7c582d2fded06f809bb98 | R | 3,817 | 124 | test_that("convert mc instances", {
instance <- list(
sample1 = data.frame(inst1 = runif(10), inst2 = runif(10)),
sample2 = data.frame(inst1 = runif(10), inst2 = runif(10)),
sample3 = data.frame(inst1 = runif(10), inst2 = runif(10))
)
instance_converted <- convert_instance(instance, ... |
bee31331d17ce522140ba791f25e3d8bcfa2a822b745c41ebde272984c193c20 | R | 3,818 | 92 | library('ggplot2')
library('Hmisc')
library('ggpubr')
library('dplyr')
setwd('/exports/igmm/eddie/GenScotDepression/shen/ActiveProject/ImagingProject/ABCD_MDD_brain/')
load('result/i.Main_result/Diffs_YouthDepression_envVariable.RData')
fig.result=filter(result,p.corrected<0.05)
fig.result=fig.result[order... |
eb30599393a29c9c59ab4f59b87d56bbc1b36db13d413df453c73660e8f38a9a | R | 3,844 | 84 | setwd("/exports/igmm/eddie/GenScotDepression/shen/ActiveProject/ImagingProject/Adolescent_MDD_brain")
source('FUNs/PheWAS_style_p_plot.R')
source('FUNs/wholeB_correction.R')
# Settings
load('result/x.Supplementary_materials/meanYouthDepree_WM_subcor_FS_noSocialCov.RData')
# Preprocess results object ------... |
af805f00f232c0b737d054da9b7f89c2556b2862b92bc150d83f115a1878d1e1 | R | 3,861 | 105 | # Script Comments ---------------------------------------------------------
# this is a script that can be used to update/add new lists to the microglia gele list database
# The new list is then used as input into the MGEnrichment app
# simply update the spreadsheet that is read in as "masterlist"
library(biomaRt)
lib... |
e5b210bbef59f535b676c428f95bbcc25391bcc7447cb23b6dffdb2e285a411b | R | 3,914 | 127 | test_that("feature label in bar plot", {
feature <- "Bacteria|Bacteroidetes|Bacteroidia|Bacteroidales|Bacteroidaceae"
short_feature <- "Bacteria|Bacteroidetes"
expect_equal(get_feature_label(feature, 1), "Bacteroidaceae")
expect_equal(get_feature_label(feature, 2), "Bacteroidales|Bacteroidaceae")
e... |
8cd5574e9c6fe321255d48e3ee9d45d7729165e49126935fdc86d18a6f30601a | R | 3,923 | 91 | setwd('Z:/Documents/sdata_backup/Shen/iv.ABCD/release2.0.1/FamilialRisk_PGRS_MDD')
source('FUNs/PheWAS_style_p_plot.R')
source('FUNs/wholeB_correction.R')
# Settings
load('result/x.Supplementary_materials/YouthDepree_WM_subcor_FS_harshQC.RData')
ls.category=read.table('data/p_plot_dat/ls.category.txt',header=F,string... |
665a5e4c808dde282d21419d97764e55f2c1c06220c8d1ce0f9924155ab5f6c1 | R | 3,937 | 135 | ions.to.spectra.loss.budding.1 = function(
ions, carbamidomethyl = TRUE, charge = NA,
loss.ratio = 0.9, loss.site = c('S', 'T'),
budding = 5e-3, budding.type = c('b', 'y', 'bp', 'yp'), budding.charge = c(1, 2),
...) {
lapply(ions, function(x) {
if (is.null(x$charge)) {
x$charge = charge
}
... |
d46326c100496b1c93c012adb7f0e29d939886905e051fd4721e7bcfd2218221 | R | 3,955 | 101 | #!/usr/bin/Rscript
library(tidyverse)
library(DescTools)
library(igraph)
library(ggnetwork)
library(intergraph)
args <- commandArgs(trailingOnly=TRUE)
fi_cfg <- args[1]
df_cfg <- read_tsv(fi_cfg)
dio <- df_cfg %>% filter(key=="dir_out") %>% pull(value)
str_cells <- df_cfg %>% filter(key=="cells") %>% pull(value)
ce... |
6b4bcad1bfc8e9de5c9817f8df80711cdbb4b3ceb35e548d724d083ac9787587 | R | 4,014 | 91 | setwd('Z:/Documents/sdata_backup/Shen/iv.ABCD/release2.0.1/FamilialRisk_PGRS_MDD')
source('FUNs/PheWAS_style_p_plot.R')
source('FUNs/wholeB_correction.R')
# Settings
load('result/x.Supplementary_materials/YouthDepree_WM_subcor_FS_harshQC.RData')
ls.category=read.table('data/p_plot_dat/ls.category.txt',header=F... |
faee473e1ae2957973f6a4f51e1f991868237cdf30bee00ef08b7114a877187a | R | 4,060 | 115 | # Download and format usafacts data
# Jarad Niemi
# May 2020
library("readr")
library("dplyr")
confirmed_url <- "https://usafactsstatic.blob.core.windows.net/public/data/covid-19/covid_confirmed_usafacts.csv"
deaths_url <- "https://usafactsstatic.blob.core.windows.net/public/data/covid-19/covid_deaths_usafacts.csv... |
f143ebd55e7d3a5b34be0e5449bacef9516c1bee1fa584259d710013d2c3df2b | R | 4,086 | 103 | # Basic setups ------------------------------------------------------------
library('dplyr')
library('pbapply')
library('nlme')
library('CCA')
setwd('/sdata/images/projects/UKBIOBANK/users/Shen/iv.ABCD/release2.0.1//FamilialRisk_PGRS_MDD')
# Load data ---------------------------------------------------------------
FA... |
d72957cf13c85da111cdddec2f88d28a47cee81ec52e5d88e54c00ac6461bc0d | R | 4,164 | 115 | #assert existence of
#commonfile
source(commonfile)
#bamfile
load(bamfile)
#pwmfile
#load(paste0(pwmdir,pwmid,'.pwmout.RData'))
#tmpdir
bamnames = names(allreads[[1]])
coords2=sapply(coords.short,flank,width=wsize,both=T)
obschrnames=names(allreads)
preads=allreads[[obschrnames[1]]][[1]]$plus
cutat=10
#stablize the... |
1b64bb90f4fa74c53876c5873b2b9ce069ebcae730940086ba7c29a6808cee4b | R | 4,229 | 102 | load('result/i.Main_result/YouthDepree_WM_subcor_FS_noSocialCov.RData')
summ_results<-function(result,ls.keywd){
keywd.dep=as.character(ls.keywd[1])
keywd.factor=as.character(ls.keywd[2])
bulk.loc=grep(keywd.dep,result$dependent)
bulk.res=result[bulk.loc,]
bulk.loc=grep(keywd.factor,bulk.res$factor)
bulk.r... |
e1ed412fadd7684833ad163feb9bc66eafb7ddd4f948e32cb4663feb4993a646 | R | 4,242 | 83 | ######
# by Shen
library(dplyr)
library(base)
setwd('/exports/igmm/eddie/GenScotDepression/shen/SData/UKB/iv.ABCD/release2.0.1/FamilialRisk_PGRS_MDD')
tab.dat.dir='/exports/igmm/eddie/GenScotDepression/shen/SData/ABCD/release2.0.1/iii.data'
## Load medication data. Note: multiple instances in this data
medi.dat=readR... |
027e5f71a46cac36ffe664f238e0cf5f6f3706c4f921da0403215f6c1a16d82b | R | 4,275 | 113 | """
This file is part of BrainMolecularAtlas.
Copyright (c) 2021-2022 Blue Brain Project/EPFL
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) an... |
dc4b492435954f82896c7192b63cf94cb798d3678dc9d0168d6862981ef3e6d3 | R | 4,289 | 89 |
# Basic settings ----------------------------------------------------------
setwd("Z:/Documents/ActiveProject/ImagingProject/Adolescent_MDD_brain")
source('FUNs/reorg_result_xlsx.R')
source('FUNs/wholeB_correction.R')
# Tables for Main results (depressive symptoms and MDD) -------------------
rm(list = ls(pa... |
c9eb4e9cc49c27ec04b69ed8810f30f757191853f38f531eba4c41ff68e59720 | R | 4,311 | 156 |
gknotLG = gauss.quad(9000,kind="hermite")
poiscompLG <- function(mu,sig,dat){
t=mu+sqrt(2*sig)*gknotLG$nodes
dp=dpois(dat,exp(t))*gknotLG$weights/sqrt(pi)
evs=dp%*%cbind(1,t,t^2)
un=evs[2]/evs[1]
vn=evs[3]/evs[1]-evs[2]^2/evs[1]^2
c(un,vn,evs[1])
}
getLapLoc<-function(mu,sig,d,cut=20){
l=rep(0,length(d)... |
517b92fd14fa1f4bf2ac1aebdd95537ebeb0bc9179d7dc661d0e17a0077d4dd3 | R | 4,341 | 148 | library(readr)
peptide.files = list.files(pattern = '[STY]phospho1\\.peptide\\.csv$')
peptide.lists = lapply(peptide.files, read_csv)
names(peptide.lists) = peptide.files
lapply(list.files(pattern = '\\.prosit\\.csv$'), function(assay.file) {
assay = read_csv(assay.file)
print(table(assay$FragmentType))
pri... |
75ccc11fe61fdd2f9060b6c35861b706c6fe88e4a01966411cb7454d2b1363ef | R | 4,351 | 79 | library(data.table)
library(googlesheets4)
#Formats FUMAS GWAS Catalog data, matching it to IBS sumstats
#Load GWAS catalog data
X = fread("/home/cq/work/ibs/fuma/results/FUMA_job45052/gwascatalog_dashfix.csv")
X[,gwascat.effectallele:=tstrsplit(Strongest,"-")[[2]]]
#Load IBS sumstats
S = fread("/home/cq/work/ibs/met... |
efeec66abab24b27476e97acc5d257fc8c67619835b55ec16f04364920fb9395 | R | 4,368 | 90 | library(tibble)
add_extra_codes = function(subj_df) {
groom_state<-subj_df$Groom>=1
groom_object_state<-subj_df$GroomObject>=1
contact_state<-subj_df$Contact>=1
huddle_state<-subj_df$Huddle>=1
proximity_state<-subj_df$Proximity>=1
anogenital_state<-subj_df$Anogenital.exploration>=1
aggression_state<-su... |
f6d4a39d45ef74a8280cb830bda91b7e2cc2a7482fc94adc1e4abdb2c20c0240 | R | 4,465 | 103 | # Basic setups ------------------------------------------------------------
library('dplyr')
library('pbapply')
library('nlme')
setwd('/exports/igmm/eddie/GenScotDepression/shen/ActiveProject/ImagingProject/ABCD_MDD_brain/')
# Load data ---------------------------------------------------------------
# fam dat... |
72e22d70c6cc3d3f1a209964ff12461fbf8cbabb86123cdd54d7f618bf86915b | R | 4,471 | 80 | #####
# Read the data
#
# read the Excel sheet containing data
library(readxl)
Hippocampus_values <- read_excel("ADNI combined.xlsx", sheet="sample")
Hippocampus_values <- subset(Hippocampus_values, subset = Hippocampus_values$sample=="ADNI3")
stopifnot(nrow(Hippocampus_values)==575)
# adjust column names to match tho... |
140112228f757fd283a6f57c33d7140112df01f7257af9b4881c0daabf599e4a | R | 4,517 | 140 | #' 16S rRNA data from "Moving pictures of the human microbiome"
#'
#' 16S read counts and phylogenetic tree file of 34 Illumina samples derived
#' from Moving Pictures of the Human Microbiome (Caporaso et al.) Group label:
#' gut, left palm, right palm, and tongue - indicating different sampled body
#' sites.
#'
#' @fo... |
32a93cedc9f429e511c5e7b2f470acc3e30b5ef054f04813d17c884a1ce393cd | R | 4,530 | 146 | #' Heatmap of microbiome marker
#'
#' Display the microbiome marker using heatmap, in which rows represents the
#' marker and columns represents the samples.
#'
#' @inheritParams plot_abundance
#' @param transform transformation to apply, for more details see
#' [`transform_abundances()`]:
#' * "identity", return th... |
718ee653d705280c515e250dfc82cc0b33b89350b606c43cadb5d402ce68b646 | R | 4,617 | 146 | #' `postHocTest` plot
#'
#' Visualize the result of post-hoc test using ggplot2
#'
#' @param pht a [`postHocTest-class`] object
#' @param feature character, to plot the post-toc test result of this feature
#' @param step_increase numeric vector with the increase in fraction of total
#' height for every additional compa... |
4caebbc617b3346e874f11239657c6e38be796213963c1cd86c776ae4d30e430 | R | 4,702 | 83 | #####
# Read the data
#
# read the Excel sheet containing data
library(readxl)
Hippocampus_values <- read_excel("aibl_ptdemog_final.xlsx", sheet="aibl_ptdemog_final")
stopifnot(nrow(Hippocampus_values)==606)
# adjust column names to match those in ADNI2 linear model
colnames(Hippocampus_values)[colnames(Hippocampus_va... |
3ba9c38afe3bf7635ca7cd3fe099cd713fc07802305bee274f999fd1cebd5d86 | R | 4,726 | 119 | # Basic setups ------------------------------------------------------------
library('dplyr')
library('pbapply')
library('nlme')
library('ggpubr')
setwd('/exports/igmm/eddie/GenScotDepression/shen/ActiveProject/ImagingProject/Adolescent_MDD_brain')
# Freesurfer data ------------------------------------------... |
5f2a4826a39dd7853b98e27a786140dcd1996241eff5e3998aab7f8f099e6761 | R | 4,814 | 150 | library(readr)
psm = read_csv(list.files(pattern = 'psm\\.csv$')[1])
phosphoRS_result = read_csv(list.files(pattern = '\\.phosphoRS\\.csv$')[1], trim_ws = TRUE)
dot_result = read_csv(list.files(pattern = '\\.result\\.csv$')[1], trim_ws = TRUE)
phosphoRS_result = local({
result = phosphoRS_result
result$Spectru... |
ae308d79232105837eea00fede7dafeeb963fbf601542b216c3d987fab9d18b1 | R | 4,841 | 163 | #' Summarize taxa into a taxonomic level within each sample
#'
#' Provides summary information of the representation of a taxonomic levels
#' within each sample.
#'
#' @param ps a \code{\link[phyloseq]{phyloseq-class}} object.
#' @param level taxonomic level to summarize, default the top level rank of the
#' `ps`.
#' ... |
b3a18f1331a6de79d22f527a8471f004020ebe8bb87373bb9de78fea8f0d258e | R | 4,910 | 103 | suppressMessages(require(DescTools))
suppressMessages(require(data.table))
suppressMessages(require(stringr))
suppressMessages(require(argparser))
parser <- arg_parser('Convert a square matrix into a long one', hide.opts = TRUE)
parser <- add_argument(parser, "--cores", type="integer", default=NULL,
... |
73d10a16f04265f473b849a680f8086017a9319c62c73f861ae22040d22db3c2 | R | 4,912 | 161 | psmFile = list.files(pattern = 'psm.csv')[1] #'{PATH_PSM_FILE}'
referencePath = 'msp' # {PATH_TO_MSP}'
spectraPath = 'mgf' # {PATH_TO_MGF}'
resultFile = 'spectral_matching.result.csv'
fragmentTolerance = 50
library(readr)
psm = read_csv(psmFile)
psm = subset(psm, !grepl('\\*.+\\*', peptide))
psm = subset(psm, charg... |
59737d0fd5060f5e6f4e2eff59e897931e618078cf0a3eadb3d7e840587639c4 | R | 4,943 | 113 | # Basic setups ------------------------------------------------------------
library('dplyr')
library('pbapply')
library('nlme')
library('reshape2')
library('ggplot2')
setwd('Z:/Documents/sdata_backup/Shen/iv.ABCD/release2.0.1/FamilialRisk_PGRS_MDD')
# Load data --------------------------------------------------------... |
ec846d3d4d1cba72f60f05489d66b1152d5e4b4559461d823abb60be8ea8c274 | R | 4,982 | 107 | # Basic setups ------------------------------------------------------------
library('dplyr')
library('pbapply')
library('nlme')
setwd('/sdata/images/projects/UKBIOBANK/users/Shen/iv.ABCD/release2.0.1//FamilialRisk_PGRS_MDD')
# Load data ---------------------------------------------------------------
# fam data
FAM.da... |
8070fd83f266a55b89758654afaaee93f7e3089ac59bba00ca81783787ee09d2 | R | 4,983 | 107 | # Basic setups ------------------------------------------------------------
library('dplyr')
library('pbapply')
library('nlme')
setwd('/sdata/images/projects/UKBIOBANK/users/Shen/iv.ABCD/release2.0.1//FamilialRisk_PGRS_MDD')
# Load data ---------------------------------------------------------------
# fam data
FAM.da... |
91b1e533f6464d59cf7cedf90722d2c1ab4094490d83a44b2ded0ecdf5b9c86d | R | 4,998 | 143 | plan = drake::drake_plan(
locations = get_locations(file_in("data-locations/locations.csv")),
##############
# Latest Forecasts
latest_forecasts = target(
read_forecast_file(file_in(file)) %>%
dplyr::left_join(locations, by = c("location")) %>%
tidyr::separate(target, into=c("n_unit","u... |
e1ab0ad7aeb09bfb211aafe1027ba269af0d0f7bcfb329c9277feaf664105d0d | R | 5,055 | 113 | # Basic setups ------------------------------------------------------------
library('dplyr')
library('pbapply')
library('nlme')
library('reshape2')
library('ggplot2')
setwd('Z:/Documents/sdata_backup/Shen/iv.ABCD/release2.0.1/FamilialRisk_PGRS_MDD')
# Load data -----------------------------------------------... |
23e4ecbc7be6f6069f6d7a503d6be7c0357a53d036bd5cd92178bca60106ecd8 | R | 5,079 | 175 | ## Note: This function is copied from package microbiome
#' @title Aggregate Taxa
#' @description Summarize phyloseq data into a higher phylogenetic level.
#' @details This provides a convenient way to aggregate phyloseq OTUs
#' (or other taxa) when the phylogenetic tree is missing. Calculates the
#' sum of OTU abunda... |
65a30d63c65d0ae2b463465c633d4b95e0b4729a7b39bf9840ad1aa2f99a62de | R | 5,149 | 116 | setwd('Z:/Documents/sdata_backup/Shen/iv.ABCD/release2.0.1/AdolescentMDD/')
source('FUNs/PheWAS_style_p_plot.R')
source('FUNs/wholeB_correction.R')
# Settings
load('result/x.Supplementary_materials/YouthDepree_WM_subcor_FS_covParentDepre.RData')
# Preprocess result objects -------------------------------------------... |
889e7be3cbae01943516d573ab144896a4989a7c9757373e13e57c8496572cf1 | R | 5,232 | 155 | """
This file is part of BrainMolecularAtlas.
This file makes PCA for Fig8a
Copyright (c) 2021-2022 Blue Brain Project/EPFL
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the ... |
ee810680fb60b4482e605324103ee5155ccf41512dd3b5e32885e1e2160e87b7 | R | 5,371 | 147 | setwd("~/work/ibs")
library(data.table)
library(ggplot2)
library(coloc)
library(cowplot)
theme_set(theme_cowplot())
library(EnsDb.Hsapiens.v75)
library(ggbio)
ensdb <- EnsDb.Hsapiens.v75
#Let's try knownGene, see https://www.biostars.org/p/275286/
#see also https://www.biostars.org/p/367011/
#TxDb plotting crashes, ex... |
565af9e63f26da3f9e629bda3277a78e2e12247d9550c00237162ec24aedf8cd | R | 5,410 | 149 | # By shen
# 14/05/2020
# Not very well annotated. But don't ask me to annotate... I'll be depressed
# *TargetResult: result table (column names:beta, std, p.value, p.corrected)
# *color_theme_usr:Shen/a list of colours
# *shape_sig: T=a different shape for significant assoc
# *category.input: a table of categorie... |
2dbbdede822fc768d3b6e1bbfc1ccb4dc8d3181ac73792dfd8ddf99d32a4c5cc | R | 5,421 | 149 | # By shen
# 14/05/2020
# Not very well annotated. But don't ask me to annotate... I'll be depressed
# *TargetResult: result table (column names:beta, std, p.value, p.corrected)
# *color_theme_usr:Shen/a list of colours
# *shape_sig: T=a different shape for significant assoc
# *category.input: a table of categorie... |
600f5c775f4fb84c2cd234999db155895efd19c7d413e2e1776fdf073b3e9272 | R | 5,424 | 147 | # Site Comparison
# By XShen
# 26/05/2020
# Settings ----------------------------------------------------------------
library('dplyr')
library('ggplot2')
library('reshape2')
library('ggpubr')
setwd('Z:/Documents/sdata_backup/Shen/iv.ABCD/release2.0.1/FamilialRisk_PGRS_MDD')
# Load data ------------------------------... |
506da3dc0c1baf45c32d2e09aeabc35747bd009a81d2adc3e07bb6dc5c922b0b | R | 5,439 | 124 | setwd('Z:/Documents/ActiveProject/ImagingProject/Adolescent_MDD_brain/')
source('FUNs/PheWAS_style_beta_plot.R')
source('FUNs/wholeB_correction.R')
# Settings
load('result/i.Main_result/YouthDepree_WM_subcor_FS_noSocialCov.RData')
# Preprocess result objects -----------------------------------------------
# Re-cor... |
f6cf96cd85e3a909a3f8d0de42290b33eb69eb95294209b54a94db4e026d7c8c | R | 5,448 | 124 | setwd('Z:/Documents/ActiveProject/ImagingProject/Adolescent_MDD_brain/')
source('FUNs/PheWAS_style_p_plot.R')
source('FUNs/wholeB_correction.R')
# Settings
load('result/i.Main_result/YouthDepree_WM_subcor_FS_noSocialCov.RData')
# Preprocess result objects -----------------------------------------------
... |
455bf5e9bdbf118bd8660484d22a65a39ef6647b081aa8eca071f1eda78764be | R | 5,545 | 156 | #' Plot hospitalization forecasts and truth data,
#' faceted for ensemble with quantiles and point forecasts for all other models
#' with additional plots that show a close-up of forecasts for both larger figures
#'
#' @param location string for US fips code, location name, or abbreviation
#' Defaults to 'US', must ha... |
d56ea99d28a411af462d33d16142aeb9cf4baeb6cfb67520942160143a3f3e51 | R | 5,571 | 147 | # Site Comparison
# By XShen
# 26/05/2020
# Settings ----------------------------------------------------------------
library('dplyr')
library('ggplot2')
library('reshape2')
library('ggpubr')
setwd('Z:/Documents/sdata_backup/Shen/iv.ABCD/release2.0.1/FamilialRisk_PGRS_MDD')
# Load data ------------------... |
53b564207bafc5cd0924cade2a04de59f4cf9b6654b43896b9c56f1af15295c1 | R | 5,581 | 115 | library(zoltr) ## devtools::install_github("reichlab/zoltr")
library(tidyverse)
library(lubridate)
theme_set(theme_bw())
## load special functions
source("code/exploration/get_filtered_counties.R")
source("code/processing-fxns/get_next_saturday.R")
## get county info
high_pop_counties <- get_filtered_counties(n_top=1... |
6c29dfad76489be3aa254677d4e41dab8d323b06567da15f245c4f4849b7c2e6 | R | 5,615 | 143 | # by Shen
# 15/05/2020
# *result.table
# *ls.vertical.vars= a vector of values in factor variable
# *cols.select= cols to keep in the result table
# *dep.kw: key word for dependent variable to select part of the result
# *table_title: title that appears at the top
# *file_name
# *colheaders
##### Settings
library(xlsx... |
1a4c39b84e8c4eda28e7509ba63a9c8b7d9448e6eb5e15f92101f16520ad062d | R | 5,656 | 226 | library("hts")
library("parallel")
naive_bottom_up <- function(hts, params) {
h <- params$prediction_length
fmethod <- params$fmethod
fcasts1.bu <- forecast(
hts,
h = h,
method="bu",
fmethod = fmethod,
parallel = TRUE,
)
aggts(fcasts1.bu)
}
top_down_w_average_historic... |
ac33501054ed5b7bf3835f926f31f798328c955ced93c940984a879af01466dc | R | 5,839 | 147 | # Basic setups ------------------------------------------------------------
library('dplyr')
library('pbapply')
library('nlme')
library('reshape2')
library('ggplot2')
setwd('/exports/igmm/eddie/GenScotDepression/shen/ActiveProject/ImagingProject/Adolescent_MDD_brain')
# Load data ----------------------------... |
c120cce198276032ac619adba70578b83101dd90285f63e6c17b7f27c550ece1 | R | 5,867 | 145 |
# Basic settings ----------------------------------------------------------
setwd("Z:/Documents/ActiveProject/ImagingProject/Adolescent_MDD_brain")
source('FUNs/wholeB_correction.R')
source('FUNs/reorg_result_web/reorg_result_web.R')
library(dplyr)
library(data.table)
library(rmarkdown)
library(knitr)
library(kableEx... |
e7095826cce12765eedf14a0b27a50a23c85f7584f1286be5624bbc391af1341 | R | 5,937 | 139 | setwd('/exports/igmm/eddie/GenScotDepression/shen/ActiveProject/ImagingProject/ABCD_MDD_brain/')
source('FUNs/PheWAS_style_p_plot.R')
source('FUNs/wholeB_correction.R')
# Settings
load('result/i.Main_result/YouthDepree_WM_subcor_FS_noSocialCov.RData')
result.mainmodel=filter(result.YouthDepre.region.covWholeB,... |
a0ec90f2f367a5bce6c3985f1caf28bab41ae013835432fed25b87c1ff2cb5d1 | R | 5,944 | 139 | setwd('/exports/igmm/eddie/GenScotDepression/shen/ActiveProject/ImagingProject/ABCD_MDD_brain/')
source('FUNs/PheWAS_style_p_plot.R')
source('FUNs/wholeB_correction.R')
# Settings
load('result/i.Main_result/YouthDepree_WM_subcor_FS_noSocialCov.RData')
result.mainmodel=filter(result.YouthDepre.region.covWholeB,... |
eda2ff318b800fa367523874fc5080c45c552b418af0d5041ec569f2906815b9 | R | 5,948 | 149 | ###################################
#### SEURAT ALIGNMENT #############
###################################
library(scater)
library(Seurat) # v. 3.1.0.
library(ggplot2); theme_set(theme_bw(base_size = 16))
load(file = "sce_CellGeneFilt_2019-05.rda")
## First, setup the Seurat object list, and run SCTransform on eac... |
de179ded57b1885c308a51cde9e7336e2e4267b5a878c33de3a1f6be41ba13ca | R | 6,064 | 136 | source('read.tcsv.R')
source('apply_constraints.R')
source('fill_gaps.R')
source('load_data.R')
library('doBy')
for(year in c(1)) {
data_dir=paste0('./data/behaviour/year',year)
groups<-read.csv(paste0('./data/groups.csv'))
unique_subjects<-unique(groups$subject)
all_subj_df<-data.frame()
obj_states... |
39584864be32e163337269ac4a9c18e198a17c997607c3cc50cff760410efe95 | R | 6,100 | 127 | # Basic setups ------------------------------------------------------------
library('dplyr')
library('pbapply')
library('nlme')
setwd('/gpfs/igmmfs01/eddie/GenScotDepression/shen/SData/UKB/iv.ABCD/release2.0.1/FamilialRisk_PGRS_MDD')
# Load data ---------------------------------------------------------------
# fam da... |
ae16014c6dccc6dcf820f35d307010828268e0bf29e138043801e1377931c900 | R | 6,112 | 149 |
# Basic setups ------------------------------------------------------------
library(dplyr)
setwd('/sdata/images/projects/UKBIOBANK/users/Shen/iv.ABCD/release2.0.1/FamilialRisk_PGRS_MDD')
# Load data ---------------------------------------------------------------
FAM.dat=readRDS('data/FamHistory_clean/FAM.dat_Unrel... |
96333fc7252c04a8b3bfc8f621a66f64199b09155b201411304d3d37a3f219f0 | R | 6,148 | 149 |
# Basic setups ------------------------------------------------------------
library(dplyr)
setwd('/sdata/images/projects/UKBIOBANK/users/Shen/iv.ABCD/release2.0.1/FamilialRisk_PGRS_MDD')
# Load data ---------------------------------------------------------------
FAM.dat=readRDS('data/FamHistory_clean/FAM.dat_Unrel... |
59dac503eec60de051fec02678cafa7f15ba8bd7b836a487534bd1de057da4ad | R | 6,152 | 146 | # Descriptive stats
# By XShen
# 18/05/2020
# Settings ----------------------------------------------------------------
library('dplyr')
library('ggplot2')
library(reshape2)
library('plyr')
library(ggridges)
library(viridis)
library(hrbrthemes)
setwd('/exports/igmm/eddie/GenScotDepression/shen/ActiveProjec... |
aadec2bd12210e6b0dfdc12aafedda4782ed943c4c06f74b1f15b2be474cf61d | R | 6,165 | 137 |
setwd('/exports/igmm/eddie/GenScotDepression/shen/ActiveProject/ImagingProject/ABCD_MDD_brain/')
# Dot plot ----------------------------------------------------------------
library(dplyr)
library(ggplot2)
library(magrittr)
library(ggpubr)
library(cowplot)
# Settings
load('result/x.Supplementary_material... |
006da07abe6e267e165fa133cf03ee2e69da3153923b8fb24520b94b54918158 | R | 6,167 | 128 | # Basic setups ------------------------------------------------------------
library('dplyr')
library('pbapply')
library('nlme')
setwd('/sdata/images/projects/UKBIOBANK/users/Shen/iv.ABCD/release2.0.1//FamilialRisk_PGRS_MDD')
# Load data ---------------------------------------------------------------
# fam data
FAM.da... |
d920a7cbcc327644ec479cdb3da1271a2d1477bc5c86f5809dc2b2918a606c4a | R | 6,167 | 149 |
# Basic setups ------------------------------------------------------------
library(dplyr)
setwd('/sdata/images/projects/UKBIOBANK/users/Shen/iv.ABCD/release2.0.1/FamilialRisk_PGRS_MDD')
# Load data ---------------------------------------------------------------
FAM.dat=readRDS('data/FamHistory_clean/FAM.dat_Unrel... |
c91e6bebcdfefe8171b5412f0c931752bfafd50ab1aca75e6fb589e083b4e349 | R | 6,205 | 149 |
# Basic setups ------------------------------------------------------------
library(dplyr)
setwd('/sdata/images/projects/UKBIOBANK/users/Shen/iv.ABCD/release2.0.1/FamilialRisk_PGRS_MDD')
# Load data ---------------------------------------------------------------
FAM.dat=readRDS('data/FamHistory_clean/FAM.dat_Unrel... |
28c9549448417b7c01716b05990b41d2a582610039e2e5bfd821621538e15a66 | R | 6,236 | 158 | # Site Comparison
# By XShen
# 18/05/2020
# Settings ----------------------------------------------------------------
library('dplyr')
library('ggplot2')
library('reshape2')
library('ggpubr')
setwd('/exports/igmm/eddie/GenScotDepression/shen/ActiveProject/ImagingProject/ABCD_MDD_brain/')
# Load data ------... |
b9e7477a3236d38340efb39f5833c8c74c637ab0321b44b383f848fe3de2f158 | R | 6,250 | 136 | # Basic setups ------------------------------------------------------------
library('dplyr')
library('pbapply')
library('nlme')
setwd('/exports/igmm/eddie/GenScotDepression/shen/ActiveProject/ImagingProject/ABCD_MDD_brain/')
# Load data ---------------------------------------------------------------
# fam data
FAM.da... |
0f833d296fbdbe419272b1b87b32400081c15e406de4d7f8c300b74538c99c86 | R | 6,257 | 127 | # Basic setups ------------------------------------------------------------
library('dplyr')
library('pbapply')
library('nlme')
setwd('/exports/igmm/eddie/GenScotDepression/shen/ActiveProject/ImagingProject/ABCD_MDD_brain/')
# Load data ---------------------------------------------------------------
# fam data
FAM.da... |
fc7f4c15db3218d1a0c10193c7d4adeec9ab369b235cf40abeeb0af9aca21383 | R | 6,259 | 127 | # Basic setups ------------------------------------------------------------
library('dplyr')
library('pbapply')
library('nlme')
setwd('/gpfs/igmmfs01/eddie/GenScotDepression/shen/SData/UKB/iv.ABCD/release2.0.1/FamilialRisk_PGRS_MDD')
# Load data ---------------------------------------------------------------
# fam da... |
5db78c428eaf1d9d0ec4e38207b2ab7c33a154ecb6f2440a505ae1398163c729 | R | 6,260 | 128 | # Basic setups ------------------------------------------------------------
library('dplyr')
library('pbapply')
library('nlme')
setwd('/gpfs/igmmfs01/eddie/GenScotDepression/shen/SData/UKB/iv.ABCD/release2.0.1/FamilialRisk_PGRS_MDD')
# Load data ---------------------------------------------------------------
# fam da... |
068f2051b081ff9c694471a14aa251ac8bd7276ba8606c7b6f56b63b11335491 | R | 6,335 | 129 | # Basic setups ------------------------------------------------------------
library('dplyr')
library('pbapply')
library('nlme')
setwd('/gpfs/igmmfs01/eddie/GenScotDepression/shen/SData/UKB/iv.ABCD/release2.0.1/FamilialRisk_PGRS_MDD')
# Load data ---------------------------------------------------------------
... |
a7c3a0c97aa7efd0ea6125beb1ccccd5664e8983b56ceb9b50273a6cc7981e24 | R | 6,341 | 129 | # Basic setups ------------------------------------------------------------
library('dplyr')
library('pbapply')
library('nlme')
setwd('/exports/igmm/eddie/GenScotDepression/shen/ActiveProject/ImagingProject/ABCD_MDD_brain/')
# Load data ---------------------------------------------------------------
# fam dat... |
d16aa2a9bff81b6f812f35e89911d55cdbb759043ca84a43c21656ef0b227b72 | R | 6,358 | 147 | library(data.table)
setwd("~/work/ibs")
#library(coloc)
library(ggplot2)
library(cowplot)
theme_set(theme_cowplot())
path_to_gene_tissue = function(X){
split = tstrsplit(X$path,"/")
n = length(split)
split[[n]] = gsub(".RDS$","",split[[n]])
X[,tissue:=split[[n-1]]]
X[,gene_id:=split[[n]]]
}
TissueNames = fr... |
6553e03b0fa06510d6fc8d3f0d8bf91664f171f31d46839c20c09ef6a32235cd | R | 6,381 | 109 | ## calculation of GAM NPMI trans-cis ratio per 250 kb bin
library(tidyverse)
#set working directory to the directory code is in, to make sure that files are found
#for Rstudio:
setwd(dirname(rstudioapi::getActiveDocumentContext()$path))
#for command line R:
#setwd(getSrcDirectory()[1])
#read in list of long genes (... |
7c6eb44e7c7001f4acb2092b890e2d7166e0f8ac10a1960421dd14a08584937e | R | 6,386 | 188 | loadNamespace("forecast")
handleModel <- function(model, params, xreg = NULL) {
outputs = list()
output_types = params$output_types
if (!("xreg" %in% names(model))){
xreg = NULL
}
if ("samples" %in% output_types) {
outputs$samples <- lapply(1:params$num_samples, function(n) { simu... |
d8dfc3367b1085ddf4696acb96025eb8f41e0c8f2c2fae8af71f2ac8d2542b06 | R | 6,412 | 132 | # Basic setups ------------------------------------------------------------
library('dplyr')
library('pbapply')
library('nlme')
setwd('/exports/igmm/eddie/GenScotDepression/shen/ActiveProject/ImagingProject/ABCD_MDD_brain/')
# Load data ---------------------------------------------------------------
# fam dat... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.