sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
b21d103ae73ec62db9b5c29693a6c885fc487433d8b826a86940e1548f6b6004 | Rust | 1,542 | 45 | //! enclone
// Copyright (c) 2021 10x Genomics, Inc. All rights reserved.
#![deny(missing_docs)]
use crate::core::barcode_fate::BarcodeFate;
use crate::core::enclone_structs::BarcodeFates;
use itertools::zip_eq;
use vector_utils::erase_if_iter;
pub(crate) mod allele;
pub(crate) mod graph_filter;
pub(crate) mod info;
... |
a9b5dfe604f094d7b2214a95798eba86a0502799ebdb3bc72a6c7b496944e97f | Rust | 1,588 | 50 | //! Utilities for finding groups of FASTQ files on disk.
#![deny(missing_docs)]
pub mod bcl2fastq;
pub mod bcl_processor;
pub mod fastq_dir;
pub mod sbx;
use serde::{Deserialize, Serialize};
use std::collections::HashSet;
/// This enum stores the lane information associated with a fastq file:
#[derive(Deserialize, S... |
0c5a7c6df039b0036df3101488ae1f9a46ec6a1160d87b8928be070a134a2b5a | Rust | 1,590 | 45 | use anyhow::Result;
use polars::prelude::*;
use std::{fs::File, io::BufWriter};
use crate::enrich::EnrichmentResult;
fn build_sgrna_dataframe(
sgrna_names: &[String],
gene_names: &[String],
adj_var: &[f64],
sgrna_results: &EnrichmentResult,
) -> Result<DataFrame, PolarsError> {
df!(
"sgrna... |
cba07c50ed4b720feafbc3e4e754aa5aee61aaaed82dd7126e204a24e27efc35 | Rust | 1,631 | 59 | #![deny(missing_docs)]
use crate::{FloatAsInt, Percent};
use anyhow::{Result, anyhow, bail};
use serde_json::{Number, Value};
pub trait TryFromValue {
fn try_from_value(value: &Value) -> Result<Option<Self>>
where
Self: Sized;
}
impl TryFromValue for Number {
fn try_from_value(value: &Value) -> R... |
9d07d791764418e02f0dde460c4ec7d4590bab34c283379adea52d0e3ec973cf | Rust | 1,639 | 48 | #![expect(missing_docs)]
use crate::reference::probe_set_reference::TargetSetFile;
use crate::types::TargetingMethod;
use martian_derive::martian_filetype;
use martian_filetypes::json_file::JsonFormat;
use serde::{Deserialize, Serialize};
martian_filetype!(_TargetPanelSummaryFile, "tps");
pub type TargetPanelSummaryFo... |
539367411ae2a73afe645f1c5c7c527e1c441cd16678ea97bdabc312543acb22 | Rust | 1,660 | 44 | #![expect(missing_docs)]
use crate::IntoExitCode;
use crate::utils::AllArgs;
use anyhow::{Context, Result};
use std::process::{Command, ExitCode};
/// Currently we capture all the arguments and pass them through to
/// the old shell wrapper code for mkfastq.
/// (full Rust-ification is an early work in progress for no... |
a469d1671cfce67ffbc7ac403dfd431b0a89e6729d0a275ce896be1d6c48d3d0 | Rust | 1,717 | 58 | #![expect(missing_docs)]
use crate::types::GenomeName;
use anyhow::Result;
use barcode::{Barcode, barcode_string};
use itertools::Itertools;
use martian_filetypes::LazyFileTypeIO;
use martian_filetypes::tabular_file::CsvFileNoHeader;
use metric::TxHashSet;
use serde::{Deserialize, Serialize};
/// Filtered barcodes CSV... |
1d79e015fc62fff8a7b7d1dd4ece95df3be6f9de4120c02e1fc5ba8edd8544d9 | Rust | 1,748 | 56 | //! Martian stage MERGE_METRICS_MAPS
//! Merge metrics JSON files.
#![deny(missing_docs)]
use anyhow::Result;
use cr_types::MetricsFile;
use itertools::Itertools;
use martian::{MartianMain, MartianRover};
use martian_derive::{MartianStruct, make_mro};
use martian_filetypes::FileTypeRead;
use metric::JsonReporter;
use ... |
d327b1a691c7a3f8d9c5a86e9ec9e6c5e09b5304b6b080059af7d4f4d9e8d851 | Rust | 1,775 | 51 | #![expect(missing_docs)]
use crate::reference::feature_reference::FeatureReference;
use anyhow::{Result, bail};
use std::collections::HashMap;
use std::iter::zip;
/// Given an array of integer counts, one per feature.
/// Return the proportions, normalized within each feature type.
pub fn compute_feature_dist(raw_coun... |
89ef8dd0a632fbb164bff705f22c2050ca884d7ea9e5c64a5c231ffffc9d01b6 | Rust | 1,782 | 64 | use anyhow::Result;
use ndarray::s;
use polars::frame::DataFrame;
use crate::{
aggregation::compute_aggregation,
cli::SgrnaColumns,
enrich::EnrichmentResult,
io::{get_string_column, to_ndarray, write_gene_frame, write_hit_list, Screenviz},
utils::{config::Configuration, logging::Logger},
};
pub fn... |
415380b501ed4826a583dc0a7f2de822825cdd1adfb045da15b12520b3e30d89 | Rust | 1,796 | 64 | #![deny(missing_docs)]
use anyhow::Result;
use serde::de::Visitor;
use serde::{Deserialize, Deserializer, de};
use std::convert::TryFrom;
use std::fmt::Formatter;
#[derive(Debug)]
pub(super) enum NumberOrStr {
Number(u64),
Str(String),
}
impl TryFrom<NumberOrStr> for usize {
type Error = de::value::Error;... |
63933a893085f3405a6ed1f2bef17b950d54a24db0b30283c045fb66faceea47 | Rust | 1,798 | 60 | use anyhow::Result;
use crate::{
aggregation::compute_aggregation,
cli::SgrnaColumns,
enrich::EnrichmentResult,
io::{GeneFrame, HitList, Screenviz, SimpleFrame},
utils::{config::Configuration, logging::Logger},
};
pub fn run_aggregation(
frame: &SimpleFrame,
columns: SgrnaColumns,
conf... |
c530ffa9e154458c329424e9715b12015a2f76e355bc0bbf526f600e218e4a9f | Rust | 1,799 | 61 | //! A thread-safe, fixed-size pool of T.
//! This type can be used to provide reusable allocations that can be passed
//! between threads, such as in-memory buffers.
//!
//! The pool will never allocate more than the specified number of members,
//! and requesting a member from the pool will block until one is availabl... |
e0009bf66640bc3563974d77c3b1be4ff15e460f457f98e7c2f01fe94e55b6b7 | Rust | 1,805 | 51 | //! Martian stage EXTRACT_SINGLE_CHEMISTRY.
//! This is a utility stage to extract a single pre-declared library type from
//! the map of chemistries produced by DETECT_CHEMISTRY. If no library type is
//! provided, the stage asserts that only a single chemistry is present and
//! returns it.
//!
//! This is a shim to ... |
cc6a44fc0d205a490c44cec1f8df765aa2ae03da460fd1b5ba56f74412d88d9b | Rust | 1,815 | 50 | // Copyright (c) 2021 10X Genomics, Inc. All rights reserved.
#![deny(missing_docs)]
use crate::core::defs::ExactClonotype;
// ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
pub(crate) fn delete_weaks(
exacts: &[usize],
exact_clonotypes: &[ExactClonotype],
... |
31e88b28cc37693c242a4b3a9f827b5129aa70b308d92ae0804369c87faa78bd | Rust | 1,839 | 51 | //! Martian stage CREATE_MULTI_GRAPH
//! Create the multiplexing sample graph.
//! This stage requires information from both the multi config CSV and chemistry detection.
#![deny(missing_docs)]
use super::detect_chemistry::DetectedProbeBarcodePairingFile;
use anyhow::Result;
use cr_types::CrMultiGraph;
use martian::pre... |
9cc8eeaee963ac5b8cb04910c181721981d91eebad24be5acc558cdfafda96c0 | Rust | 1,883 | 51 | //! CreateClonotypeClustermap stage code
#![expect(missing_docs)]
use anyhow::Result;
use cr_websummary::ChartWithHelp;
use cr_websummary::multi::antigen::{AntigenSpecificityRow, clonotype_specificity_heatmap};
use martian::prelude::*;
use martian_derive::{MartianStruct, make_mro};
use martian_filetypes::FileTypeWrite... |
61d256d908de56eebf1d5c72d0f243e1185434eb9af5222f843a11552146f306 | Rust | 1,907 | 63 | //! kmer_lookup
// Copyright (c) 2018 10X Genomics, Inc. All rights reserved.
#![deny(missing_docs)]
// Kmer lookup.
use debruijn::dna_string::DnaString;
use debruijn::kmer::{Kmer12, Kmer20};
use debruijn::{Kmer, Mer, Vmer};
use vector_utils::{lower_bound1_3, upper_bound1_3};
/// Given a vector of DnaStrings dv, cre... |
1c6756b19aadbcf6d726d0a9278c4a98c6da191558097c20f5eada1a9a063a58 | Rust | 1,923 | 71 | //! multi::cmo_set
#![deny(missing_docs)]
use anyhow::{Result, bail};
use cr_types::GenomeName;
use cr_types::reference::feature_reference::{FeatureDef, FeatureType};
use cr_types::types::FeatureBarcodeType;
use fastq_set::read_pair::WhichRead;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use st... |
3384d5d79912c1cc4efbfcf82b9a5b87575742e0becfda5084f8378b7d01c2c5 | Rust | 1,950 | 55 | #![expect(missing_docs)]
use anyhow::{Result, bail};
use clap::{ArgAction, Parser};
#[derive(Parser, Debug, Clone, PartialEq, Eq)]
pub struct CreateBam {
/// Enable or disable BAM file generation.
/// Setting --create-bam=false reduces the total computation time and the size of
/// the output directory (BA... |
245222edecc364055eda90070b12f0d121226c278468319f4df3fe174c60563a | Rust | 1,967 | 66 | //! cr_aggr
#![deny(missing_docs)]
use anyhow::Result;
use docopt::Docopt;
use martian::prelude::*;
use serde::Deserialize;
const HEADER: &str = "# Copyright 2023 10x Genomics, Inc. All rights reserved.";
const USAGE: &str = "
Test Rust stage
Usage:
cr_aggr martian <adapter>...
cr_aggr mro [--file=<filename>] [-... |
416025fa77c123f31bebfa1976b4b4f71a17cf2a582c7bbec8636808146bb716 | Rust | 1,992 | 73 | // Copyright (c) 2021 10X Genomics, Inc. All rights reserved.
#![deny(missing_docs)]
// This file provides the tail end code for join.rs, plus a small function used there.
use crate::core::defs::CloneInfo;
use equiv::EquivRel;
use vector_utils::next_diff1_2;
pub(crate) struct JoinResult {
pub(crate) i: usize,
... |
fd445bdb2e63107a5f39e00431f46661fc0ebb61077a1a92dd559ee6319cd3f7 | Rust | 2,007 | 72 | //! This captures and analyzes data about vdj umis.
#![deny(missing_docs)]
use barcode::Barcode;
use debruijn::dna_string::DnaString;
use serde::{Deserialize, Serialize};
use umi::Umi;
use vdj_types::VdjChain;
/// Strongly-typed foreign key index into a vector of contigs
#[derive(Clone, Debug, Serialize, Deserialize)... |
001cf2071f73037f428b5a00b850e7dbcff609fc5a4de153543927d27a205caf | Rust | 2,046 | 65 | #![expect(missing_docs)]
use anyhow::Result;
use martian::prelude::*;
use martian_derive::{MartianStruct, make_mro};
use serde::{Deserialize, Serialize};
use vdj_filter_barcodes::filter_log::FilterSwitch;
#[derive(Debug, Clone, Serialize, Deserialize, MartianStruct)]
pub struct StageInputs {
pub disable_count: Opt... |
2fb798a618f536bab8d257007e9cde17eac28ad9efd5eee337bfb69f7faa4bf5 | Rust | 2,054 | 63 | // Copyright (c) 2018 10x Genomics, Inc. All rights reserved.
//! Tools for working with groups FASTQ of files.
//! Major functionality includes:
//! * Find groups FASTQs (R1/R2/I1/I2) following Illumina filename conventions
//! * Parsing flowcell information from Illumina FASTQ headers
//! * High-speed FASTQ I/O (via ... |
f80eb67fd79f250367100672f06be4e70643073485245307fae49212c0fef33a | Rust | 2,058 | 60 | //! Alarms in the websummary (aka alerts)
#![expect(missing_docs)]
use cr_types::LibraryType;
use serde::{Deserialize, Serialize};
use std::collections::HashSet;
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
#[serde(rename_all = "UPPERCASE")]
pub enum AlertLevel {
Error,
Warn... |
dc2f30d4d971305e4fdfd9a5123c69d75a9fb0228f0f2310ffe7213a02cae9a0 | Rust | 2,062 | 49 | #![expect(missing_docs)]
use crate::reference::reference_info::ReferenceInfo;
use crate::types::GenomeName;
use anyhow::Result;
use std::path::Path;
/// Compute the genome for each chromosome. The output is a vector of genome names in the same
/// order as the names of chromosomes in `star/chrName.txt`. If we have mor... |
ad6ee291a2f0e8e92115024d9ce7e09392b002afb9d92759a3ec72c7cdcf7c47 | Rust | 2,064 | 67 | #![deny(missing_docs)]
use anyhow::Result;
use martian::{MartianFileType, MartianRover};
use std::path::Path;
/// Attempts to create a hard link a file and creates a copy if hard linking fails
///
/// # Arguments
///
/// * `src` - The source file path
/// * `dst` - The destination link path
pub fn hard_link_file<P: As... |
b2db7f93dacb429c7375c4f830567455aadb5bba70a0e6d1c20f7e33fca31b7e | Rust | 2,155 | 66 | // Copyright (c) 2021 10x Genomics, Inc. All rights reserved.
#![deny(missing_docs)]
// Populate features.
use amino::nucleotide_to_aminoacid_sequence;
use vdj_ann::refx::RefData;
use vdj_ann::vdj_features::{cdr1_start, cdr2_start, fr1_start, fr2_start, fr3_start};
#[allow(clippy::too_many_arguments)]
pub(crate) fn ... |
36611b1bce3d4e00e7187d38a465c092935961375602a50cb57eb509ccbe3712 | Rust | 2,208 | 61 | #![deny(missing_docs)]
use crate::barcode_counter::FilteredBarcodeFilter;
use cr_h5::molecule_info::MoleculeInfoIterator;
use cr_types::TargetingMethod;
use cr_types::probe_set::ProbeSetReference;
use cr_types::target_panel_summary::{TargetPanelSummary, TargetPanelSummaryFormat};
use cr_types::types::PROBE_IDX_SENTINEL... |
03730b0939cf470163336aabf0dcfdde33532b86be8d0b863240d5d03fd9fac1 | Rust | 2,302 | 69 | #![deny(missing_docs)]
use crate::websummary::{HeroMetric, PrettyMetric, Threshold};
use serde::{Deserialize, Serialize};
const NUMBER_OF_CELLS: &str = "Total Number of Cells";
const NUMBER_OF_CLONOTYPES: &str = "Total Number of Clonotypes";
const NUMBER_OF_PAIRED_CELLS: &str = "Number of Cells With Productive V-J Sp... |
aab7af654c7317dc8e5b530a24c0b321ba46cb1d6c90f8bdcf92066ca19332ce | Rust | 2,346 | 78 | #![expect(missing_docs)]
use anyhow::Result;
use cr_types::chemistry::ChemistryDefs;
use cr_types::rna_read::RnaRead;
use itertools::Itertools;
use martian_derive::{MartianStruct, martian_filetype};
use martian_filetypes::bin_file::BincodeFile;
use martian_filetypes::json_file::JsonFile;
use martian_filetypes::lz4_file... |
fb0f34568cd62aee64e7353ef68e9977b443ab698a27fb2fe1c6d2be4cd25ad9 | Rust | 2,383 | 72 | //! Martian stage WRITE_BARCODE_INDEX
//! Assign a distinct integer to each barcode sequence.
#![deny(missing_docs)]
use anyhow::Result;
use cr_types::{
BarcodeIndexFormat, BarcodeIndexOutput, MetricsFile, PerLibrarySortedBarcodeCounts,
};
use itertools::Itertools;
use json_report_derive::JsonReport;
use martian::... |
97fbc34e36e00d02b06c9b30a725570fa5c84f0494c24bfe81a9ba1dd03d73c5 | Rust | 2,401 | 74 | use super::logging::Logger;
use ndarray::Array2;
type FilterTuple = (Array2<f64>, Vec<String>, Vec<String>);
pub fn filter_low_counts(
norm_matrix: &Array2<f64>,
sgrna_names: &[String],
gene_names: &[String],
min_base: f64,
logger: &Logger,
) -> FilterTuple {
logger.filtering(min_base);
let... |
b39e35ef0d8034c84bf7b1f6343610f941393dfa91a9738c29b3bb7617bf496d | Rust | 2,429 | 74 | //! Martian filetype for representing metrics JSON files.
//! Use this type for any metrics JSON file whose contents is not represented
//! by a static type.
#![expect(missing_docs)]
use anyhow::{Context, Result};
use martian::MartianRover;
use martian_derive::martian_filetype;
use martian_filetypes::FileTypeRead;
use ... |
f2d545c7d87bdef17bc8c92b3774f9f468077b8fb16df61b219845f4cf9bdda5 | Rust | 2,433 | 63 | #![expect(missing_docs)]
use bitflags::bitflags;
pub const READ_GROUP_TAG: &[u8] = b"RG";
pub const PROC_BC_SEQ_TAG: &[u8] = b"CB";
pub const SPATIAL_BC_TAG: &[u8] = b"sb";
pub const PROC_UMI_SEQ_TAG: &[u8] = b"UB";
pub const FEATURE_RAW_TAG: &[u8] = b"fr";
pub const FEATURE_QUAL_TAG: &[u8] = b"fq";
pub const FEATURE_... |
845458dfe60d255f2d8d6841cecce895ba37612d3d8bb39187bc9c7a57ee2bdd | Rust | 2,462 | 79 | //!
//! This module implements `Metric` and `JsonReport` for `Option<T>`
//! where T is a `Metric` or `JsonReport`
//!
#![deny(missing_docs)]
use crate::{JsonReport, JsonReporter, Metric};
/// `JsonReport` for `Option<J>` where `J: JsonReport` is straightforward.
/// We will report J if is it Some and not report it i... |
496ad8ccae7c092b5b96eed3246c8b7192332e5768befdf6618af914dd5187b6 | Rust | 2,488 | 82 | use hashbrown::HashMap;
use ndarray::{Array1, Axis};
use std::hash::Hash;
/// recovers the indices of all unique values in a vector and returns a hashmap of the unique values and their indices
/// # Arguments
/// * `vec` - the vector to be searched and hashed
/// ```
pub fn unique_indices<T: Eq + Hash + Clone>(vec: &[... |
f3187f29ab565615f9d2b08d49751816c87c5e41c22c4a22f63196f4eef03bf9 | Rust | 2,505 | 84 | #![expect(missing_docs)]
use crate::transcriptome::Transcriptome;
use anyhow::Result;
use martian_filetypes::LazyFileTypeIO;
use martian_filetypes::tabular_file::TsvFile;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct TranscriptIndex {
pub tran... |
96d49ceaf26e9b3ad9493b2bcdb78c1f0f66b1bc6a79e255c8c4125236fa753c | Rust | 2,515 | 73 | //! Martian stage GET_GDNA_METRICS
#![deny(missing_docs)]
use crate::gdna_utils::compute_gdna_metrics;
use anyhow::Result;
use cr_types::H5File;
use cr_types::reference::probe_set_reference::TargetSetFile;
use martian::{MartianMain, MartianRover};
use martian_derive::{MartianStruct, make_mro};
use martian_filetypes::F... |
85dffaec542fa71e6d9b07751f2c784446956d82a85e7abe281196d67aca2a04 | Rust | 2,537 | 69 | //! multiconfig_converter
#![deny(missing_docs)]
use anyhow::Result;
use multi::config::MultiConfigCsv;
use serde_json::to_vec;
use std::slice::{from_raw_parts, from_raw_parts_mut};
fn safe_convert_multi_csv(input: &[u8]) -> Result<Vec<u8>> {
let config = MultiConfigCsv::from_reader(input, "api")?;
Ok(to_vec(&... |
be0f3c00539882ee303e75f30f4705a431542e71d77c9f7e6c9bd99dddd3d642 | Rust | 2,552 | 60 | #![expect(missing_docs)]
use crate::env::PkgEnv;
use crate::utils::AllArgs;
use anyhow::{Result, bail};
use serde_json;
use std::env;
use std::fs::read_to_string;
use std::path::Path;
use std::process::ExitCode;
use url::Url;
pub fn run_cloud(pkg_env: &PkgEnv, args: &AllArgs) -> Result<ExitCode> {
// target the te... |
16340ca04ab8178ca4e8565fff951366b9d5f85e5c55d25547b5a95afc3e8536 | Rust | 2,556 | 74 | //! Martian stage WRITE_MINIMAP_INDEX
#![deny(missing_docs)]
use anyhow::{Result, anyhow, bail};
use cr_types::{AlignerParam, MinimapPreset};
use martian::prelude::*;
use martian_derive::{MartianStruct, make_mro, martian_filetype};
use martian_filetypes::{LazyFileTypeIO, LazyWrite};
use minimap2::{Aligner, Preset};
us... |
5b1a3386acedbc20685a9358dcf90c54d086e59c4188ca8fad1f0a48092c5767 | Rust | 2,602 | 73 | //! HandleNoClonotyping stage code
#![expect(missing_docs)]
use anyhow::{Context, Result};
use martian::prelude::*;
use martian_derive::{MartianStruct, make_mro};
use martian_filetypes::json_file::JsonFile;
use serde::{Deserialize, Serialize};
use vdj_ann::annotate::ContigAnnotation;
#[derive(Debug, Clone, Deserializ... |
1a5c37ad0aa678cdb77cd5d59f8419ad5cbd27f72fc99e84391ae8a289fb8c09 | Rust | 2,604 | 94 | //! cr_lib
#![deny(missing_docs)]
mod align_and_count_metrics;
mod align_metrics;
pub(crate) mod io;
/// Align homopolymer sequences.
pub mod align_homopolymer;
/// Align reads, annotate, deduplicate UMI and count genes for
/// one group of reads from a single barcode
mod aligner;
/// Barcode correction stage (and ... |
c26f9e9871e7f90ce146e58f3314b2a5e82042ecffd953b1cc86f5b246c1e244 | Rust | 2,629 | 83 | use anyhow::{bail, Result};
use ndarray::{Array1, Array2, ArrayView1, Axis};
use ndarray_stats::SummaryStatisticsExt;
use std::ops::{Div, Mul};
/// Calculates the median of a provided ndarray
pub fn median(array: &ArrayView1<f64>) -> f64 {
let mut sorted = array.to_vec();
sorted.sort_by(|a, b| a.partial_cmp(b)... |
4bafb4fb2f9128a3abf780865d1791bc9a0f2968e717e52087d66a4bf9badc27 | Rust | 2,638 | 71 | //! Martian stage COPY_CHEMISTRY_SPEC
//! This is a shim stage to adapt older pipelines that only accept a single
//! chemistry spec from the user into the spec-per-library-type required by
//! DETECT_CHEMISTRY.
//!
//! This stage can also handle expanding a ChemistrySet into the individual
//! chemistries required for... |
e4b5930ecc13be167bd34d22d8a312df04ca2b846d4f590e742e72d49bc81970 | Rust | 2,716 | 81 | //! Detect accidental duplication of FASTQ files.
#![deny(missing_docs)]
use super::chemistry_filter::DetectChemistryUnit;
use anyhow::{Result, bail};
use fastq_set::read_pair::{ReadPair, ReadPart, WhichRead};
use metric::{TxHashMap, TxHasher};
use std::collections::hash_map::Entry;
use std::hash::Hasher;
use std::pat... |
5e4d78cfc6ced39f216103b76d4295f614ac5d9ece30fea875e18ce48a2dfa82 | Rust | 2,736 | 95 | //! Barcodes which are defined based segmented spatial cells
#![expect(missing_docs)]
use anyhow::ensure;
use pyo3::{pyclass, pymethods};
use serde::{Deserialize, Serialize};
use std::fmt::{Display, Formatter};
use std::str::FromStr;
pub(super) const CELL_ID_PREFIX: &str = "cellid";
#[derive(Serialize, Deserialize, C... |
25805eebee4204087b34f1978abc9e8c60fe2a1e1bba2dddfedb66d18aaf164c | Rust | 2,743 | 77 | //! Martian stage COMBINE_CHEMISTRY_DEFS
#![deny(missing_docs)]
use anyhow::{Result, ensure};
use cr_types::MetricsFile;
use cr_types::chemistry::{ChemistryDef, ChemistryDefs, ChemistryDefsExt};
use cr_types::types::{LibraryType, VdjChainType};
use itertools::{Itertools, zip_eq};
use martian::{MartianMain, MartianRove... |
11d7b1bda35a1f2ef7e9cac17c45bba57b96e19980e3938064d9f257da2cc330 | Rust | 2,748 | 93 | #![deny(missing_docs)]
use itertools::Itertools;
use metric::TxHashMap;
use pyanyhow::Result;
use pyo3::prelude::*;
use pyo3::types::{PyBytes, PyDict};
use serde::{Deserialize, Serialize};
#[pyclass(module = "cellranger.fast_utils")]
#[derive(Clone, Serialize, Deserialize)]
pub struct MatrixBarcodeIndex(TxHashMap<Str... |
119b1141f3b1d52728b72f48641c834c7f1803255fcc0ab68c0c366428732576 | Rust | 2,754 | 81 | //! Module for handling bazel specific quirks such as path resolution
#![deny(missing_docs)]
use anyhow::{Result, bail};
use std::env;
use std::path::{Path, PathBuf};
/// Canonicalize a path
pub fn canonicalize(path: &Path) -> Result<PathBuf> {
use std::path::Component::CurDir;
let path = if path.is_absolute(... |
bbf0c2ef61736b5fef375e5edfeaf6904529a6efa344e58b1b448dac699ace48 | Rust | 2,754 | 81 | //! Martian stage WRITE_H5_MATRIX.
#![deny(missing_docs)]
use crate::utils::estimate_mem::barcode_mem_gib;
use anyhow::Result;
use cr_h5::count_matrix::write_matrix_h5;
use cr_types::chemistry::{ChemistryDefs, ChemistryDefsExt};
use cr_types::{BarcodeIndexOutput, CountShardFile, FeatureReferenceFormat, H5File};
use ma... |
f6cd017e71f1f870f88d6bcf27704661b74ea90f6024f7ab884007e65c9b757d | Rust | 2,755 | 93 | //! Secondary analysis pipeline for testing
#![deny(missing_docs)]
use crate::stage_testing::run_stage;
use crate::stages::pca::{PcaStage, PcaStageInputs};
use crate::stages::umap::{UmapStage, UmapStageInputs};
use crate::types::{H5File, ReductionType};
use anyhow::Result;
use martian::prelude::*;
use martian_derive::... |
8728924a2da3837061695f61bf53273c8332bd546816893c30dc8bb18529577b | Rust | 2,759 | 72 | // Copyright (c) 2018 10X Genomics, Inc. All rights reserved.
//! This file contains some miscellaneous string utilities.
#![deny(missing_docs)]
// ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
// THINGS USED A LOT: SHORTHAND EXPRESSIONS FOR COMMON FUNCTIONALITY
// ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓... |
b4789b4e898f4263db3be31193be39e1c32bcbf2266e60d1f90b786a0a76d052 | Rust | 2,767 | 79 | //! Standard chemistry definitions imported from a json file
#![deny(missing_docs)]
use crate::chemistry::{ChemistryDef, ChemistryName};
use anyhow::{Context, Result};
use itertools::Itertools;
use lazy_static::lazy_static;
use std::collections::HashMap;
const CHEMISTRY_DEFS_JSON_STR: &str = std::include_str!("chemis... |
fb6c418792344297bb25c54d78de20b48d24c35d8ff7bd801d0e0781b753f3b3 | Rust | 2,783 | 82 | #![expect(missing_docs)]
use crate::arc::count::CountMro;
use crate::env;
use crate::fastqs::FastqArgs;
use crate::mrp_args::MrpArgs;
use crate::utils::{CliPath, validate_id};
use anyhow::Result;
use clap::{self, Parser};
use cr_types::LibraryType;
use ordered_float::NotNan;
use std::path::PathBuf;
/// Executes the co... |
171d9c1d874496b5ce749b1c60ac46e7b66bc02a879084b4237142a11d5ed2c7 | Rust | 2,784 | 75 | #![expect(missing_docs)]
use anyhow::{Result, bail, ensure};
use clap::{self, Parser};
use ordered_float::NotNan;
use serde::Serialize;
use std::collections::HashMap;
#[derive(Parser, Debug, Clone)]
pub struct ForceCellsArgs {
/// Cell caller override: define the minimum number of ATAC transposition events
///... |
58714e62c463d279343d8d5d1656e6da8402780ee056e96e1d2ccae6a5e50f08 | Rust | 2,789 | 79 | //! cr_vdj
#![deny(missing_docs)]
use anyhow::Result;
use docopt::Docopt;
use martian::prelude::*;
use serde::Deserialize;
const HEADER: &str = "# Copyright 2023 10x Genomics, Inc. All rights reserved.";
const USAGE: &str = "
Test Rust stage
Usage:
cr_vdj martian <adapter>...
cr_vdj mro [--file=<filename>] [--re... |
75f5b02e2257a407ff9ae19fa6d7021a4b4a4e20e56f334c2f707072910b855b | Rust | 2,802 | 72 | //! barcode_extensions
#![deny(missing_docs)]
use barcode::corrector::Posterior;
use barcode::{
BarcodeConstruct, BarcodeCorrector, BcSegSeq, CorrectSubNotIndel, Whitelist, WhitelistSpec,
};
use cr_types::chemistry::BarcodeExtraction;
use metric::SimpleHistogram;
use std::ops::Range;
#[cfg(feature = "tenx_interna... |
0f9d21ab4f3c422b1b1d1a48f37410fc621d97f0025922a2bce02834f92142d6 | Rust | 2,818 | 90 | #![deny(missing_docs)]
use barcode::whitelist::ReqStrand;
use minimap2::ffi::{MM_F_OUT_MD, MM_F_SPLICE_FOR, MM_F_SPLICE_REV};
use minimap2::{Aligner, Built, Preset};
use rust_htslib::bam::{Header, HeaderView, Record};
use std::path::Path;
use std::sync::Arc;
pub struct MinimapReference {
pub aligner: MinimapAlign... |
021e671fcb765c88049945f466804978d61298fa1448c48f244afce36ca7cc9a | Rust | 2,823 | 101 | //! Measure fraction of local wall time consumed by an action.
use std::io::{Write, stderr};
use std::time::{Duration, Instant};
/// Quick one-liner function to time a single action.
///
/// Writes the elapsed time to stderr.
pub fn timed<T>(name: &str, action: impl FnOnce() -> T) -> T {
let start = Instant::now(... |
2f5e26d71f0b5d371dcbc263882011e0447c919475b7712211b34527e830254b | Rust | 2,826 | 79 | //!
//! ALign reads to a contig
#![deny(missing_docs)]
use bio::alignment::Alignment;
use bio::alignment::pairwise::{self, MatchParams, banded};
use bio::alignment::sparse::{HashMapFx, find_kmer_matches_seq2_hashed, hash_kmers};
pub type Scoring = pairwise::Scoring<MatchParams>;
pub struct ContigAligner<'a> {
con... |
6c9ee06168fd3f73385197cb6f59558807062b7bab586dcc3bef1ac16c11eb88 | Rust | 2,868 | 72 | //! websummary_derive
#![deny(missing_docs)]
use proc_macro::TokenStream;
use quote::quote;
use syn::{Fields, ItemStruct};
const ALERT_NOT_ON_NAMED_STRUCT_ERROR: &str =
r"#[derive(Alert)] can only be used on structs with named fields.";
/// Implement #[derive(Alert)] macro
#[proc_macro_derive(Alert)]
pub fn webs... |
7ab46b4e0815148eeb1b2a838fb58d3623b8f7f55bcca62a27f088edd965e778 | Rust | 2,881 | 78 | #![deny(missing_docs)]
use cr_types::rna_read::RnaRead;
use fastq_set::WhichEnd::{FivePrime, ThreePrime};
use fastq_set::adapter_trimmer::{Adapter, AdapterLoc, ReadAdapterCatalog};
use fastq_set::adapters::{
ILLUMINA_P5_RC, ILLUMINA_P7_RC, ILLUMINA_R1_RC, ILLUMINA_R2_RC, POLY_A, POLY_T, RT_PRIMER,
RT_PRIMER_RC,... |
844b2bf42ffbd292ce030ed665e17cdb79d6f854b35a7d05a22a5452b6f1820d | Rust | 2,890 | 102 | use super::inverse;
use ndarray::{Array1, Array2, Axis};
/// An implementation of [Weighted Least Squares](https://en.wikipedia.org/wiki/Weighted_least_squares) using a Matrix/Vector Formulation
#[derive(Debug)]
pub struct Wols {
alpha: f64,
beta: f64,
}
impl Wols {
/// Fits a Weighted Least Squares Linear... |
0f090a424035b834051348892cc6c08620b36b1a55a884ef34b1e5801e8f8fa8 | Rust | 2,901 | 99 | use hashbrown::HashSet;
/// Sets the number of threads globally
pub fn set_threads(threads: usize) {
rayon::ThreadPoolBuilder::new()
.num_threads(threads)
.build_global()
.unwrap();
}
/// Generates default sample names
pub fn generate_sample_names(input_paths: &[String]) -> Vec<String> {
... |
8384442cf89eec665ff8fc9bbc17d220a5a6eb39dd0d6f1256b42f59dc033d34 | Rust | 2,936 | 108 | use crate::{
aggregation::GeneAggregation, enrich::TestStrategy, model::ModelChoice, norm::Normalization,
};
use adjustp::Procedure;
use bon::{builder, Builder};
use getset::Getters;
#[derive(Debug, Getters, Builder)]
#[getset(get = "pub")]
pub struct Configuration<'a> {
#[builder(default)]
normalization: ... |
331664716563d11c7e7da36ddf76fa736f414a69d6311c41dfb07dec64c1a169 | Rust | 2,955 | 118 | mod compute_aggregation;
mod results;
mod utils;
use clap::ValueEnum;
pub use compute_aggregation::compute_aggregation;
pub use results::AggregationResult;
/// Enum describing aggregation procedure selection
#[derive(ValueEnum, Clone, Debug, PartialEq)]
#[allow(clippy::upper_case_acronyms)]
pub enum GeneAggregationSe... |
59f38180dfa50eb7ae605cdd88f940fdb93a8155de11a5e16836223fc350bdbe | Rust | 2,989 | 93 | use crate::{
aggregation::compute_aggregation,
enrich::enrichment_testing,
io::{GeneFrame, HitList, Screenviz, SgrnaFrame, SimpleFrame},
model::model_mean_variance,
norm::normalize_counts,
utils::{config::Configuration, filter::filter_low_counts, logging::Logger},
};
use anyhow::Result;
use rege... |
4022456cb8b0e43964a4b853cf092c798e691988f9e95b4818644d9c8f5df7fc | Rust | 3,035 | 106 | use super::inverse;
use ndarray::{Array1, Array2, Axis};
/// An implementation of [Ordinary Least Squares](https://en.wikipedia.org/wiki/Ordinary_least_squares#Matrix/vector_formulation) using a Matrix/Vector Formulation
#[derive(Debug)]
pub struct Ols {
alpha: f64,
beta: f64,
}
impl Ols {
/// Fits an Ordi... |
182342b5090d426b38ddc21f105d61eb98a1ac93838eeb5b9926c1e6c1583649 | Rust | 3,048 | 100 | #![deny(missing_docs)]
use rand::rngs::SmallRng;
use rand::{RngExt, SeedableRng};
use std::iter::IntoIterator;
/// Randomly choose a sample of k items from a list containing n items,
/// where n is often a very large or unknown number
/// See https://en.wikipedia.org/wiki/Reservoir_sampling
pub struct ReservoirSampler... |
db960f39093166cdb37c62c5f68182983e21f1e482b9f51c34fded5767ec01f5 | Rust | 3,096 | 106 | #![deny(missing_docs)]
use anyhow::Result;
use hdf5::Group;
use hdf5::types::FixedAscii;
use itertools::Itertools;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::path::Path;
martian_derive::martian_filetype! {H5File, "h5"}
pub fn open_matrix_group(matrix_path: &Path) -> Result<Group> {
... |
5c722b7d612c5ce5455bf42533dfee6075ff0f0e8df9242aa97279b622eca52e | Rust | 3,111 | 100 | #![expect(missing_docs)]
#[allow(clippy::enum_glob_use)]
use AutoChemistryName::*;
#[allow(clippy::enum_glob_use)]
use AutoOrRefinedChemistry::*;
#[allow(clippy::enum_glob_use)]
use ChemistryName::*;
#[allow(clippy::enum_glob_use)]
use ChemistryParam::*;
#[allow(clippy::enum_glob_use)]
use ChemistrySet::*;
use anyhow::... |
c6cc4098048025e14d340261dc186b4d0511384821fdfad8181109dee240ee5a | Rust | 3,123 | 90 | //! Martian stage SUMMARIZE_MATRIX_DIMS
//! Summarize the dimensions of an H5 matrix.
#![deny(missing_docs)]
use anyhow::Result;
use cr_h5::count_matrix::CountMatrixFile;
use cr_types::MetricsFile;
use cr_types::probe_set::ProbeType;
use cr_types::reference::feature_reference::FeatureType;
use cr_types::reference::pro... |
86cc69050a64fcc7448698674473daa2d6266b7d430a66c08a9b10d719f28729 | Rust | 3,125 | 81 | //! FilterExactClonotypes stage code
#![expect(missing_docs)]
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, Serialize};
use std::collections::HashSet;
u... |
511bed81441ebbb0e58f34939d4065bc3914a4b07d7433c5dec904026cb38f8a | Rust | 3,144 | 118 | //! amino
// Copyright (c) 2019 10x Genomics, Inc. All rights reserved.
#![deny(missing_docs)]
use debruijn::Mer;
use debruijn::dna_string::DnaString;
/// Test to see if a given DnaString has a start or stop codon at a given position.
pub fn have_start(b: &DnaString, j: usize) -> bool {
let (a, g, t) = (0u8, 2u8,... |
21e8104a850480f5ae81e92b4f025aca791fec372f7f93b59002d673b3735e6f | Rust | 3,185 | 102 | use crate::{
aggregation::compute_aggregation,
enrich::enrichment_testing,
io::{
get_string_column, match_headers_from_regex_set, to_ndarray, validate_ntc,
write_gene_frame, write_hit_list, write_sgrna_dataframe, Screenviz,
},
model::model_mean_variance,
norm::normalize_counts,
... |
b2cee88f88d050c73056ee04b7e72b4bcd9b13807ddf115d28f3be8c62a425ee | Rust | 3,201 | 115 | //! cr_types
#![deny(missing_docs)]
use anyhow::{Context, Result, ensure};
use csv_parser::CsvParser;
use std::fs::{copy, hard_link};
use std::path::{Path, PathBuf};
pub mod action_timer;
pub mod aggr;
pub mod barcode_index;
pub mod cell_annotation;
pub mod chemistry;
pub mod clonotype;
pub mod constants;
pub mod csv... |
8ec5366e934bb0e2b99d46edfecf7067c69778b1804db4193144c10a9e715c99 | Rust | 3,229 | 106 | use std::time::Duration;
use indicatif::{MultiProgress, ProgressBar, ProgressStyle};
/// Initializes a Multiprogress bar for parallel logging
#[must_use]
pub fn initialize_multi_progress(
sample_names: &[String],
) -> (Option<MultiProgress>, Option<Vec<ProgressBar>>) {
let mp = MultiProgress::new();
let p... |
3c51599166d9286e0ea8b7fa8b6e1f2203e8d570df667b44e1c747eb7132715a | Rust | 3,286 | 119 | //! enclone_process
// Copyright (c) 2021 10x Genomics, Inc. All rights reserved.
#![deny(missing_docs)]
mod core;
mod disintegrate;
mod doublets;
mod enclone;
mod filter_umi;
mod flag_defective;
mod merge_onesies;
mod populate_features;
mod process;
mod read_json;
mod some_filters;
mod split_candidate_clonotypes;
mod... |
d63200f2950e3cf8e148489f38d402f2776acba69dda45f2d9f3b455f15c16b4 | Rust | 3,288 | 103 | use anyhow::Result;
use ndarray::{Array1, Array2, Axis};
use rand::Rng;
use rand_distr::{Binomial, Distribution};
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 = ar... |
386e90258f941e250179fcc2ce351dfdf3e64de4b6dc75710f43fa2fccea17dd | Rust | 3,316 | 72 | #![expect(missing_docs)]
use serde::{Deserialize, Serialize};
/// Different reasons why a barcode which have productive contig(s)
/// are not called as cells by enclone
///
/// For more explanation, see <https://10xgenomics.github.io/enclone/pages/auto/default_filters.html>
/// and <https://10xgenomics.github.io/enclo... |
be5d506ddbb18098f75504f0f082696060c8b781767ddb0326c393cbed949f19 | Rust | 3,327 | 105 | //! Align homopolymer sequences.
#![deny(missing_docs)]
use std::cmp::max;
use std::ops::Range;
/// Construct the score vector.
fn construct_score_vector(nt: u8, seq: &[u8]) -> Vec<i64> {
const MATCH_SCORE: i64 = 1;
const MISMATCH_SCORE: i64 = -9;
let scoring_function = |x| {
if x == nt { MATCH_SC... |
7e5f8e3ef93a482eadbd984064ff3fa47ec5c5d5b3d19ed48c80db824384b587 | Rust | 3,371 | 138 | mod compute_aggregation;
mod results;
mod utils;
use clap::ValueEnum;
pub use compute_aggregation::compute_aggregation;
use geopagg::WeightConfig;
pub use results::AggregationResult;
/// Enum describing aggregation procedure selection
#[derive(ValueEnum, Clone, Debug, PartialEq)]
#[allow(clippy::upper_case_acronyms)]... |
befd66fa6dba8abc3ebf7276e341b763e4ee41ef1f9fa4a2e6ca9d12fa6dcf49 | Rust | 3,415 | 87 | //! Martian stage GENERATE_CAS_METRICS
//! Generate cell annotation metrics json
#![deny(missing_docs)]
use crate::cell_annotation_ws_parameters::{CellAnnotationMetrics, CellTypeInfo, MetadataStruct};
use anyhow::{Ok, Result};
use martian::prelude::*;
use martian_derive::{MartianStruct, make_mro};
use martian_filetypes... |
aab9004fb4499b9f0fb16aa6e41ab3e68245c828587d43088372ad4825bc3c2a | Rust | 3,453 | 109 | use crate::aggregation::AggregationResult;
use anyhow::Result;
use ndarray::Array1;
use std::{
fs::File,
io::{BufWriter, Write},
};
pub struct GeneFrame<'a> {
gene: &'a [String],
gene_fc: &'a Array1<f64>,
gene_log2_fc: &'a Array1<f64>,
score_low: &'a Array1<f64>,
pvalue_low: &'a Array1<f64>... |
cb276e6009453359ae4c6ada86f44f0e1e1eee569b31f178c950abfe1ede627e | Rust | 3,477 | 106 | use crate::enrich::EnrichmentResult;
use anyhow::Result;
use ndarray::Array1;
use std::{
fs::File,
io::{BufWriter, Write},
};
pub struct SgrnaFrame<'a> {
sgrna_names: &'a [String],
gene_names: &'a [String],
adj_var: &'a Array1<f64>,
base: &'a Array1<f64>,
control: &'a Array1<f64>,
treat... |
664aba051b00f308caf0fbe2f0ad18f31bbebdb2900361b6144d9f74a46f0bf8 | Rust | 3,499 | 105 | // Copyright (c) 2021 10X Genomics, Inc. All rights reserved.
#![deny(missing_docs)]
//
// If NWEAK_ONESIES is not specified, disintegrate certain onesie clonotypes into single cell
// clonotypes. This requires editing of exact_clonotypes, info, eq, join_info and raw_joins.
use crate::core::defs::{CloneInfo, ExactClo... |
2a8bfe4cbe33f476175418d5a5c781f51c7ac456298c4a26f4950c419620c5cb | Rust | 3,524 | 96 | //! AsmMetrics stage code
#![expect(missing_docs)]
use crate::assembly::{BarcodeDataFile, VdjPrimers};
use anyhow::{Context, Result};
use cr_types::MetricsFile;
use cr_types::chemistry::ChemistryDef;
use martian::prelude::*;
use martian_derive::{MartianStruct, make_mro, martian_filetype};
use martian_filetypes::json_f... |
f558aef8d7b1f22be952449748dfd670bb0669ee43f4cc5b1709c302d7fcfcf6 | Rust | 3,545 | 106 | // Copyright (c) 2018 10x Genomics, Inc. All rights reserved.
#![expect(missing_docs)]
//! Sized, stack-allocated container for a short quality string.
use crate::array::{ArrayContent, ByteArray};
use crate::metric_utils::ILLUMINA_QUAL_OFFSET;
use std::iter::Iterator;
use std::str;
#[derive(Clone, Copy, PartialOrd, ... |
307aaa5f5d25d7655ad2b273e3092f3d0045f0827c7f57c0b581cbe42fce958d | Rust | 3,578 | 117 | #![expect(missing_docs)]
use anyhow::{Context, Result};
const CLONOTYPE_PREFIX: &str = "clonotype";
const CONSENSUS_PREFIX: &str = "consensus";
const CONCAT_REF: &str = "concat_ref";
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub struct ClonotypeId<'a> {
pub id: usize,
pub sample_id: Option<&'a s... |
7489d10630fc570faf674f5357a98dde0ba81c2d3ed8f4fe33ce4bf5942c9595 | Rust | 3,614 | 146 | // TODO: fix these.
#![expect(missing_docs)]
#![allow(clippy::needless_range_loop)]
use lz4;
use rust_htslib::bam::Record;
use rust_htslib::bam::record::Aux;
use std::fs::File;
use std::io::{BufWriter, Write};
use string_utils::TextUtils;
pub fn write_sam_record_simple(
x: &Record,
u: &str, // corrected umi
... |
83bb77b576d4da47102c469bc47a90d79333f2b62fd14f815f91c41cdf0b879a | Rust | 3,635 | 86 | use cr_h5::count_matrix::{
BarcodeCountOffset, Count, CountMatrixFile, CountMatrixStreaming, FeatureIdx, MatrixDimensions,
};
use cr_types::reference::feature_reference::FeatureType;
use numpy::{IntoPyArray, PyArray1};
use pyo3::exceptions::PyTypeError;
use pyo3::prelude::*;
use std::iter;
use std::path::Path;
use ... |
64761cdac74ebb1df0619b8cc983c983f07ffbd7ba94f2ef2d48bea0784e5a1a | Rust | 3,655 | 85 | // Copyright (c) 10x Genomics, Inc. All rights reserved.
//! Iterator adapter for post-hoc trimming of read pair lengths.
//!
//! This is the preferred mechanism for applying Illumina read-length trimming
//! because it operates as a final step after all read-source adapters have been
//! composed (e.g. the long-read ... |
4b81061aec24a3edbe95779a901ac360cacd5da7f220127988e1eb351dc23d35 | Rust | 3,669 | 113 | use anyhow::Result;
use polars::prelude::*;
use std::{fs::File, io::BufWriter};
use crate::{
aggregation::{AggregationResult, GeneAggregation},
utils::{config::Configuration, logging::Logger},
};
fn build_gene_frame(results: &AggregationResult) -> Result<DataFrame, PolarsError> {
df!(
"gene" => re... |
cf7ea8a7a63c17c1c70a7718fcd11833fbfbb7db5b38d617445080c66777440e | Rust | 3,683 | 122 | #![deny(missing_docs)]
use crate::transcriptome::Exon;
use anyhow::Result;
use bio::io::fasta::IndexedReader;
use bio_types::strand::ReqStrand;
use itertools::Itertools;
use std::io::{Read, Seek};
/// Construct a transcript sequence from a FASTA file, a strand, and a set of intervals
/// The intervals must be ordered ... |
7f2ae4aeda98a2d26177589d7caeb41bfe75d04fb9610d8ef6bcfc92701f0529 | Rust | 3,702 | 100 | //! vdj_ann_ref
// Copyright (c) 2018 10X Genomics, Inc. All rights reserved.
#![deny(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 ... |
a0db1fd1463daa090f7acc1dff849c441e29bbe4e44ff4f4bab7f5af88ca7f4c | Rust | 3,702 | 122 | //! Martian stage RUN_PCA2
//! Replacement for RUN_FBPCA. Could be absorbed into RUN_PCA_NG stage after some refactoring
#![expect(missing_docs)]
use crate::io::h5;
use crate::types::H5File;
use anyhow::Result;
use hdf5_io::matrix::read_adaptive_csr_matrix;
use martian::MartianVoid;
use martian::prelude::*;
use martia... |
e60a7d3b58cb41ef5061bca6f7ae2903eb010a41b5aa90021d198f36794a8ce4 | Rust | 3,714 | 101 | //! Martian stage SETUP_VDJ_DEMUX
#![deny(missing_docs)]
use crate::{GexMatrices, SampleMatrices};
use anyhow::{Context, Result};
use cr_types::{BarcodeMultiplexingType, CrMultiGraph, FingerprintFile};
use martian::prelude::*;
use martian_derive::{MartianStruct, make_mro};
use martian_filetypes::json_file::JsonFile;
u... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.