sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
cdef925153b20d3abddc6e4722e0a0dde188bea51a61c82c94cfbcc37f0cd2b9
R
150,892
3,327
# read in required libraries libs <- c( 'gplots','stringi','reshape2','cowplot','RColorBrewer', 'sctransform','stringr','org.Mm.eg.db','AnnotationDbi', 'IRanges','S4Vectors','Biobase','BiocGenerics','clusterProfiler', 'biomaRt','Matrix','DESeq2','RcppThread', 'extrafont', 'openxlsx', ...
0634d6047da455c254332e7aa3d5fe895b7a34c188248ab3011b63305ec5808c
R
154,714
5,760
library(loupeR) loupeR::setup() library(SeuratObject) library(SingleCellExperiment) ############################################################################# # # Filtered data (S1M + 2M) ("mismatched" samples) # ############################################################################# countMatrices <- read...
ce718abdbe726e909ce8eac5d311277769d111eecce9650b6deca555d6c39e63
R
163,034
2,466
# Read in required libraries libs <- c( 'gplots','stringi','reshape2','cowplot','RColorBrewer', 'sctransform','stringr','org.Mm.eg.db','AnnotationDbi', 'IRanges','S4Vectors','Biobase','BiocGenerics','clusterProfiler', 'biomaRt','Matrix','DESeq2','RcppThread', 'extrafont', 'openxlsx', ...
7ae9764d1550dabe30ecf797dd80b4f4df524dbd5d6473cdc11657e0c7ca5e6d
R
166,259
1,499
library(shiny) library(Seurat) library(ggplot2) library(tibble) library(cowplot) library(viridis) library(dplyr) library(ggsci) library(ggrepel) library(tidyverse) library(plotly) library(htmlwidgets) library(reshape2) library(Hmisc) library(corrplot) library(pheatmap) library(grid) library(MAST) library(shinydashboard...
2e7ee3048540aa39ab0280da6b2eb26e6947296b00f46bad80788bb6ac33e735
R
168,320
3,014
##Figure 1 (Physiology) ---- setwd("/Users/mallott/Dropbox/Projects/Gut_microbiome/mouse_inoculation/phys_data") library(tidyverse) library(ggpubr) library(ggnewscale) phys = read_csv("Phys_combined_update_072722_noinfant.csv") physnew = phys %>% mutate(Treatment = case_when(Treatment == "human_Adult" ~ "Human",...
167cba69d343df0c79ea7b625c01753a3e32792eea71bf59c3c8494b6f711501
R
168,362
3,853
######################################## ######### Li et al., 2025 ############## ######### Main Script ############## ######################################## #----- Prepare R environement ```{r} packages <- c( "dplyr", "Seurat", "SeuratData", "SeuratWrappers", "ggplot2", "patchwork", "sctransform", "co...
ce91a8a8a1ecaf27183cd7c81483c21973083344742b667daf8ae9a4a04fa476
R
184,895
5,168
# Test olink_normalization ---- # this tests also all functions called norm_internal_* except from # "norm_internal_preferred_names", "norm_internal_update_pref_name" and # "norm_internal_update_df_names". # # Namely: # - norm_internal_assay_median # - norm_internal_reference_median # - norm_internal_bridge # - norm_i...
04c15c4a0ddb8643be8b005e995acfef82b6753038d5a6c2616619dc1553bf17
R
200,000
3,927
--- title: "SGCE Interneuron" output: html_notebook --- # Setup ```{r message=FALSE, warning=FALSE, include=FALSE} # Choose the correct library location for R packages installation and usage # diffrent paths provided depending on system setup # Uncomment the desired path to set library location # LIBLOC<...
101f1631da01c572954e0b5b8c7463a6a0b1d853c4c83c4761eef95f47792b08
R
200,000
6,700
# Test olink_norm_input_check ---- test_that( "olink_norm_input_check - works - bridge normalization", { skip_if_not_installed("arrow") # no normalization column ---- bridge_samples <- intersect(x = npx_data1$SampleID, y = npx_data2$SampleID) |> (\(x) x[!grepl(pa...
3af257fb73945fe93822072df702df7aefe302bbc5b17396f2efe45e4fdc6d22
R
200,000
6,609
--- title: "Pipeline_For GeoMX_Data_Analysis" author: "Thomas Goralski" date: '2022-07-22' output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` This pipeline is intended for expedient analysis of raw data from Nanostring's GeoMx spatial transcriptomics platform. The followin...
4d677beb588e3cc895a95363e8bba50e86fb0457b7c7888ca4eb6b44408c80f9
R
200,000
2,480
library(Seurat) library(SummarizedExperiment) library(ggplot2) library(future) library(scrattch.hicat) library(data.table) library(dplyr) library(tibble) library(pbmcapply) library(SCISSORS) library(MetaMarkers) library(gplots) library(SeuratWrappers) library(SeuratDisk) library(slingshot) library(scales) library(vir...
634a75c7910f643a8ebd1c7e583c07e65112682067b65b471a0be7768978a214
R
200,000
4,311
library(Seurat) library(torch) library(SummarizedExperiment) library(ggplot2) library(future) library(scrattch.hicat) library(data.table) library(dplyr) library(tibble) library(pbmcapply) library(SCISSORS) library(MetaMarkers) library(gplots) plan("multicore", workers=10) plan() options(future.globals.maxSize= 387...
6c362b81cee82b4afc0ea40688936b0da0dbda9960e88d200f2a7174eadde0fb
R
200,000
5
tissue_mapping <- c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11) N_tissues <- 80 W_sparse <- structure(c(1, 1, 1,...
a715cc5dc869557d39f12f8d6d81b02f2cc828d47215413815db73a3ef25a40c
R
200,000
2,888
# expected.coords.smooth <- coords(smooth(r.s100b), "all", ret="all") # dump("expected.coords.smooth", "tests/testthat/helper-coords-expected-smooth.R_new") expected.coords.smooth <- structure(list(specificity = c( 0, 0, 0.0063876682047232314, 0.013341366018777919, 0.020344288637047729, 0.02732113845873314, ...
b58939d7f0f4bdd0e57646dd9009554b69f2e0be9c8705326f2bd6a90071e33d
R
200,000
5
tissue_mapping <- c(1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, ...
c9b104078e9b83660b7b36cbf34bdb100c3aaab6c35fa8b19fcfe63b1290c6e0
R
200,000
7,379
# Test read_npx_wide_split_row ---- test_that( "read_npx_wide_split_row - works", { # variables that apply to all tests olink_platform <- "Target 48" n_panels <- 3L n_assays <- 45L n_samples <- 88L show_int_ctrl <- TRUE ## NPX ---- # synthetic wide df data_type <- "NPX" sh...
7f1c83cae3109cc7e8caeaac23a8a7b73e76e0d9ca1adacdb6554e68f61451dc
R
200,001
4,928
--- title: "HeMoVal_Data_Analysis" date: "2025-01-28" authors: "Kevin Akeret & Raphael M. Buzzi. Statistical review: U. Held, D. Kronthaler" output: html_document editor_options: chunk_output_type: console --- ```{r setup, include=FALSE} library(Hmisc) library(tidyverse) library(table1) library(scales) library(ggb...
b1871e172d30c817f563a5a10406abc29d2b1c93800f205caeb373f7442e575e
R
200,001
4,756
library(torch) #################################### #Plot #################################### library(ggplot2) mytheme_classic <- theme_classic()+ theme(axis.text = element_text(size=14, color="black"), axis.ticks = element_line(size=1), axis.title = element_text(size=18, color="black"), ...
d85897a401087e44f6cc3b7578bbb6fbd06947063b515269afe3b4cdae636f9f
R
200,001
4,916
--- title: "HeMoVal_Data_Analysis - Additional explorative statistics (metHb)" date: "2025-01-28" authors: "Kevin Akeret & Raphael M. Buzzi. Statistical review: U. Held, D. Kronthaler" output: html_document editor_options: chunk_output_type: console --- ```{r setup, include=FALSE} library(Hmisc) library(tidyverse)...
98e41c2edb69bc525cac9d9b7d59dd7c72da24398cf2f1cb9515eb7200e9ebc0
R
200,016
4,255
overall_start_time = Sys.time() cat(file=stderr(), 'Loading dependencies...') options(stringsAsFactors=F) suppressMessages(library(tidyverse)) suppressMessages(library(janitor)) suppressMessages(library(binom)) suppressMessages(library(glue)) suppressMessages(library(lawstat)) suppressMessages(library(weights)) suppre...
c6d187ab381e82c00baaa9c28efd73e6c53b69143897115cd17a836aaf38fcf7
R
200,019
4,359
# The script is intended viewed in R studio # Blocks are titled # "=" symbol was used as an assignment operator # Data processing and DE in initial cohorts is located in another file "Data_preprocessing_analysis/TRANSCRIPT_SUICIDE_PREPR_ANALYSIS_SCRIPT.R" # Calculation of cohort-level moderators is located in "Moderato...
ba3a1467f21e9e9ed1d682502b54e56bb663d3eacea5e6a6c9584b95455a0131
R
200,056
3,874
# the purpose of this script is to find differentially expressed genes between conditions within cell-types # load required libraries libs <- c( 'gplots','stringi','reshape2','cowplot','RColorBrewer', 'sctransform','stringr','org.Mm.eg.db','AnnotationDbi', 'IRanges','S4Vectors','Biobase','BiocGen...
054a71cba469c7e427da777e43dbb5cb5da444558add0fa492e8751b0f0b4dff
R
200,089
4,666
# Comments # This code is intended to be viewed in RStudio and contains appropriate headings # "=" symbol was used as an assignment operator # Commands for STAR, fast, fastq tools and other command line tool/pythons scripts calls in the terminal is provided here as characters " <command code> " setwd("/home/aleksandr...
a8774494109da8a1cde3c184560403849b6455c234e5351bdb1f1858b78e5eb7
R
200,134
6,019
library(devtools) library(monocle3) library(Seurat) library(SeuratWrappers) # For conversion helper library(scater) library(TSCAN) library(slingshot) library(tradeSeq) library(scran) library(ggplot2) library(RColorBrewer) library(grDevices) library(DT) library(pheatmap) library(reshape2) library(dplyr) library(tidyr)...
ee5564275aa1f18baeee83ff2a1dfdd0673116b6cb7513bf72d7fe9216fb4f20
R
215,997
5,505
--- title: "iscience_reverse" author: "MM" date: "2025-07-31" output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) options(future.globals.maxSize = 10000 * 1024^2) library(Seurat) library(harmony) library(dplyr) library(scCustomize) library(tidyr) library(ggplot2) l...
fed9cfb12d26f8f863e56bef227d03225c75e2129cc8e5a0495ec651e7c51fb3
Rust
131
4
## A custom startup file for tests ## Run as if a system Rprofile, so no packages, no assignments options(useFancyQuotes = FALSE)
dee9324880d89e4ad6b4bb9c3454b3bdcc9c675ccc5e265788ce4c4b97da77f6
Rust
699
30
// Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license use clap::Parser; use yolov8_rs::{Args, YOLOv8}; fn main() -> Result<(), Box<dyn std::error::Error>> { let args = Args::parse(); // 1. load image let x = image::ImageReader::open(&args.source)? .with_guessed_format()? ....
218af586e8840f8d5e4db91be7c519449b91ee158d1898d6448a3650f3d6bc56
Rust
726
19
// in build.rs //use clap_generate::{generate_to, generators::*}; include!("src/cli.rs"); fn main() { /* // creates an error with cargo publish and then installing let mut app = Cli::into_app(); let outdir = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("target/"); for bin_name in ["rb", "r...
97d529590849b84f41464f1694eee69ce9296b9ba0f8f06b19eed0733c1e33fb
Rust
1,028
36
//! # Command line interface for rustybam //! [rustybam command line interface, subcommands, and options.](cli::Commands) //! # README for rustybam #![doc = include_str!("../README.md")] /// Annotation of bed files. pub mod annotate; /// Calculate stats from sam/bam/cram and paf files. pub mod bamstats; /// Bed file ut...
9ea90781a8d5c575c943511ce4cad6d6a6e8b5aa25b885c2eca9bb78b8770b42
Rust
1,424
44
use rustybam::paf::PafRecord; /// A line with fewer than 12 columns must return an error. #[test] fn short_line_returns_err() { assert!(PafRecord::new("").is_err()); assert!(PafRecord::new("A 1 2 3 + B 1 2 3 10 11").is_err()); } /// A tag token that is too short must return an error. #[test] fn short_tag_retu...
bed0679ef4ed20e721e9800af084539ea84a4a10495c84f07650feb6a207ba05
Rust
1,450
45
use super::myio; use needletail::{parse_fastx_file, parse_fastx_stdin, parser::LineEnding}; /// Split a fasta file across outputs /// ``` /// use rustybam::fastx; /// fastx::run_split_fastx(&["-".to_string()], ".test/large.test.fa.gz") /// ``` pub fn run_split_fastx(files: &[String], infile: &str) { // open the ou...
079a627400f405d69f41347aa541cad8cbe7f0b45041281d82f742df8f4bc035
Rust
1,485
46
use super::bed; //use rayon::prelude::*; use num_format::{Locale, ToFormattedString}; use std::collections::HashMap; pub fn bed_stats(bed: &str, readable: bool, column: Option<u8>) { let rgns = bed::parse_bed(bed); match column { Some(c) => { let mut dict = HashMap::new(); for r...
a8ebb3ccc85bba0cdb3a1288f1f9b2d78d8fd0c53d532253e2db4cea87c65a67
Rust
1,838
89
// Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license use clap::Parser; use crate::YOLOTask; #[derive(Parser, Clone)] #[command(author, version, about, long_about = None)] pub struct Args { /// ONNX model path #[arg(long, required = true)] pub model: String, /// input path #[arg(l...
468f5af286edfb213d35aa56b0336d37977561d311c4064576dac819212ec48f
Rust
2,092
63
use bio::data_structures::interval_tree::{Entry, IntervalTree}; use bio::io::*; use itertools::Itertools; pub trait IntervalTreeExt<N: Ord + Clone, D> { fn find_bed_overlaps(&self, rec: &bed::Record) -> Vec<Entry<'_, u64, bed::Record>>; } impl IntervalTreeExt<u64, &bed::Record> for IntervalTree<u64, bed::Record> ...
791af895bd6c260f4e777abb62bad74aa12b38c13951c02eb23ea6e01f919033
Rust
2,146
58
use super::*; use bio::alphabets::dna::revcomp; use bio_types::strand::Strand::{Forward, Reverse}; use rust_htslib::faidx; use std::str; pub fn fetch_fasta(reader: &faidx::Reader, chrom: &str, start: usize, end: usize) -> Vec<u8> { // rust-htslib 1.0 fetch_seq returns an owned Vec and frees the // htslib buffe...
a7b255ff0442b8bf1183208d4d2171a793a57f9314652e2f143f69bb9b4b842d
Rust
3,514
98
use anyhow::Result; use flate2::read; use gzp::deflate::Bgzf; //, Gzip, Mgzip, RawDeflate}; use gzp::BgzfSyncReader; use gzp::Compression; use gzp::ZBuilder; use std::error::Error; use std::ffi::OsStr; use std::fs::File; use std::io::{self, BufRead, BufReader, BufWriter, Write}; use std::path::{Path, PathBuf}; type Dy...
4869d2399f70dc9f9a387492d0d24e3daff8abfe7284c52c3e9bf54256f0b829
Rust
3,995
108
use linear_map::LinearMap; use log; use rust_htslib::bam::header::HeaderRecord; use rust_htslib::bam::{self, Header, Read}; use std::collections::HashMap; pub fn header_from_hashmap(hash_header: HashMap<String, Vec<LinearMap<String, String>>>) -> Header { let mut header = Header::new(); for (key, values) in ha...
87ef43606b33f83739fd43d86ddf2ae01527786f1c06dd237be526bf4b95b09d
Rust
4,268
152
use super::bed::*; use rust_htslib::bam; use rust_htslib::bam::Read; use std::convert::TryFrom; use std::fmt; pub struct Nucfreq { pub name: String, pub pos: u32, pub a: u64, pub c: u64, pub g: u64, pub t: u64, pub id: String, } impl fmt::Display for Nucfreq { fn fmt(&self, f: &mut fmt...
7c18f2a9d51e94c5dd46758e657c0cb5a038a440308ed12395094e371c49a5a8
Rust
4,721
153
#![allow(clippy::type_complexity)] // Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license use std::io::{Read, Write}; pub mod cli; pub mod model; pub mod ort_backend; pub mod yolo_result; pub use crate::cli::Args; pub use crate::model::YOLOv8; pub use crate::ort_backend::{Batch, OrtBackend, OrtConfig, O...
bb48fef23571c55a803f8eed235373da748e6360359c3902d7a283339fa5f17c
Rust
5,186
186
use super::paf::*; use log; use rust_htslib::bam::record::Cigar::*; use std::cmp::{max, min}; /// Walk compressed CIGAR to compute per-position scores for query range [q_start, q_end). /// O(n_cigar_ops + overlap_length) — no expansion to 1-bp resolution. fn compute_overlap_scores( paf: &PafRecord, q_start: u6...
48d608f7a1fdda27399d15e5b4b7ecff016e0b5434944cea091d642414afc35d
Rust
5,489
242
// Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license use ndarray::{Array, Axis, IxDyn}; #[derive(Clone, PartialEq, Default)] pub struct YOLOResult { // YOLO tasks results of an image pub probs: Option<Embedding>, pub bboxes: Option<Vec<Bbox>>, pub keypoints: Option<Vec<Vec<Point2>>>, ...
37755dac823b0c42ac1b5e9881d53b0e5f23f37917a8ed6b08b2b2ade7bdb494
Rust
6,030
238
// Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license use anyhow::Result; use clap::Parser; use usls::{ models::YOLO, Annotator, DataLoader, Device, Options, Viewer, Vision, YOLOScale, YOLOTask, YOLOVersion, COCO_SKELETONS_16, }; #[derive(Parser, Clone)] #[command(author, version, about, long_...
5f64088af9de6852206425d71cfca0e8e429f8b98599865c03bb83710325bb07
Rust
6,554
235
use crate::myio; use bio::io::bed; use lazy_static::lazy_static; use regex::Regex; use std::cmp::{max, min}; use std::fmt; use std::str; lazy_static! { static ref BED_RE: Regex = Regex::new(r"([^\s]+)\t([0-9]+)\t([0-9]+)\t?([^\s]+)?.*").unwrap(); static ref RGN_RE: Regex = Regex::new(r"(.+):([0-9]+)-([0-9]+)")...
8f7662bd3d8b07b0338730d44e49934db1e35df4f1bdfe3821b6ab48a8a6d7c7
Rust
7,733
270
use super::bed; use needletail::parse_fastx_file; use num_format::{Locale, ToFormattedString}; use rayon::prelude::*; use rust_htslib::bam::{self, Read}; use std::fs; use std::io::{self, BufRead}; use std::path::Path; fn read_bam(file: &str, threads: usize) -> Option<Vec<usize>> { let mut lengths = Vec::new(); ...
d2b351e919bb2da1855a256d81299dee92639c6b87d8f96036225ade731527ff
Rust
8,932
276
use super::bed; use rust_htslib::faidx; use std::collections::HashMap; /// Represents k-mer counts for a specific region category #[derive(Debug, Clone)] pub struct KmerCounts { pub name: String, pub kmer_counts: HashMap<String, u64>, } /// Generate reverse complement of a DNA sequence fn reverse_complement(s...
039f00d7506585cdf1dd6ed31e78c95d412c734cc18501a9d0bfd75a565b6f3c
Rust
10,396
297
use bio::alphabets::dna::revcomp; use bio::data_structures::suffix_array::{lcp, shortest_unique_substrings, suffix_array}; use bio::io::fasta; use std::{fs::File, io::BufReader}; static END_CHAR: u8 = b'$'; static END_CHAR_STR: &str = "$"; pub struct Genome { pub names: Vec<String>, pub starts: Vec<usize>, ...
37b9ffea71bf783640c9c11207213a799ba0e53f28ba233d59976002cf35e3d0
Rust
11,323
367
use colored::Colorize; use env_logger::{Builder, Target}; use itertools::Itertools; use log::LevelFilter; use rayon::prelude::*; use rust_htslib::bam; use rust_htslib::bam::Read; use rust_htslib::faidx; use rustybam::cli::Commands; use rustybam::fastx; use rustybam::paf::paf_swap_query_and_target; use rustybam::seq_con...
59c293873c108613c11725886215f1f7f13afe41132ecb1aa18435c92ec57bd5
Rust
12,375
304
use clap::IntoApp; use clap::{AppSettings, Parser, Subcommand}; #[derive(Parser, Debug)] #[clap( author, version, about, propagate_version = true, subcommand_required = true, infer_subcommands = true, arg_required_else_help = true, help_expected = true )] #[clap(global_setting(AppSettin...
9dceaa7163e0249d7853dc5a1e104dbde47839331ab9854e646112c115463f22
Rust
12,416
402
use super::paf; use bio_types::strand::ReqStrand::*; use colored::Colorize; use lazy_static::lazy_static; use regex::Regex; use rust_htslib::bam::record::Aux; use rust_htslib::bam::record::{Cigar::*, CigarStringView}; use rust_htslib::bam::Header; use rust_htslib::bam::HeaderView; use rust_htslib::bam::Record; use std:...
5f93cf2ca7a527f141bbd483f0d61d4dafc5441e7507d2a689b2da516a35e9e9
Rust
13,731
445
use super::bed; use super::paf::*; use colored::Colorize; use itertools::Itertools; use rayon::iter::ParallelBridge; use rayon::prelude::*; use rust_htslib::bam::record::Cigar::*; use rust_htslib::bam::record::CigarString; use std::cmp; pub enum Error { PafParseCigar { msg: String }, PafParseCS { msg: String },...
56006e860fd7a44fe7f5556cdac6c50623b0d5b124620efaf144b34ab2372bfc
Rust
19,958
609
// Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license use anyhow::Result; use clap::ValueEnum; use half::f16; use ndarray::{Array, CowArray, IxDyn}; use ort::execution_providers::{ CPUExecutionProvider, CUDAExecutionProvider, ExecutionProvider, ExecutionProviderDispatch, TensorRTExecutionProvide...
607f8f807bedf979b833be981c3b430d29160830ac060fd83508ecdd924a8343
Rust
22,962
652
#![allow(clippy::type_complexity)] // Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license use ab_glyph::FontArc; use anyhow::Result; use image::{DynamicImage, GenericImageView, ImageBuffer}; use ndarray::{s, Array, Axis, IxDyn}; use rand::{thread_rng, Rng}; use std::path::PathBuf; use crate::{ gen_t...
508d06fedfd61676f8ac937e44a88b7d4d9a7866bd4cbf4613bbf891ccb79b98
Rust
51,926
1,279
//! Visual test cases for rustybam's liftover, trim, and break-paf operations. //! //! Each test contains an ASCII diagram showing the alignment, the region being //! operated on, and the expected result. This makes it easy to verify correctness //! by visual inspection. use rustybam::bed::Region; use rustybam::liftov...
6befaa4e3df0198f76c12c700a7a18d06680eb39c2ff97ce817ac0910064a164
Rust
61,352
1,735
use super::bed; use super::getfasta; use super::myio; use super::trim_overlap::trim_overlapping_pafs; use bio::alphabets::dna::{complement, revcomp}; use core::fmt; use itertools::Itertools; use natord; use rust_htslib::bam::record::Cigar::*; use rust_htslib::bam::record::CigarString; use rust_htslib::bam::record::*; u...
055a1e4134f45e71f19e88812e0a90372361f0287d660b7a773f5ebbfb717493
SAS
72
3
%macro rm_macro_debug; options nomprint nosymbolgen nomlogic; %mend;
f626054beb0a79e00ddfbe5780f7fe1b70abc04890b75f414d43c9d082926ff1
SAS
72
4
%macro linuxtest; proc print data=sashelp.cars(obs=20); run; %mend;
60a9d0a84a1e9526e2d2dfe94fe192950e00e500c9f4e4e9fd50d0bc36f54b8a
SAS
118
3
%macro getdsdvarsfmt(dsdin,fmtdsdout); proc contents data=&dsdin out=&fmtdsdout(keep=name format) noprint;run; %mend;
057065223ffaa686f74e9618088ea9fb59798b42cc2a9089f42c1ff905f7fb81
SAS
127
4
%macro ntokens(list); %eval(1 + %length(%sysfunc(compbl(&list))) - %length(%sysfunc(compress(&list)))) %mend ntokens;
f064b31df916df537cdd552184703076a05895bb1b6dae05124d2c153daf00cf
SAS
135
10
%macro ClearLib(Libname); proc datasets lib=&Libname kill nolist memtype=data; quit; %mend ClearLib; /* %ClearLib(work); */
ee472d25578311f432bf84e4adbc88b8f974612453ddca87cc44fc6a4321b202
SAS
136
9
%macro getsystemseparator; %if (&sysscp=WIN) %then %do; %str(/) %end; %else %do; %str(\) %end; %mend;
79ba5a596177a903b9fc6d1ab9e7414f0b7dc587022dbd9103a1e3182726caf5
SAS
144
7
%macro isBlank(param) ; %sysevalf(%superq(param)=,boolean) %mend isBlank ; /*Demo:; *check whether the macro var is blank; %isBlank(&xxx); */
f6aca1dd0968ac3b3af411064c866715706528f29222a00212282729edb70af5
SAS
145
7
%macro shuffle_rows(dsdin,var,dsdout); proc sql; create table &dsdout as select &var from &dsdin order by rand('uniform'); quit; %mend;
7dceec3d146c88cf64c80c5c5313b90b2a8ff7956434062d3004b23459b063ce
SAS
151
9
%macro delete_dir(dir); filename del_dir "&dir"; data _null_; rc=fdelete('del_dir'); put rc=; msg=sysmsg(); put msg=; run; %mend;
d108bc300da266564058ff0fa3268d6bc14f3ccbf4c7142e9d9c919111f01a40
SAS
152
8
%macro import_fam(file,out); proc import datafile="&file" dbms=dlm out=&out replace; delimiter=' '; getnames=no; guessingrows=2000; run; %mend;
a646eaf8ab59b5c1eb931806d69027cfdc499aa6fc2f2b06df307997a0c93e8d
SAS
170
10
%macro import_plink_ped( pedfile=, out=x ); proc import datafile="&pedfile" dbms=dlm out=x replace; getnames=no; delimiter=' '; guessingrows=10000; run; %mend;
20573d5565f4da5919771c381a1339cdf85c3e3599e31ec2f9f9b9c0099859a8
SAS
181
10
%macro delete_file_or_dir_with_fullpath( file_or_dir_fullpath= ); filename fileref "&file_or_dir_fullpath"; data _null_; rc=fdelete('fileref'); run; filename fileref clear; %mend;
e5ae6a3e5b67b192045e019959e534ff85c20646afc0f60a30db6fe9a26cf50d
SAS
197
6
%macro importmacroslinux; %let MacroDir=/project/fas/gelernter/zc254/SAS/SAS-Useful-Codes/Macros; %include "&MacroDir/ImportAllMacros.sas"; %ImportAllMacros(MacroDir=&MacroDir,filergx=.*); %mend;
9cb188cb4c5fddae8082e9fe59c7c65e1aff39f0562cce606122f68016992adc
SAS
199
8
%macro del_file_with_fullpath(fullpath); data _null_; rc=filename("fname","&fullpath"); if rc=0 and fexist("fname") then rc=fdelete("fname"); rc=filename("fname"); run; %mend;
3618b120a263a8689f787cd2f89b1d4179b06180d314562db04f806cb6416b08
SAS
210
10
%macro print_x_cmd_via_pipe(xcmd=); /*Note: do not include double or single quotes in the xcmd argument*/ filename FX pipe "&xcmd"; data _null_; infile FX; input; put _infile_; run; %mend;
3f9369553edd9191ed7b079a2224b17f7fc30a530ce16f7cc350cf281452329f
SAS
212
8
%macro opends(name); %if %sysfunc(exist(&name)) %then %let dsid=%sysfunc(open(&name,i)); %else %put Data set &name does not exist.; %mend opends; /*%let dsname=sasuser.houses;*/ /*%opends(&dsname);*/
d3a3646463b6f23cd03d3ffef13daeec941fe4532369564b7123e835d591d303
SAS
213
9
%macro findxy(dataname,xx,yy,outdsd=outa); proc univariate data=&dataname noprint; var &xx &yy; output out=&outdsd min = minxx minyy max = maxxx maxyy; proc print data=&outdsd; run; %mend findxy;
a6bb88d612360464c8053007ea27e5dc4fea0426adaf455ba00680829948f750
SAS
214
10
%macro abort_when_file_not_exit(filepath); %if %FileOrDirExist("&filepath") eq 0 %then %do; %put no file for &filepath; %abort 255; %end; %else %do; %put file &filepath exists!; %end; %mend;
ec1e313e4f3e19ce48f7983af998ac45ac474a9de758783e29827df1b86ce820
SAS
241
10
%macro Only_Keep_noduplicates(inputdsd,key,outputdsd); proc sql noprint; create table &outputdsd as select * from &inputdsd group by &key having count(*)=1; quit; %mend; /* %Only_Keep_noduplicates(inputdsd,key,outputdsd); */
15eb8b1b4bcf0375e8ad6accecf97570fd38eaf5774047dccff993af18fbb254
SAS
242
9
%macro systran(prog,pathin,pathout,dsname); options xwait; %sysexec("&prog." &pathin.&dsname..sas7bdat &pathout.&dsname..dta /Y); options xwait; run; %mend; *%systran(C:\Program Files\StatTransfer7\st.exe,c:\data\,d:\data\,tempx);
c8495b2fb414860585d30c4dd54b636f04950403f0b6804c3844364eec7cb22a
SAS
244
13
%macro chdir(dir); %let dir=%sysfunc(prxchange(s/\\/\//,-1,&dir)); %if "&sysscp"="WIN" %then %do; x "cd /d &dir"; %end; %else %do; data _null_; rc=dlgcdir("&dir"); put rc=; run; %end; %put changed into the &dir; %mend;
933a08012cadfcdcbef35e19341d1c041693ef80d6698ed6b7ba69158a563dbe
SAS
252
12
%macro list2sql_by_grps( list=A B C /*Replace blank spaces with comma using %str or %nrstr or %nrbquote*/ ); %sysfunc(prxchange(s/ +/%str(,)/,-1,&list)) %mend; /*Demo codes:; %let new_list=%list2sql_by_grps(list=A C); %put &new_list; */
043af703dfcf0981c0a11099c9136a77387ba968a2ecb320992aec735bdc78e4
SAS
257
12
%macro numargs(arg); %if &arg= %then %do; 0 %end; %else %do; %let n=1; %do %until (%qscan(&arg,%eval(&n),%str( ))=%str()); %let n=%eval(&n+1); %end; %eval(&n-1) %end; %mend numargs;
493076fc0028cda89d588d36bb106779a621cc4cac5a54528ce9d2ef212f9376
SAS
262
11
%macro make_global_vars_with_prefix(vtot,varname=var_si,value4var=-9); %do vi=1 %to &vtot; %global &varname.&vi.; %let &varname.&vi.=&value4var; %end; %mend; /*Demo codes:; %make_global_vars_with_prefix(vtot=20,varname=var_si); %put &var_si1; */
4e179f13bca3f3c674dff966c567bf2dec31cdb51dc46688d0469df74a9ab013
SAS
263
18
%macro debug_macro( undebug=0 /*give 1 to reset macro debugging parameters;*/ ); %if &undebug=0 %then %do; options mprint symbolgen mlogic; %end; %else %do; option nomprint nosymbolgen nomlogic; %end; %mend; /*Demo: %debug_macro; %debug_macro(undebug=1); */
63c6bad6e3cec38b4ffc63a9be33aaa6de36ffd0531637076f14b999d4d6ed41
SAS
282
12
%macro LoadMacros; %let macrodir=%sysfunc(pathname(HOME))/Macros; %include "&macrodir/importallmacros_ue.sas"; %importallmacros_ue; %mend; /*Demo codes: *Load these macros; options mprint mlogic symbolgen; %include "%sysfunc(pathname(HOME))/Macros/LoadMacros.sas"; %LoadMacros; */
dd5322c18947ade3fc5b2d2baf5f71964252c0e687a7abe735a4497790479221
SAS
284
8
%macro DoseVCF2Plink(DoseVCF,GP,PlinkOut); data _null_; call system("plink1.9.exe --vcf &DoseVCF --vcf-min-gp &GP --make-bed --out &plinkOut"); run; %mend; /* %DoseVCF2Plink(DoseVCF=E:\Yale_GWAS\GWCIDR_GWGO\GWGO_GWCIDR.1kg_phase3_v5.chr13.dose.vcf.gz,GP=0.9,PlinkOut=Tmp); */
d154fff1c96bdacb7670db7b0acc1b227fce08d493b974a48d19e9c5f85fecd6
SAS
288
17
%macro startxl; filename sas2xl dde 'excel|system'; data _null_; file sas2xl; run; options noxwait noxsync; %if &syserr ne 0 %then %do; x '"C:\Program Files (x86)\Microsoft Office\Office12\excel.exe"'; data _null_; x=sleep(2); run; %end; %mend startxl; /* %startxl; */
d704b05182a49c79446a128f9f7b4ab86c876589388a6173ac470c12f51450de
SAS
315
17
%macro dbquote_vars(vars); /*%let &vars=CEU YRI;*/ %let re=%sysfunc(prxparse(s/ +/" "/oi)); %let var_list=%sysfunc(prxchange(&re,-1,"&&vars")); %syscall prxfree(re); %put &var_list; &var_list %mend; /*Demo codes:; data y; set sashelp.cars; where make in (%dbquote_vars(vars=Acura BMW)); run; */
e0c9bff2e26a644ccb5623262ac6c6a27ebdf2d4c6fa1efe5db24f20dc334c92
SAS
316
25
%macro BMI(WgtPd_Var,HgtIN_Var); %if &HgtIN_var= or &WgtPd_var= %then %do; . %end; %else %do; &WgtPd_var*0.45/(&HgtIN_Var*0.025)**2 %end; %mend; /* options mprint mlogic symbolgen; data a; input Wgt Hgt; BMI=%BMI(Wgt,Hgt); cards; 125 63 ; run; data b; set a; x=%BMI(Wgt,Hgt); run; */
93f0a8ba67a63ba5477a2fec470f0a91943a4828711a53c2c25853c107550bca
SAS
333
15
%macro GetCWD; /*Get current working directory;*/ %global cwd; %let cwd=%qsubstr( %sysget(sas_execfilepath), 1, %length(%sysget(sas_execfilepath))-%length(%sysget(sas_execfilename))-1 ); %put %sysget(sas_execfilepath); %put &cwd; %mend; /*Demo: Require the running sas script having been saved; %GetCWD; %pu...
a8498ea35410358994ef92615e9523833d6dbabf343685226cad19da09443fd8
SAS
335
19
%macro assign_str4missing(Inval,NewVal); %let Updated_Val=; %if %eval("&Inval"="") %then %do; %put New value &NewVal is updated for your input string "&Inval"; %let Updated_Val=&NewVal; &NewVal %end; %else %do; &Inval %end; %mend; /*Use it in macro ONLY; %let X=%assign_str4missing(Inval=,NewVal=X...
c4b2105cb800b91d8a911538142a984b4b9590ecfface8bcc53d3c01bb6ddbac
SAS
339
15
%macro UniHetGeno(dsdin,geno,dsdout); data &dsdout(drop=Het); retain Het '00'; set &dsdin; &geno=strip(left(&geno)); if substr(&geno,1,1)^=substr(&geno,2,1) and Het='00' then Het=&geno; if substr(&geno,1,1)^=substr(&geno,2,1) and Het^=&geno then &geno=Het; run; %mend; /* %UniHetGeno(dsdin=topsnp,geno=geno...
321f5da561e2536c8fe317172ba4d605f29369609e2f773f13c54256a204fa22
SAS
342
29
%macro chk_sas_dsd(lib=work,dsdname=_last_); %if %sysfunc(exist(&lib..&dsdname)) %then %do; 1 %end; %else %do; 0 %end; %mend; /*Demo: options mprint mlogic symbolgen; data x; input y ; cards; 10 ; run; %let chk=%chk_sas_dsd; %put &chk; libname sc "/home/cheng.zhong.shan/data"; %let chk=%chk_sas_dsd(lib=sc,dsdname...
0a809bf73c4905335128a49f720746f583f2b989b87f1bfcbae926c999436168
SAS
343
13
*options symbolgen mprint mlogic; %global list; %macro Quote_Varlist(list); %let re=%sysfunc(prxparse(s/ /" "/oi)); %let list=%sysfunc(cat("%sysfunc(prxchange(&re,-1,&list))")); %put macro variable list=&list; %syscall prxfree(re); %mend; /* options mprint macrogen mlogic symbolgen mfile; %Quote_Varlist(lis...
f977ae85f28ccb15aab0badf192d6e5344ed06fb14493aaa50ff66adbcd7235d
SAS
343
21
%macro BedCount(bed,st,end,out); proc sql; create table &out as select sum(&end-&st+1) as total from &bed; quit; data &out; set &out; WGS_Pct=total/2897310462; /*hg19=2897310462 (non-N bases)*/ run; %mend; /*Demo: libname G "G:\"; %BedCount(bed=G.promoter ,st=var2 ,end=var3 ...
a19b07f610352d6fdaaddbb90db0b67e9e9c2e55289dfd4bb53a5090909d73b4
SAS
357
20
%macro pname; %global pgmname; %let pgmname=; data _null_; set sashelp.vextfl; if (substr(fileref,1,3)='_LN' or substr (fileref,1,3)='#LN' or substr(fileref,1,3)='SYS') and index(upcase(xpath),'.SAS')>0 then do; call symput("pgmname",trim(xpath)); stop; end; run; %mend pname; /* %p...
4fce91f08f6ca0127d868c1c4101925e99769be3870c34425451592c54edda43
SAS
365
17
%macro zscroe2p(dsdin,Zscore_var,dsdout); data &dsdout; set &dsdin; pval= probnorm(&Zscore_var); /*pval=cdf('normal',&Zscore_var);*/ if (pval > .5) then pval= 1 - pval; pval= 2*pval; *SAS only can obtain pval no more less than 1e-16; if pval=0 then pval=1e-16; run; %mend; /* %zscroe2p(dsdin=both,Zscore_v...
ab36edafb0fc77485713c1b8f52d6f49e7b0eed2029a0a3fc54be21c6a804900
SAS
368
23
%macro delete_sas_dsd(dsdin); %if %sysfunc(exist(&dsdin)) %then %do; %put delete previous &dsdin; %if %index(&dsdin,.) %then %do; %let _lib_=%scan(&dsdin,1,.); %let _out_=%scan(&dsdin,2,.); %end; %else %do; %let _lib_=work; %let _out_=&dsdin; %end; proc datasets lib=&_lib_ nolist; delete &_out_; run; %en...
2d781c4c87b30a7326f58fe4259a6127f87104af623a283b078871b75b33af68
SAS
370
16
%macro totobsindsd(mydata); %let mydataID=%sysfunc(OPEN(&mydata.,IN)); %let NOBS=%sysfunc(ATTRN(&mydataID,NOBS)); %let RC=%sysfunc(CLOSE(&mydataID)); %if "&NOBS"^="." %then %do; &NOBS %end; %else %do; 0 %end; %mend; /*Demo: %let nobs=%totobsindsd(sashelp.cars); %put The total n...
dc6848dfd89e359c7bd105b68b9f4b9f6cb7fa2567bf785bb1c3dc96eb59cd50
SAS
374
17
%macro Find_duplicates(inputdsd,key,outputdsd); proc sql; create table &outputdsd as select * from &inputdsd as A1 where A1.&key in (select &key from &inputdsd group by &key having count(*)>1) ; quit; proc sort data=&outputdsd;by &key;run; proc print data=&outputdsd;run; %mend Find_duplica...
43c17f805d087c4b7a74ee439b5c3c9f48184f12bc78f3dcb1215d88ceb984dd
SAS
376
24
%macro CloseSVG_Printer; ods printer close; filename out clear; ods listing; %mend; /*Demo: *Demo1:; %OpenSVG_Printer; *default svg figure will be saved into the $HOME dir with the name mysvgfilename.svg; *It will recursively add numeric appendix to the svg filename; *to avoid overwritting previous svg files; *Pu...
f4d81cd6e24ed8a70175b7b34d97f095d168196762ffa28dd04431a3afd718e8
SAS
379
14
%macro figureit(a,b); %let y=%sysevalf(&a+&b); %put The result with SYSEVALF is: &y; %put The BOOLEAN value is: %sysevalf(&a +&b, boolean); %put The CEIL value is: %sysevalf(&a +&b, ceil); %put The FLOOR value is: %sysevalf(&a +&b, floor); %put The INTEGER value is: %sysevalf(&a +&b, int); ...
db82d7ecc4b0958a27b2edf8c79c4f41634272a2de96a298c291899431884814
SAS
410
20
%macro isDir(iPath=,iQuiet=1); %local result dname; %let result = 0; %if %sysfunc(filename(dname,&iPath)) eq 0 %then %do; %if %sysfunc(dopen(&dname)) %then %do; %let result = 1; %end; %else %if not &iQuiet %then %do; %put ERROR: ISDIR: %sysfunc(sysmsg()); %end; %end; %else %if no...
3a72019ac06555895046e844ff32f37c3c34842c90a2d42041c4046f882d129b
SAS
412
16
%macro list_files_with_dopen(dir); filename mydir "&dir"; data files; did = dopen('mydir'); if did > 0 then do; count = dnum(did); do i = 1 to count; fname = dread(did, i); output; end; rc = dclose(did); ...
b5eb207c6a1415b805a0ec65e63ae3774eca10be8f3aee5e6831743aceb2cb3c
SAS
420
27
%macro regression_estimator(dsdin=_last_,xvar=,yvar=,outdsd=PE); ods graphics off; proc reg data=&dsdin; model &yvar=&xvar; ods output ParameterEstimates=&outdsd; run; data &outdsd; set &outdsd; attrib Probt format=best32.; run; proc print;run; %mend; /*Demo: *perform regression analysis with proc reg; %regression_es...