sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
15be54ff14ccc67af9093c5c2fa054a02af06ec49fa8b603cf8dd3ff2f09a118 | Python | 108,607 | 1,465 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="dns-prefetch" href="https://github.githubassets.com">
<link rel="dns-prefetch" href="https://avatars0.githubusercontent.com">
<link rel="dns-prefetch" href="https://avatars1.githubusercontent.com">
<link rel="dns-prefetch" hre... |
b372e13a77edc06cdac3c335052446da7faf693f892ec2f9b70d7cdc31dcecf3 | Python | 110,000 | 2,999 | from chromadb.api import ClientAPI, ServerAPI
from chromadb.api.types import (
Schema,
FtsIndexConfig,
SparseVectorIndexConfig,
SparseEmbeddingFunction,
SparseVector,
StringInvertedIndexConfig,
IntInvertedIndexConfig,
FloatInvertedIndexConfig,
BoolInvertedIndexConfig,
VectorIndex... |
baaf40e614841108276de80c1b000c27cb176faca506c5471cb497788a785818 | Python | 110,274 | 3,024 | from typing import (
Optional,
Set,
Union,
TypeVar,
List,
Dict,
Any,
Tuple,
cast,
Literal,
get_args,
TYPE_CHECKING,
Final,
Type,
)
from copy import deepcopy
from typing_extensions import TypeAlias
from dataclasses import dataclass
from numpy.typing import NDArray
... |
2e203e069739820d5c342c9e185bdd922d4402a98f365eba02ff927e6dfbf311 | Python | 111,305 | 2,839 | # import warnings
# warnings.filterwarnings('ignore')
# import matplotlib
# matplotlib.use('Agg')
# plt.rcParams['savefig.dpi'] = 800
import gc
import os.path as osp
from os import makedirs
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import torch
from pandas.core.dtypes.common i... |
3eb6a1522c32d75bf678df23fb57f15e64e5ecdeffcc613bd4bbb70d91c1c5c2 | Python | 114,982 | 2,711 | import numpy as np
import pandas as pd
from scipy import ndimage, stats, signal
from scipy.ndimage.filters import maximum_filter
from scipy.ndimage.morphology import generate_binary_structure, binary_erosion
from sklearn import linear_model as lm
from sklearn.decomposition import PCA, NMF
from Utils import rob... |
6b50be3c1cbda32f48634a9a716817a17589735d0b2748ec1c75e32f29d2c52d | Python | 120,061 | 3,201 | """
202012
General purpose plotting from arbitrary csv files
Started as specifically for SanPy (using reanalyze.py) from a database of spikes
20210112, extending it to any csv for use with bImPy nodes/edges
See: bImPy/bimpy/analysis/bScrapeNodesAndEdges.py
I want this to run independent of SanPy, to do this:
... |
a8c48b1ecb24c70237b85e74292a608ac7fb32daf38598e7e9a07418ae43f34e | Python | 122,545 | 3,453 | """layers.py: Module that defines several useful layers for neural network
models."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
from tensorflow.python.ops import array_ops
from sleeprnn.nn.spectrum import (
... |
e6cc213efccdd1bda39ffe5c1212d465ae2575fd9ba8d480484a099b5d7cba57 | Python | 124,450 | 2,412 | """
ARL_EEGModels - A collection of Convolutional Neural Network models for EEG
Signal Processing and Classification, using Keras and Tensorflow
Requirements:
(1) tensorflow == 2.X (as of this writing, 2.0 - 2.3 have been verified
as working)
To run the EEG/MEG ERP classification sample script, you w... |
24d015ed236ef35975a4d4b2e044807ae113bf0b14607bf35f47c56efef045be | Python | 125,163 | 3,264 | # Authors: Mainak Jas <mainakjas@gmail.com>
from contextlib import redirect_stdout
from copy import deepcopy
import io
from pathlib import Path
import tempfile
import warnings
import numpy as np
from numpy.testing import assert_allclose
import pytest
import matplotlib.pyplot as plt
import hnn_core
from hnn_core impo... |
ed22bb7c4b15678697b76bd88ec3889b1fd0c3e2e8a1b320ff400ade90f493e6 | Python | 129,629 | 1,694 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="dns-prefetch" href="https://github.githubassets.com">
<link rel="dns-prefetch" href="https://avatars0.githubusercontent.com">
<link rel="dns-prefetch" href="https://avatars1.githubusercontent.com">
<link rel="dns-prefetch" hre... |
5932688b486651ad31b3cd30b7b5865edb1f8bd0a656da735fa37158c0bddf0d | Python | 133,911 | 3,229 | import torch
import torch.nn as nn
import globalsZe as globals
from collections import OrderedDict
from typing import Dict, Callable
import copy
import random
def GlobalWeightedRankPooling(x,d=0.9,descending=True,oneD=False,rank=True):
#GWRP, performs weighted average in spatial dimensions https://arxiv.org/abs/18... |
5510e87002fcb355e2c45fb0efd0ac72acf7754fbd006c771ff9fa4cadcd6046 | Python | 134,457 | 4,023 | # type: ignore
import os
import shutil
import sys
import tempfile
import traceback
from datetime import datetime, timedelta
from typing import Any
import httpx
import numpy as np
import pytest
import chromadb
import chromadb.server.fastapi
from chromadb.api.fastapi import FastAPI
from chromadb.api.types import (
... |
a8d19e1475c33312e8cc8386b8afa518ffc3b7b80998175f6519e24efc59f4d6 | Python | 135,521 | 4,416 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 13 22:34:49 2021
@author: mte
"""
import os
import time
from copy import deepcopy
import hdf5storage
import matplotlib as mpl
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import pandas as pd
import scipy.cluster.hierarc... |
5b7a3b1531307e1047091dfb8a35e8cfa66892388674dcfc5b73a52a0673ca55 | Python | 136,515 | 3,145 | """Network class."""
# Authors: Mainak Jas <mjas@mgh.harvard.edu>
# Sam Neymotin <samnemo@gmail.com>
# Blake Caldwell <blake_caldwell@brown.edu>
# Christopher Bailey <cjb@cfin.au.dk>
# Nick Tolley <nicholas_tolley@brown.edu>
# Ryan Thorpe <ryan_thorpe@brown.edu>
import ite... |
f5b893b196e9486fc5b3c0fa1ef4c0a86f2a44f985ef3d733dfbebc807d05dcd | Python | 144,537 | 3,287 | from chromadb.api.types import (
Schema,
SparseVectorIndexConfig,
SparseEmbeddingFunction,
SparseVector,
StringInvertedIndexConfig,
IntInvertedIndexConfig,
FloatInvertedIndexConfig,
BoolInvertedIndexConfig,
VectorIndexConfig,
HnswIndexConfig,
SpannIndexConfig,
FtsIndexCon... |
d5f5ab58ce81a51f2a8fbb0f7a54b1535e8279666293855b221e59aa8485c674 | Python | 152,696 | 3,653 | import io
import json
import re
from copy import deepcopy
from typing import List, Dict, Optional, Generator
import time
import pandas as pd
import requests
import seaborn as sns
from matplotlib import pyplot as plt
from curtainutils.common import curtain_base_payload, curtain_ptm_payload
from uniprotparse... |
33bbc7c8d459f6b70dbf88035c77d261450900b4a768f3343dc41f25f7f76824 | Python | 154,941 | 4,053 | import os
import sys
import math
import time
# import inspect # to print call stack
from functools import partial
from typing import List, Optional
import numpy as np
from PyQt5 import QtCore, QtWidgets, QtGui
import pyqtgraph as pg
import qtawesome as qta
from pyqtgraph.exporters import ImageExporter
import sanpy
... |
ae7af4683fb26ee01cab998b75b37153e5d8f37c13ffd7d45e3da73ef31de71a | Python | 165,550 | 4,161 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
PATH_THIS_DIR = os.path.dirname(__file__)
PATH_RESOURCES = os.path.join(PATH_THIS_DIR, "..", "..", "resources")
import numpy as np
import tensorflow as tf
from sleeprnn.nn.expert_feats import a7_la... |
ea25a58750db488d219cea95d79f6cb71e5b9ceb83b329203c0d374406c58f38 | Python | 174,356 | 2,437 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="dns-prefetch" href="https://github.githubassets.com">
<link rel="dns-prefetch" href="https://avatars0.githubusercontent.com">
<link rel="dns-prefetch" href="https://avatars1.githubusercontent.com">
<link rel="dns-prefetch" hre... |
a01248ad13951ad8aa3282aea83c1b80cb096b776c59bfe33ba2a3ad476d1a4f | Python | 191,197 | 4,728 | """Module exposing Baker-Campbell-Hausdorff approximation coefficents."""
import geomstats.backend as gs
BCH_COEFFICIENTS = gs.array(
[
(1, 1, 0, 1, 1),
(2, 2, 0, 1, 1),
(3, 2, 1, -1, 2),
(4, 3, 1, 1, 12),
(5, 3, 2, -1, 12),
(6, 4, 1, 0, 1),
(7, 4, 2, 1, 24)... |
b5a298403f1e683011c0953823176d2eccdb4e56708117e0439a0649f6ba450f | Python | 198,607 | 5,118 | # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# 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/licenses/LICENSE-2.0
#
# Unless required by appli... |
716fa9167ca325d074fb508fdbc90397890c1bba7406cd250556ecf547274870 | Python | 200,000 | 5,315 | """networks.py: Module that defines neural network models functions."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
PATH_THIS_DIR = os.path.dirname(__file__)
PATH_RESOURCES = os.path.join(PATH_THIS_DIR, "..", "..", "resources")
import numpy ... |
d77787a0fb2359af835fb2168465562740330e587f0e852edc965603f206dd1a | Python | 200,000 | 4,910 | import os
from pathlib import Path
import sys, warnings
import traceback
import time
import numpy as np
import pandas as pd
from types import SimpleNamespace
import Analyses.spatial_functions as spatial_funcs
import Utils.filter_functions as filt_funcs
import Utils.robust_stats as rs
import matplotlib.pyplot as plt
... |
dcc19f13cf7ce9f768ef82a26998fd2a7974e9d033c4490561539fded931c8f3 | Python | 200,000 | 4,391 | from pathlib import Path
import numpy as np
import pandas as pd
import time
import pickle
import json
import copy
import h5py
import sys
import traceback
import datetime
from importlib import reload
import warnings
from joblib import delayed, Parallel
from typing import Union
import Analyses.spike_functions as spike_f... |
f3e316c396f6d5283fac1d6d083e3e9e2b4885e4e051a4a6a9d16a9045e7a1d1 | Python | 200,000 | 4,554 | import copy
import matplotlib as mpl
import matplotlib.collections as mcoll
import matplotlib.pyplot as plt
from statannotations.Annotator import Annotator
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib import lines
from matplotlib_venn import venn2, venn3, venn2_circles
impo... |
5368d5c978984f295e3fb0b83a3c78d1800ac4b467aa0efc73c403c09f2975dd | Python | 200,004 | 5,068 | """IPywidgets GUI."""
# Authors: Mainak Jas <mjas@mgh.harvard.edu>
# Huzi Cheng <hzcheng15@icloud.com>
import base64
import codecs
import io
import json
import logging
import mimetypes
import re
import sys
import textwrap
import urllib.parse
import urllib.request
import zipfile
from copy import deepcopy
from ... |
72359775e2c372cc3984b5470deb0f411a002d499db6b153bd0370033e6f1284 | Python | 200,006 | 4,346 | # FluoroTensor Suite - By Max Wills
# Program for analysing data from sequentially illuminated objective TIRF, step detection of intensity time traces,
# and single-molecule tracking
# Project start date: 19/11/2021 @ 15:12
# First functioning version completed: 25/11/2021 @ 18:06
# Copyright (C) 2023: Max F. K. Wills ... |
9e4f926bb7ee61c92e46afd4859a0dfd0ca8cdf249fb799314495f14bec41ff7 | Python | 200,008 | 4,558 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This experiment was created using PsychoPy3 Experiment Builder (v2024.2.1),
on September 03, 2024, at 13:37
If you publish work using this script the most relevant publication is:
Peirce J, Gray JR, Simpson S, MacAskill M, Höchenberger R, Sogo H, Kastman E, Lin... |
84db6021935f62245ac635acb0c13eeb4ecf26d08964b51809e60e1ea95db708 | Python | 200,014 | 2,794 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="dns-prefetch" href="https://github.githubassets.com">
<link rel="dns-prefetch" href="https://avatars0.githubusercontent.com">
<link rel="dns-prefetch" href="https://avatars1.githubusercontent.com">
<link rel="dns-prefetch" hre... |
8b1c166a5345cf8d6c717d4fcc84e038cda13f528540999078b8eefac7f95895 | Quarto | 4,152 | 117 | ---
title: "Merge Allen"
format: gfm
---
This is a simple script to download the Allen Institute Brain atlas (ccfv3) and merge smaller ROI togethers as a function of their parent branches.
These are the packages you need to install and import before running the script.
```{r}
library(xml2)
library(nat)
library(oro.... |
37e4c3a9ab5f33b4431e4535fef3223dbcfef812c77da35e02f87ee07b2b3208 | R | 15 | 1 | # intervals.R
|
c7e38e4ae434c47f2455a4a3b71f95e713c30e080b89bdebe7d63ab0b6ac5c48 | R | 18 | 1 | # the test works!
|
eedabc8f0da8f1ad91dec69ade0ba8e827dbef43589507ec75c526f87a1823d6 | R | 50 | 4 | library(testthat)
library(mia)
test_check("mia")
|
0b4f23683a9af5c26ef953e72d285b78c2f7a8e846d804bfd62ccf0d5fe67c81 | R | 56 | 4 | library(testthat)
library(gUtils)
test_check("gUtils")
|
f3d609a26e0344d2bb54f551186501a53333083b40f491cb8127ce9ca75bec3f | R | 66 | 2 | library(rmarkdown)
rmarkdown::render("index.Rmd", "html_document") |
95a4e2e8c4b8164603ca7f52e009659a728a9f6b0f0fd15b88696dbdc5d6d604 | R | 86 | 3 | muxVizVersion <- "2.0.1"
muxVizUpdate <- "27 January 2018"
muxVizVersionName <- "Thor" |
ab89e9c8653adff3c787eff1e42a2749a7dae7f36dac15d321dc5039ec43d4ec | R | 177 | 12 | library(shiny)
library(pheatmap)
library(stringr)
library(RColorBrewer)
library(circlize)
library(ggplot2)
source("ui.R")
source("server.R")
# Run the app
shinyApp(ui, server) |
386df10df846348ebad2139a70590d69603baf518b42deda6f82451b80126222 | R | 184 | 12 | dwellCount <- function(x){
f <- c(which(diff(x) != 0),length(x))
y2 <- c(f[1],diff(f))
y1 <- x[f]
y <- list("cluster" = y1,
"dwell" = y2)
return(y)
} |
2b6fcdacb2358f1a9562024b21176824e0e39c51832c5b49d248b6413399f461 | R | 190 | 13 | doEuclid <- function(df,no){
df <- df[,no]
d <- matrix(0,dim(df)[1])
d[1] = NA
for(i in seq(2,dim(df)[1])){
d[i] <- dist(rbind(aa[i-1,],aa[i,]))
}
return(d)
} |
42627a79cfc230dbbdab93c142cd41cfd787da76014640659a01f5bf5b41c0f4 | R | 242 | 10 | # Prevent thread overuse (through data.table?) when running tests on CRAN.
Sys.setenv("OMP_THREAD_LIMIT" = 2L)
library(testthat)
library(familiar)
suppressWarnings(
testthat::test_check("familiar"),
classes = c("deprecation_warning")
)
|
f9f2508c0e23f80f4dd50a730229a41d4711886dce22bd4a53f71169f259df99 | R | 249 | 12 | smoothOut <- function(input){
outliers <- 2*as.numeric(input)
bef <- which(outliers == 2) - 1
aft <- which(outliers == 2) + 1
outliers[bef[outliers[bef] == 0]] <- 1
outliers[aft[outliers[aft] == 0]] <- 1
new_out <- outliers
} |
ffb2b2fd7a50e4d7336ace62331dab0fdeeafbfe32d06a1286d269cc630e1338 | R | 292 | 11 | .get_subset_args <- function(x, subset = NULL, select = NULL, ...){
rows <- subset
columns <- select
if(is.null(rows)){
rows <- rep(TRUE,nrow(x))
}
if(is.null(columns)){
columns <- rep(TRUE,ncol(x))
}
return(list(rows = rows, columns = columns))
}
|
6f5dac0e01fc96b35f6bf1f2e0ba47a261ec10b91c589762bd2a48ca26c16a6d | R | 294 | 8 |
#' @import ggplot2
#' @import data.table
#' @import utils
utils::globalVariables(names = c(":=", ".N", ".SD", ".",
"python_leiden", "python_louvain", "python_spatial_genes",
"Spatial_DE_AEH", "Spatial_DE", "silhouette_rank"))
|
c31e5f2533823c4cb8bedd43edd2498afe5e5c549e1664da1a2f79110118a0ec | R | 306 | 15 | library(tidyverse)
library(data.table)
args <- commandArgs(T)
gwas_data <- fread(
args[1],
sep="\t",
)
gwas_data$test <- args[3]
gwas_data %>% filter(!is.na(P)) -> gwas_data
gwas_data %>% filter(P <= 5*10^-7) -> gwas_data
gwas_data %>% {write.table(file = args[2], ., sep = "\t", row.names = F)} |
f8c231c4fbf8cbb360a574f478d44528222be769f81c64bf925e60b7cda1e980 | R | 306 | 10 | # intervals-layout.R
intervals.ui = nav("Intervals",
fluidRow(
column(6,
pickerInput("intervals_variables", NULL, multiple = T, width = "100%", choices = list("hello "=c("a b", "c d"), `One.xlsx`=c("X", "Y", "Z"), `Two.csv`=c("AB", "CD"))
)
)
)
) |
0c55e88a19401722ee710c69923a1ec331fc9f4714d4aa41ac9d765c98e7c182 | R | 310 | 14 | testthat::skip_on_cran()
testthat::skip_on_ci()
debug_flag <- FALSE
# Leave-one-out-cross-validation
familiar:::integrated_test(
experimental_design = "lv(fs+mb)",
vimp_method = "none",
parallel = FALSE,
skip_evaluation_elements = "all",
outcome_type_available = "binomial",
debug = debug_flag
)
|
79a5dc6000361f2b56731e27680aa1fb487849f7b989c75ba2df7954dbc3b413 | R | 310 | 9 | library(lmerTest)
SNdata<-read.csv('/Social_Navigation/SN_LMM.csv',head=T)
SNdata$characterlist<-as.factor(SNdata$characterlist)
SNdata$Type<-as.factor(SNdata$Type)
Test<-glmer(Response~1+characterlist+Type+(1|ID),family = binomial(link = "logit"),data=SNdata,control = glmerControl())
summary(Test) |
852fa3592f33e6dd170ad9455c562940bbd47467a9b9b749c8358249845e8e3d | R | 313 | 12 | library(ape)
library(phangorn)
library(adegenet)
for (i in 1:100) {
filename = paste("fasta/test", i, ".fasta", sep = "")
aa = read.aa(file=filename, format = "fasta")
D = dist.ml(aa, model="Dayhoff")
tree = nj(D)
savename = paste("nj/nj-tree", i, ".txt", sep = "")
write.tree(tree,file=savename)
}
|
001669c91195bb9ef95426afa190210ea9a08b2e4a78c7fec76824814f91292f | R | 318 | 17 | movavg <- function(v, win)
{
# Calculates moving average
#
# Input
# v: vector to smooth
# win: window for moving average
# Output
# smoothed signal
#
f = rep(1, win) / win
n = length(v)
v1 = c(rep(v[1], win), v, rep(v[n],win))
v1 = stats::filter(v1, f)
return(v1[win+1:n])
}
|
01a2423a8c14bdb64e0d30c06af234ee68088673233a1828477ff9c9e8fa5dd0 | R | 333 | 10 | # Environment holding global variables and settings.
familiar_global_env <- new.env(parent = emptyenv())
# Prevents notes on co-routines using the coro package. The coro developers may
# be able to fix this issue at some point. See
# https://github.com/r-lib/coro/issues/40
utils::globalVariables(c(
"generator_env",
... |
135a2a9526e9165be863352d1bf264d99517281f700a3652afec65ce1a39cdc8 | R | 335 | 15 | library(ape)
library(phangorn)
library(adegenet)
## Reading fasta file
aa = read.aa(file="test.fasta", format="fasta")
## Estimating evolutionary distances using same model as in simulations
D = dist.ml(aa, model="Dayhoff")
## Estimating tree
tree = nj(D)
## Saving estimated tree to text file
write.tree(tree,file=... |
b1eabb7106879c8bd8a5bec0e641070cc55aefd20f61e30088f97667fa7f2941 | R | 336 | 14 | whichTwin <- function(tbl){
tbl$twin[which(tbl$motparam_fd_outlier_count == min(tbl$motparam_fd_outlier_count))]
}
whichSes <- function(tbl){
tbl <- tbl %>%
dplyr::mutate(sunnivaed = FALSE)
tbl$sunnivaed <- tbl$sunnivaed[which(tbl$motparam_fd_outlier_count == min(tbl$motparam_fd_outlier_count))] <-... |
0acfb90d23b96a2bee3b64765a2824e2e3a65f64e6cc1b29c256d2826286823b | R | 345 | 13 | testthat::skip_on_cran()
testthat::skip_on_ci()
# Perform an integrated test. Note that learner is set automatically.
familiar:::integrated_test(
dynamic_model_loading = TRUE,
experimental_design = "fs+mb",
vimp_method = "none",
cluster_method = "none",
imputation_method = "simple",
parallel = FALSE,
est... |
d2cc61f22a1b72d95060b34fffa7292269ca7157f741c5399a265185f52a90dc | R | 369 | 16 | usethis::use_package("Matrix")
ObtainVarComps=function(phi, epsilon, corMat_base){
p=nrow(epsilon)
n=ncol(epsilon)
corMat=corMat_base^phi
corMat_norm=sum(corMat^2)
y1=sum(epsilon*(corMat%*%epsilon))/n
y2=sum(epsilon^2)/n
sigma2= (y1-y2)/(corMat_norm-p)
tau2= (-p*y1+corMat_norm*y2)/(corMat_norm*p-p^... |
98bf60d0a190708818018889ac213b5009a531b072615c841105462059e99e78 | R | 429 | 15 | loadInfomap <- function() {
message("Loading Infomap...")
dyn.load(paste("infomap/infomap", .Platform$dynlib.ext, sep=""))
source("infomap/infomap.R")
# The cacheMetaData(1) will cause R to refresh its object tables. Without it, inheritance of wrapped objects may fail.
cacheMetaData(1)
}
# Only load if not alrea... |
2cbacf3d0e1089d783450a5b612f993c362b2305af4469bf3d5d29de19434acf | R | 451 | 21 | #############################################################
#################### AUXILIARY FUNCTIONS ####################
#############################################################
## Min-Max normalization
normalize <- function(x) {
if (max(x) == min(x)) {
return(x)
}
return ((x - min(x)) / (max(x) ... |
c8991ca221e5e8846457641809518b76364e01ec3b8e67a71b43daf9419dc7c5 | R | 466 | 19 |
model.file = paste0('LearningModel_TMS_',modelname,'.txt')
if(modelname == 'same'){
mu_start = 0.5
alpha_start = rep(0.5,nsubs)
theta_start = 1
}
if(modelname == 'diff'){
mu_start = rep(0.5,nconds)
alpha_start = matrix(0.5,nrow = nsubs,ncol = nconds)
theta_start = 1
}
myinits <- rep(list(list(mu = mu_st... |
b99c1098bf5aefc56cf7435be23cebda522bd13023761969d31b315f55476e58 | R | 485 | 18 | myPath = "/data/bcu_projects/MelBrainSys_PostdocProject_Gruetzmann/publications/2022-my-MelBrainSys-paper/scripts-etc-for-publication/"
setwd(myPath)
install.packages("bin/covTest/", repos = NULL, type="source")
library(covTest)
library(devtools) # for function install()
.libPaths()
regNetParentDir = "bin/regNet-... |
a545028e93bee15c6950465f61970e769fc77f175a099ef43bf7cb3c01b13978 | R | 492 | 15 | # Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
.faith_cpp <- function(assay, rowTree) {
.Call(`_mia_faith_cpp`, assay, rowTree)
}
.apply_transformation_difference_or_division <- function(mat, method = "difference") {
.Call(`_mia_ap... |
f14d1ff0cbadfb482f3a2dc63e1ce9721c078588f203865590b40ed08d6515af | R | 503 | 22 | cl_radii <- function(ss_x, ss_y, zz_x, zz_y, rr = 1){
radius_x = rr*cos(2*pi/50*(0:(50-1)))
radius_y = rr*sin(2*pi/50*(0:(50-1)))
zz_dx = radius_x + zz_x
zz_dy = radius_y + zz_y
dists <- c()
euclid <- function(v1, v2) sqrt(sum((v1 - v2) ^ 2))
for (i in seq(length(zz_dx))){
dists[i]... |
c28780f2412d0cfc362e3775b97d6737ca7551f30220c7f7d4f147f8879f578b | R | 507 | 13 | # Test if detectors are available.
familiar:::test_all_novelty_detectors_available(
detectors = familiar:::.get_available_isolation_forest_detectors())
# Don't perform any further tests on CRAN due to time of running the test.
testthat::skip_on_cran()
testthat::skip_on_ci()
familiar:::test_all_novelty_detectors(
... |
e2c1829e263e1565dec601b09577c2174a2a228c2bfe16c8397998606829b1ea | R | 511 | 23 | #####
library(scales)
library(plyr)
library(Seurat)
library(dplyr)
library(harmony)
#########
####
brain=readRDS('mouse.BVE.filtered.seurat.final.selected.rds')
ctps=names(table(brain$celltype))
meta=brain@meta.data
for (c in ctps){
tmp=subset(brain,cells = rownames(meta[meta$celltype==c,]))
Idents(tmp)=tmp$conditi... |
7000e79dfca06112d90cca5cd2212a555b2f5b5acd9bfc38e22f43e6f05471f5 | R | 513 | 20 | usethis::use_package("Matrix")
CovRegOptim=function(phi, epsilon, corMat_base){
p=nrow(epsilon)
n=ncol(epsilon)
corMat=corMat_base^phi
corMat_norm=sum(corMat^2)
if (corMat_norm>p+1e-10){
y1=sum(epsilon*(corMat%*%epsilon))/n
y2=sum(epsilon^2)/n
sigma2= (y1-y2)/(corMat_norm-p)
tau2= (-p*y1+corM... |
0eb9f7b858bc915f4046d772a563f0b52b8abae97a139c54509aba700a9de153 | R | 524 | 22 | GetSummary <- function(coefs,vars,stats,name) {
for (v in 1:length(vars)){
rm("a")
a=coefs[c(paste(vars[v])),stats]
statnames=vector()
for (s in 1:length(stats)){
statnames[s]=paste(vars[v],"_",stats[s],sep='')
}
colnames(a)=c(paste(vars[v],"_Estimate",sep=''),paste(vars[v],"_SE"... |
6815438b11ec02c585ef6f17335f4b61d5ece5e4c5e5ef5e66f31c2f5f965cea | R | 529 | 21 | dfLanguage <- data.frame()
loadLanguageFile <- function(){
cat("\n")
cat("Loading language file...\n")
dfLanguage <<- read.csv("lang/default.csv",header=T)
rownames(dfLanguage) <<- dfLanguage$object
dfLanguage$object <<- as.character(dfLanguage$object)
dfLanguage$message <<- as.character(dfLan... |
75e4a9b53cbd926af91dc7cece12cfbda9db50eec57113e6792c82b75e3eb391 | R | 531 | 21 | ## code to prepare `mn17` dataset goes here
library(readr)
ct <- cols(
subject = col_double(),
rt = col_double(),
correct = col_double(),
jitter = col_double(),
noise = col_double(),
n200trialerp_c1r = col_double(),
n200trialerplat_c1r = col_double(),
p200trialerp_c1n = col_double(),
p200trialerplat... |
4341d734333cdea31728cd912ed125ca3e12bbd1a58c08e2160cfae178095134 | R | 563 | 14 | #' obtain_dada2_amplicon_sizes(mergers_list = NULL, sample_name = NULL, fun_to_apply = "median")
#'
#' This is a JAMS16 function.
#' This function will return the statistical transformation set by fun_to_apply on a given sample's merged F-R pairs within a DADA2 "mergers" object.
#'
#' @export
obtain_dada2_amplicon_siz... |
c13702ca476dfa196d07411b6c5c5b0a0e88a620852d53dac3b9556845486099 | R | 571 | 15 | # Define vector of package names
packages <- c("ggplot2", "RColorBrewer", "tidyverse", "psych", "summarytools", "htmlTable", "dplyr", "stringr", "lsr", "gtsummary", "flextable", "officer", "rcompanion", "reshape2", "openxlsx", "lavaan", "ggtext", "drc", "ggh4x", "EnvStats", "GPArotation", "corrplot")
# Load package... |
8fe5f7d124415ccdd48e7b9340dad7e6c90d1bb4f947809d1f8abdae0a07320e | R | 588 | 11 | terminalMTFixed <- read.csv("../../Result/Simulation/MTFixed/led/out_terminal.csv")
terminalMTVariable <- read.csv("../../Result/Simulation/MTVariable/out_terminal.csv")
outFile <- "../../Result/Analysis/StatisticalTest/wilcoxon_ranksum_test.txt"
sink( outFile)
cat( "Wilcoxon Rank Sum Test : Movement of MT Fixed and ... |
9094a7eb3bd1b8a16943c0e4d5d3f01e2d0cddc5071f025200232e7e9ded3362 | R | 596 | 16 |
identify.bin.events = function(dt, t, length = 15, start = 0) {
i = 1
bin.start = start
el = data.table()
while(bin.start < max(dt[, get(t)])) {
el = rbindlist(list(el, data.table(start = bin.start, end = bin.start + length)))
bin.start = bin.start + length
i = i + 1
... |
376458ca9faf3b4922bef4020428f5e9bfc0cadafaf9bd6604f21357979ea7f2 | R | 613 | 16 | # Test if detectors are available.
familiar:::test_all_novelty_detectors_available(
detectors = familiar:::.get_available_none_detectors())
# Don't perform any further tests on CRAN due to time of running the test.
testthat::skip_on_cran()
testthat::skip_on_ci()
familiar:::test_all_novelty_detectors(
detectors = ... |
1b998ccedb188a9ce1e2c7498705191fb0d4b638ccb4c6ae7514dc20deb464c3 | R | 635 | 13 | # Format the reviewed held-out metric table for the documentation figure; no refit.
data <- read.delim("metrics.tsv", check.names = FALSE)
rows <- list()
for (epitope in c("GLCTLVAML", "YLQPRTFLL")) {
subset <- data[data$epitope == epitope, ]
for (metric in c("ap", "accuracy", "balanced_accuracy")) {
value <- f... |
406d2e0883b85d9c0446108c42e6d81c13b9afcb5bea2678c53191931c5daae6 | R | 636 | 16 | ---
title: "README"
author: Jordan H. Whitlock
output: github_document
date: "`r Sys.Date()`"
---
# GTEx SETBP1 decoupleR inputs:
## TF regulation prior: CollecTRI (human)
* The prior network for [decoupleR](https://saezlab.github.io/decoupleR/) was constructed using [CollecTRI](https://github.com/saezlab/CollecTRI)... |
93ccea197a15b172baedbbd3513e0f82fb939cc2c3fa9207780af980d0765886 | R | 645 | 20 | library(plyr)
options(digits = 4)
input <- read.csv(file = 'output.csv',header = FALSE)
njdist <- input[which(input$V1 == 'njdist'),]
sumnj <- count(njdist,"V2")
totalnj<-sum(sumnj[,'freq'])
cornj<-sumnj[which(sumnj$V2 == 0),]
corrnj<-cornj$freq
accnj <-corrnj/totalnj
mldist <- input[which(input$V1 == 'mldist'),]
sum... |
90443a9d14d5a3481750e9e0f847b9f5b5a6a773160be4673f63d15cf785ed9a | R | 647 | 25 | ## generate-reads.R -- generate reads with different contamination
## rates.
source("read-sim.R")
contams <- seq(0, 0.95, 0.05)
n.reps <- 10
if (!file.exists("simulated-reads"))
dir.create("simulated-reads")
for (rate in contams) {
for (rep in 1:n.reps) {
dir <- file.path("simulated-reads", rate)
if (!f... |
a1999d98cba3618a0157e72f2e980213fdca69ab4853885c7b6770f3d66529fc | R | 656 | 28 | # Don't perform any further tests on CRAN due to running time.
testthat::skip_on_cran()
testthat::skip_on_ci()
debug_flag <- TRUE
results <- familiar:::test_export_specific(
export_function = familiar:::export_shap,
outcome_type_available = "multinomial",
data_element = "shap",
create_novelty_detector = FALSE... |
4ab72e0e0395b871a7bfc9ea260c6bfbfc0f51190f9f5bda81fa04235d1457e6 | R | 670 | 29 | usethis::use_package("Matrix")
ObtainVarComps2=function(phi, epsilon, corMat_base1, corMat_base2){
phi1=phi[1]
phi2=phi[2]
p=nrow(epsilon)
n=ncol(epsilon)
corMat1=corMat_base1^phi1
corMat2=corMat_base2^phi2
corMat1_norm=sum(corMat1^2)
corMat2_norm=sum(corMat2^2)
corMat12_norm=sum(corMat1*corMat2)
... |
0fc8caa2c5bcfd90f7525f7c4410444178939e1857facf68d7b6ebf28fee96ec | R | 679 | 33 | outliers <- function(vec, scale = 1.5) {
vec > scale * IQR(vec) + quantile(vec)[4]
}
outlierLevel <- function(vec, lvl = c(0.15, 1.50, 15.00)){
as.numeric(outliers(vec, scale = lvl[1])) +
as.numeric(outliers(vec, scale = lvl[2])) +
as.numeric(outliers(vec, scale = lvl[3]))
}
neighbours <- f... |
ef762e120776ce5a06b3b1ca3e4afb47ea408a7e33207ce1d595bfaccf49f972 | R | 709 | 9 | args <- commandArgs() # the input given in the command line on the hpc server when running the jobscript
sample <- as.numeric(args[6]) # getting the right input argument represeting the sample number
y_brain_pr <- read.csv(file = "/kyukon/scratch/gent/434/vsc43409/omics_data/JDS_brain_expression_2_75_var_only_names... |
d0717991cd7eb866fbd795cd424ab1d813bfd35f490a8060d6d600daa1e5e6d2 | R | 724 | 20 | library(dplyr)
library(data.table)
SNPs <- fread("~/Desktop/Retinol_GWAS/Meta_analyses/FUMA/Stouffer_METSIM_INTERVAL/rs.txt")
SNPs <- rename(SNPs, "rsids"="rsID")
Ret <- fread("~/Desktop/Retinol_GWAS/Meta_analyses/Common_var/IVW_METSIM_INTERVAL_sumstats_retinol_hg38.txt.gz")
Merge <- merge(SNPs, Ret, by = "rsids")
... |
c348b7ce9b0a0cc7797faba1a7f83827527e5416a910f73a141ec2c3798444d7 | R | 736 | 29 |
source("load-infomap.R")
infomap <- Infomap("--two-level")
# Set the start index for the feature nodes
infomap$setBipartiteNodesFrom(5)
features <- c(5,5,5,6,6,6)
nodes <- c(0,1,2,2,3,4)
weights <- c(1,1,1,1,1,1)
edgelist <- cbind(features, nodes, weights)
apply(edgelist, 1, function(e) infomap$addLink(e[1], e[2]... |
2a7937700cd02d4f01a2309c9fec1e5854e536f17c254e511100a223194b5326 | R | 742 | 21 | #' make_jams_file
#'
#' JAMSalpha function
#' @export
make_jams_file <- function(opt = opt, objectstoinclude = c("contigsdata", "featuredata", "abundances", "taxonomic_Quality_split_list", opt$blastanalyses, "bam_contig_depths", "TNF_contigs", "readstats", "fastqstats", "projinfo"), outdir = opt$outdir){
setwd(op... |
5f4363d328347d267124e1efcbec79c1227b70b8d59fbc491274f4338a110f33 | R | 744 | 10 | args <- commandArgs() #extract the argument given on the command line
sample <- as.numeric(args[6]) #position of the wished argument
y_brain_pr <- read.csv(file = '/kyukon/scratch/gent/434/vsc43409/omics_data/JDS_brain_expression_2_75_var_only_names.csv', header=TRUE, row.names = 1)
source('/kyukon/scratch/gent/vo/0... |
1491208d899671a2a75a94945b44e8ff6fe58b4114aa923bc9f0d88496a60e8e | R | 753 | 31 | # setup libraries and seed
set.seed(2178)
library(Seurat)
library(VISION)
library(GSEABase)
library(dplyr)
library(here)
library(RColorBrewer)
library(circlize)
library(ComplexHeatmap)
library(tidyr)
library(readr)
library(ggplot2)
library(org.Hs.eg.db)
library(org.Mm.eg.db)
# load data
load(here("data/setbp1_cerebral... |
af94f51e917feb7a2abdced3ac386cd87b09038497d4bb213c54c7bebdabdda9 | R | 767 | 26 | ######################
## Intersecting genome-wide sig SNPs with GTEX eQTL finemapping results (DAP-G, PIP > 0.95)
## William Reay (2022)
#######################
setwd("~/Desktop/Retinol_GWAS/")
library(data.table)
library(dplyr)
## METSIM+INTERVAL - DAP-G
INTERVAL_METSIM_GW_sig <- fread("Meta_analyses/METSIM_IN... |
da5e513f90c2bbf9e2035f2b856ba79db0439746e1f908f0abfa5026870c127d | R | 790 | 28 | library(data.table)
train <- data.frame(fread("/pine/scr/d/d/ddray/ArchIE_glm_features_train_v2.txt")) ## read in the training data
LABEL_COL=209
lr <- train[,1:LABEL_COL] # cut down the extra columns -- 209 is the label (0=not archaic, 1=archaic)
model <- glm(V209 ~ .,family=binomial(link='logit'),data=lr) # train t... |
56acafe7e05d86e71a20c102b7fadfce5ae78682254e9fdb40717e89c0620216 | R | 795 | 16 | # datasets/import.R
source("datasets/import-tabular.R", local = T)
source("datasets/import-spectra.R", local = T)
source("datasets/import-rds.R", local = T)
source("datasets/import-tdt.R", local = T)
refreshDatasetChoices = function () {
updatePickerInput(session, "data_dataset", choices = names(data$meta... |
a82e6bfb05b1727eb6286ccfc206933674471fd17aa56487926229e0bdbc3fea | R | 812 | 25 | context("agglomerateByRanks")
test_that("agglomerateByRanks", {
data(GlobalPatterns, package="mia")
x <- GlobalPatterns
# splitByRanks
x <- agglomerateByRanks(x)
expect_equal(altExpNames(x),
taxonomyRanks(x))
altExp(x,"Kingdom")
expect_equal(dim(altExp(x,"Kingdom")),c(2,26)... |
440a96c346ee1a48ec7d1a0b7f08b7cf404082ed13b897b40c968615c55a6f6a | R | 827 | 17 | #' SraRunTable_to_metadata(SraRunTable=NULL, Sample=NULL, discrete=NULL, subsettable=NULL, continuous=NULL)
#'
#' Converts an SRA Run Table to JAMS-style metadata (phenotable, phenolabels).
#' @export
SraRunTable_to_metadata <- function(SraRunTable = NULL, Sample = "Run", discrete = NULL, subsettable = NULL, continuou... |
d3dda879269a3f602b45735fa0cbe813efb43ae227a0987d6bb5e14236cb137e | R | 827 | 20 |
observeEvent(input$data_remove_finish, {
if (str_length(input$data_dataset) > 0) {
for (d in names(data)) {
#data[[d]][input$data_rename_current] = setNames(data[[d]][input$data_rename_current], input$data_rename_new_name)
data[[d]][input$data_dataset] = NULL
... |
4d6a01f5a3c004b9d52094556f39ab8a679c1bb15ff8014159050434e7175c24 | R | 830 | 27 | # Don't perform any further tests on CRAN due to time of running the complete
# test.
testthat::skip_on_cran()
testthat::skip_on_ci()
debug_flag <- FALSE
familiar:::test_export(
export_function = familiar:::export_calibration_info,
data_element = "calibration_info",
not_available_no_samples = FALSE,
not_avail... |
5ec45d051452add91aafb0ce47ef63380ca6034b77ca280edd12905508725749 | R | 832 | 28 | # setup libraries and seed
set.seed(2178)
library(Seurat)
library(VISION)
library(GSEABase)
library(dplyr)
library(here)
library(RColorBrewer)
library(circlize)
library(ComplexHeatmap)
library(tidyr)
library(readr)
library(ggplot2)
library(org.Hs.eg.db)
library(org.Mm.eg.db)
# load data
load(here("data/kidney_integrat... |
fbe6690fee3a00ba77d2403b1029dea63a7ceb31ccd24e5da470a3e845ab29bc | R | 836 | 31 | testthat::skip_on_cran()
testthat::skip_on_ci()
# Initiate process clock.
pc <- familiar:::ProcessClock()
initial_time <- pc$time()
Sys.sleep(1)
time_1 <- pc$time()
pc$suspend()
Sys.sleep(1)
time_2 <- pc$time()
time_mark <- microbenchmark::get_nanotime()
Sys.sleep(1)
pc$resume()
time_3 <- pc$time()
pc$suspend()
Sys.s... |
bdfe88a4066785a52f402a19edb5df84bdd726efe3ee81066819159db5fe6605 | R | 846 | 33 | WhittakerSmooth <- function(x,w,lambda,differences=1) {
x=matrix(x,nrow = 1, ncol=length(x))
L=length(x)
E=spMatrix(L,L,i=seq(1,L),j=seq(1,L),rep(1,L))
D=as(diff(E,1,differences),"dgCMatrix")
W=as(spMatrix(L,L,i=seq(1,L),j=seq(1,L),w),"dgCMatrix")
background=solve((W+lambda*t(D)%*%D),t((w*x)));
return(as.... |
9a8e8e856869b696367493a715b073f2fcbec9ea89bd94b9771e80f7924b6ca7 | R | 856 | 22 | #' plot_bias(bias, method = c("pca", tSNE"), frac = 0.25))
#'
#' Makes biased plots. Just kidding.
#' @export
plot_bias <- function(bias=NULL, method = "pca", frac = 0.25) {
bias <- sample_by_category(bias, frac)
data <- bias[,1:(ncol(bias)-1)]
data <- mutate_all(data[,2:ncol(data)], function(y) as.numeric... |
f91fdf4e28fae7544946c70e90916c1c19d1c098a1513197a4849a322f976316 | R | 860 | 32 | setwd("/Users/hongbin/Desktop/r work document")
library(corrplot)
library(pheatmap)
#数据格式,行为样本;列为代谢物,不需要归一化
x <- mtcars
#协方差,值越大,“趋势”相近
a <- cov(x)
#相关性处理
a <- cor(x, method = "pearson")
a <- cor(x, method = "spearman")
a <- cor(x, method = "kendall")
#含有缺失值
a <- cor(x, use = "complete.obs")
#去除显著性低于0.4的
a<- matri... |
831448d4b897f34eee3fd57011f1f95585dda876c8ff1299dcb6697375ae335e | R | 874 | 15 | #' evaluate_consolidated_Quality_split_df(consolidated_df = NULL)
#'
#' JAMSalpha function
#' @export
evaluate_consolidated_Quality_split_df <- function(consolidated_df = NULL){
Quality_levels_pecking_order <- c("HQ", "MHQ", "MQ", "LQ", "Contaminated")
Quality_levels_present <- Quality_levels_pecking_order[Qua... |
342b02524eca4f93dac9a67cc5f9d09ea45d05172fdb6d4ecb8347816e68fa89 | R | 879 | 30 | ############################
## Retinol - SNP h2: LDSR vs LDAK plots
## William Reay (2022)
###########################
library(ggplot2)
library(ggpubr)
library(readxl)
library(RColorBrewer)
DF <- read_excel("~/Desktop/Retinol_GWAS/h2_est/h2_plot_LDSR_LDAK.xlsx")
h2 <- ggplot(DF, aes(x=GWAS, y=h2, fill=LD)) +
... |
8e8adcd9ad2fd7cf8ae56ccf2a406b073ad1e5e038eeabab540886b821a435ef | R | 885 | 23 | library(argparse)
parser <- ArgumentParser()
parser$add_argument("--generator", default="FABP7")
args <- parser$parse_args()
foldername=args$generator
input_path=paste0('/scratch/users/banwang3/references/outputs/',foldername,'/')
align2='hg38'
for (align2 in c('hg38','pantro6')){
df = read.csv(paste0(input_path,al... |
efb1134848bc1f6365b3111cbb80fe39cfce82c135964c5c0e71ef5278b76418 | R | 887 | 26 | #' get_genome_completeness<-function(pheno=pheno, list.data=NULL))
#'
#' Returns a data frame with the estimated number of complete genomes of given taxa in each sample
#' @export
get_genome_completeness <- function(pheno = pheno, list.data = NULL){
#Get data for features
Samples <- rownames(pheno)
assobj... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.