From a7b0e08f69b5a3527f78119bc0cf220ddca64597 Mon Sep 17 00:00:00 2001 From: Manuel Holtgrewe Date: Sat, 21 Oct 2023 10:02:21 +0200 Subject: [PATCH] fix: switching from unmaintained tempdir to tempfile (#227) --- Cargo.lock | 136 +++++++++------------------------- Cargo.toml | 2 +- src/annotate/strucvars/mod.rs | 7 +- 3 files changed, 41 insertions(+), 104 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f064de7d..b2f83b7d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -49,7 +49,7 @@ dependencies = [ "mime", "percent-encoding", "pin-project-lite", - "rand 0.8.5", + "rand", "sha1", "smallvec", "tokio", @@ -268,7 +268,7 @@ dependencies = [ "clap", "clap-verbosity-flag", "csv", - "enum-map 2.6.3", + "enum-map 2.7.0", "env_logger", "flate2", "hgvs", @@ -463,7 +463,7 @@ dependencies = [ "num-traits", "ordered-float", "petgraph", - "rand 0.8.5", + "rand", "regex", "serde", "serde_derive", @@ -766,9 +766,9 @@ checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "cpufeatures" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" +checksum = "3fbc60abd742b35f2492f808e1abbb83d45f72db402e14c55057edc9c7b1e9e4" dependencies = [ "libc", ] @@ -997,9 +997,9 @@ dependencies = [ [[package]] name = "enum-map" -version = "2.6.3" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c188012f8542dee7b3996e44dd89461d64aa471b0a7c71a1ae2f595d259e96e5" +checksum = "53337c2dbf26a3c31eccc73a37b10c1614e8d4ae99b6a50d553e8936423c1f16" dependencies = [ "enum-map-derive 0.14.0", "serde", @@ -1117,12 +1117,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "fuchsia-cprng" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" - [[package]] name = "futures" version = "0.3.28" @@ -1299,9 +1293,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.14.1" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dfda62a12f55daeae5015f81b0baea145391cb4520f86c248fc615d72640d12" +checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" dependencies = [ "ahash", "allocator-api2", @@ -1313,7 +1307,7 @@ version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" dependencies = [ - "hashbrown 0.14.1", + "hashbrown 0.14.2", ] [[package]] @@ -1343,7 +1337,7 @@ dependencies = [ "base16ct", "bio", "chrono", - "enum-map 2.6.3", + "enum-map 2.7.0", "flate2", "indexmap 2.0.2", "lazy_static", @@ -1464,7 +1458,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" dependencies = [ "equivalent", - "hashbrown 0.14.1", + "hashbrown 0.14.2", "serde", ] @@ -1523,7 +1517,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ "hermit-abi", - "rustix 0.38.19", + "rustix 0.38.20", "windows-sys 0.48.0", ] @@ -1776,8 +1770,8 @@ dependencies = [ "prost", "prost-build", "quick_cache", - "rand 0.8.5", - "rand_core 0.6.4", + "rand", + "rand_core", "rocksdb", "rstest", "rustc-hash", @@ -1787,7 +1781,7 @@ dependencies = [ "serde_with", "strum", "temp_testdir", - "tempdir", + "tempfile", "thousands", "tracing", "tracing-subscriber", @@ -1864,7 +1858,7 @@ dependencies = [ "num-complex", "num-rational", "num-traits", - "rand 0.8.5", + "rand", "rand_distr", "simba", "typenum", @@ -1954,9 +1948,9 @@ checksum = "94fbe3192fe33acacabaedd387657f39b0fc606f1996d546db0dfe14703b843a" [[package]] name = "noodles-csi" -version = "0.25.0" +version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f327250086b20edade50756b6aee1851d656a3a5967cf94cbe4d4e10a5ef85d7" +checksum = "39d86e55b4784ba7c38b4ffbfc24e122bc05ce971b0a664e8e1a15ffd9de68a7" dependencies = [ "bit-vec", "byteorder", @@ -2249,7 +2243,7 @@ dependencies = [ "hmac", "md-5", "memchr", - "rand 0.8.5", + "rand", "sha2", "stringprep", ] @@ -2408,7 +2402,7 @@ checksum = "f69f8d22fa3f34f3083d9a4375c038732c7a7e964de1beb81c544da92dfc40b8" dependencies = [ "ahash", "equivalent", - "hashbrown 0.14.1", + "hashbrown 0.14.2", "parking_lot", ] @@ -2421,19 +2415,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "rand" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" -dependencies = [ - "fuchsia-cprng", - "libc", - "rand_core 0.3.1", - "rdrand", - "winapi", -] - [[package]] name = "rand" version = "0.8.5" @@ -2442,7 +2423,7 @@ checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", "rand_chacha", - "rand_core 0.6.4", + "rand_core", ] [[package]] @@ -2452,24 +2433,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core 0.6.4", -] - -[[package]] -name = "rand_core" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -dependencies = [ - "rand_core 0.4.2", + "rand_core", ] -[[package]] -name = "rand_core" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" - [[package]] name = "rand_core" version = "0.6.4" @@ -2486,7 +2452,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32cb0b9bc82b0a0876c2dd994a7e7a2683d3e7390ca40e6886785ef0c7e3ee31" dependencies = [ "num-traits", - "rand 0.8.5", + "rand", ] [[package]] @@ -2515,15 +2481,6 @@ dependencies = [ "crossbeam-utils", ] -[[package]] -name = "rdrand" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -dependencies = [ - "rand_core 0.3.1", -] - [[package]] name = "redox_syscall" version = "0.3.5" @@ -2583,15 +2540,6 @@ version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c707298afce11da2efef2f600116fa93ffa7a032b5d7b628aa17711ec81383ca" -[[package]] -name = "remove_dir_all" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi", -] - [[package]] name = "rocksdb" version = "0.21.0" @@ -2702,9 +2650,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.19" +version = "0.38.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "745ecfa778e66b2b63c88a61cb36e0eea109e803b0b86bf9879fbc77c70e86ed" +checksum = "67ce50cb2e16c2903e30d1cbccfd8387a74b9d4c938b6a4c5ec6cc7556f7a8a0" dependencies = [ "bitflags 2.4.1", "errno", @@ -2928,9 +2876,9 @@ checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" [[package]] name = "socket2" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ "libc", "windows-sys 0.48.0", @@ -2946,7 +2894,7 @@ dependencies = [ "lazy_static", "nalgebra", "num-traits", - "rand 0.8.5", + "rand", ] [[package]] @@ -3045,16 +2993,6 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "921f1e9c427802414907a48b21a6504ff6b3a15a1a3cf37e699590949ad9befc" -[[package]] -name = "tempdir" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" -dependencies = [ - "rand 0.4.6", - "remove_dir_all", -] - [[package]] name = "tempfile" version = "3.8.0" @@ -3064,7 +3002,7 @@ dependencies = [ "cfg-if", "fastrand", "redox_syscall 0.3.5", - "rustix 0.38.19", + "rustix 0.38.20", "windows-sys 0.48.0", ] @@ -3079,18 +3017,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.49" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1177e8c6d7ede7afde3585fd2513e611227efd6481bd78d2e82ba1ce16557ed4" +checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.49" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc" +checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", @@ -3193,7 +3131,7 @@ dependencies = [ "pin-project-lite", "postgres-protocol", "postgres-types", - "rand 0.8.5", + "rand", "socket2", "tokio", "tokio-util", @@ -3341,7 +3279,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "88ad59a7560b41a70d191093a945f0b87bc1deeda46fb237479708a1d6b6cdfc" dependencies = [ "getrandom", - "rand 0.8.5", + "rand", "serde", ] @@ -3451,7 +3389,7 @@ dependencies = [ "either", "home", "once_cell", - "rustix 0.38.19", + "rustix 0.38.20", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index d9e1f604..1e29e6fe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -66,7 +66,7 @@ serde_json = "1.0" serde = { version = "1.0", features = ["derive"] } serde_with = { version = "3.3", features = ["indexmap_2"] } strum = { version = "0.25", features = ["derive"] } -tempdir = "0.3" +tempfile = "3" thousands = "0.2" tracing-subscriber = "0.3" tracing = { version = "0.1", features = ["log"] } diff --git a/src/annotate/strucvars/mod.rs b/src/annotate/strucvars/mod.rs index a50a59c4..496979f0 100644 --- a/src/annotate/strucvars/mod.rs +++ b/src/annotate/strucvars/mod.rs @@ -39,7 +39,6 @@ use rand_core::SeedableRng; use serde::{Deserialize, Serialize}; use std::ops::Deref; use strum::{Display, EnumIter, IntoEnumIterator}; -use tempdir::TempDir; use uuid::Uuid; use self::bnd::Breakend; @@ -2647,7 +2646,7 @@ pub fn run_vcf_to_jsonl( reader: &mut noodles_vcf::Reader>, header: &VcfHeader, sv_caller: &SvCaller, - tmp_dir: &TempDir, + tmp_dir: &tempfile::TempDir, cov_readers: &mut HashMap, rng: &mut StdRng, ) -> Result<(), anyhow::Error> { @@ -2745,7 +2744,7 @@ fn annotate_cov_mq( /// /// The clustered records for the contig. pub fn read_and_cluster_for_contig( - tmp_dir: &TempDir, + tmp_dir: &tempfile::TempDir, contig_no: usize, slack_ins: i32, slack_bnd: i32, @@ -2881,7 +2880,7 @@ fn run_with_writer( // Create temporary directory. We will create one temporary file (containing `jsonl` // seriealized `VarFishStrucvarTsvRecord`s) for each SV type and contig. - let tmp_dir = TempDir::new("mehari")?; + let tmp_dir = tempfile::Builder::new().prefix("mehari").tempdir()?; // Read through input VCF files and write out to temporary files. tracing::info!("Input VCF files to temporary files...");