sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
4e31077525a97d6964a8c5a13803adb2b1b04c5c97b7ab20d86ab2b5e990ad6d | R | 39,886 | 997 | # Prepare data and Working Environment ------
# Ensure correct python virtual environment is used
library(reticulate) # R interface to Python modules, classes, and functions
# NOTE: set this to the directory holding your Python virtualenvs (was a local Windows path)
Sys.setenv(WORKON_HOME = path.expand("~/.virtualenvs... |
b08b1d7296929e81760e6279b328d2267d91e6f9988174dbc9c256affe7f76d0 | R | 42,408 | 706 | ---
output:
html_document:
keep_md: true
pdf_document: default
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = F, warning = F, message = F, cache = T, results = 'hide')
```
```{r libraries}
library(RCTD)
library(Matrix)
library(ggplot2)
library(ggpubr)
library(gridExtra)
library(reshape2)
lib... |
5880e97ae43a185af1525eb133eda3178922b3cc152cf758475f3aa77cfd1100 | R | 46,294 | 1,267 | #=============================================================================#
# DCM_MUMC_ASE_analysis.R #
# #
# Version: 4.0 #
... |
fb97b6f5222c9b298ab534ade395c7d72b088cd5169b69ccc2be3509c8b0cd44 | R | 48,427 | 783 | ##MQ
```{r setup, include=FALSE}
#library/packages
.libPaths( c( .libPaths(), "L:/promec/Animesh/R/win-library/4.0") )
.libPaths()
#plot
#par(mfrow=c(1,2))
#data
inpD <-"L:/promec/TIMSTOF/LARS/2023/230222 Katja/"
thr<-20
selThr=0.1
selThrFC=1
hdr<-gsub("[^[:alnum:] ]", "",inpD)
setwd(inpD)
getwd()
#test
... |
9c98e1fe441696ce7883edf20dbe825e42845eb1fad46866c658906018b5cec6 | R | 51,028 | 920 | library(Seurat)
library(dplyr)
library(patchwork)
library(SeuratWrappers)
setwd("/mnt/alamo01/users/gbb/NDMG_snRNA/seurat/")
marker <- c("MAG", "MBP", "RNF220", "CTNNA3",
"HLA-DRA", "C1QA", "LRMDA", "TBXAS1",
"SNAP25", "MYT1L", "FAM155A", "NRG3",
"CD96","CD247", "SKAP1", "THEMIS",
... |
d6750012c6c404bfabf24b42319357e88bd3b90cd8b2b8f76e7921ec10d998bf | R | 51,148 | 1,212 | ```{r setup, include=FALSE}
#plot
par(mfrow=c(1,2))
#library/packages
#.libPaths( c( .libPaths(), "C:/Users/animeshs/GD/R-4.0.1/library") )
#.libPaths()
#[1] "C:/Users/animeshs/GD/R-4.0.1/library"
#install.packages("lattice", repos="http://cran.r-project.org", lib="~/local/R_libs/")
#.libPaths( c( .libPaths(), ... |
b434d876b5bad8fa07d2d6473f7b949d265ce856d0c534f7396ad295c0e02bb5 | R | 53,303 | 748 | #' Runs CSIDE on a \code{\linkS4class{RCTD}} object with a single explanatory variable
#'
#' Identifies cell type specific differential expression (DE) as a function of the explanatory variable.
#' The design matrix contains an intercept column and a column of the explanatory variable. Uses maximum
#' likelihood estima... |
1e7232e0a9bc224d389a9774e887f9b31c3aa1dcb7d54001fcef35d15384eda9 | R | 58,547 | 1,024 | ---
title: "Pseudobulk TE Heatmap Visualization"
author: "Raquel Garza"
output:
html_document:
df_print: paged
---
## Overview
This notebook provides a complete workflow to generate pseudobulk heatmaps for transposable element (TE) and HERV expression in single-nucleus RNA-seq data from the ASAP PMDBS cohort. I... |
6691c8fbfdf219d9bb2d4b73abc778af9894de880f173a5d3cbbfa6f697a6ed8 | R | 60,833 | 2,362 | library(Seurat)
library(SeuratDisk)
setwd("D:/Leon/snRNAseq/heilig_data_transfer/R/high_depth")
library(BPCells)
adata.data = open_matrix_anndata_hdf5("D:/Leon/snRNAseq/high_depth_processing/Heilig_aggr_noF1_nonormalize_highdepth/outs/count/high_processing.h5ad")
write_matrix_dir(
mat = adata.data,
d... |
c43602f98e500b2cc889ba8814c4785ee89a08eba36506f557dc2d163ac35cd9 | R | 62,724 | 1,903 | ---
title: "E16_clonal_information"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
knitr::opts_knit$set(root.dir = normalizePath(".."))
library(Seurat)
options(Seurat.object.assay.version = "v5")
library(ggplot2)
library(dplyr)
library(stringr)
library(patchwork)
library(circl... |
2cc4161866c4a5d2edc89167a7004e269b21f468e8204c3ec1c75a8661d6e237 | R | 64,524 | 2,206 | ---
title: "Intraskeletal Analysis"
author: "Trent M Trombley"
date created: "2023-03-22"
last updated: "2026-01-23"
output:
html_document:
toc: true
toc_float: true
theme: sandstone
---
```{r setup, echo=FALSE}
knitr::opts_chunk$set(echo = FALSE)
knitr::opts_chunk$set(message = FALSE)
knitr::opts_chunk$se... |
b3a518e571b3ed95e174ca5176a54ba60779e22cfb7bc8581f1dc1344ce7fa04 | R | 69,344 | 1,735 | ```{r libs}
#https://github.com/brandonyph/Survival-Analysis-demo/blob/main/Survival_Analysis_demo.R
#BiocManager::install("TCGAbiolinks",force = TRUE)
library("TCGAbiolinks")
library("limma")
#BiocManager::install("edgeR",force = TRUE)
library("edgeR")
#install.packages("glmnet")
library("glmnet")
#install.pa... |
e73285d76bfb835c9d6ab8ee56283c55a8878364067f4f8a9959eddd7d3e3234 | R | 75,937 | 1,492 | ```{r setup, echo = FALSE}
install.packages("explore")
library(explore)
beer <- use_data_beer()
beer |> explore()
```
```{r setup, echo = FALSE}
#library/packages
.libPaths( c( .libPaths(), "L:/R/library") )
.libPaths()
#install.packages("glue")
#plot
par(mfrow=c(1,2))
#data
inpD <-"L:/promec/Animesh/Aida/"
selThr=0... |
eff9bf1fbfbb19517bcc3c1968dac851b03fabd8f7b62d7a54238b1bd49e5e7e | R | 76,808 | 1,794 | # Prepare data and Working Environment ------
#load required libraries
library(lubridate) # parsing and manipulation of dates
library(Boruta) # Boruta feature importance algorithm
library(gratia) # GAM model evaluation
library(mgcv) # Generalized additive modeling (GAM)
library(caret) # Machine learning and classific... |
57bc16990c043a3ce26f4dd640871747ecc821c0c011504df68f25ebf9eaf846 | R | 77,223 | 1,578 | #setup####
inpD <-"L:/promec/USERS/SINTEF/20211207_SINTEF_30samples/combined/txt/"
#correlate log2median Clinical and WT and their difference between with dose
.libPaths( c( .libPaths(), inpD) )
.libPaths()
par(mfrow=c(1,2))
warnings()
#data####
selThr=0.1
selThrFC=0.1
hdr<-gsub("[^[:alnum:] ]", "",inpD)
setwd(inpD)
ge... |
83205630b846966acf8c94a1e2e1353b82c6198e78a35aaaaa5afa5010e1d148 | R | 91,877 | 2,591 | # Created: 2020-07-07 15:00:00
# Last modified: 2020-07-07 15:00:00
setwd("/Users/suchetachakravarty/Documents/projects/geode/")
rm(list=ls())
# Load the required libraries
library(data.table)
library(ggplot2)
library(dplyr)
library(ggpubr)
library(rstatix)
library(gridExtra)
library(Hmisc)
library(rstan)
library(zoo... |
dc0ec8c15644ebf49d8e8c58a8f04bfb77670bca30ee80ae1be61312db27d69a | R | 91,912 | 2,592 | # Created: 2020-07-07 15:00:00
# Last modified: 2020-07-07 15:00:00
setwd("/Users/suchetachakravarty/Documents/projects/geode/")
rm(list=ls())
# Load the required libraries
library(data.table)
library(ggplot2)
library(dplyr)
library(ggpubr)
library(rstatix)
library(gridExtra)
library(Hmisc)
library(rstan)
library(zoo... |
4011d4b201960b20e8789537351b86833456ab72789822affb78359308254d5a | R | 96,646 | 2,157 | ```{r proteinGroups}
inpD <-"Z:/PA/_Pseudomonas_ 1/"
inpF<-paste0(inpD,"140605_Pseudomonas_O1_K0K6_Proteins.txt")
data <- read.delim(inpF,sep="\t",header = T,row.names = 5)
data = data[!data$Contaminant=="True",]
summary(data)
dim(data)
colnames(data)
selection<-"Abundance.Ratio.log2."
SILAC<-as.matrix(data[,grep(selec... |
cbe8fc6da4f405740383e49ea714fe15adf0ff3bc69356334798de7915b21036 | R | 122,563 | 4,028 | mstr1 = "
data{
int<lower=1> nTrial;
int<lower=1> nSub;
int<lower=1> nStim;
int<lower=1> nResp;
int<lower=1> K;
int<lower=1> s[nSub, nTrial];
int<lower=1> a[nSub, nTrial];
int<lower=1> ya[nSub, nTrial];
int<lower=-1> r[nSub, nTrial];
int<lower=1> rew[nSub, nTrial];
int<lower=1> yax[nTrial*nSub];
int<lower=1> ... |
29b4090b992014065c35ca362417088383c1452d3d987f7cd65856dc5198ddcf | R | 143,470 | 2,976 | #!/usr/bin/env Rscript
#libraries required
library(bigstatsr)
library(Rcpp)
#library(data.table)
#library(parallel)
#library(hashmap)
#library(functionsdchic)
#library(bench)
#library(limma)
#library(depmixS4)
library(optparse)
########################### PCA calculation ###########################
#Generate FBM matr... |
9d0a8f26c4a9015de87a32b48029cac4f41186581d1de4669ed99480c8565b1a | R | 180,895 | 8,494 |
##############################################
### Description: Single-cell RNA-seq analysis pipeline
### Author:Jinjin zhu
##############################################
### Load required packages
library(Seurat)
library(dplyr)
library(ggplot2)
library(patchwork)
library(RColorBrewer)
library(ggsci)
... |
e04c162beb9963fbfaba77370db3580526300ac04194fbbaa0951c5ce0d99c05 | R | 192,044 | 4,332 | ```{r Pasientceller}
library(readxl)
inpD<-"L:/promec/Animesh/Sigrid/Hierarchical clustering/"
inpW<-paste0(inpD,"Pasientceller mut vs wt uten beh til publ.xlsx")
data<-read_xlsx(inpW)
data<-data.frame(data)
dataS<-data[,grep("Slot1",colnames(data))]
dataS<-sapply(dataS,as.numeric)
hist(dataS)
dataPasientceller<-data.f... |
53f99c3e5824484523f210b49500b1922df4f28066774a063640f04e6cccbf7d | R | 200,162 | 4,750 | ```{r}
pv<-c(0.00071993,0.001390152,0.001620303,0.014643094,0.014791889,0.026367867,1,1,1,1,1)
p.adjust(pv,method="BH")
```
```{r}
vals<-c(0:1000)
quantiles<-quantile(vals,probs=seq(0,1,0.01))
plot(quantiles)
```
```{r perm-ANOVA}
library(vegan)
library(tidyverse)
library(readxl)
set.seed(100)
data<-readexcel("test.xls... |
4dc90b6548dc166710f695d31cc9776dd0fd040b6d4d9362b38073208effa341 | Rust | 88 | 5 | //! I/O helper functions
#![deny(missing_docs)]
pub(crate) mod csv;
pub(crate) mod h5;
|
e950703ef3a3eb51f0478c71be472898a9f1dead33602432dbd3a5686ab95f59 | Rust | 103 | 7 | //! vdj_proto
#![deny(missing_docs)]
mod adapters;
pub mod io;
#[expect(missing_docs)]
pub mod types;
|
18f79c5e80428220d57f3dbef5f61f18304a618e45f1ee812228de38f75cd3e2 | Rust | 111 | 6 | //! tx_annotation
#![deny(missing_docs)]
pub mod mark_dups;
pub mod read;
pub mod transcript;
pub mod visitor;
|
30339de5726ab9325b7a1a759eb1393b941a32fb6580b792a2557f833cc1ee8e | Rust | 120 | 4 | mod enrichment_testing;
mod results;
pub use enrichment_testing::enrichment_testing;
pub use results::EnrichmentResult;
|
b04bcb18c075686e2af944a8334b62fbc8a665ed68e5a071da923e87afc39519 | Rust | 121 | 8 | //! cr_wrap::arc
#![deny(missing_docs)]
pub mod aggr;
pub mod count;
pub mod reanalyze;
pub mod testrun;
pub mod types;
|
6ebc9883d036bfd3395683f1a0640ffad26b2115e5df6d5af54769a0556da47d | Rust | 124 | 6 | //! cr_bam
// Constants and some I/O for BAM stuff
#![deny(missing_docs)]
pub mod bam;
pub mod bam_tags;
pub mod constants;
|
f0a8122baec6f1525ca2822bf584c79349575277a003379da33d6b0d97412ab9 | Rust | 142 | 8 | //! cr_websummary::multi
#![deny(missing_docs)]
pub mod antigen;
pub mod metrics;
pub mod plots;
pub mod websummary;
pub mod websummary_vdj;
|
be82577b5b96fd1b494673fa5aaeab2262b6b8064fa78271ca3cf2cc27c7d49c | Rust | 157 | 6 | //! Parallel processing
#![deny(missing_docs)]
mod par_proc;
pub use par_proc::{MAX_ITEMS_IN_MEM, Proc, group_by_processor, group_by_processor_in_memory};
|
896420d0628838b173b7bf080458cb1e1486a5aa82c8fdf8da95f7979a92130e | Rust | 173 | 7 | //! vdj_filter_barcodes
#![deny(missing_docs)]
pub mod filter_barcode_level;
pub mod filter_clonotype_level;
pub mod filter_library_level;
pub mod filter_log;
mod pack_dna;
|
e673012768335b9398392bb020c736e99ea553cda540b730d476086c73e6ea0b | Rust | 202 | 10 | //! multi
#![deny(missing_docs)]
mod barcode_sample_assignment;
mod cmo_set;
pub mod config;
mod deprecated_os;
pub use barcode_sample_assignment::SampleAssignmentCsv;
pub use deprecated_os::oscheck;
|
87c30b6250f422d4bdd40437e6dbeea61e213ec00081bcdc2731f1879ce826b0 | Rust | 208 | 8 | //! Definition of the proto file created by enclone and readers/writers for the proto file
#![deny(missing_docs)]
pub mod proto_io;
pub mod types;
/// Proto version
pub const PROTO_VERSION: &str = "1.0.0";
|
2abdef03b6671c3c82e19f022f7befa49cbbda03ba1e700d71060b9095268a75 | Rust | 211 | 11 | //! cr_ana::stages
#![deny(missing_docs)]
pub mod assign_low_umi_cells;
pub mod diff_exp_stage;
pub mod graph_clustering;
pub mod hierarchical_clustering;
pub mod pca;
pub mod pca2;
pub mod tsne;
pub mod umap;
|
2b8a3d72f3c2763d69863d1ff79e7effd48ab0078ea2da39b50e7a96900da8f0 | Rust | 234 | 8 | // Copyright (c) 2021 10x Genomics, Inc. All rights reserved.
#![deny(missing_docs)]
pub(crate) mod define_column_info;
pub(crate) mod define_mat;
pub(crate) mod delete_weaks;
pub(crate) mod loupe;
pub(crate) mod process_clonotypes;
|
b62541238abba15879d9b55210c84514f0cafc28c4f874c71041f22d25871545 | Rust | 237 | 11 | mod gene_frame;
mod hit_list;
mod screenviz;
mod sgrna_frame;
mod simple_frame;
pub use gene_frame::GeneFrame;
pub use hit_list::HitList;
pub use screenviz::Screenviz;
pub use sgrna_frame::SgrnaFrame;
pub use simple_frame::SimpleFrame;
|
e05afa7970c6b52f69ec19d3416a7703c03366014c36af52ec2a435b24dfe59d | Rust | 246 | 8 | mod median_ratio_norm;
mod normalize_counts;
mod total_norm;
pub use median_ratio_norm::median;
use median_ratio_norm::median_ratio_normalization;
pub use normalize_counts::{normalize_counts, Normalization};
use total_norm::total_normalization;
|
7031497c85e290397c920409d5236fd5d5d072193305a5a5dcfc3c828deea4ec | Rust | 251 | 9 | //! Functions and traits useful for testing the martian stages
#![deny(missing_docs)]
pub(crate) mod correctness;
pub(crate) mod tools;
pub use tools::{
diff_metrics, ensure_identical_set_of_lines, ensure_no_diff, safe_copy, set_permissions,
};
|
a9bff7c7002ad8bc38b2f486774d244d6212b31cd523665abc7f9cbc7575cba8 | Rust | 256 | 10 | //! slide_design
#![deny(missing_docs)]
#[cfg(feature = "tenx_source_available")]
mod stubs;
#[cfg(feature = "tenx_source_available")]
pub use stubs::*;
#[cfg(feature = "tenx_internal")]
mod internal;
#[cfg(feature = "tenx_internal")]
pub use internal::*;
|
4b874f91f38ae23aa51978e78283e55b0d683f0b9e64ce159adad0fe40cee359 | Rust | 265 | 11 | //! vdj_ann
// Copyright (c) 2019 10x Genomics, Inc. All rights reserved.
#![deny(missing_docs)]
// Modules introducing macros need to come before the modules that use them.
pub mod align;
pub mod annotate;
pub mod refx;
pub mod transcript;
pub mod vdj_features;
|
10b71c959649159a5c22d5a1c207c6bbaf8de7cb03edc868472519f79352f8e3 | Rust | 271 | 10 | //! clonotype_assigner
#![deny(missing_docs)]
pub mod assigner;
pub use assigner::Assigner;
pub mod fill_clonotype_info;
pub mod handle_no_clonotyping;
pub mod write_clonotype_outs;
pub mod write_concat_ref_outs;
pub mod write_consensus_bam;
pub mod write_consensus_txt;
|
784a15102d66049027bcdbdfffc5fc0fb91bb80676f0ebb7369190065621c8eb | Rust | 295 | 19 | pub mod agg;
pub mod config;
pub mod filter;
pub mod logging;
pub mod math;
use clap::ValueEnum;
/// Selection for P-Value Adjustments
#[derive(ValueEnum, Clone, Debug)]
pub enum Adjustment {
/// Bonferroni
Bf,
/// Benjamini-Hochberg
Bh,
/// Benjamini-Yekutieli
By,
}
|
e21d6fa059a5f8a0920fe42f344ac0a77b1306e59ffdf53679354d66475c62cd | Rust | 300 | 13 | //! transcriptome
#![deny(missing_docs)]
mod bed12;
mod parse_gtf;
pub mod python_gene_index;
mod transcript_index;
mod transcript_sequence;
mod transcriptome;
pub use bed12::Bed12Format;
pub use transcript_index::{Gene, TranscriptIndex};
pub use transcriptome::{Transcriptome, TranscriptomeGene};
|
6d665f042ce97df6e136ecf7a9d4ac91bd38611b25f4d82b3e02d651d0284316 | Rust | 302 | 12 | //! enclone_core
// Copyright (c) 2021 10x Genomics, Inc. All rights reserved.
#![deny(missing_docs)]
pub(crate) mod align_to_vdj_ref;
mod alignment;
pub(crate) mod barcode_fate;
pub(crate) mod defs;
pub(crate) mod enclone_structs;
pub(crate) mod hcomp;
pub(crate) mod join_one;
pub(crate) mod opt_d;
|
f0383c4cebb100f2f4fbcaf97f1fbf78c9e6657a43c6845199dcbfab114802e1 | Rust | 329 | 12 | //! cr_lib::detect_chemistry
#![deny(missing_docs)]
pub(crate) mod adapter_filter;
pub(crate) mod chemistry_filter;
pub(crate) mod errors;
pub(crate) mod identity_check;
pub(crate) mod length_filter;
pub(crate) mod mapping_filter;
pub(crate) mod probe_bc_check;
pub(crate) mod probe_bc_pairing;
pub(crate) mod whitelist... |
8aba72216a9c6217be1f4f601af5b9a549ccac9be8c36eae5057e2fc2b6b6534 | Rust | 337 | 12 | mod gene_frame;
mod screenviz;
mod sgrna_frame;
mod utils;
pub use gene_frame::{write_gene_frame, write_hit_list};
pub use screenviz::Screenviz;
pub use sgrna_frame::write_sgrna_dataframe;
pub use utils::{
build_regex_set, get_string_column, load_dataframe, match_headers_from_regex_set, to_ndarray,
validate_nt... |
d9133218395008402021869124962378f85ec94b801e44f9f613e835ce16ec83 | Rust | 337 | 11 | //! cr_types::reference
#![deny(missing_docs)]
pub mod feature_checker;
pub mod feature_extraction;
pub mod feature_reference;
pub mod genome_of_chrom;
pub mod probe_set_reference;
/// Metadata of the reference from the `reference.json` (if reference_path
/// provided) or from the probe set reference CSV file.
pub mod... |
79e81fc20d79ecf8efe7601f1eb43ad6b460641290f96a26c2c24038aa42761f | Rust | 382 | 18 | //! cr_ana
#![deny(missing_docs)]
use cr_types::FeatureBarcodeType;
use cr_types::reference::feature_reference::FeatureType;
mod hclust_utils;
mod io;
mod louvain;
mod pca;
#[cfg(test)]
mod stage_testing;
pub mod stages;
#[cfg(test)]
mod test_pipeline;
mod types;
pub(crate) const EXCLUDED_FEATURE_TYPES: &[FeatureType... |
7d69fe620aa5a248361fb23d237882aaa55e24cce3a3d372ba58771632b42bf2 | Rust | 410 | 22 | // Control over the algorithm.
#![expect(missing_docs)]
pub struct Heuristics {
pub free: bool, // do denovo assembly?
pub prim_trim: bool, // trim after primers?
}
impl Heuristics {
pub fn new() -> Heuristics {
Heuristics {
free: false,
prim_trim: true,
}
... |
49af62349206e9bfb0a17ca0c6606f2faa18539a641eb3a0e70c3a23694e6d70 | Rust | 423 | 20 | #![expect(missing_docs)]
use crate::{UmiQual, UmiSeq, is_valid};
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug)]
pub struct UmiInfo {
pub seq: UmiSeq,
pub qual: UmiQual,
pub is_valid: bool,
}
impl UmiInfo {
pub fn new(seq: UmiSeq, qual: UmiQual) -> UmiInfo {
UmiIn... |
01f362e1217c190defe0795e16eab320f15a02f06843948d670e0c2ec49b3744 | Rust | 446 | 12 | #![expect(missing_docs)]
/// The quality offset for Illumina FASTQ files.
pub const ILLUMINA_QUAL_OFFSET: u8 = 33;
/// Default minimum CRISPR UMI threshold.
pub const DEFAULT_MIN_CRISPR_UMI_THRESHOLD: usize = 3;
/// Name of the environment variable command line inputs are stashed in
pub const COMMAND_LINE_ENV_VARIABL... |
c1c0befa97aea96feed372e0bffd1231dfd2bb591cc4c044dabaf1f6b605d82f | Rust | 456 | 20 | #![expect(missing_docs)]
use bio::pattern_matching;
pub const ILLUMINA_QUAL_OFFSET: u8 = 33;
pub type Pattern = pattern_matching::bndm::BNDM;
pub struct PatternCheck {
pattern: Pattern,
}
impl PatternCheck {
pub fn new(pattern_seq: &[u8]) -> Self {
PatternCheck {
pattern: Pattern::new(pat... |
817a8c15a71202299e4f469fa4307b4311d5495a98fc32775d8d2d13b053e444 | Rust | 482 | 28 | use clap::ValueEnum;
mod logged_ols;
mod math;
mod model_mean_variance;
mod ols;
mod sqmean;
mod wols;
use logged_ols::LoggedOls;
use math::inverse;
pub use model_mean_variance::model_mean_variance;
use ols::Ols;
use sqmean::Sqmean;
use wols::Wols;
#[derive(ValueEnum, Debug, Clone, Default, PartialEq, Eq, Copy)]
pub... |
ed5e34e3a6ebef75359f86dff8906935621e36791c9d85198bcf42989ce4b9f7 | Rust | 490 | 19 | //! stats
#![deny(missing_docs)]
mod nx;
mod reservoir_sampling;
pub use nx::{compute_nx, n50, n90};
pub use reservoir_sampling::ReservoirSampler;
/// Compute the effective diversity (inverse Simpson index) of a distribution of numbers.
pub fn effective_diversity(members: impl Iterator<Item = f64>) -> f64 {
// in... |
fdbac58d1c32d0746ba99ef7ed03754c3d75ea1e7a88efd0e4eb1c8177de3006 | Rust | 524 | 12 | #![expect(missing_docs)]
use bio::alignment::Alignment;
use bio::alignment::pairwise::Aligner;
use debruijn::dna_string::DnaString;
/// Return a "standard" affine alignment of x to y. This is intended to be
/// applied to the case where x is to be fully aligned to part of y.
pub fn affine_align(x: &DnaString, y: &Dna... |
b275f770a6c96aa274c3e334f19a3709e69bdc151bbe2603b5d189789e01801e | Rust | 540 | 11 | // Constants used for ShardIO operations
// in align_and_count and barcode_sort
// we only need these here because we need DISK_CHUNK_SZ to estimate memory usage. Once ShardReader
// has API to provide that, these can return to the stages where they are used
// TODO: Set the parameters optimally?
#![expect(missing_docs... |
8e097169b33930d8eba98ceefa9df1bda525aa5b13f0ca4c1494ea66e0eb24b9 | Rust | 559 | 27 | //! pyanyhow
#![deny(missing_docs)]
use pyo3::PyErr;
use pyo3::exceptions::PyException;
/// A Result of PyAnyhowError
pub type Result<T, E = PyAnyhowError> = core::result::Result<T, E>;
/// Wrap a anyhow::Error
#[derive(Debug)]
pub struct PyAnyhowError(pub anyhow::Error);
impl From<PyAnyhowError> for PyErr {
fn... |
743fc03f23fc73dd7cbc6f9d54821e5f643ea0b11f2487d3b6fe5c0837d16da7 | Rust | 563 | 21 | #![deny(missing_docs)]
use anyhow::Result;
use barcode::Barcode;
use martian_derive::MartianStruct;
use martian_filetypes::json_file::JsonFile;
use metric::TxHashSet;
use serde::Deserialize;
#[derive(Clone, Deserialize, MartianStruct)]
pub struct V1PatternFixParams {
#[expect(dead_code)]
affected_barcodes: Jso... |
d553f0e5dd2cb618a49e22675d7479f6275518a3254bc0ce58d245d542d8e820 | Rust | 578 | 31 | //! vdj_asm_utils
#![deny(missing_docs)]
pub mod asm;
pub mod bam_utils;
pub mod barcode_data;
pub mod constants;
mod contigs;
pub mod exact_clonotyping;
mod fastq;
pub mod graph_read;
pub mod heuristics;
pub mod log_opts;
pub mod primers;
pub mod process;
mod ref_free;
pub mod sw;
pub mod umi_data;
mod utils;
pub(cra... |
52570f75abd2ace84ac0ca52c6a018012895f2b8694ea0c8493bffd078ea2798 | Rust | 615 | 18 | //! I/O functionality
#![deny(missing_docs)]
use anyhow::{Context, Result};
use itertools::Itertools;
use std::fs::File;
use std::io::{BufReader, Read};
use std::path::Path;
/// Count the number of lines in a file.
/// The number of newline characters is counted.
/// A final line missing a terminal newline character ... |
416b92de219bbcfbfada3ef7ce1557ce8ba94bead51385e90ecae6c531483504 | Rust | 630 | 28 | use ndarray::Array1;
pub struct Sqmean {
kappa: f64,
}
impl Sqmean {
pub fn fit(log_means: &Array1<f64>, log_variances: &Array1<f64>) -> Self {
let kappa = (log_variances - (2.0 * log_means)).mean().unwrap();
Self { kappa }
}
pub fn kappa(&self) -> f64 {
self.kappa
}
}
#[cf... |
add83b77a025e10dd20c8a40c666de1a721148909de309567f1144f3624af398 | Rust | 655 | 26 | //! cr_aggr
#![deny(missing_docs)]
mod errors;
pub mod match_vdj_outs;
/// Trim and merge molecules
pub mod merge_molecules;
pub mod create_antigen_clonotype_clustermap;
pub mod parse_aggr_csv;
pub mod process_vdj_proto;
pub mod run_enclone_aggr;
pub mod setup_vdj_aggr;
pub(crate) mod websummary;
pub mod write_aggr_a... |
be0b9fee6d46a0f3c5affcbaed447da24a017c571dc9543172f82f044c71c311 | Rust | 669 | 20 | #![deny(missing_docs)]
use anyhow::{Context, Result};
use flate2::read::MultiGzDecoder;
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::path::Path;
const GZ_BUF_SIZE: usize = 1 << 20;
/// Open a (possibly gzipped) file into a BufReader.
pub(super) fn open_with_gz(path: &Path) -> Result<Box<dyn BufRead>... |
2e4b6579750ae1ee48455bfeb4828efbc8ddbb4990c3aceb0502763cbbc2af0b | Rust | 694 | 27 | use ndarray::Array1;
use std::ops::{Div, Sub};
/// Z-Score Transforms the Provided Array
/// # Arguments
/// * `array` - the array to be transformed
pub fn zscore_transform(array: &Array1<f64>) -> Array1<f64> {
let mu = array.mean().unwrap_or(0.);
let sigma = array.std(0.);
array.sub(mu).div(sigma)
}
#[cf... |
a23385e9719ade01d158cb3e8b26cb9d20e93c21db53ea0748f4bd4939a89224 | Rust | 694 | 28 | // Copyright (c) 2021 10X Genomics, Inc. All rights reserved.
#![deny(missing_docs)]
// Miscellaneous functions.
use crate::core::defs::BarcodeContigs;
use std::cmp::Ordering;
pub(crate) fn sort_tig_bc(tig_bc: &mut [BarcodeContigs]) {
tig_bc.sort_by(|x, y| -> Ordering {
for i in 0..x.len() {
... |
a297669210a4283e74f8e49e3b6ed94cfdffcf1142280798b6ab0542c41f3e52 | Rust | 718 | 27 | //! Metric implementation for f64 and i64
#![deny(missing_docs)]
use crate::{JsonReport, JsonReporter, Metric};
macro_rules! impl_metric_and_json_report {
($type:ty) => {
impl Metric for $type {
fn merge(&mut self, other: $type) {
*self += other
}
}
... |
bdff1709aef6101c68b9d46d66613856e23851c0706109287b896e81c0f45da0 | Rust | 719 | 25 | //! Types used in aggr pipelines
#![expect(missing_docs)]
use martian_derive::MartianType;
use serde::{Deserialize, Serialize};
use std::path::PathBuf;
#[derive(Serialize, Deserialize, Clone, PartialOrd, PartialEq, Eq, Debug, MartianType)]
pub struct CountAggrSampleDef {
pub library_id: String,
pub molecule_h... |
0137845d2ea2ba738166fb2ef0922b4ecfae77a46c064193fdf204284f7d49b7 | Rust | 735 | 32 | //! slide_design::stubs
#![expect(missing_docs)]
use anyhow::Result;
use martian::AsMartianPrimaryType;
use serde::{Deserialize, Serialize};
use std::path::Path;
#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[serde(rename_all = "snake_case")]
pub enum OligoPart {
Bc1... |
956888e7550d6d90263426cd3b0b2560dcc7fb5546a099a048cbaa82ae5f0854 | Rust | 775 | 22 | mod enrichment_testing;
mod results;
use clap::ValueEnum;
pub use enrichment_testing::enrichment_testing;
pub use results::EnrichmentResult;
#[derive(Debug, Clone, Copy, ValueEnum, Default)]
pub enum TestStrategy {
/// Take the median of the counts within a group before testing differential abundance
#[value(n... |
e71906979405cabf6f927add77bd27ec02cc780edde828f2cea87c4fbee597ac | Rust | 798 | 29 | //! vdj_asm_asm
#![deny(missing_docs)]
pub mod airrfilter;
pub mod asm_call_cells;
pub mod asm_metrics;
mod assembly;
pub use assembly::{Assembly, BarcodeDataBriefFile};
mod adapter;
pub mod assembly_types;
mod contig_aligner;
pub mod filter_exact_clonotypes;
pub mod filter_sample_specific;
pub mod make_exact_clonotype... |
ebe46250e16b2e8e5236c3586875a789c81bd742bfe0abf911ed1c768c7799ce | Rust | 814 | 29 | //! cr_vdj
#![deny(missing_docs)]
pub mod clonotype_hist;
pub mod clonotype_table;
/// Copy the VDJ reference
pub mod copy_vdj_reference;
pub mod create_barcode_csv;
pub mod make_vdj_plots;
mod matrix;
pub mod summarize_vdj_filters;
use serde::Serialize;
/// Assert that two JSON values are equal
pub fn check_eq_json... |
22aa54626a9254e69d8c1bc1cc56aee484bed3a0555c8cd60f7b54a83c239bba | Rust | 870 | 27 | use super::{LoggedOls, ModelChoice};
use crate::norm::median;
use crate::utils::logging::Logger;
use ndarray::{s, Array1, Array2, Axis};
/// Model Mean Variance using Ordinary Least Squares Regression
pub fn model_mean_variance(
normed_matrix: &Array2<f64>,
n_controls: usize,
model_choice: &ModelChoice,
... |
80218043382c85cdd08c243b2aaf766fb20608ffc0c03b8959fe1933a281e101 | Rust | 935 | 27 | // Copyright (c) 2021 10X Genomics, Inc. All rights reserved.
#![deny(missing_docs)]
use super::barcode_fate::BarcodeFate;
use super::defs::{CloneInfo, ExactClonotype};
use enclone_proto::types::DonorReferenceItem;
use qd::Double;
use std::collections::HashMap;
pub(crate) type BarcodeFates = HashMap<String, BarcodeFa... |
b73a9fabfbb41b1bb16e518be07b12fac07ad918335b3461bec53b37f295f08a | Rust | 952 | 28 | //! Common code for annotate subcommand of cellranger and spaceranger
use crate::utils::CliPath;
use serde::Serialize;
#[derive(Serialize)]
/// The MRO arguments for the annotate CS pipeline.
pub struct AnnotateMro {
/// Sample ID
pub sample_id: String,
/// Sample description
pub sample_desc: String,
... |
9fd607330acc5e732602cf8e631b0757765d16000c7d3615c2153dc6be71f159 | Rust | 981 | 34 | use crate::utils::logging::Logger;
use clap::ValueEnum;
use ndarray::Array2;
use super::{median_ratio_normalization, total_normalization};
#[derive(ValueEnum, Debug, Clone, Default, PartialEq, Eq)]
pub enum Normalization {
/// Median ratio of sgRNA geometric means (unstable at high zeros)
#[default]
Media... |
aad832c21248350c8b59f9eadb10c23915e27bd4787afddad8b80ea45f243a22 | Rust | 1,027 | 44 | use ndarray::Array2;
/// Determininant of a 2x2 matrix
///
/// Calculated as a * d - b * c
pub fn determinant(m: &Array2<f64>) -> f64 {
assert_eq!(m.shape(), &[2, 2]);
m[[0, 0]] * m[[1, 1]] - m[[0, 1]] * m[[1, 0]]
}
/// Inverse of a 2x2 matrix
///
/// Calculated as 1 / det * [[d, -b], [-c, a]]
pub fn inverse(... |
ff32f308d0cea8365580817e32257c8cd45d8f90ade0160747f813669b27750f | Rust | 1,032 | 31 | //! barcode_extensions::stubs
#![expect(missing_docs)]
use crate::select_barcode_corrector_common;
use anyhow::Result;
use barcode::{BarcodeConstruct, BarcodeCorrector, BcSegSeq, Whitelist, WhitelistSpec};
use cr_types::chemistry::BarcodeExtraction;
use metric::SimpleHistogram;
use std::ops::Range;
pub type Correctio... |
1d6c7e02cdda5374f6b0c5c5f32493af9058fe8ec68187b6f0120c33c150a475 | Rust | 1,041 | 21 | // Logging options.
#![expect(missing_docs)]
#[derive(Default)]
pub struct LogOpts {
pub print_umi: bool, // print umis
pub show_supp: bool, // show read support for each graph edge
pub print_seq_edges: bool, // print sequence for each graph edge
pub nreject: bool, // don't show rej... |
e076abea783f38a2a2d116675f0752e5986b2348909bb88fcd4a0bd1e7588e17 | Rust | 1,046 | 37 | //! Martian stage LOGIC_NOT
//! Return the logical not of its input argument.
#![deny(missing_docs)]
use anyhow::Result;
use martian::{MartianMain, MartianRover};
use martian_derive::{MartianStruct, make_mro};
use serde::{Deserialize, Serialize};
/// The Martian stage inputs.
#[derive(Clone, Deserialize, MartianStruc... |
fcc923fd3bdd518c047a9e3ea6ba72eb91869370d4a8f50c9e5bf89181d003da | Rust | 1,091 | 45 | #![deny(missing_docs)]
pub(super) fn pack_bases_80(x: &[u8; 80], y: &mut [u8; 20]) {
for i in 0..20 {
y[i] = 0;
for j in 0..4 {
y[i] <<= 2;
match x[4 * i + j] {
b'C' => {
y[i] += 1;
}
b'G' => {
... |
f0b69e568712febc88505cfb89c06b6fab1838e3ffee64deabeb6f59a4554ce8 | Rust | 1,095 | 33 | //! This tool is used the python code in lib/python/cellranger/reference.py to
//! quickly load properties of the Genes and Transcripts from the GTF/ FASTA
//! files.
#![deny(missing_docs)]
use std::path::Path;
use transcriptome::python_gene_index;
fn main() {
let args: Vec<String> = std::env::args().collect();
... |
4ae0b9603fa5d8f33307f48c187cc10bbaa24aa7b3e3c83bee387e1505fcd03e | Rust | 1,107 | 37 | #![expect(missing_docs)]
pub const MATCH_SCORE: i32 = 2;
pub const MISMATCH_SCORE: i32 = 4;
pub const GAP_OPEN: i32 = 10;
pub const GAP_EXTEND: i32 = 1;
pub const CLIP: i32 = 10;
pub type UmiType = u32;
pub type ReadType = u32;
pub const KMER_LEN_BANDED_ALIGN: usize = 11;
pub const WINDOW_SIZE_BANDED_ALIGN: usize = ... |
edbd406fa91e22bf71f46ff229d545f0f4615c05c916199b4e2a722cdf22a602 | Rust | 1,146 | 32 | //! Module for supporting pipeline - 10x Cloud Analysis interaction.
#![deny(missing_docs)]
use anyhow::Result;
use std::env;
use std::path::Path;
/// Return the product id from the TENX_PRODUCT env var, defaulting to "ranger".
fn product_id() -> String {
env::var("TENX_PRODUCT").unwrap_or_else(|_| "ranger".to_st... |
6654fc0dc53fdecb5b4828e75b93dde43601ff5d5f7d4ff2a46d8715faa3d02e | Rust | 1,179 | 41 | //! Martian stage EXPECT_SINGLE_BARCODE_WHITELIST
#![deny(missing_docs)]
use anyhow::{Result, ensure};
use martian::prelude::*;
use martian_derive::{MartianStruct, make_mro};
use serde::{Deserialize, Serialize};
#[derive(Clone, Serialize, Deserialize, MartianStruct)]
pub struct Inputs {
pub barcode_whitelists: Ve... |
49dadf6091fa772937891e8fee88d3d413441b0452470328a5af4152fd01ed8f | Rust | 1,208 | 40 | //! Martian stage WRITE_GENE_INDEX
#![deny(missing_docs)]
use anyhow::Result;
use martian::prelude::*;
use martian_derive::{MartianStruct, make_mro};
use martian_filetypes::json_file::JsonFile;
use serde::{Deserialize, Serialize};
use std::path::PathBuf;
/// Martian stage WRITE_GENE_INDEX
pub struct WriteGeneIndex;
... |
394792a5440ede70958e0f92db49b99ee83709a47eefbe9f007f8a59b4a64d39 | Rust | 1,272 | 38 | //! Martian stage CHECK_SINGLE_BEAM_MODE
#![deny(missing_docs)]
use anyhow::{Result, bail};
use cr_types::reference::feature_reference::BeamMode;
use itertools::Itertools;
use martian::prelude::*;
use martian_derive::{MartianStruct, make_mro};
use serde::{Deserialize, Serialize};
#[derive(Deserialize, MartianStruct)]... |
1361e83b6672f41fa423ee45ff2ece0b4f4085afcbbfa82589b8cebc01e0c442 | Rust | 1,281 | 45 | #![deny(missing_docs)]
use itertools::Itertools;
use std::collections::HashMap;
pub(super) struct CellrangerFastqHeader {
pub(super) qname: String,
pub(super) header: String,
pub(super) tags: HashMap<String, String>,
}
impl CellrangerFastqHeader {
pub(super) fn new(header: String) -> CellrangerFastqH... |
9e2c5cb256430d656f85e77d839ea10c3e7f1d3b1ca07e1eb82d2e3f9776f8cf | Rust | 1,335 | 49 | //! cr_ana
#![deny(missing_docs)]
use anyhow::Result;
use clap::Parser;
use martian::prelude::*;
#[derive(Debug, Parser)]
enum Args {
Martian {
adapter_args: Vec<String>,
},
Mro {
#[clap(long)]
file: Option<String>,
#[clap(long)]
rewrite: bool,
},
}
const HEADE... |
5d4bbb3fd312f41e1cb47dcc181345fe80f2b7d7431216bb6f7308d88c74cd3e | Rust | 1,357 | 43 | //! Martian stage GET_CHEMISTRY_DEF
//! Load chemistry def from a chemistry name or a custom chemistry def
#![deny(missing_docs)]
use anyhow::Result;
use cr_types::chemistry::{ChemistryDef, ChemistryName};
use martian::{MartianMain, MartianRover};
use martian_derive::{MartianStruct, make_mro};
use serde::{Deserialize,... |
850baa514b9e839233f992fa64338ba4287f37c205489b2791f5e3154543acde | Rust | 1,361 | 39 | #![deny(missing_docs)]
use std::env;
/// Return the software product name, for example "Cell Ranger" or "Space Ranger"
/// or "Ranger" when the environment variable TENX_PRODUCT is not set.
pub fn get_tenx_product_name() -> String {
match env::var("TENX_PRODUCT").as_deref() {
Ok("cellranger") => "Cell Rang... |
72738a119315f585b4d74bd5ee55e20285528c2e4646f403f78265c8251b79cb | Rust | 1,392 | 38 | //! MakeExactClonotypes stage code
#![expect(missing_docs)]
use anyhow::Result;
use martian::prelude::*;
use martian_derive::{MartianStruct, make_mro};
use martian_filetypes::FileTypeWrite;
use martian_filetypes::json_file::JsonFile;
use serde::{Deserialize, Serialize};
use vdj_ann::annotate::ContigAnnotation;
use vdj... |
6fb0f3f111722e58789dfc6256299fe7b7a768b7e35b7f60b059fd2bbe2725dc | Rust | 1,406 | 40 | // Copyright (c) 2021 10X Genomics, Inc. All rights reserved.
#![deny(missing_docs)]
use crate::core::defs::{CloneInfo, EncloneControl, ExactClonotype, PotentialJoin};
use crate::core::join_one::join_one;
use equiv::EquivRel;
use qd::Double;
use std::collections::HashMap;
use vdj_ann::refx::RefData;
#[allow(clippy::t... |
e8c324355cacf26361c70f2f51fceb9d0880bf8ec729427a14a8c53cb9ed4fbd | Rust | 1,410 | 47 | #![expect(missing_docs)]
use anyhow::{Error, Result, bail};
use serde::Serialize;
use std::str::FromStr;
const MODELS_NOT_ALLOWED: [&str; 2] = ["azimuth", "panhuman"];
#[derive(Clone, Debug, Serialize)]
pub enum CellAnnotationModel {
Auto,
Custom(String),
}
impl CellAnnotationModel {
/// Converts cell an... |
85ce7b022658c9bc5ad4943fae24d40c4538868f42dd804ceb1d7e3ffae675ba | Rust | 1,417 | 46 | //! Martian stage MERGE_METRICS
//! Merge metrics JSON files.
#![deny(missing_docs)]
use anyhow::Result;
use cr_types::MetricsFile;
use martian::prelude::*;
use martian_derive::{MartianStruct, make_mro};
use martian_filetypes::FileTypeRead;
use metric::{JsonReporter, Metric};
use serde::{Deserialize, Serialize};
/// ... |
7724073ac7a6cb87d8b476b7dbc752175f7209ef2a12aacd99caaac5bcc4b263 | Rust | 1,442 | 43 | //! websummary_build
#![deny(missing_docs)]
use anyhow::{Context, Result};
use std::path::Path;
use tenx_websummary::WebSummaryBuildFiles;
/// Read a file and return a string
pub fn read_to_string(fname: &Path) -> Result<String> {
std::fs::read_to_string(fname).with_context(|| format!("While opening {fname:?} fil... |
ac5164c566e04686278d6b708eab8524ca5ab681310c17312adc418053f2a6cc | Rust | 1,464 | 43 | //! Gathering FASTQ files from Roche SBX sequencers.
use crate::read_pair_iter::FastqSet;
use anyhow::{Context, Result, anyhow};
use regex::bytes::Regex;
use std::os::unix::ffi::OsStrExt;
use std::path::Path;
use std::sync::LazyLock;
/// Gather FASTQs from a Roche SBX output directory.
/// TODO: this currently just gr... |
b4a7962bd03c35418a959351eca6d2a63fe47334898690149a5b5bab423522d5 | Rust | 1,474 | 43 | use ndarray::{Array2, Axis};
/// Performs normalization using the average of total reads in each sample
pub fn total_normalization(matrix: &Array2<f64>) -> Array2<f64> {
let sample_totals = matrix.sum_axis(Axis(0));
let average_size = sample_totals.mean().expect("Unexpected Empty Input");
let sample_fact... |
48c2c0ac820d6830f3b3e53234e938f443f6cb7f412a8d846d98b986a9f2ebff | Rust | 1,475 | 54 | //! Crate for dealing with dna sequences represented as a byte vector
#![deny(missing_docs)]
use std::borrow::Borrow;
const COMPLEMENT: [u8; 256] = make_complement_map();
const fn make_complement_map() -> [u8; 256] {
let mut comp = [0; 256];
// For some reason for isn't allowed in const contexts, but while i... |
62ba76052e7d1219243ca2566270655c4fbda1a2771b397d7009143a36c4fb86 | Rust | 1,515 | 39 | //! io_utils
// Copyright (c) 2021 10x Genomics, Inc. All rights reserved.
#![deny(missing_docs)]
// ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
// WRITE STUFF
// ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
/// fwriteln! is just like writeln!... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.