sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
0af4ba5ca765862513a231c5c1a3e63a9e9c6540f44e0f1746f0fdeeff6b0b98
Rust
7,067
177
// Copyright (c) 2021 10X Genomics, Inc. All rights reserved. #![deny(missing_docs)] // Miscellaneous functions. use super::BarcodeFilter; use crate::Dataset; use crate::core::barcode_fate::BarcodeFate; use crate::core::defs::{BarcodeContigs, ExactClonotype}; use itertools::Itertools; use vector_utils::{bin_member, b...
f2ebfd413f7b75d8e89a43beba46f7c471809afddc3a16fff5ec2a53e48c8a9d
Rust
7,253
254
//! In-flight counter pool: a single-producer semaphore with RAII reservation tokens. //! //! The producer calls [`InFlightPool::acquire`] which blocks until the total in-flight //! count drops below the caller-supplied threshold, then wraps a payload in a //! [`Reservation`] and increments the counter. When the [`Rese...
b76468e306671ac50ce6685409251c4a5337a70d74eb7af433b2e1c3fe139147
Rust
7,428
231
// Copyright (c) 2021 10X Genomics, Inc. All rights reserved. //! This file provides the function process_clonotypes, which performs some final //! filtering and writes out the barcode fate and the loupe clonotype files. //! Additional behavior is injected by Enclone through the candidate clonotypeProcessor trait. #![d...
0db1ec7503de63f4ff7fb8a9fb21adb81b37c9eb521efd5a1de74ce0dfa870a9
Rust
7,460
245
//! graph_simple // Copyright (c) 2018 10X Genomics, Inc. All rights reserved. #![deny(missing_docs)] // Define generic digraph functions. // // Some of the functions here are unnecessarily quadratic in the vertex degree for // petgraph as a result of calling v_from and related functions below. The // quadratic behav...
a6a586ed59b4bb5612578ea251bee17a09ccdcec1363353a80607167a0dc3fb7
Rust
7,490
212
//! Martian stage RUN_TSNE #![expect(missing_docs)] use crate::EXCLUDED_FEATURE_TYPES; use crate::io::{csv, h5}; use crate::types::{EmbeddingResult, EmbeddingType, H5File, ReductionType}; use anyhow::Result; use bhtsne::BarnesHutTSNE; use cr_types::FeatureBarcodeType; use cr_types::reference::feature_reference::Featur...
c2767e129e47541172714e578259fca869a7d05359c7d388f2c8610a4b68b986
Rust
7,497
206
//! Functions and traits useful for testing the martian stages #![deny(missing_docs)] use anyhow::Result; use martian::prelude::*; use std::path::PathBuf; /// Create a directory within the rover, run the given stage in /// that directory and return the stage outputs pub fn run_stage<S>( stage: S, args: <S as ...
fa733d844261b4e6d0f551dc9398ff5afc3eeef8f1540c4fbf66ede9859b50bc
Rust
7,508
198
//! Crate for resolving paths from lib/python/{assay}/barcodes folder. #![deny(missing_docs)] use anyhow::{Context, Result, bail, ensure}; use itertools::Itertools; use std::path::PathBuf; const HD_CS_CANONICAL_SLIDE_NAME: &str = "visium_hd_v1"; const HD_PD_CANONICAL_SLIDE_NAME: &str = "visium_hd_rc1"; const HD_XL_CA...
ee28c7f8ba664ad647a295859672ad40740e97d167fc54011e6dd53a3b1e3f5e
Rust
7,539
260
//! cr_aggr::websummary #![deny(missing_docs)] use cr_vdj::clonotype_table::VdjAggrClonotypeTable; use cr_websummary::{ CardWithTable, GenericTable, HeroMetric, NamedTable, PrettyMetric, TableRow, TermDesc, Threshold, TitleWithHelp, TitleWithTermDesc, WsSample, }; use serde::Serialize; pub(crate) mod annotati...
35663b11a3bde61b75dae6e9f647c34539cc49a51246c1d13e5bf8206a084b12
Rust
7,591
252
#![deny(missing_docs)] use itertools::Itertools; use std::sync::mpsc::{Receiver, sync_channel}; use std::thread::{JoinHandle, Scope, ScopedJoinHandle, spawn}; /// Abstract over scoped or regular thread join handles. enum AnyJoinHandle<'scope> { Regular(JoinHandle<()>), Scoped(ScopedJoinHandle<'scope, ()>), } ...
496da68cb9964c4418eca4646037d998ec8e7e00c27a2b360c0f635e6a4d2349
Rust
7,639
217
#![deny(missing_docs)] use crate::websummary::{GenericTable, NamedTable, PrettyMetric, TableRow, TitleWithHelp}; use serde::Serialize; use std::convert::Into; const HELP_TEXT: &str = "This table displays the 10 most shared CDR3 amino acid sequences. It is ordered by the number of shared donor/origin/libraries and the...
da44834c5f1b2c411b2dd4f13fdbe8cc666f094a3fbd5a9f30ced55b6be6ab06
Rust
7,684
218
use super::EnrichmentResult; use crate::norm::median; use adjustp::Procedure; use ndarray::{s, Array1, Array2, Axis, Zip}; use statrs::function::beta; /// Calculates the negative binomial cumulative distribution if measuring depletion otherwise /// calculates the negative binomial survival function. fn enrichment_test...
6e5ba1e54a7153cf4fdd785dd00019e68a0570e22e4d698de5c19d35e3c15095
Rust
7,707
256
//! A generalized approach for streaming 1D data from HDF5 using chunked reads. //! //! Variants are provided for doing the reading synchronously or using a thread. #![deny(missing_docs)] use anyhow::Result; use hdf5::{Dataset, H5Type}; use ndarray::Array1; use std::cmp::min; use std::sync::mpsc::{Receiver, sync_chann...
f9ab606162d8d70c98ada76c1c726bd20b3c49880857e15ea92b9b7ef2edf5f4
Rust
7,711
280
use super::{ utils::{filter_zeros, num_unique, set_alpha_threshold}, AggregationResult, GeneAggregation, }; use crate::{ enrich::EnrichmentResult, utils::{agg::aggregate_fold_changes, logging::Logger}, }; use adjustp::Procedure; use alpha_rra::AlphaRRA; use intc::{fdr::Direction, Inc}; use ndarray::Arra...
f8bfe448732a1efa0b0ccf0096d3a7c20a7ba3af738d4e188519bf9072d975f4
Rust
7,713
217
use crate::utils::logging::Logger; use hashbrown::HashSet; use ndarray::Array1; /// Return all indices where values are above zero pub fn mask_zeros(array: &Array1<f64>, logger: &Logger) -> HashSet<usize> { let mask = array .iter() .enumerate() .filter(|(_idx, x)| **x > 0.) .map(|(i...
a65945a4fe1db40b59723dee5174bc06baee78ad63a8b3717018d13645a6e400
Rust
7,789
213
#![deny(missing_docs)] use super::chemistry_filter::{ChemistryFilter, DetectChemistryUnit}; use super::errors::DetectChemistryErrors; use crate::detect_chemistry::chemistry_filter::DetectChemistryCandidates; use anyhow::Result; use barcode::{BarcodeConstruct, BcSegSeq, Whitelist, WhitelistSpec}; use cr_types::chemistry...
3603bc7da48f5ba32141e81dbe6d021556432a4e173b649c43e7a0c0956c7fd0
Rust
7,884
271
//! cr_wrap #![deny(missing_docs)] pub mod annotate; pub mod arc; pub mod chemistry_arg; pub mod cloud; pub mod create_bam_arg; pub mod env; pub mod fastqs; pub mod mkfastq; pub mod mkref; pub mod mrp_args; pub mod shared_cmd; pub mod telemetry; pub mod utils; use anyhow::{Context, Result, ensure}; use mrp_args::MrpA...
4c4f9dee1d5c257b26f4fb9638063561108ed51bb101273657181f899adcfc06
Rust
7,988
233
//! Helpers for producting adapter trimmers. use crate::LibraryType; use crate::chemistry::{ChemistryDef, ChemistryName}; use crate::rna_read::AdapterTrimmingParameters; use crate::types::AlignerParam; use anyhow::{Result, bail}; use fastq_set::long_read_adapter_trimmer::{ AdapterLayout, DEFAULT_MAX_R2_LENGTH, Read...
a56c9d3b1bda531fd1524b7cfcd55f7e61a292babb8088dc3aa8f092f20210ef
Rust
8,047
205
#![deny(missing_docs)] use anyhow::Result; use regex::Regex; use std::borrow::Cow; use std::fs::File; use std::io::{BufRead, BufReader}; use std::path::Path; // Regexes to check for known incompatible OS versions. If any of these match, the pipeline will fail with an error. // The error can be suppressed for by setti...
be57c4423d26931084f0ae4ac2a6395bd140d7407dd90e9c6786c13d697abe3f
Rust
8,068
254
//! I/O CSV helper functions #![deny(missing_docs)] use crate::types::{ClusteringResult, ClusteringType, EmbeddingResult, PcaResult, clustering_key}; use anyhow::{Result, anyhow}; use cr_types::reference::feature_reference::FeatureType; use ndarray::Array2; use std::fs::{File, copy, create_dir_all}; use std::io::{BufW...
c39ef8975f6771c2aec4aee57a87be8ce4b8ab5a49a4c9828be62fe4d62c5792
Rust
8,075
264
#![deny(missing_docs)] use anyhow::{Result, anyhow, bail}; use cr_types::FeatureBarcodeType; use cr_types::reference::feature_reference::FeatureType; use martian_derive::{MartianType, martian_filetype}; use ndarray::{Array1, Array2}; use serde::{Deserialize, Serialize}; use std::borrow::Cow; use std::convert::TryFrom; ...
4c2de35468efdbd0a5308642dd71bb5743162eb9ab1df7377806d98adc3f2f15
Rust
8,086
225
//! Martian stage RUST_BRIDGE #![deny(missing_docs)] use crate::barcode_sort::BarcodeOrder; use crate::types::ReadShardFile; use anyhow::Result; use barcode::Barcode; use cr_types::chemistry::ChemistryDefs; use cr_types::rna_read::RnaRead; use cr_types::types::LibraryType; use cr_types::{MetricsFile, PerLibrarySortedB...
2460f51d7126996408ac97140a785329007038efb18e111c8bc9249d8bded18a
Rust
8,119
217
//! WriteClonotypeOuts stage code #![expect(missing_docs)] use crate::assigner::ProtoBinFile; use amino::nucleotide_to_aminoacid_sequence; use anyhow::Result; use cr_types::clonotype::ClonotypeId; use enclone_proto::proto_io::read_proto; use enclone_proto::types::InvariantTCellAnnotation; use martian::prelude::*; use ...
10d74a44b81c3c12c2962b6cfca061ce985388e265e2909f305ab7e038441f1f
Rust
8,139
258
//! This crate defines a procedural macro for deriving the //! `JsonReport` trait. `JsonReport` trait can be auto derived for a //! struct if all the fields of the structs implement //! the `JsonReport` trait //! //! # How to use //! Add `json_report_derive` as a dependency to you `Cargo.toml`. //! Just apply `#[derive...
6ae7854d4dc8e709811128861c25ac19657ad68de51690c13e4ba843d802ecf4
Rust
8,246
195
//! SubsetAssemblyOuts stage code #![expect(missing_docs)] use crate::BarcodeDataBriefFile; use crate::assembly::BarcodeDataFile; use crate::assembly_types::UmiSummaryRow; use anyhow::Result; use barcode::whitelist::BarcodeId; use cr_types::chemistry::{ChemistryDefs, ChemistryDefsExt}; use cr_types::{BarcodeMultiplexi...
ca8efcae47d561b551c75afd0374955013630e4fc64b0ebbad24b541ff4a2648
Rust
8,265
247
#![expect(missing_docs)] use anyhow::{Context, Result, anyhow, bail}; use csv::StringRecord; use itertools::Itertools; use std::collections::{BTreeMap, HashMap}; use std::path::{Path, PathBuf}; use std::str::FromStr; /// Helper class for parsing configuration CSV files, validating them & providing good error messages ...
ab662930e53b49ca1759e5ff84f05f00e3636e3df41faaf7ac7652bbfa59f3b8
Rust
8,282
331
#![deny(missing_docs)] use serde::de::{self, Visitor}; use serde::{Deserialize, Deserializer, Serialize, Serializer}; use std::borrow::Borrow; use std::fmt; use std::hash::{Hash, Hasher}; use std::iter::FromIterator; use std::marker::PhantomData; use std::ops::{Index, IndexMut}; pub trait ArrayContent { fn valida...
81fb1c0810c8d3d9b405a73afb655f30d8b004473a01fffcf6098b0d6fa50ff0
Rust
8,364
224
#![deny(missing_docs)] use barcode::BcSeq; use cr_h5::molecule_info::{ BarcodeIdxType, FullUmiCount, GemGroupType, LibraryIdxType, MoleculeInfoIterator, MoleculeInfoReader, }; use cr_types::reference::feature_reference::{FeatureDef, FeatureType, HASHTAG}; use cr_types::rna_read::LibraryInfo; use cr_types::types...
2e5a2359cb2e6bbd11ad7e0527289024c2dea713cc2e3833db4ae7092750e318
Rust
8,388
235
#![deny(missing_docs)] use super::errors::DetectChemistryErrors; use super::identity_check::check_read_identity; use anyhow::Result; use cr_types::LibraryType; use cr_types::chemistry::{ChemistryDef, ChemistryName}; use cr_types::sample_def::{FastqMode, SampleDef}; use fastq_set::long_read_adapter_trimmer::{LongReadTri...
fbd565b8745bbfed7a5e1dcc50da2172976ad4d6d9adda6173073476a1c64289
Rust
8,507
254
//! Module for filtering raw reads based on adapter configurations to determine //! compatible chemistries and trimming parameters. //! //! This filter operates before the standard read loading process. It //! determines which adapter layout //! (if any) matches the raw reads. This result is used to provide the necessa...
48d658f5315ea4ab9d4fa7049cc23b266db1a2eee11c3d0c3c0ce7e873d891c3
Rust
8,515
198
//! Martian stage WRITE_CONCAT_REF_OUTS creates concat_ref.bam and concat_ref.bam.bai. #![expect(missing_docs)] use crate::assigner::{ BamBaiFile, BamFile, ProtoBinFile, QUALITY_OFFSET, SamFile, bam_record_from_align, replace_sam_by_indexed_bam, }; use anyhow::Result; use bio::alignment::pairwise::Aligner; use...
d4707876b10440ce56e3aba3af3f0957f8814253af28d03cead1cde4dc6a7f1f
Rust
8,536
230
//! Detection of probe barcode pairing between gene expression and feature barcoding. #![deny(missing_docs)] use crate::barcode_overlap::{ FRPGemBarcodeOverlapRow, GelBeadBarcodesPerProbeBarcode, ProbeBarcodeGelBeadGrouper, calculate_frp_gem_barcode_overlap, }; use crate::detect_chemistry::chemistry_filter::Uni...
5d0263ca0e65caa2752bf61c78ec9878732f850978c55143e553c3c381ea1587
Rust
8,555
245
//! Martian stage COUNT_ALLELES //! Count alleles of each cell using VarTrix #![deny(missing_docs)] use crate::BamFile; use anyhow::{Context, Ok, Result}; use bio::io::fasta; use cr_types::filtered_barcodes::FilteredBarcodesCsv; use cr_types::{BarcodeIndex, GeneticDemuxParams, Mtx, SamHeaderFile}; use itertools::Itert...
f05587d203b1fae9ab4da1f74bdf2df5621b1e29f2c66c44edae33ef5411ea49
Rust
8,559
304
use adjustp::Procedure; use anyhow::Result; use bon::builder; use clap::Parser; use cli::{ Cli, Commands, DiffAbundanceArgs, GeopaggArgs, IncArgs, InputArgs, MiscArgs, RraArgs, SgrnaColumns, }; use geopagg::WeightConfig; use log::LevelFilter; use run_aggregation::run_aggregation; use std::path::Path; pub mod a...
84199e5e37b47dbc4f50de6422649ba9965e77289722f08307df1335a5fbc7ee
Rust
8,637
294
//! vdj_types // Copyright (c) 2021 10x Genomics, Inc. All rights reserved. #![expect(missing_docs)] use serde::{Deserialize, Serialize}; use std::convert::TryFrom; use std::fmt; use std::str::FromStr; // From https://danielkeep.github.io/tlborm/book/blk-counting.html macro_rules! replace_expr { ($_t:tt $sub:expr...
3dcfb85cdf4ec9c96b1652eadc1fc6aebb0402a99cf233b4bd69735f4fb44016
Rust
8,657
238
// Copyright (c) 2021 10X Genomics, Inc. All rights reserved. #![deny(missing_docs)] // Delete exact subclonotypes that appear to represent doublets. // // THIS FILTER DOESN'T PROPERLY TRACK FATE. use crate::core::barcode_fate::BarcodeFate; use crate::core::defs::{CloneInfo, EncloneControl, ExactClonotype}; use crate...
8afa56fa01e3923505348c8fb8cdc2feed0595b0d8d86944a68b102defb5da22
Rust
8,734
308
use crate::{ aggregation::{GeneAggregationSelection, GeoPAGGWeightConfigEnum}, enrich::TestStrategy, model::ModelChoice, norm::Normalization, utils::Adjustment, }; use clap::{ builder::{ styling::{AnsiColor, Effects}, Styles, }, Parser, Subcommand, }; // Configures Clap ...
65fd2331491ee95b38828f09dcd0a244fd2975e902c9f2a6c47dcbde42d85ce7
Rust
8,745
254
use hashbrown::{HashMap, HashSet}; const LEXICON: [u8; 5] = [b'A', b'C', b'G', b'T', b'N']; type NullSet = HashSet<Vec<u8>>; type PermuteMap = HashMap<Vec<u8>, Vec<u8>>; /// Calculates all unambiguous single edit distance permutations /// for a set of sequences (hamming distance = 1) /// /// # Example of unambiguous ...
9d003797370858b6e365241fb07af54ec2897402db4137085e4f787784a70082
Rust
8,765
264
#![expect(missing_docs)] use crate::utils::CliPath; use anyhow::{Result, anyhow, bail}; use clap::builder::NonEmptyStringValueParser; use clap::{self, Parser}; use cr_types::LibraryType; use cr_types::sample_def::{COUNT_HELP, FastqMode, SampleDef, SampleDefBuilder}; use fastq_set::filenames::fastq_dir::FastqChecker; us...
f112d1fb6f770936ce797528e72d4636ceda5da16afe225f2082a3b02520d9d9
Rust
8,782
215
//! ASM_CALL_CELLS stage code #![expect(missing_docs)] use crate::assembly::BarcodeDataBriefFile; use anyhow::Result; use martian::prelude::*; use martian_derive::{MartianStruct, make_mro}; use martian_filetypes::json_file::JsonFile; use martian_filetypes::{LazyFileTypeIO, LazyWrite}; use serde::{Deserialize, Serializ...
d59f11dab0c8fa939841e526e1fba4f1faffef738a1f41f1de1415cdf34d235a
Rust
8,930
255
#![deny(missing_docs)] use super::parse::ParseCtx; use super::scsv::{Section, Span, XtraData}; use anyhow::{Context, Result, anyhow, bail}; use itertools::Itertools; use nom_locate::LocatedSpan; use std::collections::HashMap; use std::fmt::Display; use std::ops::Range; #[derive(Debug)] pub struct CsvParser<'a, T: Disp...
ceff16ab4726fda02fd4fd36450a028831b700ce58d560d83abaf14a6b694e0a
Rust
8,987
281
// Copyright (c) 2018 10X Genomics, Inc. All rights reserved. #![expect(missing_docs)] // This file contains code to make reference data. // // ◼ Experiment with building a reference from scratch. This would be a better // ◼ solution than ad hoc editing of a flawed reference. // // ◼ Document reference sequence requi...
880c6b1a40ee58e68d986362490beb569eb3e07cf452d3ace16baf3df77628dc
Rust
8,991
248
// Copyright (c) 2021 10X Genomics, Inc. All rights reserved. #![deny(missing_docs)] // Miscellaneous functions. use super::innate::mark_innate; use crate::core::defs::{ BarcodeContigs, CellContig, EncloneControl, ExactClonotype, Junction, SharedContig, }; use amino::nucleotide_to_aminoacid_sequence; use debruijn...
7bcdc7856ebf0851de6ac1e9c227ef6a768b617cb8d0d33e0ff02cda4d1badb8
Rust
9,055
277
use adjustp::Procedure; use colored::Colorize; use hashbrown::HashSet; use std::fmt::Debug; use crate::{aggregation::GeneAggregation, io::HitList, model::ModelChoice, norm::Normalization}; #[derive(Default)] pub struct Logger { verbose: bool, } impl Logger { pub fn new() -> Self { Self { verbose: true...
6b02e444e3dcb587a356c7498fa5840a7c6afbfae74dd4b213b9c39eb2ebe49b
Rust
9,064
213
//! WriteConsensusTxt stage code #![expect(missing_docs)] use crate::assigner::ProtoBinFile; use crate::write_concat_ref_outs::{FastaFaiFile, FastaFile}; use amino::nucleotide_to_aminoacid_sequence; use anyhow::Result; use cr_types::clonotype::ClonotypeId; use enclone_proto::proto_io::read_proto; use martian::prelude:...
70315e1ce140f7a04f46b4d882f939cf7ce259d91b043e37d144d75622fee38a
Rust
9,167
250
//! Flag defective reference sequences. // Copyright (c) 2021 10x Genomics, Inc. All rights reserved. #![deny(missing_docs)] use crate::core::defs::EncloneControl; use amino::nucleotide_to_aminoacid_sequence; use itertools::Itertools; use log::debug; use string_utils::TextUtils; use vdj_ann::refx::RefData; use vdj_ann...
69d3a2e3010082b6b966abbf9dbc7e2bca185d94aa957381f6acddeeca91fde3
Rust
9,197
249
#![deny(missing_docs)] use itertools::Itertools; use ndarray::prelude::*; use ndarray::{Array1, NdFloat, Zip, concatenate}; use num::FromPrimitive; /// Local helper function that computes the dot product between /// two one dimensional vectors (ndarray::Array1). /// Using this rather than ndarray::dot as the latter ca...
1b114a36ba34230b8d6fe1fb2a040e5c243ab4acfe3a5f295affb42587c44549
Rust
9,267
232
#![deny(missing_docs)] use crate::websummary::{GenericTable, PrettyMetric, TableRow, TermDesc, TitleWithTermDesc}; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] struct CardWithMetric { pub table: GenericTable, pub help: TitleWithTermDesc, } const PRODUCTI...
a68ac63e61a3776dbf0f87cfe0584b1637652f2dc07623d20c488fbca69b2e0d
Rust
9,287
377
use anyhow::{Result, bail}; use geojson::{Bbox, Feature, JsonValue}; use serde::de::{SeqAccess, Visitor}; use serde::{Deserialize, Deserializer, de}; use std::collections::HashSet; use std::fmt; use std::fs::File; use std::io::BufReader; use std::path::PathBuf; const FEATURE_COLLECTION_NAME: &str = "FeatureCollection"...
fd3ab09d4ab83dfe042803e4bfadce18189e7bdf8b95837c81ba9add5dbab932
Rust
9,311
264
#![expect(missing_docs)] use crate::arc::types::{MAX_CLUSTERS_RANGE, validate_distance}; use crate::mrp_args::MrpArgs; use crate::utils::{CliPath, validate_id}; use anyhow::{Context, Result, anyhow, bail}; use clap::{self, Parser, value_parser}; use csv::StringRecord; use ordered_float::NotNan; use serde::{self, Deseri...
1138486f838d8b269915debc5d398087605fcae332b2db344f06c40161094601
Rust
9,404
269
//! Differential Expression stage code #![expect(missing_docs)] use crate::io::{csv, h5}; use crate::types::{ClusteringType, H5File}; use anyhow::Result; use cr_types::FeatureBarcodeType; use cr_types::reference::feature_reference::FeatureType; use diff_exp::{NbExactBackend, compute_sseq_params, sseq_differential_expr...
8cb6197d318e3141810f508b115b0731880b9641f2a065c8ca04864b500140c0
Rust
9,492
244
#![expect(missing_docs)] use crate::arc::types::{ ForceCellsArgs, MAX_CLUSTERS_RANGE, MinCounts, validate_distance, validate_strict_fraction, }; use crate::create_bam_arg::CreateBam; use crate::fastqs::FastqArgs; use crate::mrp_args::MrpArgs; use crate::utils::{CliPath, validate_id}; use anyhow::{Result, bail, ensu...
40b0ea2ecc9904636dfc2dac5f6c8c2320d438adb2e335f88df2ca3f65def160
Rust
9,622
210
//! Martian stage WRITE_CRISPR_ONLY_MATRIX //! //! Stream the full filtered feature-barcode matrix once and write a CRISPR-only //! feature-barcode matrix: keep only the CRISPR Guide Capture feature rows (remapped to a //! contiguous CRISPR-only feature reference) while preserving every barcode column. Every //! downst...
0486450dad8f86189a588faeccadec6eaa000ae12ab1180b1ebce6d6ff806e28
Rust
9,631
292
#![deny(missing_docs)] use barcode::Barcode; use cr_types::GenomeName; use cr_types::filtered_barcodes::{FilteredBarcodesCsv, FilteredBarcodesCsvRow}; use itertools::Itertools; use martian_filetypes::bin_file::BincodeFile; use martian_filetypes::{FileTypeRead, FileTypeWrite}; use numpy::PyArray1; use pyanyhow::Result; ...
ea4c3738bca11aa6f8c9cc6173097f40ee240d6d06ff72cf6032a18c0324d4ce
Rust
9,681
270
//! Martian stage PROCESS_VDJ_PROTO #![expect(missing_docs)] use crate::parse_aggr_csv::VdjAggrCsvLibrary; use anyhow::Result; use itertools::Itertools; use martian::prelude::*; use martian_derive::{MartianStruct, make_mro}; use serde::{Deserialize, Serialize}; use std::collections::{BTreeMap, HashMap}; use std::fmt; ...
81a6de37ebae48cc53bedcc1e2ac47b0a14f147fcafb79930c3d9b813009ef3e
Rust
9,735
315
//! Utilities for finding groups of FASTQ produced by the legacy `demux` pipeline from 10x Genomics. #![expect(missing_docs)] use crate::filenames::{LaneMode, LaneSpec}; use crate::read_pair_iter::FastqSet; use crate::sseq::SSeq; use anyhow::{Context, Result}; use itertools::Itertools; use regex; use serde::{Deseriali...
b7ba69910cdc7861c3178d8dfa25318e79629a38113853b6d3103c8c81b9a911
Rust
9,787
271
//! //! Create read data object that the assembler needs from a //! vector of rna reads. This is likely a patch until the more structured //! form of data makes its way deep into the assembler //! #![deny(missing_docs)] use bitflags::bitflags; use cr_types::chemistry::ChemistryDef; use cr_types::rna_read::RnaRead; use ...
2053120564638cb29f2fe0406f728d5d5d01feb2b78051bb4156ba46d3966e54
Rust
9,802
269
// Copyright (c) 2021 10X Genomics, Inc. All rights reserved. //! Code for reading and writing custom proto files //! //! Protobuf format by default is not suitable for streaming. We need to write our own logic to //! track where a message begins and ends. The documentation recommends using a length delimited //! forma...
334f25b84eec1a522be1f083802723cf764ad4af6f12b0486f31ff8db52a2d84
Rust
9,871
252
//! Module for storing adapter sequences. #![deny(missing_docs)] use crate::WhichEnd; use crate::adapter_trimmer::{Adapter, AdapterLoc}; use martian::{AsMartianPrimaryType, MartianPrimaryType}; use serde::{Deserialize, Serialize}; use strum::{Display, EnumString}; /// TSO sequence used in Fiveprime chemistries. pub co...
2677afde6fc6bf0a0f22bb9dccc74d4a042e72a2999097f9db9ce721f39a3fb8
Rust
9,910
272
#![deny(missing_docs)] use super::probe_set_reference::TargetSetFile; use crate::GenomeName; use crate::probe_set::ProbeSetReferenceMetadata; use anyhow::{Context, Result, ensure}; use digest_io::IoWrapper; use itertools::Itertools; use martian::MartianFileType; use martian_derive::MartianStruct; use martian_filetypes:...
3764d2fd3409367887116707e9baf8bac3ce043986fd9e6b58ae9298e83ddd24
Rust
10,134
246
//! Martian stage ASSIGN_LOW_UMI_CELLS use crate::io::h5; use crate::pca::PCA_COMPONENTS; use crate::types::{H5File, ReductionType}; use anyhow::{Result, bail}; use barcode::{Barcode, BarcodeContent}; use cr_types::reference::feature_reference::FeatureType; use hdf5_io::matrix::read_adaptive_csr_matrix; use itertools:...
245c3cefbc93349b5a08e325e258749a16a37d3abd03448364044640b226dc21
Rust
10,196
282
//! Martian stage RUN_ENCLONE #![expect(missing_docs)] use anyhow::Result; use bio::alignment::{Alignment, AlignmentOperation}; use enclone_process::{ ClonotypingConfig, Dataset, InputSpec, VdjReceptor as EncloneRangerVdjReceptor, run_enclone, }; use enclone_proto::proto_io::read_proto; use enclone_proto::types::E...
4691ec8fa564ef0dec2b49c3cd75c7b670dbb8b98f4a30de412db6473abe0db8
Rust
10,351
325
#![deny(missing_docs)] use anyhow::Result; use bio::io::fasta::Record; use itertools::Itertools; use std::fmt::{self, Write}; use std::fs::File; use std::io::{BufRead, BufReader, Lines}; use std::iter::Enumerate; use std::ops::Range; use std::path::{Path, PathBuf}; pub struct ErrorContext { reader: Enumerate<Line...
ff4fa07c472b97f2e2bccfe88ebfa137b7e5bfbcbc7d2e7471dd64320d426cba
Rust
10,455
308
//! Graph-clustering (Louvain) + merge-clusters stage code #![expect(missing_docs)] use crate::io::{csv, h5}; use crate::louvain::{run_louvain, run_louvain_parallel}; use crate::types::{ClusteringResult, ClusteringType, H5File, ReductionType}; use anyhow::{Context, Result}; use cr_types::reference::feature_reference::...
2e0bcaaa6ac06c6b7f09d5faebcf711d93dc11d8b60537a8047d1bb39bb7fc73
Rust
10,645
323
//! Types shared between websummary derive macros and websummary construction. #![expect(missing_docs)] use anyhow::{Result, bail, ensure}; use proc_macro2::TokenStream; use quote::quote; use serde::{Deserialize, Serialize}; use std::collections::HashSet; use std::iter::zip; #[derive(Serialize, Deserialize, Debug, Cop...
7df8f956989545f36f83f8e9a94cb5f31fe825e6be0b769d484dab43ad896980
Rust
10,646
304
//! Args for the reanalyze sub-command #![expect(missing_docs)] use crate::arc::aggr::AggrDefs; use crate::arc::types::{ForceCellsArgs, MAX_CLUSTERS_RANGE, MinCounts, validate_distance}; use crate::mrp_args::MrpArgs; use crate::utils::{CliPath, validate_id}; use anyhow::{Context, Result, bail}; use clap::{self, Parser...
37768a07e8325bb5923c9320598bf8e94edcb2ac8442ca7ea8c9b28f8eeb7aaf
Rust
10,753
339
// Possibly useful in the future -- these are currently unneccesary. #![expect(missing_docs)] use crate::telemetry::{CollectTelemetry, TelemetryCollector}; use crate::utils::AllArgs; use crate::{IntoExitCode, check_deprecated_os}; use anyhow::{Context, Result}; use clap::parser::ValueSource; use clap::{CommandFactory,...
51acd83c47b9e2b5654a2c4b2a29c048926b303dd8b27fde9919aa0e3b1d63fd
Rust
11,201
161
use crate::transcriptome::{Exon, Transcript}; use itertools::Itertools; use martian_derive::martian_filetype; use martian_filetypes::table_config; use martian_filetypes::tabular_file::{DelimitedFormat, TableConfig}; use serde::{Deserialize, Serialize, Serializer}; martian_filetype!(Bed12File, "bed"); table_config! { B...
a301c03d3f99fd461ecf8295d5a7056675071abbe18dc41bb7ab29a08db19557
Rust
11,251
286
//! fast_utils #![deny(missing_docs)] mod barcode_counter; mod barcode_index; mod compute_extra_multiplexing_metrics; mod diff_exp; mod feature_collection_geojson_validator; mod filtered_barcodes; mod gdna_analysis; mod matrix; mod molecule_info; mod multi_graph; use crate::barcode_counter::counts_per_barcode; use cra...
9163507ad88d6f1e783c728e9cd0012ec2193bbba31675f0bbc646c02231fa08
Rust
11,266
324
//! Martian stage SETUP_VDJ_AGGR #![expect(missing_docs)] use crate::parse_aggr_csv::VdjAggrCsvLibrary; use anyhow::Result; use enclone_process::Dataset; use itertools::Itertools; use martian::prelude::*; use martian_derive::{MartianStruct, make_mro, martian_filetype}; use martian_filetypes::json_file::{JsonFile, Json...
652a73ea8e523c50e65a30329c8915b267137549d0c2b87e6f6a12f3a63f9e1a
Rust
11,288
351
use std::{ fmt::{Display, Formatter}, fs::File, io::{BufWriter, Write}, }; use crate::{ aggregation::{AggregationResult, GeneAggregation}, utils::config::Configuration, }; use anyhow::Result; #[derive(Debug, PartialEq, Eq, Clone, Copy)] enum Method { AlphaRRA, IncProd, IncPvalue, } imp...
b09f42f7aaf1e4eaff2240acf17f0d4a3d40431dd60e528ecad42a2309e5d2d2
Rust
11,414
319
// Copyright (c) 2021 10X Genomics, Inc. All rights reserved. #![deny(missing_docs)] use crate::core::barcode_fate::BarcodeFate; use crate::core::defs::{CloneInfo, EncloneControl, ExactClonotype}; use crate::core::enclone_structs::{BarcodeFates, CandidateClonotype}; use crate::core::join_one::{REF_J_TRIM, REF_V_TRIM};...
82315a7253de6b0b968ab4897fa7dbfe62f6fdd230a27685e33e5ca87c1f7bfb
Rust
11,418
322
#![cfg(test)] #![deny(missing_docs)] use crate::aligner::BarcodeSummary; use crate::testing::diff_metrics; use anyhow::{Context, Result}; use cr_bam::bam::BamPosSort; use cr_types::{FeatureBarcodeType, MetricsFile}; use itertools::{Itertools, zip_eq}; use martian_filetypes::tabular_file::CsvFile; use martian_filetypes...
83288f792dcc5b3adba1f9c2f4aaa42bd0b5dae073fbc249ca017ec7ce5276da
Rust
11,707
343
#![expect(missing_docs)] use crate::{ChartWithHelp, PlotlyChart, TitleWithHelp}; use anyhow::Result; use cr_types::clonotype::ClonotypeId; use hclust::{ClusterDirection, DistanceMetric, HierarchicalCluster, LeafOrdering, LinkageMethod}; use itertools::Itertools; use martian_filetypes::FileTypeRead; use martian_filetype...
aec8b08a04aaed6db25ae8a80af09e6fa383be2f49b26efd232c4a16982be1fd
Rust
11,749
383
use super::{Library, Permuter}; use crate::Offset; use fxread::{FastxRead, Record}; use hashbrown::HashMap; #[derive(Debug, PartialEq)] enum Position { Plus, Minus, Centered, Null, } /// Struct to handle the mapping between the trimmed records generated by [`FastxRead`] /// and the sequences found in ...
0c2df63b841d1bd0d49b2c986cf6f8c3ddb83d7c54fa23d50dad9f2ea4dc191c
Rust
11,771
364
use adjustp::Procedure; use colored::Colorize; use geopagg::WeightConfig; use hashbrown::HashSet; use ndarray::Array1; use std::fmt::Debug; use crate::{ aggregation::GeneAggregation, enrich::TestStrategy, model::ModelChoice, norm::Normalization, }; #[derive(Default)] pub struct Logger { verbose: bool, } impl ...
0c49075e6bb82bed03ad1800d2df6e7bdd4985751b8c98adfa95168c71132ab6
Rust
11,782
381
use super::{ utils::{filter_zeros, num_unique, set_alpha_threshold}, AggregationResult, GeneAggregation, }; use crate::{ enrich::EnrichmentResult, utils::{agg::aggregate_fold_changes, logging::Logger}, }; use adjustp::Procedure; use alpha_rra::AlphaRRA; use anyhow::{Context, Result}; use bon::{bon, Buil...
7e1bf162fa04275d36fbfd184841b255543bd88d57881477551a3f800532b9ce
Rust
11,903
342
use super::{EnrichmentResult, TestStrategy}; use crate::{ norm::median, utils::logging::Logger, utils::math::{negative_log_sum, normalize, weighted_geometric_mean}, }; use adjustp::Procedure; use ndarray::{s, stack, Array1, Array2, Axis, Zip}; use statrs::function::beta; /// Calculates the negative binomia...
248132950f3d4e810f6153ce7cbaf41fec59c8ccc6a728617ea5ebc96c48eeee
Rust
11,905
294
#![expect(missing_docs)] use crate::{VdjHierarchy, VdjReference}; use ahash::HashMapExt; use metric::TxHashMap; const DEFAULT_KMER_LENGTH: usize = 20; /// Control the strategy used to classify reads in `KmerClassify` /// There are two strategies: /// * `Lazy` (Default): In this mode, the `choice` corrsponding to the ...
634e75b1480fc89f86ca12b718c91b9191aabd788149febc231e03e62b5db23b
Rust
11,947
307
//! Probe barcode matrix I/O #![deny(missing_docs)] use anyhow::{Context, Result}; use cr_h5::count_matrix::{MAT_H5_BUF_SZ, write_barcodes_column}; use cr_h5::feature_reference_io::{FA_LEN, make_fixed_ascii, write_target_set_group}; use cr_h5::{extend_dataset, make_column_ds, write_column_ds}; use cr_types::probe_set:...
ad92b5fdd1f524f9da753487a1dff339721d9e80cc013d1ba58a067bf95bb078
Rust
11,981
253
//! //! This module defines a visitor strategy useful for configuring the `Aligner` and //! performing operations at different levels including the computation of metrics. //! //! The stategy is inspired by the visitor implementation within the [rust compiler](https://github.com/rust-lang/rust/blob/c9bacb70f0b19d324a54...
ccab8c4f1e9ce199e0ae0c434eb19d25d1f2b8dc39280f68c7af2dd3fcc29a26
Rust
11,991
366
#![deny(missing_docs)] #![expect(dead_code)] use anyhow::{Context, Result}; use hdf5::types::{FixedAscii, FloatSize, IntSize, TypeDescriptor, VarLenAscii, VarLenUnicode}; use hdf5::{Attribute, Container, Dataset, File, Group, H5Type, Location}; use itertools::{EitherOrBoth, Itertools}; use std::cmp::Ord; use std::path...
f0ab63aa22ede3728cedf1cb8b6ec67940baab556a012f2223f4973b94a4d7f2
Rust
12,004
350
use std::{ fmt::{Display, Formatter}, fs::File, io::{BufWriter, Write}, }; use crate::{ aggregation::{AggregationResult, GeneAggregation}, utils::config::Configuration, }; use anyhow::Result; #[derive(Debug, PartialEq, Eq, Clone, Copy)] enum Method { AlphaRRA, IncProd, IncPvalue, G...
08c3b323e005885dbb085cfb71fd35cd14e1ec0b4df32f10257939b48c8a7a51
Rust
12,122
356
// Copyright (c) 2018 10X Genomics, Inc. All rights reserved. #![expect(missing_docs)] // Code that analyzes transcripts. use crate::annotate::{Annotation, get_cdr3_using_ann}; use crate::refx::RefData; use amino::{have_start, have_stop}; use debruijn::dna_string::DnaString; use debruijn::kmer::Kmer20; use debruijn::...
02b52f7ba89334aefc74d11dcb6d3fffd8c7394c7a34a8cb3023431a7744d6fc
Rust
12,132
338
//! vector_utils // Copyright (c) 2018 10X Genomics, Inc. All rights reserved. #![expect(missing_docs)] // This file contains miscellaneous vector utilities. use std::borrow::Borrow; use superslice::Ext; // ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ // SORT A VECTOR // ▓▓▓▓▓▓▓▓...
9df6d00d8e6fe47dd697b7bf71a79e1ee41dc400d95f74cf1be1f931d1c0b6ef
Rust
12,160
348
//! Corrects sequencing errors in barcodes, allowing up to one mismatch. #![deny(missing_docs)] use crate::whitelist::Whitelist; use crate::{BarcodeSegment, BarcodeSegmentState, BcSegQual, BcSegSeq}; use metric::{Histogram, SimpleHistogram}; const BC_MAX_QV: u8 = 66; // This is the illumina quality value pub(super) c...
ed26519a130d9bd1cf5dde4dbe3cd083df17cfc62ef1c99a166488718a921854
Rust
12,205
363
use anyhow::{bail, Result}; use fxread::{initialize_reader, Record}; use ndarray::{Array1, Array2, ArrayBase, Axis, Dim, ViewRepr}; use ndarray_stats::{DeviationExt, EntropyExt, QuantileExt}; /// An enumeration describing whether the sequences /// are offset in a forward direction or if the offset /// is better descri...
b55fa3bd19157975693faf5f5c85d5b22ac9bba426ab01bb7f424a29534bfd43
Rust
12,556
319
//! WriteWsJson stage code #![expect(missing_docs)] use crate::parse_aggr_csv::VdjAggrCsvLibrary; use crate::setup_vdj_aggr::EncloneProtoMetaFormat; use crate::websummary::annotation_card::VdjAggrAnnotationTable; use crate::websummary::cdr3_table::{VdjAggrSharedCdr3, VdjAggrSharedCdr3Row}; use crate::websummary::cells...
118c48fbd1d5c203bfc28617e4e1a5c5ae221414835ede76a8b527b8c459e1d9
Rust
12,581
275
#![deny(missing_docs)] use super::chemistry_filter::DetectChemistryUnit; use super::length_filter::{LengthStats, WHICH_LEN_READS}; use super::mapping_filter::MappingStats; use crate::detect_chemistry::chemistry_filter::DetectChemistryCandidates; use barcode::whitelist::BarcodeId; use cr_types::ERROR_CODE_INFO; use cr_t...
773d5756f6d6f875da5329372aa80856ca08130eca1ec75e530aa78c22b04a2d
Rust
12,608
321
#![expect(missing_docs)] use crate::env::PkgEnv; use crate::mrp_args::MrpArgs; use crate::telemetry::TelemetryCollector; use crate::utils::{CliPath, validate_ascii_identifier_with_dots}; use crate::{IntoExitCode, execute_to_status, make_mro}; use anyhow::{Context, Result, bail, ensure}; use clap::{self, Parser, value_p...
43e6992b6a21e5967913f78cc5b65006d4f6826b2bccceef66758a79836e96d1
Rust
12,692
404
#![deny(missing_docs)] use super::scsv::{Span, eof, rstrip_space, space0, space1, take_until_eof}; use anyhow::{Result, bail}; use nom::IResult; use nom::branch::alt; use nom::bytes::complete::{tag, take_till}; use nom::combinator::peek; use nom::multi::many0; use nom::sequence::{delimited, preceded, terminated}; use r...
90d0f950d80e3e4f95c5dd0df683053852dddee0e11a2ce172a90613cd0a4467
Rust
12,818
363
// Copyright (c) 2021 10X Genomics, Inc. All rights reserved. #![deny(missing_docs)] // // Align a sequence to a concatenated V(D)J reference, encouraging insertions exactly at // junction points and deletions that bridge junction points. // // ASSESSMENT // // enclone BI=1-4,9 BUILT_IN SUBSET_JSON=subset/outs/all_cont...
eb56b33c23db7820eaf39b43075a44833c7756da3eadcc0047f537a5f085542c
Rust
13,171
369
//! PCA analysis code #![deny(missing_docs)] use crate::types::PcaResult; use anyhow::{Error, Result}; use cr_types::FeatureBarcodeType; use cr_types::reference::feature_reference::FeatureType; use log::warn; use ndarray::linalg::Dot; use ndarray::{Array, Array1, Array2, Axis, s}; use ndarray_stats::Quantile1dExt; use...
38b1b24282edfcb124294cf8e313adbfd4ce24967cb2768238a68d024f135aea
Rust
13,220
365
#![deny(missing_docs)] use anyhow::{Result, anyhow, bail, ensure}; use nom::branch::alt; use nom::bytes::complete::{is_not, tag, take_until, take_while, take_while1}; use nom::character::complete::{char, digit1}; use nom::combinator::{all_consuming, map, map_res, opt}; use nom::error::{ErrorKind, ParseError}; use nom::...
b155ca55f3c2fcded483b8197e6ec6301cff8d710ca01d07bb00c9c547728acc
Rust
13,252
288
//! AirrFilter stage code #![expect(missing_docs)] use anyhow::Result; use bio::io::fasta::Reader; use martian::{MartianMain, MartianRover}; use martian_derive::{MartianStruct, make_mro, martian_filetype}; use martian_filetypes::json_file::JsonFile; use martian_filetypes::tabular_file::TsvFile; use martian_filetypes::...
bd3594b8ba3cedb6effd484744ea975de4d438cdf5dc1d2531197d07d8e27e47
Rust
13,639
369
// Copyright (c) 2024 10X Genomics, Inc. All rights reserved. #![deny(missing_docs)] //! This file contains an equivalence relation struct. There is a literature on //! this and multiple rust implementations of sophisticated algorithms, see: //! //! 1. https://en.wikipedia.org/wiki/Disjoint-set_data_structure //! 2. ...
c71ce26f9cb56f9a1055280e770c7803e6baf41ded7948825cd96fe6f103fc79
Rust
13,759
441
#![expect(missing_docs)] use anyhow::Result; use martian::MartianFileType; use martian_derive::martian_filetype; use parquet::basic::{Compression, ZstdLevel}; use parquet::file::metadata::ParquetMetaData; use parquet::file::properties::WriterProperties; use parquet::file::reader::FileReader; use parquet::file::serializ...
d09e8fb779a8097aae5daa1cf73ab675ca1c68bab3704cd1864dc40e559e1a5b
Rust
13,915
314
//! Streaming sufficient-statistics reducer for the CRISPR perturbation differential expression. //! //! `MEASURE_PERTURBATIONS`'s sSeq DE reduces to per-(gene, cell-group) sufficient statistics: the //! kernel never needs cell-resolution data, only additive sums over each group's cells (the control //! once + each per...
11c2ba2074c8eedc694ef6718eb688a1722aba1542c18637fe047b3823853a0a
Rust
13,925
251
// Copyright (c) 2021 10X Genomics, Inc. All rights reserved. #![deny(missing_docs)] // Functions relating to the identification if iNKT and MAIT cells. // species: return "human" or "mouse" or "unknown", based on a 60-base perfect match between // the TRAC or IGHM sequence in the provided reference sequences, and in...
8a596119beaf5c3fad8934d3754382769b612f3f97153551f609da840a1bdfff
Rust
13,965
315
// Copyright (c) 2021 10X Genomics, Inc. All rights reserved. #![deny(missing_docs)] // This file provides the single function build_info. use self::refx::RefData; use crate::core::barcode_fate::BarcodeFate; use crate::core::defs::{CloneInfo, ExactClonotype}; use crate::core::enclone_structs::BarcodeFates; use amino:...
d88fd1e5bbf5a057ef8664d620b9d5d22ecc53daae0616d4ee71188ded3e0a93
Rust
14,056
350
#![expect(missing_docs)] use anyhow::Result; use enclone_process::ClonotypingFilterConfig; use martian_derive::MartianStruct; use martian_filetypes::json_file::JsonFile; use martian_filetypes::lz4_file::Lz4; use martian_filetypes::{LazyFileTypeIO, LazyWrite}; use serde::{Deserialize, Serialize}; #[derive(Clone, Copy, ...