From 36f69046e13d807d13ab9ccecec2b52dc770b485 Mon Sep 17 00:00:00 2001 From: Pierre Marijon Date: Thu, 7 Nov 2024 17:11:00 +0100 Subject: [PATCH] feat: Update dependency and bump msrv --- .github/workflows/main.yml | 8 +- Cargo.lock | 617 +++++++++++++++++++++++------------- Cargo.toml | 5 +- Readme.md | 2 +- src/editor/extract.rs | 5 +- src/editor/filter.rs | 3 +- src/editor/scrubbing.rs | 27 +- src/editor/split.rs | 27 +- src/reads2ovl/fullmemory.rs | 4 +- src/reads2ovl/mod.rs | 4 +- src/reads2ovl/ondisk.rs | 4 +- 11 files changed, 439 insertions(+), 267 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 23f1516..ad9bb49 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -77,10 +77,10 @@ jobs: use-tool-cache: true - name: Run cargo-tarpaulin - run: cargo tarpaulin --all-features --timeout 600 --out Xml -- --test-threads 1 + run: cargo tarpaulin --all-features --engine llvm --follow-exec --timeout 600 --out Xml -- --test-threads 1 - name: Upload coverage to codecov - uses: codecov/codecov-action@v1.0.3 + uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} @@ -118,11 +118,11 @@ jobs: - uses: actions-rs/toolchain@v1 with: - toolchain: 1.57 + toolchain: 1.74 override: true - name: check if Readme matches MSRV defined here - run: grep '1.57' Readme.md + run: grep '1.74' Readme.md - name: Run tests uses: actions-rs/cargo@v1 diff --git a/Cargo.lock b/Cargo.lock index 991c82d..de3acfb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3,25 +3,43 @@ version = 3 [[package]] -name = "adler" -version = "1.0.2" +name = "adler2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" [[package]] name = "aho-corasick" -version = "0.7.18" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] +[[package]] +name = "aligned" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "377e4c0ba83e4431b10df45c1d4666f178ea9c552cac93e60c3a88bf32785923" +dependencies = [ + "as-slice", +] + [[package]] name = "anyhow" -version = "1.0.58" +version = "1.0.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" + +[[package]] +name = "as-slice" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb07d2053ccdbe10e2af2995a2f116c1330396493dc1269f6a91d0ae82e19704" +checksum = "516b6b4f0e40d50dcda9365d53964ec74560ad4284da2e7fc97122cd83174516" +dependencies = [ + "stable_deref_trait", +] [[package]] name = "atty" @@ -36,15 +54,15 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.1.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bgzip" -version = "0.2.1" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b24c7834de214cf8da3054a155602eb727eba3bb4bbd07f3114f337421c15acf" +checksum = "b64fd8980fb64af5951bc05de7772b598150a6f7eac42ec17f73e8489915f99b" dependencies = [ "flate2", "thiserror", @@ -65,29 +83,39 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + [[package]] name = "bstr" -version = "0.2.17" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" +checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c" dependencies = [ - "lazy_static", "memchr", - "regex-automata", "serde", ] [[package]] name = "byteorder" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" [[package]] name = "bzip2" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6afcd980b5f3a45017c57e57a2fcccbb351cc43a356ce117ef760ef8052b89b0" +checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8" dependencies = [ "bzip2-sys", "libc", @@ -106,11 +134,13 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.73" +version = "1.1.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" +checksum = "baee610e9452a8f6f0a1b6194ec09ff9e2d85dea54432acdae41aa0761c95d70" dependencies = [ "jobserver", + "libc", + "shlex", ] [[package]] @@ -119,14 +149,20 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + [[package]] name = "clap" -version = "3.2.14" +version = "3.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54635806b078b7925d6e36810b1755f2a4b5b4d57560432c1ecf60bcbe10602b" +checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" dependencies = [ "atty", - "bitflags", + "bitflags 1.3.2", "clap_derive", "clap_lex", "indexmap", @@ -138,15 +174,15 @@ dependencies = [ [[package]] name = "clap_derive" -version = "3.2.7" +version = "3.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "759bf187376e1afa7b85b959e6a664a3e7a95203415dba952ad19139e798f902" +checksum = "ae6371b8bdc8b7d3959e9cf7b22d4435ef3e79e138688421ec654acf8c81b008" dependencies = [ "heck", "proc-macro-error", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -160,65 +196,53 @@ dependencies = [ [[package]] name = "crc32fast" -version = "1.3.2" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" dependencies = [ "cfg-if", ] [[package]] name = "crossbeam-channel" -version = "0.5.6" +version = "0.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" +checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" dependencies = [ - "cfg-if", "crossbeam-utils", ] [[package]] name = "crossbeam-deque" -version = "0.8.2" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" dependencies = [ - "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" -version = "0.9.10" +version = "0.9.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "045ebe27666471bb549370b4b0b3e51b07f56325befa4284db65fc89c02511b1" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" dependencies = [ - "autocfg", - "cfg-if", "crossbeam-utils", - "memoffset", - "once_cell", - "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.11" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51887d4adc7b564537b15adcfb307936f8075dfcd5f00dde9a9f1d29383682bc" -dependencies = [ - "cfg-if", - "once_cell", -] +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" [[package]] name = "csv" -version = "1.1.6" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1" +checksum = "ac574ff4d437a7b5ad237ef331c17ccca63c46479e5b5453eb8e10bb99a759fe" dependencies = [ - "bstr", "csv-core", "itoa", "ryu", @@ -227,24 +251,33 @@ dependencies = [ [[package]] name = "csv-core" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" +checksum = "5efa2b3d7902f4b634a20cae3c9c4e6209dc4779feb6863329607560143efa70" dependencies = [ "memchr", ] +[[package]] +name = "cvt" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2ae9bf77fbf2d39ef573205d554d87e86c12f1994e9ea335b0651b9b278bcf1" +dependencies = [ + "cfg-if", +] + [[package]] name = "either" -version = "1.7.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f107b87b6afc2a64fd13cac55fe06d6c8859f12d4b14cbcdd2c67d0976781be" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "env_logger" -version = "0.9.0" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" +checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" dependencies = [ "atty", "humantime", @@ -254,19 +287,26 @@ dependencies = [ ] [[package]] -name = "fastrand" -version = "1.8.0" +name = "errno" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" dependencies = [ - "instant", + "libc", + "windows-sys 0.52.0", ] +[[package]] +name = "fastrand" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" + [[package]] name = "flate2" -version = "1.0.24" +version = "1.0.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" +checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0" dependencies = [ "crc32fast", "miniz_oxide", @@ -282,6 +322,20 @@ dependencies = [ "winapi", ] +[[package]] +name = "fs_at" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14af6c9694ea25db25baa2a1788703b9e7c6648dcaeeebeb98f7561b5384c036" +dependencies = [ + "aligned", + "cfg-if", + "cvt", + "libc", + "nix", + "windows-sys 0.52.0", +] + [[package]] name = "fxhash" version = "0.2.1" @@ -299,9 +353,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "heck" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" @@ -320,9 +374,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "indexmap" -version = "1.9.1" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", "hashbrown", @@ -330,64 +384,48 @@ dependencies = [ [[package]] name = "instant" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" dependencies = [ "cfg-if", ] [[package]] name = "itoa" -version = "0.4.8" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jobserver" -version = "0.1.24" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af25a77299a7f711a01975c35a6a424eb6862092cc2d6c72c4ed6cbc56dfc1fa" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" dependencies = [ "libc", ] -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - [[package]] name = "libc" -version = "0.2.126" +version = "0.2.162" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" +checksum = "18d287de67fe55fd7e1581fe933d965a5a9477b38e949cfa9f8574ef01506398" [[package]] -name = "lock_api" -version = "0.4.7" +name = "liblzma" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" +checksum = "603222e049bf0da71529325ada5d02dc3871cbd3679cf905429f7f0de93da87b" dependencies = [ - "autocfg", - "scopeguard", + "liblzma-sys", ] [[package]] -name = "log" -version = "0.4.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "lzma-sys" -version = "0.1.19" +name = "liblzma-sys" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e06754c4acf47d49c727d5665ca9fb828851cda315ed3bd51edd148ef78a8772" +checksum = "6630cb23edeb2e563cd6c30d4117554c69646871455843c33ddcb1d9aef82ecf" dependencies = [ "cc", "libc", @@ -395,49 +433,74 @@ dependencies = [ ] [[package]] -name = "memchr" -version = "2.5.0" +name = "linux-raw-sys" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] -name = "memoffset" -version = "0.6.5" +name = "lock_api" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ "autocfg", + "scopeguard", ] +[[package]] +name = "log" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + [[package]] name = "miniz_oxide" -version = "0.5.3" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f5c75688da582b8ffc1f1799e9db273f32133c49e048f614d22ec3256773ccc" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" dependencies = [ - "adler", + "adler2", ] [[package]] name = "niffler" -version = "2.4.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68c7ffd42bdba05fc9fbfda31283d44c5c8a88fed1a191f68795dba23cc8204b" +checksum = "bd625dd485c2d20bdb98d7ec364f798b256ac09997ef18b4274be2168f53a647" dependencies = [ "bgzip", "bzip2", "cfg-if", "flate2", + "liblzma", "thiserror", - "xz2", "zstd", ] +[[package]] +name = "nix" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" +dependencies = [ + "bitflags 2.6.0", + "cfg-if", + "cfg_aliases", + "libc", +] + [[package]] name = "noodles" -version = "0.18.0" +version = "0.84.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46b363071107c31b072a8545082d8f41703d4ff73443c3042c55ada6b1e3cbe7" +checksum = "651989969f399b6c5a44563b4f93e27c8753361169ef433a9c1f6b8ea135ab66" dependencies = [ "noodles-fasta", "noodles-fastq", @@ -445,29 +508,33 @@ dependencies = [ [[package]] name = "noodles-bgzf" -version = "0.8.0" +version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46188f1df92074ef4acc9a0f849a3f70c95c87641863c1c04b2827d3063ecf36" +checksum = "3b50aaa8f0a3c8a0b738b641a6d1a78d9fd30a899ab2d398779ee3c4eb80f1c1" dependencies = [ "byteorder", + "bytes", + "crossbeam-channel", "flate2", ] [[package]] name = "noodles-core" -version = "0.3.4" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c35afd686e72e4f6240c67fc7cbddfc1b4f07cbec35151b2caedbb3d667882b4" +checksum = "c5a8c6b020d1205abef2b0fab4463a6c5ecc3c8f4d561ca8b0d1a42323376200" dependencies = [ - "noodles-sam", + "bstr", ] [[package]] name = "noodles-fasta" -version = "0.6.0" +version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d55244fd143300bc77c900060c4dd67d8ca9a6ffd4547ca8bf3855464029e4e4" +checksum = "fde46cd7109fec9bb035ddceb95476531d057c1e61106b79a3a5b8d7ee7d5ee9" dependencies = [ + "bstr", + "bytes", "memchr", "noodles-bgzf", "noodles-core", @@ -475,43 +542,34 @@ dependencies = [ [[package]] name = "noodles-fastq" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92d3cb2bb5dc82e7f3126a390636037c043145299b1e8b0c98703b39e92f516b" - -[[package]] -name = "noodles-sam" -version = "0.11.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "487017ca18f7a7cc773a4c01544e1e0fe1c005b8703bf84bee3b12480b2675a0" +checksum = "1606247d99eae65370cdb0ef5590f109a5286d57c06da8e738466cf95a4509d5" dependencies = [ - "bitflags", - "indexmap", - "noodles-bgzf", - "rustc-hash", + "bstr", + "memchr", ] [[package]] -name = "num_cpus" -version = "1.13.1" +name = "normpath" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" +checksum = "c8911957c4b1549ac0dc74e30db9c8b0e66ddcd6d7acc33098f4c63a64a6d7ed" dependencies = [ - "hermit-abi", - "libc", + "windows-sys 0.59.0", ] [[package]] name = "once_cell" -version = "1.13.0" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "os_str_bytes" -version = "6.2.0" +version = "6.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "648001efe5d5c0102d8cea768e348da85d90af8ba91f0bea908f157951493cd4" +checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1" [[package]] name = "parking_lot" @@ -526,9 +584,9 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" +checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" dependencies = [ "cfg-if", "instant", @@ -540,9 +598,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.25" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "proc-macro-error" @@ -553,7 +611,7 @@ dependencies = [ "proc-macro-error-attr", "proc-macro2", "quote", - "syn", + "syn 1.0.109", "version_check", ] @@ -570,98 +628,92 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.41" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdcc2916cde080c1876ff40292a396541241fe0072ef928cd76582e9ea5d60d2" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.20" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] [[package]] name = "rayon" -version = "1.5.3" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" dependencies = [ - "autocfg", - "crossbeam-deque", "either", "rayon-core", ] [[package]] name = "rayon-core" -version = "1.9.3" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" dependencies = [ - "crossbeam-channel", "crossbeam-deque", "crossbeam-utils", - "num_cpus", ] [[package]] name = "redox_syscall" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534cfe58d6a18cc17120fbf4635d53d14691c1fe4d951064df9bd326178d7d5a" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] name = "regex" -version = "1.6.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", + "regex-automata", "regex-syntax", ] [[package]] name = "regex-automata" -version = "0.1.10" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] [[package]] name = "regex-syntax" -version = "0.6.27" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "remove_dir_all" -version = "0.5.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi", -] - -[[package]] -name = "remove_dir_all" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "882f368737489ea543bc5c340e6f3d34a28c39980bd9a979e47322b26f60ac40" +checksum = "a694f9e0eb3104451127f6cc1e5de55f59d3b1fc8c5ddfaeb6f1e716479ceb4a" dependencies = [ + "cfg-if", + "cvt", + "fs_at", "libc", - "log", - "num_cpus", - "rayon", - "winapi", + "normpath", + "windows-sys 0.59.0", ] [[package]] @@ -670,38 +722,57 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustix" +version = "0.38.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "375116bee2be9ed569afe2154ea6a99dfdffd257f533f187498c2a8f5feaf4ee" +dependencies = [ + "bitflags 2.6.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.52.0", +] + [[package]] name = "ryu" -version = "1.0.10" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "scopeguard" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" -version = "1.0.140" +version = "1.0.214" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc855a42c7967b7c369eb5860f7164ef1f6f81c20c7cc1141f2a604e18723b03" +checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.140" +version = "1.0.214" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f2122636b9fe3b81f1cb25099fcf2d3f542cdb1d45940d56c713158884a05da" +checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.87", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "sled" version = "0.34.7" @@ -720,9 +791,15 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.9.0" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "strsim" @@ -732,9 +809,20 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "syn" -version = "1.0.98" +version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" dependencies = [ "proc-macro2", "quote", @@ -743,64 +831,63 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.3.0" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" +checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" dependencies = [ "cfg-if", "fastrand", - "libc", - "redox_syscall", - "remove_dir_all 0.5.3", - "winapi", + "once_cell", + "rustix", + "windows-sys 0.59.0", ] [[package]] name = "termcolor" -version = "1.1.3" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" dependencies = [ "winapi-util", ] [[package]] name = "textwrap" -version = "0.15.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" +checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" [[package]] name = "thiserror" -version = "1.0.31" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" +checksum = "02dd99dc800bbb97186339685293e1cc5d9df1f8fae2d0aecd9ff1c77efea892" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.31" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" +checksum = "a7c61ec9a6f64d2793d8a45faba21efbe3ced62a886d44c36a009b2b519b4c7e" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.87", ] [[package]] name = "unicode-ident" -version = "1.0.2" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15c61ba63f9235225a22310255a29b806b907c9b8c964bcbd0a2c70f3f2deea7" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "winapi" @@ -820,11 +907,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.5" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "winapi", + "windows-sys 0.59.0", ] [[package]] @@ -834,14 +921,87 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] -name = "xz2" -version = "0.1.7" +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388c44dc09d76f1536602ead6d325eb532f5c122f17782bd57fb47baeeb767e2" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ - "lzma-sys", + "windows-targets", ] +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + [[package]] name = "yacrd" version = "1.0.0" @@ -855,7 +1015,7 @@ dependencies = [ "niffler", "noodles", "rayon", - "remove_dir_all 0.7.0", + "remove_dir_all", "rustc-hash", "serde", "sled", @@ -865,29 +1025,28 @@ dependencies = [ [[package]] name = "zstd" -version = "0.7.0+zstd.1.4.9" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9428752481d8372e15b1bf779ea518a179ad6c771cca2d2c60e4fbff3cc2cd52" +checksum = "fcf2b778a664581e31e389454a7072dab1647606d44f7feea22cd5abb9c9f3f9" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "3.1.0+zstd.1.4.9" +version = "7.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa1926623ad7fe406e090555387daf73db555b948134b4d73eac5eb08fb666d" +checksum = "54a3ab4db68cea366acc5c897c7b4d4d1b8994a9cd6e6f841f8964566a419059" dependencies = [ - "libc", "zstd-sys", ] [[package]] name = "zstd-sys" -version = "1.5.0+zstd.1.4.9" +version = "2.0.13+zstd.1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e6c094340240369025fc6b731b054ee2a834328fa584310ac96aa4baebdc465" +checksum = "38ff0f21cfee8f97d94cef41359e0c89aa6113028ab0291aa8ca0038995a95aa" dependencies = [ "cc", - "libc", + "pkg-config", ] diff --git a/Cargo.toml b/Cargo.toml index be61bc1..b4e4fd3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,7 @@ name = "yacrd" version = "1.0.0" authors = ["Pierre Marijon "] edition = '2021' +rust-version = "1.74" exclude = ["image/*", "tests/*"] @@ -14,7 +15,7 @@ license = "MIT" keywords = ["bioinformatics", "chimera", "long-read", "scrubbing"] [dependencies] -noodles = { version = "0.18", features = ["fasta", "fastq"] } +noodles = { version = "0.84", features = ["fasta", "fastq"] } csv = { version = "1" } log = "0.4" sled = "0.34" @@ -27,7 +28,7 @@ niffler = "2" thiserror = "1" env_logger = "0.9" rustc-hash = "1" -remove_dir_all = "0.7" +remove_dir_all = "0.8" [dev-dependencies] tempfile = "3" diff --git a/Readme.md b/Readme.md index f651eb0..b8207bb 100644 --- a/Readme.md +++ b/Readme.md @@ -168,7 +168,7 @@ Here, readB is chimeric with 2 zero-coverage regions: one between bases 1260 and ## Minimum supported Rust version -Currently the minimum supported Rust version is 1.57. +Currently the minimum supported Rust version is 1.74. ## Citation diff --git a/src/editor/extract.rs b/src/editor/extract.rs index d707426..fac69d2 100644 --- a/src/editor/extract.rs +++ b/src/editor/extract.rs @@ -79,13 +79,12 @@ where let records = reader.records(); for result in records { - println!("PROUT"); - let record = result.with_context(|| error::Error::ReadingErrorNoFilename { format: util::FileType::Fasta, })?; - let (badregion, length) = badregions.get_bad_part(record.name())?; + let (badregion, length) = badregions + .get_bad_part(&unsafe { String::from_utf8_unchecked(record.name().to_vec()) })?; let rtype = editor::type_of_read(*length, badregion, not_covered); diff --git a/src/editor/filter.rs b/src/editor/filter.rs index deec439..a6e5b3b 100644 --- a/src/editor/filter.rs +++ b/src/editor/filter.rs @@ -81,7 +81,8 @@ where format: util::FileType::Fasta, })?; - let (badregion, length) = badregions.get_bad_part(record.name())?; + let (badregion, length) = badregions + .get_bad_part(&unsafe { String::from_utf8_unchecked(record.name().to_vec()) })?; let rtype = editor::type_of_read(*length, badregion, not_covered); diff --git a/src/editor/scrubbing.rs b/src/editor/scrubbing.rs index e483232..9304f2c 100644 --- a/src/editor/scrubbing.rs +++ b/src/editor/scrubbing.rs @@ -88,7 +88,8 @@ where format: util::FileType::Fasta, })?; - let (badregion, length) = badregions.get_bad_part(record.name())?; + let (badregion, length) = badregions + .get_bad_part(&unsafe { String::from_utf8_unchecked(record.name().to_vec()) })?; let rtype = editor::type_of_read(*length, badregion, not_covered); @@ -121,14 +122,20 @@ where if pos[0] as usize > record.sequence().len() || pos[1] as usize > record.sequence().len() { - error!("For read {} scrubb position is larger than read, it's strange check your data. For this read, this split position and next are ignore.", record.name()); + error!("For read {} scrubb position is larger than read, it's strange check your data. For this read, this split position and next are ignore.", unsafe { String::from_utf8_unchecked(record.name().to_vec()) }); break; } writer .write_record(&noodles::fasta::Record::new( noodles::fasta::record::Definition::new( - &format!("{}_{}_{}", record.name(), pos[0], pos[1]), + format!( + "{}_{}_{}", + &unsafe { String::from_utf8_unchecked(record.name().to_vec()) }, + pos[0], + pos[1] + ) + .as_bytes(), None, ), noodles::fasta::record::Sequence::from( @@ -182,9 +189,8 @@ where format: util::FileType::Fastq, })?; } else { - let mut sequence_description = std::str::from_utf8(record.name())?.splitn(2, ' '); - let name = sequence_description.next().unwrap(); - let description = sequence_description.next(); + let name = record.name(); + let description = record.description(); let mut poss = vec![0]; for interval in badregion { @@ -212,11 +218,10 @@ where writer .write_record(&noodles::fastq::Record::new( - match description { - Some(desc) => format!("{}_{}_{} {}", name, pos[0], pos[1], desc), - None => format!("{}_{}_{}", name, pos[0], pos[1]), - } - .as_bytes(), + noodles::fastq::record::Definition::new( + format!("{}_{}_{}", name, pos[0], pos[1]).as_bytes(), + description, + ), record.sequence()[(pos[0] as usize)..(pos[1] as usize)].to_vec(), record.quality_scores()[(pos[0] as usize)..(pos[1] as usize)].to_vec(), )) diff --git a/src/editor/split.rs b/src/editor/split.rs index f079b7f..e4168fe 100644 --- a/src/editor/split.rs +++ b/src/editor/split.rs @@ -88,7 +88,8 @@ where format: util::FileType::Fasta, })?; - let (badregion, length) = badregions.get_bad_part(record.name())?; + let (badregion, length) = badregions + .get_bad_part(&unsafe { String::from_utf8_unchecked(record.name().to_vec()) })?; let rtype = editor::type_of_read(*length, badregion, not_covered); @@ -116,14 +117,20 @@ where if pos[0] as usize > record.sequence().len() || pos[1] as usize > record.sequence().len() { - error!("For read {} split position is larger than read, it's strange check your data. For this read, this split position and next are ignore.", record.name()); + error!("For read {} split position is larger than read, it's strange check your data. For this read, this split position and next are ignore.", &unsafe { String::from_utf8_unchecked(record.name().to_vec()) }); break; } writer .write_record(&noodles::fasta::Record::new( noodles::fasta::record::Definition::new( - &format!("{}_{}_{}", record.name(), pos[0], pos[1]), + format!( + "{}_{}_{}", + &unsafe { String::from_utf8_unchecked(record.name().to_vec()) }, + pos[0], + pos[1] + ) + .as_bytes(), None, ), noodles::fasta::record::Sequence::from( @@ -177,9 +184,8 @@ where format: util::FileType::Fastq, })?; } else { - let mut sequence_description = std::str::from_utf8(record.name())?.splitn(2, ' '); - let name = sequence_description.next().unwrap(); - let description = sequence_description.next(); + let name = record.name(); + let description = record.description(); let mut poss = vec![0]; for interval in badregion { @@ -202,11 +208,10 @@ where writer .write_record(&noodles::fastq::Record::new( - match description { - Some(desc) => format!("{}_{}_{} {}", name, pos[0], pos[1], desc), - None => format!("{}_{}_{}", name, pos[0], pos[1]), - } - .as_bytes(), + noodles::fastq::record::Definition::new( + format!("{}_{}_{}", name, pos[0], pos[1]).as_bytes(), + description, + ), record.sequence()[(pos[0] as usize)..(pos[1] as usize)].to_vec(), record.quality_scores()[(pos[0] as usize)..(pos[1] as usize)].to_vec(), )) diff --git a/src/reads2ovl/fullmemory.rs b/src/reads2ovl/fullmemory.rs index ae805d7..a4e7195 100644 --- a/src/reads2ovl/fullmemory.rs +++ b/src/reads2ovl/fullmemory.rs @@ -50,7 +50,7 @@ impl reads2ovl::Reads2Ovl for FullMemory { } fn overlap(&self, id: &str) -> Result> { - if let Some((vec, _)) = self.reads2ovl.get(&id.to_string()) { + if let Some((vec, _)) = self.reads2ovl.get(id) { Ok(vec.to_vec()) } else { Ok(self.no_overlap.to_vec()) @@ -58,7 +58,7 @@ impl reads2ovl::Reads2Ovl for FullMemory { } fn length(&self, id: &str) -> usize { - if let Some((_, len)) = self.reads2ovl.get(&id.to_string()) { + if let Some((_, len)) = self.reads2ovl.get(id) { *len } else { 0 diff --git a/src/reads2ovl/mod.rs b/src/reads2ovl/mod.rs index be5fdc5..6f0bdaf 100644 --- a/src/reads2ovl/mod.rs +++ b/src/reads2ovl/mod.rs @@ -32,7 +32,6 @@ pub use self::fullmemory::*; pub use self::ondisk::*; /* std use */ -pub use self::fullmemory::*; /* local use */ use crate::error; @@ -147,7 +146,9 @@ pub trait Reads2Ovl { fn get_overlaps(&mut self, new: &mut MapReads2Ovl) -> bool; + #[allow(dead_code)] fn overlap(&self, id: &str) -> Result>; + #[allow(dead_code)] fn length(&self, id: &str) -> usize; fn add_overlap(&mut self, id: String, ovl: (u32, u32)) -> Result<()>; @@ -155,6 +156,7 @@ pub trait Reads2Ovl { fn add_overlap_and_length(&mut self, id: String, ovl: (u32, u32), length: usize) -> Result<()>; + #[allow(dead_code)] fn get_reads(&self) -> rustc_hash::FxHashSet; fn read_buffer_size(&self) -> usize; diff --git a/src/reads2ovl/ondisk.rs b/src/reads2ovl/ondisk.rs index 145c6b1..8396075 100644 --- a/src/reads2ovl/ondisk.rs +++ b/src/reads2ovl/ondisk.rs @@ -162,11 +162,11 @@ impl reads2ovl::Reads2Ovl for OnDisk { } fn length(&self, id: &str) -> usize { - *self.reads2len.get(&id.to_string()).unwrap_or(&0) + *self.reads2len.get(id).unwrap_or(&0) } fn add_overlap(&mut self, id: String, ovl: (u32, u32)) -> Result<()> { - self.reads2ovl.entry(id).or_insert_with(Vec::new).push(ovl); + self.reads2ovl.entry(id).or_default().push(ovl); self.number_of_value += 1;