sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
c7eeb2b2b624680ee1c48c0713591539a1a2aee497965caa0f6eedce39fbbdcd | R | 93,207 | 1,886 | ################################################################
#
# Analysis of psychiatric service use from the study:
#
# Only Anxiety Remains Reliably Associated with Paediatric
# Mild TBI at Two Years Follow-up after Adjusting for Pre-Existing Mental Health Problems
#
# Revill et al
#
##################... |
38b20012bd8735b0c187dc4ea22ca0f434492062ae03dee29c58bd88254563c1 | R | 111,047 | 2,140 | #set working directory ====
setwd("/athena/ganlab/scratch/lif4001/Mouse_pgrn_mertk/DF_2ndRound")
#install.packages
library(Seurat)
library(ggplot2)
library(DoubletFinder)
library(SoupX)
#for loading Cell Ranger counts:
sc = load10X('/athena/ganlab/scratch/lif4001/Mouse_pgrn_mertk/cellranger/LG180_1601/outs')
sc = auto... |
f8a04cfbd24f4514c9fef6ec4c4ae6025e7d1781bf18911fa922558491f68c1f | R | 115,234 | 3,203 | ---
title: "BBB scRNA Analysis"
author: "ZZ"
date: "2025-03-10"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
knitr::opts_knit$set(root.dir = "~/BBB_MPreterm_MTerm")
```
```{r}
# run this to save objects (be careful: overwrites previously saved ones)
save(list = ls(all.names... |
1a7e60258806e2fb85e1501d51cf8cce5ab2d36f0f00ff75f9e3c8b1c7eab45b | R | 118,619 | 2,345 | ################################################################
#
# Analysis of Child Behaviour Checklist (CBCL) and DSM diagnoses
# outcomes (from KSADS) from the study:
#
# Only Anxiety Remains Reliably Associated with Paediatric
# Mild TBI at Two Years Follow-up after Adjusting for Pre-Existing Mental Health... |
96bf15665093a85bf3d8e0385ee2290d63ff1197077f8d705f8af82d2f3701ac | R | 128,092 | 2,546 | ---
title: "Step3_DE_analysis"
author: "Sam Pring, Sarah Lower, Brian Vestal"
date: "`r Sys.Date()`"
output:
html_document:
theme: cerulean
toc: TRUE
toc_float:
collapsed: TRUE
code_folding: hide
editor_options:
chunk_output_type: console
---
```{r setup, include=FALSE}
knitr::opts_chunk$... |
5bd0141d3a76b25883aa93ed25372c9cfba4f4b97868cb04272f8bb766e8f703 | R | 139,911 | 4,197 | #DE detection#########
#library(RaceID)
library(OmnipathR)
library(magrittr)
library(BiocParallel)
#library(MAST)
library(reshape2)
library(trend)
library(Seurat)
library(SeuratData)
#library(SeuratDisk)
library(ggrepel)
library(ggplot2)
library(gtable)
library(ggpubr)
library(gridExtra)
library(gridGraphics)
library(g... |
bfdffe5dbd8be406f91e7d5c0117971817ddf354a384400e82cd3b76b65f3a40 | R | 149,919 | 3,863 | # this app is based on compare_gene_list.R
# remove user library path to avoid confusion
if(length(.libPaths())>1) .libPaths(.libPaths()[-1])
run_nextflow <- FALSE
library(shiny)
library(GeneOverlap)
library(gridExtra)
library(ggplot2)
library(gridGraphics)
library(eulerr)
library(reshape)
library(ggthemes)
library(gg... |
82ce8e44dfc26a65cf6db41770fbecc3aa3a8839415821b01a0aaaa2b9efb6c5 | R | 155,863 | 1,909 | #### load packages ####
targetPackages <- c('tidyverse','BiocManager','wordcloud','ggnewscale','ggarchery','tidytext')
newPackages <- targetPackages[!(targetPackages %in% installed.packages()[,"Package"])]
if(length(newPackages)) install.packages(newPackages, repos = "http://cran.us.r-project.org")
targetPackages_Bioc ... |
2381fc339f96f58ff08b4811e6cad058fc4c76bb5f8a550b035ed90712d2cff9 | R | 179,912 | 5,195 | #!/bin/env Rscript
#### SCRIPT INFORMATION ####
#### License Notice ####
##
# Copyright (c) 2025 Cedars-Sinai Medical Center
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 ... |
be2e0e81f9a138b4e734ea015d21efcd4fbc8155bab0336496b82f3484528768 | R | 200,000 | 4,632 | ---
title: "Zebrafish_Analysis"
author: "Sebastien Audet"
date: "2024-02-05"
output: html_document
---
## First Setup
Generate a new R environment with it's own package to avoid version conflicts.
Paths need to be modified for your own environment. Advanced users can skip.
Important aspect is simply to in... |
c8e0583694bb1e0188dbe28fe0d65ac1130723c55f968b6262b906c147f72549 | Rust | 45 | 3 | fn main() {
println!("Hello, world!");
}
|
4e790275483456579f5069e6852f396026c91895ac6c2b9a7db0d92734246eb4 | Rust | 58 | 4 | #[no_mangle]
pub extern "C" fn ret_12() -> u32 {
12
}
|
2ddfb48967ef5b2c79e9653f99aa3e0489a09c45f1222acad9ff1d0997c46334 | Rust | 65 | 3 | pub mod analysis;
pub mod genetic_algorithm;
pub mod simulation;
|
a6a1be48a653832dfc4eab5c5800a3ce70eee016b94052f58cbb85aac97c875f | Rust | 66 | 3 | fn main() {
println!("Hello, world from test rust binary");
}
|
64731db85b1f59ece441a10ef8e2203cd15936ff2b9185c2e0818d79a0b17d68 | Rust | 87 | 4 | #[no_mangle]
pub extern "C" fn rust_function1() {
println!("Hello from lib 1!");
}
|
d736b2d6e893576d3b1e22bcad64005a9b8aea22034475424c4f3b2f4c42d02e | Rust | 87 | 4 | #[no_mangle]
pub extern "C" fn rust_function2() {
println!("Hello from lib 2!");
}
|
f9c4156407ca4921edfae54b1bbdca5ca004595d729d0cebd9f563edd8ca38a6 | Rust | 95 | 7 | #[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}
|
a06f645f72472d021d25e1a47aa853385ff6a3ad2f02c6d74c48e6e8bdbc6673 | Rust | 122 | 8 |
extern "C" {
fn get_42() -> u32;
}
pub fn calls_ffi() {
let res = unsafe { get_42()};
assert_eq!(res, 42);
}
|
c1a4b87d4ac9ac256a22d5b35d8cc2288171e4407b82b5e2336b58cf4d057206 | Rust | 134 | 10 | mod foo;
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
let result = 2 + 2;
assert_eq!(result, 4);
}
}
|
ca7ca74498581762ba6a45e5254393fd4a465e3109f6594260bdfb62fe12137d | Rust | 145 | 9 | use std::os::raw::c_char;
pub fn hello_world() {
println!("Hello, world!");
}
extern "C" {
pub fn cpp_function(name: *const c_char);
}
|
7d53d1b55e7919bf760dc55e14cae257d817db0cbb34d573031f75564f91349a | Rust | 149 | 4 | // Build-scripts also need to be linked, so just add a dummy buildscript ensuring this works.
fn main() {
println!("Build-script is running.")
}
|
448c2f5dff519ce4dc9a053a0769047492a6a189197467eb2d56ade72111c85c | Rust | 157 | 8 | use multitarget_lib::hello_world;
fn main() {
hello_world();
unsafe {
multitarget_lib::cpp_function("bin3\0".as_ptr() as *const _);
}
}
|
bd6e6ec3ab357d0d0ca5ee874e2d57a3712d2a47eb96877fe36f97d899e2c583 | Rust | 157 | 8 | use multitarget_lib::hello_world;
fn main() {
hello_world();
unsafe {
multitarget_lib::cpp_function("bin2\0".as_ptr() as *const _);
}
}
|
c98598363aa5d121d1b2cf7bfcb879435065e46c6b2dade1fab46c018a961e03 | Rust | 157 | 8 | use multitarget_lib::hello_world;
fn main() {
hello_world();
unsafe {
multitarget_lib::cpp_function("bin1\0".as_ptr() as *const _);
}
}
|
7c23ef55c6bf78f41a4beb04967e4e6cacbcceae1bc60597615c02e0d3e4fc74 | Rust | 161 | 10 | #![no_std]
use core::panic::PanicInfo;
#[no_mangle]
pub extern "C" fn rust_function() {}
#[panic_handler]
fn panic(_panic: &PanicInfo<'_>) -> ! {
loop {}
} |
7e552e1fbe394f21822850f7e9cbd4c48456eec7a9f608819cf790aa8ea8543e | Rust | 199 | 10 | #[cxx::bridge(namespace = "foo")]
mod bridge {
extern "Rust" {
fn print(slice: &[u64]);
}
}
fn print(slice: &[u64]) {
println!("Hello cxxbridge from foo/mod.rs! {:?}", slice);
}
|
767679f16d5e71fe74115679e0ae57e46bfbbae2d2798665a53b4e2eba61b6e6 | Rust | 205 | 12 | mod foo;
#[cxx::bridge(namespace = "lib")]
mod bridge {
extern "Rust" {
fn print(slice: &[u64]);
}
}
fn print(slice: &[u64]) {
println!("Hello cxxbridge from lib.rs! {:?}", slice);
}
|
9d3e916acad0aa021579eb3831cd0be2f880838c519b02ea79f56d6e3cd71df3 | Rust | 212 | 13 | use std::os::raw::c_char;
extern "C" {
fn c_function(name: *const c_char);
}
fn main() {
println!("ok");
let name = b"Rust Hostbuild\0";
unsafe {
c_function(name.as_ptr() as _);
}
}
|
e08d403d7207992eb2795c77bb241469d7ffcdf6e6ad7caf2c9e17f9bb14d2d4 | Rust | 217 | 7 | use std::os::raw::c_char;
#[no_mangle]
pub extern "C" fn rust_function(name: *const c_char) {
let name = unsafe { std::ffi::CStr::from_ptr(name).to_str().unwrap() };
println!("Hello, {}! I'm Rust!", name);
}
|
dd7b93f51f09fede2bc32de73d518ac719d08d96295a95ba7ef1805db61d0371 | Rust | 218 | 8 | use std::os::raw::c_char;
#[no_mangle]
pub extern "C" fn rust_function(name: *const c_char) {
let name = unsafe { std::ffi::CStr::from_ptr(name).to_str().unwrap() };
println!("Hello, {}! I'm Rust!", name);
}
|
e1e2c8cf0e082b7f8ddd8f144bd5ee13f5f782e5ff057e3a7be97a3c8e706211 | Rust | 229 | 6 | use std::io::Write;
fn main() -> Result<(), std::io::Error> {
let out_name = std::env::args().skip(1).next().unwrap();
let mut out_file = std::fs::File::create(out_name)?;
Ok(write!(out_file, "const _: () = ();")?)
}
|
18769f01e9144cc42fc47478f1f5e2a378756ca2b3e6e87cf12872ff0347ef1d | Rust | 260 | 10 | //! Test that the local rustflags are only passed to the main crate and not to dependencies.
#[cfg(test_local_rustflag1)]
const _: [(); 1] = [(); 2];
#[cfg(test_local_rustflag2 = "value")]
const _: [(); 1] = [(); 2];
pub fn some_function() -> u32 {
42
}
|
a9764a740ebe0a362ca1e9db2e69d758cc53925ffaf877f20ed68eeb20d8c6be | Rust | 296 | 10 | fn main() {
let out_dir = std::env::var("OUT_DIR").unwrap();
cc::Build::new()
.file("src/lib.c")
.compile("hello");
println!("cargo:rustc-link-search=native={}", out_dir);
println!("cargo:rustc-link-lib=hello");
println!("cargo:rerun-if-changed=src/lib.c");
} |
75223378162f4822a08c58c86d5d9f597913d7a0bd4a2e1eb386a89daa16c34e | Rust | 333 | 11 | use std::os::raw::c_char;
#[no_mangle]
pub extern "C" fn rust_function(name: *const c_char) {
let name = unsafe { std::ffi::CStr::from_ptr(name).to_str().unwrap() };
println!("Hello, {}! I'm Rust!", name);
}
#[cfg(debug_assertions)]
const _: () = assert!(false, "Debug assertions where not disabled via custom... |
a44fddf827d69aa9da2a97c5ad796d85f522f1a93cf79225eeb2be07ae741f07 | Rust | 335 | 16 |
#[cfg(some_cargo_config_rustflag)]
fn print_line() {
println!("Rustflag is enabled");
}
// test that local rustflags don't override global rustflags set via `.cargo/config`
#[cfg(local_rustflag)]
fn test_local_rustflag() {
println!("local_rustflag was enabled");
}
fn main() {
print_line();
test_local... |
2245920e2e892ee3c719bb0918e68e1b145b46cb8abd01df43a0e834ea3ddef9 | Rust | 344 | 14 | use cxxbridge_lib::ffi::{RsImage,Rgba,read_image};
fn main() {
println!("main function");
let expected = RsImage { width: 1, height: 1, raster: Rgba {
r: 1.0,
g: 2.0,
b: 3.0,
a: 4.0,
}};
let actual = read_image("dummy path");
println!("returned from C++");
assert... |
52b3e25efdefe524bc3e8ae9569be25a7513ab19cc54d3317f6308a959e03d99 | Rust | 359 | 13 | mod chemotaxis_index;
mod function;
mod gene;
mod setting;
mod time;
pub use chemotaxis_index::{chemotaxis_index, chemotaxis_index_wave_check};
pub use function::{
concentration, gauss_concentration, sigmoid, two_gauss_concentration, y_on_off, y_osc,
};
pub use gene::{Gene, GeneConst};
pub use setting::{Const, Set... |
5afb7c6762f351a7e45157fce5a8a074da2b027f1180109b73e6a690e48ea258 | Rust | 461 | 26 | #[cxx::bridge]
pub mod ffi
{
#[derive(Debug, PartialEq)]
pub struct Rgba
{
r: f32,
g: f32,
b: f32,
a: f32,
}
#[derive(Debug,PartialEq)]
pub struct RsImage
{
width: usize,
height: usize,
raster: Rgba,
}
unsafe extern "C++"
{... |
e379794cdb1d67e6c7c623896c0dbf7d898af11eba19c9f828649388cd13fdce | Rust | 472 | 14 | use std::os::raw::c_char;
#[no_mangle]
pub extern "C" fn rust_function(name: *const c_char) {
let name = unsafe { std::ffi::CStr::from_ptr(name).to_str().unwrap() };
println!("Hello, {}! I am Rust!", name);
#[cfg(not(feature = "one"))]
compile_error!("Feature one is not enabled");
#[cfg(not(featur... |
f220b91660eca02d636782ef7ed8f8cdd89b7c96fb115f8eb0ea67e105e32ed6 | Rust | 537 | 16 | use crate::simulation::*;
use serde::{Deserialize, Serialize};
// Ga構造体は遺伝的アルゴリズムの中での個体を表します
#[derive(Clone, Debug)]
pub struct Ga {
pub value: f64, // 個体の評価値(CI値)
pub gene: Gene, // 遺伝子
}
// Gajson構造体は遺伝的アルゴリズムの中での個体をJSON形式で表します
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Gajson {
pub valu... |
05817faeee4f7f0aac6ac464fa8d654491a8539e1364245829fb9512dec55e7e | Rust | 552 | 17 | mod crossover;
mod evaluate;
mod ga;
mod genetic_algorithm_constrain_aiy_aiz;
mod genetic_algorithm_normal;
mod mutation;
mod population;
mod setting;
pub use crossover::two_point_crossover;
pub use evaluate::evaluate_fitness;
pub use ga::{Ga, Gajson};
pub use genetic_algorithm_constrain_aiy_aiz::genetic_algorithm_con... |
5f42387877e83e9bd17b067db44f77f7b0c863b2899d202648fd71696ceab0b1 | Rust | 594 | 27 | use std::os::raw::c_char;
extern "C" {
fn cpp_function(name: *const c_char);
fn cpp_function2(name: *const c_char);
fn cpp_function3(name: *const c_char);
}
fn greeting(name: &str) {
let name = std::ffi::CString::new(name).unwrap();
unsafe {
cpp_function(name.as_ptr());
cpp_functi... |
bf8c7db6ee7dfea0770154402186dd2340325dc13e224fdfbbbfd6fc18d9d14d | Rust | 651 | 15 | use serde::{Deserialize, Serialize};
// Gasetting構造体は遺伝的アルゴリズムの設定を表します
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Gasetting {
pub average: i32, // CI測定時の平均回数
pub gen_size: usize, // 遺伝子の長さ
pub ga_count: usize, // 遺伝的アルゴリズムの実行回数
pub n_gen: usize, // 世代数
pub pop_size: usize, // ... |
88add84ed02dc257d8c6feb54821bc0e4f200a57ffb8fe2211bc2fd6daa9c26c | Rust | 692 | 24 | use block_aligner::scan_block::*;
use block_aligner::scores::*;
use simulate_seqs::*;
use std::hint::black_box;
fn run(len: usize, k: usize) {
let mut rng = StdRng::seed_from_u64(1234);
let r = rand_str(len, &AMINO_ACIDS, &mut rng);
let q = rand_mutate(&r, k, &AMINO_ACIDS, &mut rng);
let r = PaddedByt... |
db41e18bfaeeb09e21de54a20a6b22c62b1889b7c95e99f194634ffbb8dc5c51 | Rust | 716 | 30 | pub const MAGIC_NUMBER: u64 = 0xABCD_EFAB;
#[derive(Debug)]
#[repr(C)]
pub struct Point {
x: u64,
y: u64,
}
impl Point {
pub(crate) fn add(&mut self, rhs: &Point) {
self.x = self.x.wrapping_add(rhs.x);
self.y = self.y.wrapping_add(rhs.y);
}
}
#[no_mangle]
pub extern "C" fn add_point(l... |
1dd2eea2efa99b8646e6d51d9c6676fc7c083aa8a7c96844c83c438319416e4b | Rust | 812 | 27 | use c_elegans_chemotaxis::analysis::*;
use c_elegans_chemotaxis::genetic_algorithm::*;
// use c_elegans_chemotaxis::simulation::*;
use std::env;
fn main() {
let args: Vec<String> = env::args().collect();
if args.len() < 2 {
eprintln!("Usage: cargo run --release -- <command>");
eprintln!("Comma... |
52646707b5d650c566e611da8aad86e25015cc14946d8d1202aedad790448b44 | Rust | 829 | 25 | mod analytical_control;
mod bearing;
mod klinotaxis;
mod normal_gradient;
mod read_result;
mod setting;
mod translational_gradient;
mod curving_rate;
pub use analytical_control::analytical_control;
pub use bearing::{
analysis_klinotaxis_bearing_errbar_std_max_min, bearing, histgram_count_bearing,
};
pub use klinot... |
365f167026bf8639367cf030da93a82c430a0c85604cf98c0b13a6f8d829755e | Rust | 855 | 18 | fn main() {
assert_eq!(env!("REQUIRED_VARIABLE"), "EXPECTED_VALUE");
assert_eq!(std::env::var("ANOTHER_VARIABLE").unwrap(), "ANOTHER_VALUE");
let cargo_major = env!("COR_CARGO_VERSION_MAJOR")
.parse::<u32>()
.expect("Invalid Major version");
let cargo_minor = env!("COR_CARGO_VERSION_MINO... |
e3f49bd668a6e4704884e33c178c4aefa465a2718b0be6dbefda5bba29b96475 | Rust | 927 | 26 | #[cfg(feature = "myfeature")]
use std::os::raw::c_char;
#[no_mangle]
#[cfg(feature = "myfeature")]
pub extern "C" fn rust_function(name: *const c_char) {
let name = unsafe { std::ffi::CStr::from_ptr(name).to_str().unwrap() };
println!("Hello, {}! I'm Rust!", name);
}
#[no_mangle]
#[cfg(feature = "secondfeatur... |
265bb6f3aa6a576ac549af31e491a9b19e621b876bcd904ddbc9496188d7ad17 | Rust | 1,148 | 32 | use crate::analysis::setting::*;
use crate::genetic_algorithm::*;
use crate::simulation::*;
use toml::Value;
pub fn read_result() -> Vec<Ga> {
// klinotaxis_analysis.toml ファイルを読み込む
let toml_str: String =
std::fs::read_to_string("klinotaxis_analysis_setting.toml").expect("Failed to read file");
let ... |
183981b49be99f23deeb3dc1804bcd4b0427e40b887d21486b09f53bcbdbbe82 | Rust | 1,172 | 42 | #![feature(test)]
#![cfg(feature = "simd_avx2")]
extern crate test;
use test::{Bencher, black_box};
use block_aligner::avx2::*;
#[repr(align(32))]
struct A([i16; L]);
#[bench]
fn bench_opt_prefix_scan(b: &mut Bencher) {
#[target_feature(enable = "avx2")]
unsafe fn inner(b: &mut Bencher) {
let vec = ... |
c5a816a0802736ed9f4bbd9a14a9a28f2c0a6c099d65b0660af4d46bae592324 | Rust | 1,187 | 37 | use crate::genetic_algorithm::ga::*;
use crate::simulation::*;
use rand::{rng, Rng};
// two_point_crossover関数は2点交叉を実行し、2つの子個体を生成します
pub fn two_point_crossover(parent1: &Ga, parent2: &Ga) -> Vec<Ga> {
// ランダムな交叉点を決定
let mut rng = rng();
let crossover_points: (usize, usize) = (
rng.random_range(0..pa... |
b2ac2c1584de0e5dd5c8b26079ba9edbda09fc7c6fc9f6f156a49f76bdee1085 | Rust | 1,249 | 38 | use crate::genetic_algorithm::ga::*;
use crate::simulation::*;
use rayon::prelude::*;
impl Ga {
// fitnessメソッドは個体の適応度を計算します
pub fn fitness(&self, setting: &Setting, average: i32, version: i32) -> f64 {
let mut sum: f64 = 0.0;
// バージョン0の場合: 通常の化学性走化性指数を計算
if version == 0 {
fo... |
fc64b8dbade30616d4df1fa7db4ddb991320e391f5be972c1dc8874ef6f3e2d1 | Rust | 1,306 | 39 | use crate::genetic_algorithm::ga::*;
use crate::simulation::*;
use rand::{rng, Rng};
// population_new関数はランダムな遺伝子を持つ個体群を生成します
pub fn population_new(gen_size: usize, pop_size: usize) -> Vec<Ga> {
let mut rng = rng();
let population: Vec<Ga> = (0..pop_size)
.map(|_| {
let gene: Gene = (0..gen... |
9a99e1775fff2b62c5040abb9a66bf8cd1dbf0b771a1dd0d744f9d2ecd301345 | Rust | 1,359 | 29 | use crate::simulation::gene::*;
use crate::simulation::setting::*;
// 構造体Timeはシミュレーションの時間関連の設定を保持するための構造体
#[allow(dead_code)]
pub struct Time {
pub n_time: usize, // 感覚ニューロンの時間スケールに対応するタイムステップ数
pub m_time: usize, // 運動ニューロンの時間スケールに対応するタイムステップ数
pub simulation_time: usize, // シミュレーション全体のタイムステップ数
pub f_in... |
23ed72073c433ca1835c398a7849bc91893a45eee74beb218da5e54801cf57fa | Rust | 1,397 | 40 | #[cfg(test_rustflag_cfg1 = "test_rustflag_cfg1_value")]
use std::os::raw::c_char;
#[no_mangle]
#[cfg(test_rustflag_cfg1 = "test_rustflag_cfg1_value")]
pub extern "C" fn rust_function(name: *const c_char) {
let name = unsafe { std::ffi::CStr::from_ptr(name).to_str().unwrap() };
println!("Hello, {}! I'm Rust!", ... |
c0e9ddfb9188ce4d76f8eaed7e48aea12509d00631e11bf4901aad4f039c60bf | Rust | 1,562 | 46 | use bio::alignment::pairwise::*;
use bio::scores::blosum62;
use block_aligner::scan_block::*;
use block_aligner::scores::*;
use block_aligner::cigar::*;
use std::{env, str};
fn main() {
let mut args = env::args().skip(1);
let mut q = args.next().unwrap();
q.make_ascii_uppercase();
let q = q.as_bytes(... |
3e30f9fa961fc6f4daf89209aa837bf5428b79299fd3184531dc061f348282da | Rust | 1,867 | 58 | use crate::genetic_algorithm::ga::*;
use crate::simulation::*;
use rand::{rng, Rng};
use rand_distr::{Distribution, Normal};
// mutation関数は遺伝子に突然変異を起こします
pub fn mutation(gene: &Ga, rate: f64, mean_std: (f64, f64)) -> Ga {
let mut rng = rng();
let normal = Normal::new(mean_std.0, mean_std.1).expect("Failed to c... |
ea3d745730e928573c8030d3c450f78ea1c4639ef9f43b1221a11575f7f2eb7b | Rust | 2,162 | 38 | use serde::{Deserialize, Serialize};
// ファイル名関連の情報を格納する構造体Filename
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Filename {
pub read_result_json: String, // 解析結果の JSON ファイルのパス
pub bearing_vs_curving_rate_output: String, // Bearing vs Turning Bias の出力ファイルのパス
pub nomal_gradient_vs_curving_rate_o... |
a2f43b72128d288fcd87f8c735bf43fca115990f0d6b2e0a70a788bde1e1152a | Rust | 2,269 | 55 | use crate::simulation::*;
pub fn curving_rate_bear(r_vec: &[[f64; 2]], time: &Time, periodic_number: &usize) -> Vec<f64> {
// カービングレート計算用の座標リストを初期化
let mut curving_point: Vec<[[f64; 2]; 2]> = Vec::new();
for i in 0..time.simulation_time - periodic_number * time.periodic_time {
curving_point.push([... |
e79f52088697cf132449609a1a0938273a0f17065ca1946c5d5a734f3267a14a | Rust | 2,311 | 76 | use crate::simulation::gene::*;
use crate::simulation::setting::*;
use crate::simulation::time::*;
use std::collections::VecDeque;
use std::f64::consts::PI;
// concentration関数は与えられた位置(x, y)における濃度を計算します
#[inline]
pub fn concentration(constant: &Const, x: f64, y: f64) -> f64 {
constant.alpha * ((x - constant.x_peak)... |
98adce875c916cc18de739e2184f69651e80150d0cd2b8754604064eaeb4b10b | Rust | 2,407 | 58 | use rand::{rng, Rng};
use serde::{Deserialize, Serialize};
// シミュレーション設定を表す構造体Setting
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Setting {
pub alpha: (f64, f64), // 濃度勾配の範囲
pub c_0: f64, // ガウス濃度の設定
pub lambda: f64, // ガウス濃度の設定
pub x_peak: f64, // 勾配のピーク... |
124de849645c59ee5b6a782cc53813f6cff6811d593d7f24a87a6fd30aa13e9b | Rust | 2,742 | 95 | use std::path::PathBuf;
use cargo_metadata::Metadata;
use clap::{App, Arg};
mod subcommands {
pub mod gen_cmake;
}
use subcommands::*;
// common options
const MANIFEST_PATH: &str = "manifest-path";
const CARGO_EXECUTABLE: &str = "cargo-executable";
const VERBOSE: &str = "verbose";
const LOCKED: &str = "locked";... |
5340f03dd079bd9bd5e5a34dbc884d7794d7972206be5ebbc38eb006226d15ab | Rust | 2,939 | 98 | use block_aligner::scan_block::*;
use block_aligner::scores::*;
use block_aligner::cigar::*;
use simulate_seqs::*;
use std::str;
fn consistent(i: usize, j: usize, cigar: &Cigar) -> bool {
let mut curr_i = 0;
let mut curr_j = 0;
for i in 0..cigar.len() {
let op_len = cigar.get(i);
match op... |
1eb49ada4d02c37a62797b1237a79d31b0483cb339688c14c2e93d028b011a5a | Rust | 3,464 | 104 | use block_aligner::scan_block::*;
use block_aligner::scores::*;
use block_aligner::cigar::*;
use std::fs::File;
use std::io::{BufRead, Write, BufReader, BufWriter};
use std::usize;
fn run_ours(r: &AAProfile, q: &PaddedBytes, min_size: &[usize], max_size: &[usize]) -> Vec<i32> {
let mut scores = Vec::new();
f... |
59f8c22befcac95fa7d6a8045e39c77ad20b346dbdf13bf354e234709ffce13d | Rust | 3,769 | 131 | // CLI wrapper around `multitaper_rs::compute_spectrogram`.
//
// Reads data + tapers (+optional eigen) from .npy, computes the multitaper
// spectrogram, writes the result to .npy, and prints a TIMING line.
use std::time::Instant;
use clap::Parser;
use ndarray::{Array1, Array2};
use ndarray_npy::{ReadNpyExt, WriteNp... |
3d2bb4051fd13af7d5be0743f8bed3a0a3ebdda4dca67ae4ef7329b70e649b13 | Rust | 3,858 | 118 | #[cfg(not(any(feature = "simd_wasm", feature = "simd_neon", feature = "no_simd")))]
use parasailors;
use block_aligner::scan_block::*;
use block_aligner::scores::*;
use block_aligner::cigar::*;
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::usize;
use std::time::{Instant, Duration};
use std::hint::bla... |
9ed2982cd3a86dac5fa129891efcef864c6ab8d1aee88878ae1572b9d7205b4b | Rust | 4,271 | 117 | //! SIMD-accelerated library for computing global and X-drop affine
//! gap penalty sequence-to-sequence or sequence-to-profile alignments
//! using an adaptive block-based algorithm.
//!
//! Currently, SSE2, AVX2, Neon, and WASM SIMD are supported.
//!
//! ## Example
//! ```
//! use block_aligner::{cigar::*, scan_bloc... |
9dce82d3dc933f4cc3c06906d103b0323d8a91fd518ff7606c182a60c7185f25 | Rust | 4,355 | 122 | //! End-to-end spectrogram test against the synthetic-EEG fixture.
//!
//! Runs `compute_spectrogram` on `sim_full_seed42` (a 300 s, 100 Hz EEG
//! sim with injected 1 Hz, 12 Hz and 60 Hz components plus motion
//! artifacts) and asserts:
//!
//! 1. Output shape matches `((freq_range_count), num_windows)`.
//! 2. T... |
189a1cdb0d25507c4a0b5e3e6bc841459ddfc3f3d1d570b81052683e75d0fb8f | Rust | 4,427 | 97 | // 遺伝子のデータを表現するための構造体Gene
#[derive(Clone, Debug)]
pub struct Gene {
pub gene: Vec<f64>, // 遺伝子データを格納するベクタ
}
// 遺伝子の定数を格納するための構造体GeneConst
pub struct GeneConst {
pub n: f64, // 感覚ニューロンの時間スケール
pub m: f64, // 運動ニューロンの時間スケール
pub theta: [f64; 8], // ニューロンの閾値
pub w_on: [f64; 8], //... |
caa71055ac73dfd0c276c8bbde63c9fdb708f98a3eb35ddcdff093876e847ced | Rust | 4,474 | 133 | use crate::analysis::bearing::*;
use crate::analysis::curving_rate::*;
use crate::analysis::normal_gradient::*;
use crate::analysis::translational_gradient::*;
use crate::simulation::*;
use rand::{rng, Rng};
use std::collections::VecDeque;
use std::f64::consts::PI;
#[allow(clippy::too_many_arguments)]
pub fn klinotaxi... |
8b61241b8f4d8b3e59fc025eb2fdf0b8c50a8b763ff2d1caeb9966522a2a47ce | Rust | 5,072 | 158 | //! Data structures and functions for working with CIGAR strings.
use std::fmt;
/// A match/mismatch, insertion, or deletion operation.
///
/// When aligning `q` against `r`, this represents the edit operations to get from `r` to `q`.
#[derive(Debug, PartialEq, Copy, Clone)]
#[repr(u8)]
pub enum Operation {
/// P... |
b0d1b68c3ccf7549b30b84c82825ab9e423f7263c3a73f0d7a5c1ec711c3244e | Rust | 5,146 | 176 | use anyhow::Result;
use ndarray::{ArrayView, Dim};
use numpy::{PyReadonlyArray1, PyReadonlyArray2};
use pyo3::prelude::*;
use rayon::prelude::*;
use std::{
collections::HashMap,
fs::File,
io::{BufWriter, Write},
sync::{Arc, Mutex},
};
#[derive(Debug)]
struct QueryInterval {
pub start: usize,
pu... |
51447290709e7252bf5e079ff07f1591ebfabfb98d5d348791f6c522d3e6807a | Rust | 5,183 | 160 | use std::{
fs::{create_dir_all, File},
io::{stdout, Write},
path::Path,
rc::Rc,
};
use clap::{App, Arg, ArgMatches, SubCommand};
mod target;
// Command name
pub const GEN_CMAKE: &str = "gen-cmake";
// Options
const OUT_FILE: &str = "out-file";
const CONFIGURATION_ROOT: &str = "configuration-root";
c... |
5c733a1232067dd963a596e90f10194780f82316a49e8c445bb362a8ebc7a3a1 | Rust | 5,262 | 87 | #[cfg(not(feature = "simd_avx2"))]
fn main() {}
#[cfg(feature = "simd_avx2")]
fn main() {
use block_aligner::scan_block::*;
use block_aligner::scores::*;
use block_aligner::cigar::*;
use image::{Rgb, RgbImage, ColorType};
use image::codecs::png::{PngEncoder, CompressionType, FilterType};
use i... |
3d8ea980af7c4d026bd55ff1e4dc52e62c6a2711972c98c393404c89ef49578c | Rust | 5,277 | 156 | use crate::analysis::bearing::*;
use crate::analysis::normal_gradient::*;
use crate::analysis::read_result::*;
use crate::analysis::setting::*;
use crate::analysis::translational_gradient::*;
use crate::genetic_algorithm::*;
use crate::simulation::*;
use std::fs;
use std::path::Path;
use toml::Value;
pub fn analytical... |
d68d1436c673ad59a5623c2ae7b5c7c43a9ab013ed03af03c1a8a7b01b06ef38 | Rust | 5,380 | 160 | use bio::scores::blosum62;
use block_aligner::scan_block::*;
use block_aligner::scores::*;
use simulate_seqs::*;
use std::{env, str, cmp};
fn test(iter: usize, len: usize, k: usize, verbose: bool) -> (usize, f64, i32, i32, usize) {
let mut wrong = 0usize;
let mut wrong_avg = 0f64;
let mut wrong_min = i32... |
6a1d81e84ed1ea5312a51194e91945d227f404f31d9823f8402a3d0628a59516 | Rust | 5,434 | 154 | use crate::analysis::klinotaxis::klinotaxis_analysis;
use crate::analysis::setting::*;
use crate::genetic_algorithm::*;
use crate::simulation::*;
use rayon::prelude::*;
use std::fs::File;
use std::io::Write;
pub fn bearing(
r_vec: &[[f64; 2]],
constant: &Const,
time: &Time,
periodic_number: &usize,
) -... |
d82ad172e5d30183789bf529dee6042e5b6cf66ef737f7fe8dc97f3717bc7eab | Rust | 5,981 | 161 | #[cfg(not(any(feature = "simd_wasm", feature = "simd_neon", feature = "no_simd")))]
use parasailors::{Matrix, *};
use block_aligner::scan_block::*;
use block_aligner::scores::*;
use block_aligner::cigar::*;
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::time::{Instant, Duration};
use std::hint::black_... |
5d5f03ffc6d939ddae2da8bfaad17d42b95489739eef8cba14bcfd2032bacb74 | Rust | 5,985 | 150 | #[cfg(not(feature = "simd_avx2"))]
fn main() {}
#[cfg(feature = "simd_avx2")]
fn test(file_name: &str, max_size: usize, name: &str, verbose: bool, writer: &mut impl std::io::Write) -> (usize, usize, usize, f64, usize, f64) {
use parasailors::{Matrix, *};
use rust_wfa2::aligner::*;
use bio::alignment::dis... |
82cecf0c2ee43832444d608459a23d367a7d1734f10ff6c3e634099bcc8a4e3b | Rust | 6,274 | 166 | #[cfg(not(any(feature = "simd_wasm", feature = "simd_neon", feature = "no_simd")))]
use parasailors::{Matrix, *};
use block_aligner::scan_block::*;
use block_aligner::scores::*;
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::time::{Instant, Duration};
use std::hint::black_box;
use std::iter;
use simu... |
6ea9476b177ba10ac2fdcdb5f0d1d673ee554d8823c392310d5390c465463008 | Rust | 6,275 | 190 | use crate::analysis::klinotaxis::klinotaxis_analysis;
use crate::analysis::setting::*;
use crate::genetic_algorithm::*;
use crate::simulation::*;
use rayon::prelude::*;
use std::fs::File;
use std::io::Write;
pub fn normal_gradient(
r_vec: &[[f64; 2]],
constant: &Const,
time: &Time,
periodic_number: &us... |
3d644d35c4ba579541e25f949e5a6643c986b4103b40765399b499c7ead4c33c | Rust | 6,333 | 189 | //! DPSS parity tests against MATLAB R2025a `dpss(N, NW, K)` plus
//! standalone sanity tests (orthonormality, eigenvalue residual,
//! concentration-ratio range, error on under-determined window).
//!
//! Fixtures generated by
//! `DYNAM-O_DesktopApp/scripts/generate_handoff_fixtures.m` and staged
//! into `tests/fixt... |
5a8b56cde9cd266f7f6e7345fa514e5bfef4b7c20bb76411b5d0b6ea1ea097ac | Rust | 6,492 | 164 | use crate::genetic_algorithm::crossover::*;
use crate::genetic_algorithm::evaluate::*;
use crate::genetic_algorithm::ga::*;
use crate::genetic_algorithm::mutation::*;
use crate::genetic_algorithm::population::*;
use crate::genetic_algorithm::setting::*;
use crate::simulation::*;
use rand::{rng, Rng};
use std::fs::File;... |
fc75e4b2e592c86169f949c3fb4bcc629f4bee38ad25f9e28e82e512077ee63a | Rust | 6,719 | 169 | use crate::genetic_algorithm::crossover::*;
use crate::genetic_algorithm::evaluate::*;
use crate::genetic_algorithm::ga::*;
use crate::genetic_algorithm::mutation::*;
use crate::genetic_algorithm::population::*;
use crate::genetic_algorithm::setting::*;
use crate::simulation::*;
use rand::{rng, Rng};
use std::fs::File;... |
440da19fb98107957833a694277e00ee2371f636f380cc32bf64b4940720ea36 | Rust | 6,848 | 175 | #![feature(test)]
extern crate test;
use test::{Bencher, black_box};
use bio::alignment::pairwise::*;
use bio::scores::blosum62;
#[cfg(not(any(feature = "simd_wasm", feature = "simd_neon")))]
use bio::alignment::distance::simd::bounded_levenshtein;
#[cfg(not(any(feature = "simd_wasm", feature = "simd_neon")))]
use ... |
0da9712de9b2ba89a651c6623d84851faa702f1d7bdb381b62ded1c7ca2d842b | Rust | 7,183 | 200 | use crate::simulation::function::*;
use crate::simulation::gene::*;
use crate::simulation::setting::*;
use crate::simulation::time::*;
use rand::{rng, Rng};
use std::collections::VecDeque;
use std::f64::consts::PI;
// chemotaxis_index関数は化学的走化性指数を計算します
pub fn chemotaxis_index(gene: &Gene, setting: &Setting) -> f64 {
... |
5bf023bb8ab07a001e839303655a2d8d881f10e7b15c25bde041e5694ae8704c | Rust | 7,685 | 211 | use bio::alignment::pairwise::*;
use bio::alignment::{Alignment, AlignmentOperation};
use bio::scores::blosum62;
use block_aligner::scan_block::*;
use block_aligner::scores::*;
use block_aligner::cigar::*;
use std::{env, cmp};
use std::fs::File;
use std::io::{BufRead, Write, BufReader, BufWriter};
use std::usize;
fn... |
90e98b35b30c42ff159715200ccb253f46501a33c2369933914b4a0182fcbf2c | Rust | 7,735 | 217 | #[cfg(not(any(feature = "simd_wasm", feature = "simd_neon", feature = "no_simd")))]
use parasailors::{Matrix, *};
#[cfg(not(any(feature = "simd_wasm", feature = "simd_neon", feature = "no_simd")))]
use rust_wfa2::aligner::*;
#[cfg(not(any(feature = "simd_wasm", feature = "simd_neon", feature = "no_simd")))]
use edlib... |
f40c4e5d7068443aa595a250ad19807d2add273206e1a5cbac82654150998a84 | Rust | 8,190 | 226 | use std::error::Error;
use std::path::PathBuf;
use std::rc::Rc;
#[derive(Clone)]
pub enum CargoTargetType {
Executable,
Library {
has_staticlib: bool,
has_cdylib: bool,
},
}
#[derive(Clone)]
pub struct CargoTarget {
cargo_package: Rc<cargo_metadata::Package>,
cargo_target: cargo_me... |
bf08174f71b2c654d38313c313e9093e2a053be094270c7ed7521189012209f0 | Rust | 8,875 | 246 | //use parasailors::{Matrix, *};
use bio::alignment::pairwise::*;
use bio::scores::blosum62;
use block_aligner::scan_block::*;
use block_aligner::scores::*;
use simulate_seqs::*;
use std::{env, str, cmp};
fn test(iter: usize, len: usize, k: usize, slow: bool, insert_len: Option<usize>, nuc: bool, max_size: usize, ve... |
c519788584a77dec2b500086c48f77f987257d7fe5c68d08ed5636065e4d1b67 | Rust | 9,056 | 251 | use block_aligner::scan_block::*;
use block_aligner::scores::*;
use std::{env, cmp};
use std::fs::File;
use std::io::{BufRead, BufReader};
fn test(file_name: &str, max_size: usize, x_drop: i32) -> (usize, usize, f64, usize, f64) {
let reader = BufReader::new(File::open(file_name).unwrap());
let mut count = 0;... |
a3821d0dcca871d5a3d0db33f3c9c215b7d4e51ee121d75eb9df2216b9f3daec | Rust | 9,383 | 266 | use crate::analysis::klinotaxis::klinotaxis_analysis;
use crate::analysis::setting::*;
use crate::genetic_algorithm::*;
use crate::simulation::*;
use rayon::prelude::*;
use std::fs::File;
use std::io::Write;
pub fn translational_gradient(
r_vec: &[[f64; 2]],
constant: &Const,
time: &Time,
periodic_numb... |
404a4361d8ffdc0228ade7196330ef88f1e6b6397ab17a0faf801caad57aaded | Rust | 12,406 | 519 | #![allow(dead_code)]
use core::{cmp, ptr};
pub type Simd = u128; // 8 × i16 packed little-endian
pub type HalfSimd = u128; // 16 × i8 packed little-endian
pub type LutSimd = u128; // 16 × i8 packed little-endian
pub type TraceType = i16;
/// Number of 16-bit lanes in a SIMD vector.
pub const L: usize = 8;
pub c... |
c908af225b028b69a33f0e52472289d280a9485074ae6b318ff00b3ceb535e44 | Rust | 14,932 | 515 | use std::arch::aarch64::*;
pub type Simd = int16x8_t;
pub type HalfSimd = int8x8_t;
pub type LutSimd = int8x16_t;
pub type TraceType = i16;
/// Number of 16-bit lanes in a SIMD vector.
pub const L: usize = 8;
pub const L_BYTES: usize = L * 2;
pub const HALFSIMD_MUL: usize = 1;
// using min = 0 is faster, but restricts... |
21f038ce3d2a857b3707910a2ad948c3b3c506db3fc9a12716a881d5bd315f27 | Rust | 15,151 | 451 | // Rust port of the multitaper spectrogram core loop.
//
// Mirrors `calc_mts_batch` in
// /Users/Mike/code/labcode_main/multitaper/python/multitaper_spectrogram_python.py
// and the one-sided PSD scaling applied by `multitaper_spectrogram`.
//
// This library crate exposes a `compute_spectrogram` function usable from ... |
394bf48c1bde935d7504df6ce0abf0a562f29d214d7ffda8878b7ee78b15f05b | Rust | 15,184 | 490 | #[cfg(target_arch = "x86")]
use std::arch::x86::*;
#[cfg(target_arch = "x86_64")]
use std::arch::x86_64::*;
pub type Simd = __m256i; // use for storing DP scores
pub type HalfSimd = __m128i; // used for storing bytes (sequence or scoring matrix)
pub type LutSimd = __m128i; // used for storing a row in a scoring matrix... |
16b5b96e0cfcb84690443606bd7e21ef944df2d89aa3119b797f6350b52032f3 | Rust | 17,306 | 564 | use std::arch::wasm32::*;
pub type Simd = v128;
// no v64 type, so HalfSimd is just v128 with upper half ignored
pub type HalfSimd = v128;
pub type LutSimd = v128;
pub type TraceType = i16;
/// Number of 16-bit lanes in a SIMD vector.
pub const L: usize = 8;
pub const L_BYTES: usize = L * 2;
pub const HALFSIMD_MUL: us... |
fa3950692309cfe7dfea2a7e8580e77728ae013d17591862571a457b3f1cdb67 | Rust | 17,477 | 478 | //! Discrete Prolate Spheroidal Sequences (DPSS / Slepian) taper generation.
//!
//! Pure-Rust port of `scipy.signal.windows.dpss(N, NW, K, return_ratios=True)`.
//! Removes the MATLAB / scipy dependency for the standalone CLI.
//!
//! # Algorithm
//!
//! Slepian (1978) showed that the DPSS tapers are the eigenvectors ... |
49b74db6b561bbec2771e2c354c8ca46beaef8c5391fe58ab0908560852a9f0d | Rust | 18,209 | 601 | #[cfg(target_arch = "x86")]
use std::arch::x86::*;
#[cfg(target_arch = "x86_64")]
use std::arch::x86_64::*;
pub type Simd = __m128i; // use for storing DP scores
pub type HalfSimd = __m128i; // used for storing bytes (sequence or scoring matrix)
pub type LutSimd = __m128i; // used for storing a row in a scoring matrix... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.