sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
c53e3a5c9c6df614a0a996f48035e7755e56a6d5e23519af046cb50e9e251d89
Rust
3,767
97
#![deny(missing_docs)] use itertools::Itertools; use ndarray::{Array2, ShapeBuilder}; use num_traits::Num; use sprs::{CsMatI, SpIndex}; use std::ops::AddAssign; /// Get representatives for each cluster in a clustering. /// The current implementation returns the centroid of the features in all /// barcodes in a cluster...
b63cc0cccd93a5d31ac85e55dbb2740ea6a223e271cfd4b8cfe598a25eb7b105
Rust
3,781
102
#![expect(missing_docs)] use cr_websummary::{ CardWithTable, GenericTable, MakePretty, Percent, TableRow, TitleWithHelp, card_with_table, }; use serde::Serialize; card_with_table!( table_name: VdjAggrClonotypeTable, row_name: VdjAggrClonotypeRow, title: "Top 10 Clonotype CDR3 Sequences", help_text:...
3e446475643be97fd0e3694f08ea039abb31ddc94a0754f68be098afa39c36ef
Rust
3,797
150
use crate::{aggregation::GeneAggregation, model::ModelChoice, norm::Normalization}; use adjustp::Procedure; #[derive(Debug)] pub struct Configuration<'a> { normalization: Normalization, aggregation: GeneAggregation<'a>, correction: Procedure, model_choice: ModelChoice, min_base_mean: f64, seed:...
91a9fa40d90610b4ef30d8f68c2009a96122760cff53c87830b2749905788082
Rust
3,887
132
//! This module defines the `MeanMetric` struct. This struct //! helps accumulate a mean value over observations. #![deny(missing_docs)] use crate::Metric; use metric_derive::Metric; use serde::{Deserialize, Serialize}; use std::iter::{FromIterator, Sum}; /// Use this struct to accumulate mean metrics /// /// # Examp...
182a3aa4c1a77b7e2bf18d7a861fc3d50efa0e26e9ace9e9bff8ad444b23a086
Rust
3,891
118
#![expect(missing_docs)] use super::websummary::MetricsTraitWrapper; use crate::alert::AlertLevel; use crate::{ Alert, AlertContext, AlertSpec, ChartWithHelp, GenericTable, PlotlyChart, TableRow, TitleWithHelp, }; use cr_types::{BarcodeMultiplexingType, LibraryType}; use serde::{Deserialize, Serialize}; use ser...
be674c668af41b83045c2e543efed25703aa7fb1a8a276b7cc1768cd3d288f13
Rust
3,915
120
//! WriteAggrAnn stage code #![expect(missing_docs)] use crate::parse_aggr_csv::{DONOR_HEADER, ORIGIN_HEADER}; use crate::setup_vdj_aggr::EncloneProtoMetaFormat; use anyhow::Result; use enclone_proto::types::Metadata; use martian::prelude::*; use martian_derive::{MartianStruct, make_mro}; use martian_filetypes::FileTy...
9d8c7c09850109a60fc67e09a3c0ee3723309d5fc7b9bd4c966c3deecd0b7d32
Rust
3,951
116
#![expect(missing_docs)] use clap::Parser; use clap::builder::NonEmptyStringValueParser; #[derive(Parser, Debug, Clone)] pub struct MrpArgs { /// Job manager to use. Valid options: local (default), sge, /// lsf, slurm or path to a .template file. Search for help on "Cluster Mode" /// at support.10xgenomics...
64e1d90466259d461492779205f91997bd36866ed02ff4a147fe732160e31596
Rust
4,007
116
//! Wrapping the Rust handling of the multi config. #![deny(missing_docs)] use cr_types::{BarcodeMultiplexingType, CellLevel, CrMultiGraph, Fingerprint, ReadLevel}; use martian::MartianFileType; use martian_filetypes::FileTypeRead; use martian_filetypes::json_file::JsonFile; use pyo3::exceptions::PyException; use pyo3:...
ddd02dce72f6b8550025da52de3f939e09bed7aba7a1c693603edead47b45654
Rust
4,012
113
// Copyright (c) 2021 10X Genomics, Inc. All rights reserved. //! Based on the number of cells in each column, decide which exact subclonotypes //! look like junk. Preliminary heuristic. #![deny(missing_docs)] use crate::core::barcode_fate::BarcodeFate; use crate::core::defs::{CloneInfo, EncloneControl, ExactClonotyp...
a3897273c72a91e30e668901ddeca24887760758d296231e4127a01d775ef6f0
Rust
4,031
113
#![deny(missing_docs)] use anyhow::Result; use barcode::whitelist::BarcodeId; use barcode::{BcSegSeq, BcSeq}; use cr_h5::count_matrix::{BarcodeWithGemGroup, CountMatrix, CountMatrixStreaming}; use cr_types::reference::feature_reference::FeatureType; use itertools::{Itertools, process_results}; use metric::TxHashMap; us...
a0b7e1cf4efb584014506da599234074ec519391ef31e309cee58e4e27ff2b95
Rust
4,061
119
#![expect(missing_docs)] use crate::filter_log::{AsmCellFilter, FilterLogEntry, FilterLogger}; use serde::Serialize; use std::collections::HashMap; use strum::{Display, EnumIter, IntoEnumIterator}; use vdj_ann::annotate::ContigAnnotation; use vdj_asm_utils::exact_clonotyping::ExactClonotype; #[derive(Debug)] pub struc...
e88e618336e6c77cffb61ede0ff3b7b6b493876b6b15f5dce41dad75afa4e2c4
Rust
4,095
126
//! Martian stage SETUP_REFERENCE_INFO //! Computes reference genomes and version from reference path or target set metadata so //! that downstream stages do not to duplicate this logic (i.e. checking if we do not have //! a reference path, then we should have a target set file). #![deny(missing_docs)] use anyhow::Res...
30addd5248bf946b12ec6a44175d32441531ed2fcb09eed262b6336a275e5189
Rust
4,124
144
use crate::progress::{ finish_progress_bar, finish_progress_bar_ref, initialize_multi_progress, initialize_progress_bar, start_progress_bar, start_progress_bar_ref, }; use crate::results::write_results; use crate::{Counter, GeneMap, Library, Offset, Permuter}; use anyhow::{bail, Result}; use fxread::initialize_...
d4ff91ae076955c92d431533ac8d4c05fadd741b34cd780ae350d97d1d58c3fc
Rust
4,230
111
// Copyright (c) 2021 10X Genomics, Inc. All rights reserved. #![deny(missing_docs)] // Merge onesies where totally unambiguous. Possibly inefficient and should optimize. use crate::core::defs::{CloneInfo, EncloneControl, ExactClonotype}; use crate::core::enclone_structs::CandidateClonotype; use equiv::EquivRel; use...
037a1e2fe6375782b84ff91faf34d826d23362202b980558f144f4f029b6aa43
Rust
4,234
144
//! Barcodes which are defined based on binning geometry #![expect(missing_docs)] use anyhow::ensure; use pyo3::{pyclass, pymethods}; use serde::{Deserialize, Serialize}; use std::fmt::{Display, Formatter}; use std::str::FromStr; /// A row or column index in a square binning scheme #[derive(Serialize, Deserialize, Cl...
ff52106e547b3dbbbd48a6adaa95bca0d51a9f0932e85e529fc886674a806aa6
Rust
4,246
112
#![expect(missing_docs)] use crate::clonotype_hist::{ClonotypeHist, ProportionsType}; use crate::clonotype_table::{VdjAggrClonotypeRow, VdjAggrClonotypeTable}; use anyhow::Result; use clonotype_assigner::write_clonotype_outs::ClonotypesCsvRow; use cr_types::MetricsFile; use cr_types::clonotype::ClonotypeId; use cr_webs...
1747a250c97b4aea6abcf948a989c416544d9231e2074c8c7981b0953446c782
Rust
4,251
152
#![expect(missing_docs)] use crate::read_pair::ReadHeader; use crate::read_pair_iter::FastqSet; use anyhow::{Result, anyhow}; use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord, Clone, Debug)] pub struct IlluminaHeaderInfo { pub instrument: String, pub run_numb...
7090f27dacc61246733c9b893f3688a162f7de74cc35cd2da7e77dbeba55dfa6
Rust
4,297
131
#![expect(missing_docs)] use anyhow::{Context, Result}; use std::fs::File; use std::io::{BufRead, BufReader}; use std::ops::{Add, Div}; use std::path::Path; use std::str::FromStr; /// Read a text file with one record per line into a vector of records. pub fn load_txt<T: FromStr>(path: &Path) -> Result<Vec<T>> where ...
b7ff50d794cc13604c2b7f4dbb5aeb006a0adba7891b8be525e989e0e4a9a204
Rust
4,318
136
//! Martian stage DETECT_CHEMISTRY_TEST #![deny(missing_docs)] use crate::stages::detect_chemistry::{DetectChemistry, DetectChemistryStageInputs}; use anyhow::Result; use cr_types::LibraryType; use cr_types::chemistry::ChemistryName; use itertools::Itertools; use martian::prelude::*; use martian_derive::{MartianStruct...
548df9686bcbec34419c07b436c7623353890048795e67bdc3f9c76c5aaf9550
Rust
4,334
127
#![expect(missing_docs)] use crate::env::PkgEnv; use crate::mkref::Mkref; use crate::telemetry::{TELEMETRY_BIN_PATH, TelemetryCollector}; use crate::utils::{AllArgs, external_subcommand}; use anyhow::Result; use clap::{self, Parser}; use multi::oscheck; use std::process::ExitCode; // Shared between spaceranger/cellran...
440d0530a8775dacdd3c2ac039f9fe58887406aeffc59eacf060a46c0ad6edc2
Rust
4,351
134
use super::logging::Logger; use bon::builder; use ndarray::Array2; type FilterTuple = (Array2<f64>, Vec<String>, Vec<String>); #[builder] pub fn filter_low_counts( norm_matrix: &Array2<f64>, sgrna_names: &[String], gene_names: &[String], min_base: f64, n_controls: Option<usize>, logger: &Logger...
a8831f37b8a37a6133f1be28f2c8813f6f5658acb1edd876d489008d717b9551
Rust
4,379
137
use anyhow; use anyhow::Result; use fxread::{FastxRead, Record}; use hashbrown::HashMap; type FxReader = Box<dyn FastxRead<Item = Record>>; /// Container for input library sequences. pub struct Library { table: HashMap<Vec<u8>, Vec<u8>>, size: usize, } impl Library { /// Creates a library from a [`fxread:...
5cec1a13c7773607560125d7ef27f1a4037c0fbdbb1fe7d5e98ecdbab483d1c0
Rust
4,431
141
//! cr_lib #![deny(missing_docs)] use anyhow::{Context, Result, bail}; use cr_lib::{load_dist, write_web_summary_html}; use docopt::Docopt; use martian::prelude::*; use serde::Deserialize; use std::fs::File; const HEADER: &str = "# Copyright 2023 10x Genomics, Inc. All rights reserved."; const USAGE: &str = " Test R...
f6c18a3f02f7af24738988a6cd55a649a68696bd0bbe92b923e14b2dd806ad7c
Rust
4,453
133
#![deny(missing_docs)] use crate::parse_aggr_csv::MULTI_OUTS; use itertools::Itertools; use std::path::PathBuf; #[derive(Debug, PartialEq, Eq, thiserror::Error)] pub(super) enum FieldResolutionErrors { #[error( "Could not resolve path {path:?}. The paths specified in the CSV needs to be one of:\n\ ...
9535d32cbec5d6d48f89a1e606e119acba5dd14e2b51c7133c7d96e6768edf81
Rust
4,454
139
#![expect(missing_docs)] use anyhow::{Context, Result}; use std::collections::{HashMap, HashSet}; use std::path::Path; pub fn ensure_no_diff(actual: &Path, expected: &Path) { println!("Comparing {} and {}", actual.display(), expected.display()); assert!( file_diff::diff(actual.to_str().unwrap(), expect...
6532c13d2f0160e06ba0029df7396136493a41097641d16a18c6dc8a027893f4
Rust
4,469
136
use anyhow::{bail, Result}; use bon::builder; use ndarray::prelude::*; use ndarray_rand::rand::SeedableRng; use polars::prelude::*; use rand_chacha::ChaCha8Rng; use rand_distr::{Dirichlet, DirichletError, Distribution}; use crate::{ io::{build_regex_set, load_dataframe, match_headers_from_regex_set, to_ndarray, wr...
fd2f8f157bdb1521437a202404ba17a134ebb212aaaed2a2ec84136c54b82226
Rust
4,475
121
//! cr_lib::stages #![deny(missing_docs)] mod align_and_count; mod barcode_correction; mod build_per_sample_vdj_ws_contents; mod call_tags_genetic; mod call_tags_read_level; mod check_barcodes_compatibility; mod check_barcodes_compatibility_vdj; mod check_single_beam_mode; mod collate_metrics; mod collate_probe_metric...
828b8a2d046bf821728596d11530cf58008b58b157171fa4b3880c9f6640c942
Rust
4,529
137
//! CopyVdjReference stage code //! ```text //! vdj_GRCh38_alts_ensembl-4.0.0/ //! ├── fasta //! │   └── regions.fa //! └── reference.json //! ``` #![expect(missing_docs)] use anyhow::{Context, Result}; use martian::prelude::*; use martian_derive::{MartianStruct, make_mro, martian_filetype}; use martian_filetypes::jso...
a6732de8000ca27287597287bf23e59137674ac885a8c32c3dd6cf6086023d0b
Rust
4,567
158
#![deny(missing_docs)] use num_traits::PrimInt; use std::fmt::Display; /// Compute nx of a list of positive integers /// Helper function to compute n50 and n90 scores. pub fn compute_nx<'a, T, I>(items: I, fraction: f64) -> Option<T> where T: 'a + PrimInt + Display, I: IntoIterator<Item = &'a T>, { assert!...
cd2750eb2b88b684fd33227767d225eef58e39fe7906f3a9a1bca36254c3f11e
Rust
4,592
131
#![expect(missing_docs)] use crate::IntoExitCode; use crate::env::PkgEnv; use std::ffi::OsString; use std::os::unix::process::ExitStatusExt; use std::path::PathBuf; use std::process::{Child, Command, ExitStatus}; use std::sync::mpsc::sync_channel; use std::thread; use std::time::{Duration, Instant}; /// Path to the co...
5c285fc42a5961a80d0e3f8fdf7fc30fd6d0c812cd9d9f83c49da098139cb34a
Rust
4,615
119
//! Martian stage FILTER_SAMPLE_SPECIFIC #![expect(missing_docs)] use anyhow::Result; use barcode::whitelist::BarcodeId; use cr_types::chemistry::{ChemistryDefs, ChemistryDefsExt}; use cr_types::filtered_barcodes::FilteredBarcodesCsv; use cr_types::{Fingerprint, FingerprintFile}; use itertools::Itertools; use martian:...
4ec07119452af0aed0017f9b077eb1a87a3ae14578e4a22e761d16a6ba4b0123
Rust
4,627
137
//! high-level louvain implementation #![deny(missing_docs)] use leiden::Network; use leiden::clustering::{Clustering, SimpleClustering}; use leiden::louvain::Louvain; use leiden::louvain_parallel::ParallelLouvain; use leiden::objective::{cpm, par_cpm}; use log::info; use ndarray::{Array1, Array2}; use scan_rs::merge_...
9a6363f6b4fc2882529b639abcb4a5176feaf96840642a276bcd8342352e0980
Rust
4,638
157
//! Crate for dealing with UMI related types and functionalities. #![deny(missing_docs)] use fastq_set::squality::SQualityGen; use fastq_set::sseq::{HammingIterOpt, SSeqGen, SSeqOneHammingIter}; use serde::{Deserialize, Serialize}; use std::fmt::{Display, Formatter}; mod info; pub use info::UmiInfo; /// The maximum...
92e9b9a91dd44298d5e406fbfadc55227e00553a8264659d82ca7f6dd2967df9
Rust
4,682
133
//! Martian stage CALL_TAGS_GENETIC //! Assign cells to samples using genetic demultiplexing (Souporcell). use anyhow::Result; use cr_types::filtered_barcodes::FilteredBarcodesCsv; use cr_types::{GeneticDemuxParams, Mtx}; use itertools::Itertools; use martian::{MartianRover, MartianStage, MartianVoid, Resource, StageDe...
5bffd2dc9c643c54fb8a7aa5ef556af6ee0cb0f82c10df27e2a41267530d4b29
Rust
4,685
150
use crate::Library; use anyhow::{anyhow, Result}; use bstr::{io::BufReadExt, ByteSlice}; use hashbrown::HashMap; use std::{fs::File, io::BufReader, path::Path}; /// Container to handle mapping of gene identifiers and /// `sgRNA` identifiers #[derive(Debug)] pub struct GeneMap { map: HashMap<Vec<u8>, Vec<u8>>, } im...
e87a8bd8c7a7c408886ade528c56f1f92e4a8835c3fe7b6790c1e627f4863b29
Rust
4,741
125
//! Martian stage MERGE_VDJ_CELL_BARCODES //! //! Merge the union of cell-associated barcodes from all VDJ libraries. //! Output `vdj_cell_barcodes` as a `FilteredBarcodesCsv`. #![deny(missing_docs)] use anyhow::Result; use barcode::Barcode; use cr_types::filtered_barcodes::{FilteredBarcodesCsv, FilteredBarcodesCsvRow...
edd7501168f429ddcdcc1c7b18eee053911e7124468da3f9e2c6a419864d5178
Rust
4,793
164
//! cr_h5 #![deny(missing_docs)] use anyhow::{Result, ensure}; use hdf5::{Dataset, Extents, Group, H5Type}; mod compare; pub mod count_matrix; pub mod feature_reference_io; mod iter; pub mod molecule_info; pub mod probe_reference_io; /// Write a scalar attribute to the given group, with the given attribute name. pub ...
6eb35eb5ff4042866eeefb828cd5c6a5acaf7284d2f43528fbafb961c2ed6481
Rust
4,826
140
#![deny(missing_docs)] use crate::align_metrics::{AlignAndCountVisitor, BarcodeMetrics, LibFeatThenBarcodeOrder}; use crate::aligner::BarcodeSummary; use anyhow::Result; use cr_types::types::LibraryType; use itertools::Itertools; use martian_filetypes::LazyWrite; use metric::TxHashMap; use rand::RngExt; use rand::rngs...
446b79f68d43827e0dc1355b1077e8f25604af0352658028c5d2c2850575efd6
Rust
4,847
136
//! Martian stage MULTI_SETUP_CHUNKS #![deny(missing_docs)] use anyhow::{Result, ensure}; use barcode::WhitelistSpec; use cr_types::LibraryType; use cr_types::chemistry::ChemistryDefs; use cr_types::rna_read::RnaChunk; use cr_types::sample_def::SampleDef; use fastq_set::long_read_adapter_trimmer::TrimmerConfig; use it...
f20bb4876b8488c2aa1f807e938645c5ff961eb64afb981f9523dd11cb648ba8
Rust
4,880
146
// Various functions to iterate over molecule info files #![deny(missing_docs)] // Code for downsampling and collecting filters, to move a downsampler out of pandas and into Rust use cr_h5::molecule_info::{ BarcodeIdxType, FeatureIdxType, FullUmiCount, LibraryIdxType, MoleculeInfoIterator, MoleculeInfoReader,...
732db41c99406eb543f5ca4ecaa1514fa48ec88a5660578a20f620605deffa2a
Rust
4,882
143
//! Martian stage MAKE_CORRECTION_MAP #![deny(missing_docs)] use anyhow::Result; use barcode::BarcodeConstruct; use barcode_extensions::{CorrectionMap, CorrectionMapBuilder}; use cr_types::chemistry::{BarcodeExtraction, ChemistryDef, ChemistryDefs, ChemistryDefsExt}; use cr_types::{BcSegmentCountFormat, LibraryType}; ...
21d9119c7269d66a1f8f389f5548aa303f292232a1f6619bbc083484f8c1d4d0
Rust
4,970
158
//! Crate for Souporcell. //! //! Genetic demultiplexing using cell barcode by ref/alt count matrices. #![deny(missing_docs)] mod souporcell; use anyhow::Result; use cr_types::{GeneticDemuxParams, Mtx}; use itertools::Itertools; use metric::TxHashMap; use rand::rngs::SmallRng; use rand::{RngExt, SeedableRng}; use sou...
af2d0a9cb3e12c6c366b5a7cd313269c31d20de03c97e2819765a9ce59af89ad
Rust
4,984
174
//! This module defines the `CountMetric` struct. As the name implies, this struct //! is geared toward tracking counts, typically read counts. Internally it is //! represented using an `i64` variable. #![deny(missing_docs)] use crate::{JsonReport, JsonReporter, Metric}; use serde::{Deserialize, Serialize}; /// Use t...
46476b90fc80d0e8950fde9c87a8cca35734fd2c2376728b6ae5ecdef7d90b84
Rust
4,987
118
#![deny(missing_docs)] use barcode::{BarcodeConstructMetric, BarcodeSegmentState}; use cr_types::rna_read::RnaRead; use cr_types::types::LibraryType; use json_report_derive::JsonReport; use martian_derive::martian_filetype; use martian_filetypes::bin_file::BinaryFormat; use metric::{CountMetric, Metric, PercentMetric, ...
e6df923024180b29582ec74f462a5d8a70f6b0ebd0b86f17b7ce77f598b06a21
Rust
5,003
126
//! Martian stage PICK_BEAM_ANALYZER #![deny(missing_docs)] use super::compute_antigen_vdj_metrics::AntigenVdjMetricsFormat; use crate::utils::hard_link_martianfile; use anyhow::Result; use cr_types::SampleAssignment; use cr_websummary::multi::antigen::AntigenSpecificityRow; use martian::{MartianMain, MartianRover}; u...
d49bfe936b608e31ce12bd4955e49d3b46f8c26b272e6ae52733d986547960ae
Rust
5,010
147
#![expect(missing_docs)] use anyhow::{Result, anyhow}; use barcode::Barcode; use itertools::Itertools; use martian_filetypes::LazyFileTypeIO; use martian_filetypes::json_file::JsonFile; use serde::{Deserialize, Serialize}; use std::cmp::Reverse; use std::collections::{HashMap, HashSet}; use std::str::FromStr; use vdj_a...
a56e35514e88b0d176e238571a304cfa5c9e1109c80cd43169911a9fca95c252
Rust
5,017
145
//! RunEncloneAggr stage code #![expect(missing_docs)] use crate::setup_vdj_aggr::EncloneProtoMetaFormat; use anyhow::Result; use enclone_process::{ ClonotypingConfig, Dataset, InputSpec, VdjReceptor as EncloneRangerVdjReceptor, run_enclone, }; use martian::prelude::*; use martian_derive::{MartianStruct, make_mro,...
6d147eda363327e7ecb198a9c3c038e723774350fbe53377c89fcd32a96e5e80
Rust
5,048
147
//! Compute overlap coefficient matrix for a collection of barcodes. #![deny(missing_docs)] use crate::read_level_multiplexing::BarcodeFromBytes; use barcode::GelBeadAndProbeConstruct; use barcode::whitelist::BarcodeId; use itertools::Itertools; use metric::TxHashMap; use serde::{Deserialize, Serialize}; use std::cmp::...
6269f1be90b85b6543b4ec0b1aa2d81eb922df9b5fa0fdd69e90850cea2e39eb
Rust
5,068
150
#![deny(missing_docs)] use crate::websummary::{CardWithTable, GenericTable, PrettyMetric, TableRow, TitleWithHelp}; use serde::Serialize; use std::convert::Into; const HELP_TEXT: &str = "This table displays summary statistics for the aggregated samples on the basis of donor and origin. Each line lists the number of c...
9a46c64973884f2d8a9aafdb783783be470a12f2774eacf67fe642b5dbcabe27
Rust
5,244
162
// Copyright (c) 2021 10X Genomics, Inc. All rights reserved. #![deny(missing_docs)] // This file provides the single function join_exacts, which computes the equivalence relation // on exact subclonotypes. // // Note that in principle the specificity of joining might be increased by using nonproductive // contigs tha...
c49887e64882696e9430f57521c87ad68a3d723729e8aaa517ccc8d53a83cf53
Rust
5,277
178
use crate::{Counter, GeneMap, Library}; use anyhow::Result; use std::{ fmt::Write as fmtWrite, fs::File, io::{stdout, Write}, }; /// Writes the results to stdout / path fn write( path: Option<String>, iterable: impl Iterator<Item = String>, columns: &str, ) -> Result<()> { let mut writer = ...
4b38715603ec76612bc196e36cb269182e6d6c0ad98e1bf43720da983fc40ba4
Rust
5,329
188
// Copyright (c) 2021 10X Genomics, Inc. All rights reserved. //! This crate defines the data structure that would represent the clonotypes //! computed by enclone. #![expect(missing_docs)] use vdj_ann::annotate::Region as AnnRegion; include!("./enclone.types.rs"); impl From<&bio::alignment::Alignment> for Alignment...
f7d37df65c2d45b1aa119a610f19d63cea7c827e2e89fe1068c40f40bec60d52
Rust
5,348
139
//! WriteAnnCsv stage produces the CS outputs `all_contig_annotations.csv` and //! `filtered_contig_annotations.csv` from the contig annotations json file. #![expect(missing_docs)] use anyhow::Result; use martian::prelude::*; use martian_derive::{MartianStruct, make_mro}; use martian_filetypes::json_file::JsonFile; us...
00514f886a01db591cc6c8cdd8495c04f304aeffcf58f6f4d5613167a79f5258
Rust
5,353
141
//! MatchVdjOuts stage code #![expect(missing_docs)] use crate::write_contig_proto::ProtoFile; use anyhow::Result; use martian::prelude::*; use martian_derive::{MartianStruct, make_mro, martian_filetype}; use martian_filetypes::json_file::JsonFile; use martian_filetypes::tabular_file::{CsvFile, TsvFile}; use serde::{D...
d78021c8bce652783a16e561a933326be20497fa74d789c84b907b78aa4abb1b
Rust
5,374
145
//! Martian stage COLLATE_PROBE_METRICS #![deny(missing_docs)] // Bring the procedural macros in scope: // Other imports for stage use crate::gdna_utils::{ GdnaCorrectedMetrics, compute_gdna_corrected_median_genes_per_spot, get_filtered_per_probe_metrics, }; use crate::probe_barcode_matrix::{ProbeCounts, write...
41487d8e7434753144a7e044e369acca75cedc74052e12e439f686e17c997a4b
Rust
5,385
142
// ◼ There are some fundamental problems with rust-htslib that affect our ability // ◼ to debug our code: // ◼ (a) the lack of code to print a bam record // ◼ (b) lack of code to validate a bam record and say what’s wrong with it // ◼ (c) bad exit handling by rust-htslib -- it doesn’t panic upon failure so you // ◼ ...
ce21cd08faf034c1fa3b3ff51bb12e30154f3a4b8e01a55b23a2a186fca4e821
Rust
5,403
203
//! sgcount //! //! # Summary //! This is a commandline tool to count the frequency of `sgRNAs` //! in a group of provided sequencing files. It is meant to replace //! methods of exact sequence matching without sacrificing speed and //! replace costly alignment scripts using bwa or bowtie to align to //! a library. #!...
e16f2d5ff7fa598b57a8a93f1cbad02f5c913fe220f31b9e0c141f525e6ddad4
Rust
5,407
205
use adjustp::Procedure; use anyhow::Result; use clap::Parser; use cli::{Cli, Commands, DiffAbundanceArgs, IncArgs, InputArgs, MiscArgs, RraArgs, SgrnaColumns}; use io::SimpleFrame; use regex::Regex; use run_aggregation::run_aggregation; use std::path::Path; pub mod aggregation; pub mod cli; pub mod differential_expres...
53f33b23384dfcff93da88044cdd8b09c21e33f3a866233cabd38fca92695c87
Rust
5,482
184
use bon::bon; use ndarray::{Array1, Zip}; pub struct AggregationResult { genes: Vec<String>, gene_fc: Array1<f64>, gene_log2_fc: Array1<f64>, pvalues_low: Array1<f64>, pvalues_high: Array1<f64>, aggregation_score_low: Array1<f64>, aggregation_score_high: Array1<f64>, fdr_low: Array1<f64...
372555d649a1f3c8419d26459a020a3672ac8b599c060aa0a39d566e21180306
Rust
5,525
185
use ndarray::{Array1, Zip}; pub struct AggregationResult { genes: Vec<String>, gene_fc: Array1<f64>, gene_log2_fc: Array1<f64>, pvalues_low: Array1<f64>, pvalues_high: Array1<f64>, aggregation_score_low: Array1<f64>, aggregation_score_high: Array1<f64>, fdr_low: Array1<f64>, fdr_hig...
a36f4a2d86f5f392a8b9814c74457bda1f7bbfd57920bab04b78e66c7d138faf
Rust
5,529
153
// Copyright (c) 2021 10X Genomics, Inc. All rights reserved. #![deny(missing_docs)] use crate::core::defs::{ColInfo, ExactClonotype}; use vector_utils::{erase_if, make_freq}; // ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ // Define reference segment identifiers, ...
adfc4989e77219bf7974dbe5247f1925cc4145a1c17df8857bbd767b03364cfd
Rust
5,551
143
// Copyright (c) 2022 10X Genomics, Inc. All rights reserved. #![deny(missing_docs)] use super::align_to_vdj_ref::align_to_vdj_ref; use super::defs::{ExactClonotype, Junction}; use super::opt_d::{jflank, opt_d}; use bio::alignment::AlignmentOperation::{Del, Ins, Subst}; use enclone_proto::types::DonorReferenceItem; us...
767004f947f16d7cb6695aba828147596d6518a9138f58fc3197533a3f8a19af
Rust
5,604
207
use crate::{ aggregation::GeneAggregationSelection, model::ModelChoice, norm::Normalization, utils::Adjustment, }; use clap::{Parser, Subcommand}; #[derive(Parser, Debug)] #[command(author, version, about, long_about = None)] pub struct Cli { #[clap(subcommand)] pub command: Commands, } #[derive(Parse...
8b6c3e7a72bf24debd7def195b44c37c0602f8d20ec32053412d2ddb356c5840
Rust
5,608
209
//! A stack-allocated immutable string. #![deny(missing_docs)] use anyhow::{Result, bail}; use metric::AsMetricPrefix; use serde::de::{self, Visitor}; use serde::{Deserialize, Deserializer, Serialize}; use std::borrow::Borrow; use std::fmt::{Debug, Display}; use std::hash::Hash; use std::ops::Deref; /// A stack-alloc...
426348ed76904469c9742d8de6681a7871993af96de5c636d6af953755c99c78
Rust
5,624
147
//! WriteContigProto stage code #![expect(missing_docs)] use anyhow::Result; use cr_types::{BarcodeMultiplexingType, CellLevel, MetricsFile, ReadLevel}; use martian::prelude::*; use martian_derive::{MartianStruct, make_mro, martian_filetype}; use martian_filetypes::json_file::JsonFile; use martian_filetypes::{FileType...
a3fcb7fa6435bf5f83df4da96685fd2e9e8c0699f9911e5aec876268eeda0f55
Rust
5,665
178
//! Martian stage RUN_PCA_NG #![expect(missing_docs)] use crate::EXCLUDED_FEATURE_TYPES; use crate::io::{csv, h5}; use crate::pca::{PCA_COMPONENTS, run_pca}; use crate::types::H5File; use anyhow::Result; use cr_types::reference::feature_reference::FeatureType; use hdf5_io::matrix::read_adaptive_csr_matrix; use martian...
b335e01e834fb30cf95332eeaf70adc0dab63bae55c0461b1bee6f4d14491b81
Rust
5,864
184
#![expect(missing_docs)] use crate::in_flight::TryIntoIterator; use anyhow::Result; use martian_filetypes::{LazyFileTypeIO, LazyWrite}; use std::vec; enum SpillableStorage<M, D> { MemOnly(M), MemAndDisk(M, D), } pub struct SpillVec<T, F> where F: LazyFileTypeIO<T>, { storage: Option<SpillableStorage<V...
5b5d5f4e5af3ceddc1b6ecc7147c786d6653223ed242f0d1986e05d241df387f
Rust
5,887
161
#![deny(missing_docs)] use crate::corrector::{BARCODE_CONFIDENCE_THRESHOLD, CorrectBarcode}; use crate::{ BarcodeSegment, BarcodeSegmentContent, BarcodeSegmentState, BcSegQual, BcSegSeq, Whitelist, }; use fastq_set::sseq::{HammingIterOpt, InsertionIterOpt}; use itertools::{Itertools, chain}; use metric::{Histogram...
ca5f8087d7ff6b2b138cde4beb820fcbe6f71fbf8f99d797309f7292e558dd1c
Rust
5,899
154
// Specify inner primers. #![expect(missing_docs)] // // Usage: inner_primers( species, class ) // - where species is either "human" or "mouse" // - and class is either "tcr" or "bcr". // // Note that if we ever change the primers, we should append the new primers to // this file (under each of the ...
a0ab47f6106eca76801ba434fe9cc49556da10fb14f586d25c2ae1489bc6e754
Rust
5,964
183
use adjustp::{adjust, Procedure}; use ndarray::Array1; pub struct EnrichmentResult { pvalues_low: Array1<f64>, pvalues_high: Array1<f64>, pvalues_twosided: Array1<f64>, fdr: Array1<f64>, base_means: Array1<f64>, control_means: Array1<f64>, treatment_means: Array1<f64>, fold_change: Array...
6bb5562fd632e3b162d21d9c847753112bcb7e6fdb8ee83ac041f0f1f2a804c1
Rust
5,984
205
#![expect(missing_docs)] use crate::IntoExitCode; use anyhow::{Context, Result, bail, ensure}; use clap::{self, Parser}; use itertools::Itertools; use serde::{Deserialize, Serialize}; use std::fmt::{Debug, Display, Formatter}; use std::ops::Deref; use std::path::{Path, PathBuf}; use std::process::{Command, ExitCode}; u...
a9c917b3ab6dbff5bb75376c08b455da732fbce6b26660ab0c1354a865d49d27
Rust
6,018
181
//! Martian stage RUN_UMAP #![expect(missing_docs)] use crate::EXCLUDED_FEATURE_TYPES; use crate::io::{csv, h5}; use crate::types::{EmbeddingResult, EmbeddingType, H5File, ReductionType}; use anyhow::Result; use cr_types::reference::feature_reference::FeatureType; use hdf5_io::matrix::get_barcodes_between; use martian...
4b3f294487498be7d7309645154c16acde42f1602c51e1f49a4b40d2ba8b7fb6
Rust
6,069
171
#![deny(missing_docs)] #![recursion_limit = "128"] //! //! This is documentation for the `metric_derive` crate. //! //! This crate defines a procedural macro for deriving the //! Metric Trait. Metric trait can be auto derived for a //! struct if all the fields of the structs implement //! the Metric trait //! //! # Ho...
3abdc8c4893e781a29f55e9b6b4daf5fcd84d6f482a297e32f03207e1a31481c
Rust
6,179
190
//! Martian stage WRITE_MATRIX_MARKET. #![deny(missing_docs)] use crate::env; use crate::utils::estimate_mem::barcode_mem_gib; use anyhow::Result; use barcode::Barcode; use cr_types::barcode_index::BarcodeIndex; use cr_types::reference::feature_reference::{FeatureReference, FeatureType}; use cr_types::types::FeatureBa...
df58e7e073ae298ed2fcfa8ae3ca6ec26241d090d64515adf0fa48ed0f4fed7d
Rust
6,183
210
//! This module defines the `PercentMetric` struct. As the name implies, this struct //! is geared toward tracking percentages. Internally it is represented using a //! numerator and denominator counter. #![deny(missing_docs)] use crate::{CountMetric, JsonReport, JsonReporter, Metric}; use metric_derive::Metric; use s...
64131b5ef705eebd219673e3e7409cfec126b7e13037688a5d438d131ebdbb96
Rust
6,224
201
use anyhow::{bail, Result}; use hashbrown::HashSet; use ndarray::Array2; use polars::prelude::*; use regex::Regex; use std::path::PathBuf; use std::{fs::File, io::Write}; use crate::aggregation::GeneAggregation; pub fn load_dataframe(path: PathBuf) -> Result<DataFrame, PolarsError> { CsvReadOptions::default() ...
e5b1aad1865cc62e1562dda7b6c10fe4415695b0c44bb37abc0d3578951feac0
Rust
6,266
183
// Copyright (c) 2021 10x Genomics, Inc. All rights reserved. #![deny(missing_docs)] use crate::core::defs::{CloneInfo, EncloneControl, ExactClonotype}; use crate::core::enclone_structs::CandidateClonotype; use crate::process::define_mat::{define_mat, setup_define_mat}; use equiv::EquivRel; use qd::Double; use std::co...
d73327b061cbaea09848afbb71307ecee0ea8d1e9529b4b53aa69be4738dc4df
Rust
6,355
205
use std::{ fs::File, io::{BufWriter, Write}, }; use crate::{ aggregation::{AggregationResult, GeneAggregation}, utils::config::Configuration, }; use anyhow::Result; use hashbrown::HashSet; use ndarray::{Array1, Axis}; #[derive(Clone, Copy)] #[allow(clippy::upper_case_acronyms)] pub enum MethodEnum { ...
20d55e77122e88b8a12cc5afd8b304ec9f97e42ba410b9206d3636d9b2829ced
Rust
6,404
199
use super::{ModelChoice, Ols, Sqmean, Wols}; use crate::utils::{logging::Logger, math::zscore_transform}; use hashbrown::HashSet; use ndarray::Array1; use ndarray_rand::rand_distr::num_traits::Pow; use std::ops::Sub; pub struct LoggedOls { kappa: f64, beta: f64, } impl LoggedOls { pub fn fit( means...
022b69c0c09f0be9194256546fa4076bcbe1a83ca355f5ca72bb616fa58be19e
Rust
6,435
158
//! WriteConsensusBam stage code #![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 cr_types::clonotype::ClonotypeId; use enclone_proto::...
eda7a6f80a381e8d3ed5f17a46b592600149e81c6a861ecfff8b9961c0e6202d
Rust
6,478
191
#![deny(missing_docs)] use super::chemistry_filter::{ChemistryFilter, DetectChemistryUnit}; use super::errors::DetectChemistryErrors; use crate::detect_chemistry::chemistry_filter::DetectChemistryCandidates; use anyhow::Result; use cr_types::LibraryType; use cr_types::chemistry::{ChemistryDef, ChemistryName}; use cr_ty...
9f2600153ff2045e45142658019ac3bc7b9b63a56d968d03ea11c5961ad1e0e7
Rust
6,493
182
#![expect(missing_docs)] use crate::barcode_sort::ReadTrimmingMetrics; use crate::probe_barcode_matrix::ProbeCounts; use crate::utils::hard_link_martianfile; use anyhow::{Error, Result}; use barcode::{Barcode, barcode_string}; use cr_h5::count_matrix::CountMatrixFile; use cr_types::chemistry::{ChemistryDef, IndexScheme...
295c0245891bc864bbeec28a0f5913e86196996e1dcb6b181718c219729a538f
Rust
6,570
173
//! Martian stage DEMUX_PROBE_BC_MATRIX #![deny(missing_docs)] use crate::gdna_utils::get_filtered_per_probe_metrics; use crate::probe_barcode_matrix::{ProbeCounts, write_probe_bc_matrix}; use barcode::Barcode; use cr_types::reference::probe_set_reference::TargetSetFile; use cr_types::reference::reference_info::Refere...
d9dc8ec3dfcade9fd030cadbea125d6282fd0d51598e4f4ea1e32b2d21680341
Rust
6,570
204
//! This module implements the `Metric` and `JsonReport` trait //! for common collections (`Vec`, `HashMap`) #![deny(missing_docs)] use crate::{JsonReport, JsonReporter, Metric, ToMetricPrefix, join_metric_name}; use itertools::zip_eq; use serde::{Deserialize, Serialize}; use std::collections::{BTreeMap, HashMap}; use...
521b60a050ec82cb3a767ca2aa70f94a7c8d1a49bdf45b12f9de44a0bc7da533
Rust
6,601
145
#![deny(missing_docs)] use super::errors::DetectChemistryErrors; use crate::detect_chemistry::chemistry_filter::{ ChemistryFilter, UnitsPerLibrary, named_candidates, }; use crate::detect_chemistry::length_filter::LengthFilter; use anyhow::Result; use barcode::BcSegSeq; use cr_types::LibraryType; use cr_types::chem...
097ff8bd7e19cdb69d66cbf72ee23df38cf80bd4baf1d95b8a06dc4977410dcc
Rust
6,619
169
//! MergePerSampleAnnotations stage code #![expect(missing_docs)] use anyhow::Result; use cr_h5::count_matrix::BarcodeWithGemGroup; use cr_lib::map_multiplexing_seq_to_id; use cr_types::chemistry::ChemistryDef; use cr_types::{BarcodeMultiplexingType, ReadLevel}; use hdf5::types::FixedAscii; use itertools::Itertools; us...
a6dcabc0ab3f964759494fc3405b24ebc69f09e453e5c5108b5e44a50e2d4002
Rust
6,638
205
#![expect(missing_docs)] use crate::bam_tags::{ EXTRA_FLAGS_TAG, ExtraFlags, FEATURE_IDS_TAG, PROC_BC_SEQ_TAG, PROC_UMI_SEQ_TAG, RAW_BARCODE_SEQ_TAG, RAW_UMI_SEQ_TAG, SPATIAL_BC_TAG, }; use crate::constants::{ALN_BC_DISK_CHUNK_SZ, ALN_BC_GIB}; use barcode::{Barcode, BarcodeContent}; use metric::TxHasher; use ru...
fb35b9904c30ba49bbf5e6e7d05c3dd77871afa2f51968e9c9248a5a3764ec0e
Rust
6,638
239
#![deny(missing_docs)] #[cfg(test)] use std::hash::{Hash, Hasher}; #[cfg(test)] use std::path::{Path, PathBuf}; /// Computes log(exp(a) + exp(b)) in a way that tries to avoid over/underflows. /// log(exp(a - b) + 1) + b = log((exp(a) + exp(b)) - exp(b)) + b = log(exp(a) + exp(b)) pub fn logaddexp(a: f64, b: f64, base...
1bd5f4492303296dd53f253d16381b2eead9124e6e5c763c86af19b00fe42ffb
Rust
6,661
178
//! //! A thin wrapper around orbit used for chemistry detection to distinguish between 3' and 5' //! #![deny(missing_docs)] use super::chemistry_filter::{ChemistryFilter, DetectChemistryUnit}; use super::errors::DetectChemistryErrors; use crate::detect_chemistry::chemistry_filter::DetectChemistryCandidates; use anyho...
edc1a06f78b88b69a868ea09bc2c37a9c6952e6e11e7317a0eab8733ac8e31c7
Rust
6,662
169
//! FillClonotypeInfo stage code #![expect(missing_docs)] use crate::assigner::ProtoBinFile; use anyhow::Result; use cr_types::clonotype::ClonotypeId; use enclone_proto::proto_io::ClonotypeIter; use martian::prelude::*; use martian_derive::{MartianStruct, make_mro}; use martian_filetypes::json_file::JsonFile; use mart...
185b4b2be03630721612cb4ca185d680ac7f3f74c83aec70c5d9ca4c23ba56a6
Rust
6,721
204
//! Scan a directory of FASTQ file & provide access a subset of files based on lane or sample name. #![expect(missing_docs)] use crate::filenames::bcl_processor::{self, BclProcessorFileGroup}; use crate::filenames::bcl2fastq::{self, IlmnFastqFileGroup, SampleNameSpec}; use crate::filenames::{LaneMode, LaneSpec}; use c...
ee9296aeb39eb497a79c71c88a7a4031f0c4a3d8c4d119fdf0700eb13c2a4c42
Rust
6,721
198
#![expect(missing_docs)] use crate::feature_reference_io::encode_ascii_xml; use anyhow::{Context, Result}; use cr_types::GenomeName; use cr_types::probe_set::{Probe, ProbeRegion, ProbeType}; use cr_types::reference::feature_reference::get_genome_from_feature_id; use hdf5::Group; use hdf5::types::FixedAscii; use std::bo...
d2f7eac5b1cb6fe5c4132576b15ff32aa0c2812245483fb775d01ed03cc7c55a
Rust
6,753
165
#![expect(missing_docs)] use cr_websummary::{ChartWithHelp, PlotlyChart, TitleWithHelp}; use plotly::layout::{Axis, AxisType, BarMode, HoverMode, Margin}; use plotly::{Bar, Layout}; use serde::Serialize; #[derive(Debug, Serialize, PartialEq, Clone)] pub enum ProportionsType { SingleSample(Vec<f64>), Aggr(Vec<(...
4a6c65c8a3fbbc353eadc804c19a29dc8ec9f1cfae25ece585ade9c3f08e4bae
Rust
6,773
238
// Copyright (c) 2021 10X Genomics, Inc. All rights reserved. #![deny(missing_docs)] // Find the optimal D segment, the runner up, and the delta between the scores. This uses // the donor V and J segments that are assigned to the clonotype. Note that the optimal D // segment may be null. This is obvious from lookin...
5ec75d02a534af9c38489b0b39ec5b8f8720ae393a22618b624948027366151b
Rust
6,773
182
//! Martian stage RUN_HIERARCHICAL_CLUSTERING #![expect(missing_docs)] use crate::hclust_utils::get_cluster_representatives; use crate::io::{csv, h5}; use crate::types::{ClusteringResult, ClusteringType, H5File}; use anyhow::Result; use cr_types::FeatureBarcodeType; use cr_types::reference::feature_reference::FeatureT...
6ee27f9ea12d14ef026ecb11dbcee695580ac05c9bfdba71f4b9b6dbb680643b
Rust
6,805
196
//! Martian stage COMPUTE_ANTIGEN_VDJ_METRICS #![deny(missing_docs)] use crate::BarcodeMetricsShardFile; use crate::align_metrics::{BarcodeKind, BarcodeMetrics, LibFeatThenBarcodeOrder, VisitorMetrics}; use anyhow::Result; use barcode::Barcode; use cr_types::FeatureBarcodeType; use itertools::Itertools; use martian::p...
aeb50bbf5590f88412a29d35f5d140656bedc38ebc86c475a8773c8d1039d183
Rust
6,901
186
// Stage to quickly get the counts of UMIs and Reads per Barcode for valid // cell barcodes for a given feature type (e.g. AB, CMO, GEX), etc. #![deny(missing_docs)] //use strum::EnumString; use cr_h5::molecule_info::{ BarcodeIdxType, FullUmiCount, LibraryIdxType, MoleculeInfoIterator, MoleculeInfoReader, }; use cr...
5e5cdd34edb2fed2ca02193a614c264f58b5e172873bb954c4f6e0f1181d849f
Rust
6,937
216
//! Compute per_barcode.csv for BEAM analysis. Note that this is different from the //! per_barcode_metrics.csv computed in BASIC_SC_RNA_COUNTER. #![expect(missing_docs)] use crate::matrix::{H5File, load_barcodes_from_matrix}; use anyhow::{Result, ensure}; use martian::prelude::*; use martian_derive::{MartianStruct, M...
6496db7c93e7ea0511844194b260c70c6e3edeef21ae3f34c4e3d4d20ed5febd
Rust
6,990
218
//! Datatypes for creating the GeneIndex class used in the //! python codebase from the reference GTF file. #![expect(missing_docs)] use crate::Transcriptome; use anyhow::{Context, Result, bail}; use bio::io::fasta::IndexedReader; use bio_types::strand::ReqStrand; use ordered_float::NotNan; use serde::Serialize; use s...
ccdbf0114c66102c99f8080a78ec8f9016cb4277defd911f838677f10422d7c9
Rust
7,016
197
//! Martians stage SETUP_VDJ_ANALYSIS #![deny(missing_docs)] use super::setup_vdj_demux::VdjDemuxSampleInfo; use crate::GexMatrices; use anyhow::Result; use cr_h5::count_matrix::CountMatrixFile; use cr_types::reference::feature_reference::BeamMode; use cr_types::{BarcodeMultiplexingType, ReadLevel}; use itertools::Ite...