From 3850e1ea611c9ef90a0213415afd3f3e5ebd9606 Mon Sep 17 00:00:00 2001 From: DominikRafacz Date: Sat, 10 Jul 2021 10:36:36 +0200 Subject: [PATCH 1/4] fix signedness mismatch --- inst/include/tidysq/Alphabet.h | 2 +- inst/include/tidysq/ProtoSq.h | 2 +- inst/include/tidysq/io/write_fasta.h | 4 ++-- inst/include/tidysq/paste.h | 2 +- inst/include/tidysq/sqapply.h | 2 +- inst/include/tidysq/tidysq-typedefs.h | 1 + src/test-pack.cpp | 10 +++++----- 7 files changed, 12 insertions(+), 11 deletions(-) diff --git a/inst/include/tidysq/Alphabet.h b/inst/include/tidysq/Alphabet.h index ec3662e7..ab891848 100644 --- a/inst/include/tidysq/Alphabet.h +++ b/inst/include/tidysq/Alphabet.h @@ -48,7 +48,7 @@ namespace tidysq { static std::unordered_map prepare_value_to_letter(const std::vector &letters) { std::unordered_map ret{}; - for (int i = 0; i < letters.size(); i++) { + for (unsigned short i = 0; i < letters.size(); i++) { if (letters[i].empty()) throw std::invalid_argument("each \"letter\" has to have at least one character!"); ret.insert({i, letters[i]}); diff --git a/inst/include/tidysq/ProtoSq.h b/inst/include/tidysq/ProtoSq.h index 84ae6727..8ea818fa 100644 --- a/inst/include/tidysq/ProtoSq.h +++ b/inst/include/tidysq/ProtoSq.h @@ -65,7 +65,7 @@ namespace tidysq { inline bool operator==(const ProtoSq &other) const { if ((alphabet_ != other.alphabet_) || (content_.size() != other.content_.size())) return false; - for (LenSq i = 0; i < content_.size(); i++) { + for (typeof(content_.size()) i = 0; i < content_.size(); i++) { if ((*this)[i] != other[i]) return false; } return true; diff --git a/inst/include/tidysq/io/write_fasta.h b/inst/include/tidysq/io/write_fasta.h index 064afc7a..65fa0487 100644 --- a/inst/include/tidysq/io/write_fasta.h +++ b/inst/include/tidysq/io/write_fasta.h @@ -21,7 +21,7 @@ namespace tidysq { } void write_sequence_part(const std::string &content, - LenSq &written) { + u_LenSq &written) { // if there is more to be written than content size, write only part of it if (content.size() - written >= width_) { stream_.write(content.data() + written, width_); @@ -36,7 +36,7 @@ namespace tidysq { void write_sequence(LenSq i) { ProtoSequence unpacked = unpack(sq_[i], sq_.alphabet()); const std::string &content = unpacked.content(); - LenSq written = 0; + u_LenSq written = 0; while (written < content.size()) { write_sequence_part(content, written); diff --git a/inst/include/tidysq/paste.h b/inst/include/tidysq/paste.h index 5212f245..98609629 100644 --- a/inst/include/tidysq/paste.h +++ b/inst/include/tidysq/paste.h @@ -33,7 +33,7 @@ namespace tidysq { element_count += sq[0].get().original_length(); } } else { - for (LenSq i = 0; i < element_counts.size(); ++i) { + for (u_LenSq i = 0; i < element_counts.size(); ++i) { element_counts[i] += sq[i].get().original_length(); } } diff --git a/inst/include/tidysq/sqapply.h b/inst/include/tidysq/sqapply.h index 63b23aa7..e9794afa 100644 --- a/inst/include/tidysq/sqapply.h +++ b/inst/include/tidysq/sqapply.h @@ -10,7 +10,7 @@ namespace tidysq { ops::OperationVectorToVector &operation) { if (operation.may_return_early(vector_in)) return operation.return_early(vector_in); VECTOR_OUT ret = operation.initialize_vector_out(vector_in); - for (LenSq i = 0; i < vector_in.size(); i++) { + for (typeof(vector_in.size()) i = 0; i < vector_in.size(); i++) { ret[i] = operation(vector_in[i]); } return ret; diff --git a/inst/include/tidysq/tidysq-typedefs.h b/inst/include/tidysq/tidysq-typedefs.h index a6b7b7fd..3073d437 100644 --- a/inst/include/tidysq/tidysq-typedefs.h +++ b/inst/include/tidysq/tidysq-typedefs.h @@ -8,6 +8,7 @@ namespace tidysq { typedef R_xlen_t LenSq; + typedef unsigned long int u_LenSq; //max vector size for comparisons typedef unsigned char ElementPacked; typedef unsigned char ElementRaws; typedef unsigned short int ElementInts; diff --git a/src/test-pack.cpp b/src/test-pack.cpp index 8dd47c2c..1b6d6cfa 100644 --- a/src/test-pack.cpp +++ b/src/test-pack.cpp @@ -47,7 +47,7 @@ template<> ProtoSequence create_proto_sequence_from_raws(const std::vector &raws, const Alphabet &alphabet) { std::vector strings(raws.size()); - for (LenSq i = 0; i < raws.size(); i++) { + for (u_LenSq i = 0; i < raws.size(); i++) { strings[i] = util::match_letter(raws[i], alphabet); } return ProtoSequence(strings); @@ -57,7 +57,7 @@ template<> ProtoSequence create_proto_sequence_from_raws(const std::vector &raws, const Alphabet &alphabet) { Rcpp::StringVector strings(raws.size()); - for (LenSq i = 0; i < raws.size(); i++) { + for (u_LenSq i = 0; i < raws.size(); i++) { strings[i] = util::match_letter(raws[i], alphabet); } return ProtoSequence(strings); @@ -67,7 +67,7 @@ template<> ProtoSequence create_proto_sequence_from_raws(const std::vector &raws, const Alphabet &alphabet) { std::string seq; - for (LenSq i = 0; i < raws.size(); i++) { + for (u_LenSq i = 0; i < raws.size(); i++) { seq += util::match_letter_multichar(raws[i], alphabet); } return ProtoSequence(seq); @@ -77,7 +77,7 @@ template<> ProtoSequence create_proto_sequence_from_raws(const std::vector &raws, const Alphabet &alphabet) { std::string seq; - for (LenSq i = 0; i < raws.size(); i++) { + for (u_LenSq i = 0; i < raws.size(); i++) { seq += util::match_letter_multichar(raws[i], alphabet); } return ProtoSequence(seq); @@ -86,7 +86,7 @@ create_proto_sequence_from_raws(const std::vector ProtoSq create_proto_sq_from_raws(const std::vector> &raws, const Alphabet &alphabet) { ProtoSq ret(raws.size(), alphabet); - for (LenSq i = 0; i < raws.size(); i++) { + for (u_LenSq i = 0; i < raws.size(); i++) { ret[i] = create_proto_sequence_from_raws(raws[i], alphabet); } return ret; From c2fb0b5bfe034d24a3dcc99c6607ad327e3de906 Mon Sep 17 00:00:00 2001 From: DominikRafacz Date: Sat, 10 Jul 2021 10:43:53 +0200 Subject: [PATCH 2/4] update renv and RcppExports --- renv.lock | 296 +++++++++++++++----------------- renv/activate.R | 399 ++++++-------------------------------------- src/RcppExports.cpp | 5 + 3 files changed, 193 insertions(+), 507 deletions(-) diff --git a/renv.lock b/renv.lock index 028d3391..0944f6e1 100644 --- a/renv.lock +++ b/renv.lock @@ -1,6 +1,6 @@ { "R": { - "Version": "4.0.4", + "Version": "4.1.0", "Repositories": [ { "Name": "CRAN", @@ -9,7 +9,7 @@ ] }, "Bioconductor": { - "Version": null + "Version": "3.13" }, "Packages": { "BH": { @@ -21,28 +21,53 @@ }, "BiocGenerics": { "Package": "BiocGenerics", - "Version": "0.36.0", + "Version": "0.38.0", "Source": "Bioconductor", - "Hash": "1fe8a6250d04cfb040ebec87447770ba" + "Hash": "de5e346fed0fc44a0424a0531cf5d12d" + }, + "BiocManager": { + "Package": "BiocManager", + "Version": "1.30.16", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "2fdca0877debdd4668190832cdee4c31" + }, + "BiocVersion": { + "Package": "BiocVersion", + "Version": "3.13.1", + "Source": "Bioconductor", + "Hash": "94abf4508341d86378c2a78d219b3fca" }, "Biostrings": { "Package": "Biostrings", - "Version": "2.58.0", + "Version": "2.60.1", + "Source": "Bioconductor", + "Hash": "ee27fadce643ce9df34bb1778748af38" + }, + "GenomeInfoDb": { + "Package": "GenomeInfoDb", + "Version": "1.28.1", + "Source": "Bioconductor", + "Hash": "b84b718032db0bf747bbd2563399f354" + }, + "GenomeInfoDbData": { + "Package": "GenomeInfoDbData", + "Version": "1.2.6", "Source": "Bioconductor", - "Hash": "7025417314cfb2f1be19919998874466" + "Hash": "64835ce2e680bc34bd1de009121663f8" }, "IRanges": { "Package": "IRanges", - "Version": "2.24.1", + "Version": "2.26.0", "Source": "Bioconductor", - "Hash": "21b3bc3dfb55cb9501c5f3413b35388c" + "Hash": "7859b18fedba59e99467df40b42e3553" }, "MASS": { "Package": "MASS", - "Version": "7.3-53.1", + "Version": "7.3-54", "Source": "Repository", "Repository": "CRAN", - "Hash": "4ef21dd0348b9abb7f8bd1d77e4cd0c3" + "Hash": "0e59129db205112e3963904db67fd0dc" }, "R6": { "Package": "R6", @@ -51,38 +76,45 @@ "Repository": "CRAN", "Hash": "b203113193e70978a696b2809525649d" }, + "RCurl": { + "Package": "RCurl", + "Version": "1.98-1.3", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "ddac9abbfba243f9aeab9b5680b968d3" + }, "Rcpp": { "Package": "Rcpp", - "Version": "1.0.6", + "Version": "1.0.7", "Source": "Repository", "Repository": "CRAN", - "Hash": "dbb5e436998a7eba5a9d682060533338" + "Hash": "dab19adae4440ae55aa8a9d238b246bb" }, "S4Vectors": { "Package": "S4Vectors", - "Version": "0.28.1", + "Version": "0.30.0", "Source": "Bioconductor", - "Hash": "f558c55a285751bd72af11d2bb853521" + "Hash": "a750488825efca8e08a30e8157821b9b" }, "XVector": { "Package": "XVector", - "Version": "0.30.0", + "Version": "0.32.0", "Source": "Bioconductor", - "Hash": "9bd9f991fb4ecde6adeff2fa2e401cc5" + "Hash": "0d2db71f7183fe0de9a7058de3d3cd15" }, "ade4": { "Package": "ade4", - "Version": "1.7-16", + "Version": "1.7-17", "Source": "Repository", "Repository": "CRAN", - "Hash": "44f4527bf44c58cf0003572fe6e17265" + "Hash": "dd151b78c19c121431545c277a74b61b" }, "ape": { "Package": "ape", - "Version": "5.4-1", + "Version": "5.5", "Source": "Repository", "Repository": "CRAN", - "Hash": "08310cebe9ad2da068486b26b05e6030" + "Hash": "8927e35d3da343034928548484e5eda7" }, "askpass": { "Package": "askpass", @@ -91,13 +123,6 @@ "Repository": "CRAN", "Hash": "e8a22846fff485f0be3770c2da758713" }, - "assertthat": { - "Package": "assertthat", - "Version": "0.2.1", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "50c838a310445e954bc13f26f26a6ecf" - }, "backports": { "Package": "backports", "Version": "1.2.1", @@ -119,26 +144,26 @@ "Repository": "CRAN", "Hash": "d4ef1fc818710631728dca77c262d308" }, - "brio": { - "Package": "brio", - "Version": "1.1.1", + "bitops": { + "Package": "bitops", + "Version": "1.0-7", "Source": "Repository", "Repository": "CRAN", - "Hash": "36758510e65a457efeefa50e1e7f0576" + "Hash": "b7d8d8ee39869c18d8846a184dd8a1af" }, - "cachem": { - "Package": "cachem", - "Version": "1.0.4", + "brio": { + "Package": "brio", + "Version": "1.1.2", "Source": "Repository", "Repository": "CRAN", - "Hash": "2703a46dcabfb902f10060b2bca9f708" + "Hash": "2f01e16ff9571fe70381c7b9ae560dc4" }, "callr": { "Package": "callr", - "Version": "3.5.1", + "Version": "3.7.0", "Source": "Repository", "Repository": "CRAN", - "Hash": "b7d7f1e926dfcd57c74ce93f5c048e80" + "Hash": "461aa75a11ce2400245190ef5d3995df" }, "checkmate": { "Package": "checkmate", @@ -149,10 +174,10 @@ }, "cli": { "Package": "cli", - "Version": "2.3.1", + "Version": "3.0.0", "Source": "Repository", "Repository": "CRAN", - "Hash": "3e3f28efcadfda442cd18651fbcbbecf" + "Hash": "096829b701eec2d2b4538be63de97e75" }, "clipr": { "Package": "clipr", @@ -177,10 +202,10 @@ }, "cpp11": { "Package": "cpp11", - "Version": "0.2.6", + "Version": "0.3.1", "Source": "Repository", "Repository": "CRAN", - "Hash": "f08909ebdad90b19d8d3930da4220564" + "Hash": "e02edab2bc389c5e4b12949b13df44f2" }, "crayon": { "Package": "crayon", @@ -191,24 +216,24 @@ }, "curl": { "Package": "curl", - "Version": "4.3", + "Version": "4.3.2", "Source": "Repository", "Repository": "CRAN", - "Hash": "2b7d10581cc730804e9ed178c8374bd6" + "Hash": "022c42d49c28e95d69ca60446dbabf88" }, "desc": { "Package": "desc", - "Version": "1.2.0", + "Version": "1.3.0", "Source": "Repository", "Repository": "CRAN", - "Hash": "6c8fe8fa26a23b79949375d372c7b395" + "Hash": "b6963166f7f10b970af1006c462ce6cd" }, "diffobj": { "Package": "diffobj", - "Version": "0.3.3", + "Version": "0.3.4", "Source": "Repository", "Repository": "CRAN", - "Hash": "55fae7ec1418d2a47bd552571673d1af" + "Hash": "feb5b7455eba422a2c110bb89852e6a3" }, "digest": { "Package": "digest", @@ -219,17 +244,17 @@ }, "dplyr": { "Package": "dplyr", - "Version": "1.0.4", + "Version": "1.0.7", "Source": "Repository", "Repository": "CRAN", - "Hash": "01c82e3b053eb7660a8ace8d932265b8" + "Hash": "36f1ae62f026c8ba9f9b5c9a08c03297" }, "ellipsis": { "Package": "ellipsis", - "Version": "0.3.1", + "Version": "0.3.2", "Source": "Repository", "Repository": "CRAN", - "Hash": "fd2844b3a43ae2d27e70ece2df1b4e2a" + "Hash": "bb0eec2fe32e88d9e2836c2f73ea2077" }, "evaluate": { "Package": "evaluate", @@ -240,24 +265,10 @@ }, "fansi": { "Package": "fansi", - "Version": "0.4.2", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "fea074fb67fe4c25d47ad09087da847d" - }, - "fastmap": { - "Package": "fastmap", - "Version": "1.1.0", + "Version": "0.5.0", "Source": "Repository", "Repository": "CRAN", - "Hash": "77bd60a6157420d4ffa93b27cf6a58b8" - }, - "fs": { - "Package": "fs", - "Version": "1.5.0", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "44594a07a42e5f91fac9f93fda6d0109" + "Hash": "d447b40982c576a72b779f0a3b3da227" }, "generics": { "Package": "generics", @@ -275,17 +286,17 @@ }, "highr": { "Package": "highr", - "Version": "0.8", + "Version": "0.9", "Source": "Repository", "Repository": "CRAN", - "Hash": "4dc5bb88961e347a0f4d8aad597cbfac" + "Hash": "8eb36c8125038e648e5d111c0d7b2ed4" }, "hms": { "Package": "hms", - "Version": "1.0.0", + "Version": "1.1.0", "Source": "Repository", "Repository": "CRAN", - "Hash": "bf552cdd96f5969873afdac7311c7d0d" + "Hash": "e4bf161ccb74a2c1c0e8ac63bbe332b4" }, "htmltools": { "Package": "htmltools", @@ -317,17 +328,17 @@ }, "knitr": { "Package": "knitr", - "Version": "1.31", + "Version": "1.33", "Source": "Repository", "Repository": "CRAN", - "Hash": "c3994c036d19fc22c5e2a209c8298bfb" + "Hash": "0bc1b5da1b0eb07cd4b727e95e9ff0b8" }, "lattice": { "Package": "lattice", - "Version": "0.20-41", + "Version": "0.20-44", "Source": "Repository", "Repository": "CRAN", - "Hash": "fbd9285028b0263d76d18c95ae51a53d" + "Hash": "f36bf1a849d9106dc2af72e501f9de41" }, "lazyeval": { "Package": "lazyeval", @@ -357,19 +368,19 @@ "Repository": "CRAN", "Hash": "61e4a10781dd00d7d81dd06ca9b94e95" }, - "memoise": { - "Package": "memoise", - "Version": "2.0.0", + "mime": { + "Package": "mime", + "Version": "0.11", "Source": "Repository", "Repository": "CRAN", - "Hash": "a0bc51650201a56d00a4798523cc91b3" + "Hash": "8974a907200fc9948d636fe7d85ca9fb" }, - "mime": { - "Package": "mime", - "Version": "0.10", + "mockr": { + "Package": "mockr", + "Version": "0.1", "Source": "Repository", "Repository": "CRAN", - "Hash": "26fa77e707223e1ce042b2b5d09993dc" + "Hash": "9fdcfc0a7a31707a2b763c69613938b8" }, "nlme": { "Package": "nlme", @@ -380,17 +391,17 @@ }, "openssl": { "Package": "openssl", - "Version": "1.4.3", + "Version": "1.4.4", "Source": "Repository", "Repository": "CRAN", - "Hash": "a399e4773075fc2375b71f45fca186c4" + "Hash": "f4dbc5a47fd93d3415249884d31d6791" }, "pillar": { "Package": "pillar", - "Version": "1.5.0", + "Version": "1.6.1", "Source": "Repository", "Repository": "CRAN", - "Hash": "39a778e4e487ded8b1bf5bb617c567b3" + "Hash": "8672ae02bd20f6479bce2d06c7ff1401" }, "pixmap": { "Package": "pixmap", @@ -399,13 +410,6 @@ "Repository": "CRAN", "Hash": "ff0e0b97265ced0db4d13d0005334d78" }, - "pkgbuild": { - "Package": "pkgbuild", - "Version": "1.2.0", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "725fcc30222d4d11ec68efb8ff11a9af" - }, "pkgconfig": { "Package": "pkgconfig", "Version": "2.0.3", @@ -413,19 +417,12 @@ "Repository": "CRAN", "Hash": "01f28d4278f15c76cddbea05899c5d6f" }, - "pkgdown": { - "Package": "pkgdown", - "Version": "1.6.1", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "8896076540d9e9b556a2ec658c81f916" - }, "pkgload": { "Package": "pkgload", - "Version": "1.2.0", + "Version": "1.2.1", "Source": "Repository", "Repository": "CRAN", - "Hash": "cb57de933545960a86f03513e4bd2911" + "Hash": "463642747f81879e6752485aefb831cf" }, "praise": { "Package": "praise", @@ -434,33 +431,19 @@ "Repository": "CRAN", "Hash": "a555924add98c99d2f411e37e7d25e9f" }, - "prettyunits": { - "Package": "prettyunits", - "Version": "1.1.1", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "95ef9167b75dde9d2ccc3c7528393e7e" - }, "processx": { "Package": "processx", - "Version": "3.4.5", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "22aab6098cb14edd0a5973a8438b569b" - }, - "progress": { - "Package": "progress", - "Version": "1.2.2", + "Version": "3.5.2", "Source": "Repository", "Repository": "CRAN", - "Hash": "14dc9f7a3c91ebb14ec5bb9208a07061" + "Hash": "0cbca2bc4d16525d009c4dbba156b37c" }, "ps": { "Package": "ps", - "Version": "1.5.0", + "Version": "1.6.0", "Source": "Repository", "Repository": "CRAN", - "Hash": "ebaed51a03411fd5cfc1e12d9079b353" + "Hash": "32620e2001c1dce1af49c49dccbb9420" }, "purrr": { "Package": "purrr", @@ -485,10 +468,10 @@ }, "renv": { "Package": "renv", - "Version": "0.13.0", + "Version": "0.12.2", "Source": "Repository", "Repository": "CRAN", - "Hash": "9f10d9db5b50400c348920c5c603385e" + "Hash": "398cc1ea892e1aade66d1ecbb2874d24" }, "rex": { "Package": "rex", @@ -499,17 +482,17 @@ }, "rlang": { "Package": "rlang", - "Version": "0.4.10", + "Version": "0.4.11", "Source": "Repository", "Repository": "CRAN", - "Hash": "599df23c40a4fce9c7b4764f28c37857" + "Hash": "515f341d3affe0de9e4a7f762efb0456" }, "rmarkdown": { "Package": "rmarkdown", - "Version": "2.7", + "Version": "2.9", "Source": "Repository", "Repository": "CRAN", - "Hash": "edbf4cb1aefae783fd8d3a008ae51943" + "Hash": "912c09266d5470516df4df7a303cde92" }, "rprojroot": { "Package": "rprojroot", @@ -527,17 +510,17 @@ }, "segmented": { "Package": "segmented", - "Version": "1.3-2", + "Version": "1.3-4", "Source": "Repository", "Repository": "CRAN", - "Hash": "8f3d6a24110c2fbdb93314a54b4a2283" + "Hash": "69c8364de576f1e4455800d6183fc88e" }, "seqinr": { "Package": "seqinr", - "Version": "4.2-5", + "Version": "4.2-8", "Source": "Repository", "Repository": "CRAN", - "Hash": "ba33302ea56701f826d30efbc557199c" + "Hash": "487529ff4c174fb9a83d6ffce74f9d62" }, "sp": { "Package": "sp", @@ -555,10 +538,10 @@ }, "stringi": { "Package": "stringi", - "Version": "1.5.3", + "Version": "1.6.2", "Source": "Repository", "Repository": "CRAN", - "Hash": "a063ebea753c92910a4cca7b18bc1f05" + "Hash": "9df5e6f9a7fa11b84adf0429961de66a" }, "stringr": { "Package": "stringr", @@ -576,73 +559,66 @@ }, "testthat": { "Package": "testthat", - "Version": "3.0.2", + "Version": "3.0.4", "Source": "Repository", "Repository": "CRAN", - "Hash": "495e0434d9305716b6a87031570ce109" + "Hash": "575216c9946ca70016c3ffb9c31709ba" }, "tibble": { "Package": "tibble", - "Version": "3.1.0", + "Version": "3.1.2", "Source": "Repository", "Repository": "CRAN", - "Hash": "4d894a114dbd4ecafeda5074e7c538e6" + "Hash": "349b40a9f144516d537c875e786ec8b8" }, "tidyselect": { "Package": "tidyselect", - "Version": "1.1.0", + "Version": "1.1.1", "Source": "Repository", "Repository": "CRAN", - "Hash": "6ea435c354e8448819627cf686f66e0a" + "Hash": "7243004a708d06d4716717fa1ff5b2fe" }, "tinytex": { "Package": "tinytex", - "Version": "0.29", + "Version": "0.32", "Source": "Repository", "Repository": "CRAN", - "Hash": "f0b0ba735febac9a8344253ae6fa93f5" + "Hash": "db9a6f2cf147751322d22c9f6647c7bd" }, "utf8": { "Package": "utf8", - "Version": "1.1.4", + "Version": "1.2.1", "Source": "Repository", "Repository": "CRAN", - "Hash": "4a5081acfb7b81a572e4384a7aaf2af1" + "Hash": "c3ad47dc6da0751f18ed53c4613e3ac7" }, "vctrs": { "Package": "vctrs", - "Version": "0.3.6", + "Version": "0.3.8", "Source": "Repository", "Repository": "CRAN", - "Hash": "5cf1957f93076c19fdc81d01409d240b" + "Hash": "ecf749a1b39ea72bd9b51b76292261f1" }, "waldo": { "Package": "waldo", - "Version": "0.2.4", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "29df52c781e572c967f90de9713423c4" - }, - "whisker": { - "Package": "whisker", - "Version": "0.4", + "Version": "0.2.5", "Source": "Repository", "Repository": "CRAN", - "Hash": "ca970b96d894e90397ed20637a0c1bbe" + "Hash": "20c45f1d511a3f730b7b469f4d11e104" }, "withr": { "Package": "withr", - "Version": "2.4.1", + "Version": "2.4.2", "Source": "Repository", "Repository": "CRAN", - "Hash": "caf4781c674ffa549a4676d2d77b13cc" + "Hash": "ad03909b44677f930fa156d47d7a3aeb" }, "xfun": { "Package": "xfun", - "Version": "0.21", + "Version": "0.24", "Source": "Repository", "Repository": "CRAN", - "Hash": "f3ddcca198959a42e8cb6b06c30d4f1e" + "Hash": "88cdb9779a657ad80ad942245fffba31" }, "xml2": { "Package": "xml2", @@ -660,9 +636,9 @@ }, "zlibbioc": { "Package": "zlibbioc", - "Version": "1.36.0", + "Version": "1.38.0", "Source": "Bioconductor", - "Hash": "effcbe90f6986ca6f81ce4d67db7238b" + "Hash": "fb9cf082f0e3c89e05a720003fa94450" } } } diff --git a/renv/activate.R b/renv/activate.R index 2cba08a4..4e1cc716 100644 --- a/renv/activate.R +++ b/renv/activate.R @@ -2,7 +2,7 @@ local({ # the requested version of renv - version <- "0.13.0" + version <- "0.12.2" # the project directory project <- getwd() @@ -39,6 +39,16 @@ local({ # load bootstrap tools bootstrap <- function(version, library) { + # read repos (respecting override if set) + repos <- Sys.getenv("RENV_CONFIG_REPOS_OVERRIDE", unset = NA) + if (is.na(repos)) + repos <- getOption("repos") + + # fix up repos + on.exit(options(repos = repos), add = TRUE) + repos[repos == "@CRAN@"] <- "https://cloud.r-project.org" + options(repos = repos) + # attempt to download renv tarball <- tryCatch(renv_bootstrap_download(version), error = identity) if (inherits(tarball, "error")) @@ -51,35 +61,24 @@ local({ } - renv_bootstrap_tests_running <- function() { - getOption("renv.tests.running", default = FALSE) - } - - renv_bootstrap_repos <- function() { - - # check for repos override - repos <- Sys.getenv("RENV_CONFIG_REPOS_OVERRIDE", unset = NA) - if (!is.na(repos)) - return(repos) - - # if we're testing, re-use the test repositories - if (renv_bootstrap_tests_running()) - return(getOption("renv.tests.repos")) + renv_bootstrap_download_impl <- function(url, destfile) { - # retrieve current repos - repos <- getOption("repos") + mode <- "wb" - # ensure @CRAN@ entries are resolved - repos[repos == "@CRAN@"] <- "https://cloud.r-project.org" + # https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17715 + fixup <- + Sys.info()[["sysname"]] == "Windows" && + substring(url, 1L, 5L) == "file:" - # add in renv.bootstrap.repos if set - default <- c(FALLBACK = "https://cloud.r-project.org") - extra <- getOption("renv.bootstrap.repos", default = default) - repos <- c(repos, extra) + if (fixup) + mode <- "w+b" - # remove duplicates that might've snuck in - dupes <- duplicated(repos) | duplicated(names(repos)) - repos[!dupes] + download.file( + url = url, + destfile = destfile, + mode = mode, + quiet = TRUE + ) } @@ -91,9 +90,7 @@ local({ components <- unclass(nv)[[1]] methods <- if (length(components) == 4L) { - list( - renv_bootstrap_download_github - ) + list(renv_bootstrap_download_github) } else { list( renv_bootstrap_download_cran_latest, @@ -111,113 +108,42 @@ local({ } - renv_bootstrap_download_impl <- function(url, destfile) { - - mode <- "wb" - - # https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17715 - fixup <- - Sys.info()[["sysname"]] == "Windows" && - substring(url, 1L, 5L) == "file:" - - if (fixup) - mode <- "w+b" - - utils::download.file( - url = url, - destfile = destfile, - mode = mode, - quiet = TRUE - ) - - } - renv_bootstrap_download_cran_latest <- function(version) { - repos <- renv_bootstrap_download_cran_latest_find(version) - - message("* Downloading renv ", version, " ... ", appendLF = FALSE) - - downloader <- function(type) { - - tryCatch( - utils::download.packages( - pkgs = "renv", - destdir = tempdir(), - repos = repos, - type = type, - quiet = TRUE - ), - condition = identity - ) + # check for renv on CRAN matching this version + db <- as.data.frame(available.packages(), stringsAsFactors = FALSE) + entry <- db[db$Package %in% "renv" & db$Version %in% version, ] + if (nrow(entry) == 0) { + fmt <- "renv %s is not available from your declared package repositories" + stop(sprintf(fmt, version)) } - # first, try downloading a binary on Windows + macOS if appropriate - binary <- - !identical(.Platform$pkgType, "source") && - !identical(getOption("pkgType"), "source") && - Sys.info()[["sysname"]] %in% c("Darwin", "Windows") - - if (binary) { - info <- downloader(type = "binary") - if (!inherits(info, "condition")) { - message("OK (downloaded binary)") - return(info[1, 2]) - } - } + message("* Downloading renv ", version, " from CRAN ... ", appendLF = FALSE) + + info <- tryCatch( + download.packages("renv", destdir = tempdir(), quiet = TRUE), + condition = identity + ) - # otherwise, try downloading a source tarball - info <- downloader(type = "source") if (inherits(info, "condition")) { message("FAILED") return(FALSE) } - # report success and return - message("OK (downloaded source)") + message("OK") info[1, 2] } - renv_bootstrap_download_cran_latest_find <- function(version) { - - all <- renv_bootstrap_repos() - - for (repos in all) { - - db <- tryCatch( - as.data.frame( - x = utils::available.packages(repos = repos), - stringsAsFactors = FALSE - ), - error = identity - ) - - if (inherits(db, "error")) - next - - entry <- db[db$Package %in% "renv" & db$Version %in% version, ] - if (nrow(entry) == 0) - next - - return(repos) - - } - - fmt <- "renv %s is not available from your declared package repositories" - stop(sprintf(fmt, version)) - - } - renv_bootstrap_download_cran_archive <- function(version) { name <- sprintf("renv_%s.tar.gz", version) - repos <- renv_bootstrap_repos() + repos <- getOption("repos") urls <- file.path(repos, "src/contrib/Archive/renv", name) destfile <- file.path(tempdir(), name) - message("* Downloading renv ", version, " ... ", appendLF = FALSE) + message("* Downloading renv ", version, " from CRAN archive ... ", appendLF = FALSE) for (url in urls) { @@ -276,7 +202,7 @@ local({ return(FALSE) } - message("OK") + message("Done!") return(destfile) } @@ -308,7 +234,7 @@ local({ } - renv_bootstrap_platform_prefix <- function() { + renv_bootstrap_prefix <- function() { # construct version prefix version <- paste(R.version$major, R.version$minor, sep = ".") @@ -327,8 +253,8 @@ local({ components <- c(prefix, R.version$platform) # include prefix if provided by user - prefix <- renv_bootstrap_platform_prefix_impl() - if (!is.na(prefix) && nzchar(prefix)) + prefix <- Sys.getenv("RENV_PATHS_PREFIX") + if (nzchar(prefix)) components <- c(prefix, components) # build prefix @@ -336,152 +262,6 @@ local({ } - renv_bootstrap_platform_prefix_impl <- function() { - - # if an explicit prefix has been supplied, use it - prefix <- Sys.getenv("RENV_PATHS_PREFIX", unset = NA) - if (!is.na(prefix)) - return(prefix) - - # if the user has requested an automatic prefix, generate it - auto <- Sys.getenv("RENV_PATHS_PREFIX_AUTO", unset = NA) - if (auto %in% c("TRUE", "True", "true", "1")) - return(renv_bootstrap_platform_prefix_auto()) - - # empty string on failure - "" - - } - - renv_bootstrap_platform_prefix_auto <- function() { - - prefix <- tryCatch(renv_bootstrap_platform_os(), error = identity) - if (inherits(prefix, "error") || prefix %in% "unknown") { - - msg <- paste( - "failed to infer current operating system", - "please file a bug report at https://github.com/rstudio/renv/issues", - sep = "; " - ) - - warning(msg) - - } - - prefix - - } - - renv_bootstrap_platform_os <- function() { - - sysinfo <- Sys.info() - sysname <- sysinfo[["sysname"]] - - # handle Windows + macOS up front - if (sysname == "Windows") - return("windows") - else if (sysname == "Darwin") - return("macos") - - # check for os-release files - for (file in c("/etc/os-release", "/usr/lib/os-release")) - if (file.exists(file)) - return(renv_bootstrap_platform_os_via_os_release(file, sysinfo)) - - # check for redhat-release files - if (file.exists("/etc/redhat-release")) - return(renv_bootstrap_platform_os_via_redhat_release()) - - "unknown" - - } - - renv_bootstrap_platform_os_via_os_release <- function(file, sysinfo) { - - # read /etc/os-release - release <- utils::read.table( - file = file, - sep = "=", - quote = c("\"", "'"), - col.names = c("Key", "Value"), - comment.char = "#", - stringsAsFactors = FALSE - ) - - vars <- as.list(release$Value) - names(vars) <- release$Key - - # get os name - os <- tolower(sysinfo[["sysname"]]) - - # read id - id <- "unknown" - for (field in c("ID", "ID_LIKE")) { - if (field %in% names(vars) && nzchar(vars[[field]])) { - id <- vars[[field]] - break - } - } - - # read version - version <- "unknown" - for (field in c("UBUNTU_CODENAME", "VERSION_CODENAME", "VERSION_ID", "BUILD_ID")) { - if (field %in% names(vars) && nzchar(vars[[field]])) { - version <- vars[[field]] - break - } - } - - # join together - paste(c(os, id, version), collapse = "-") - - } - - renv_bootstrap_platform_os_via_redhat_release <- function() { - - # read /etc/redhat-release - contents <- readLines("/etc/redhat-release", warn = FALSE) - - # infer id - id <- if (grepl("centos", contents, ignore.case = TRUE)) - "centos" - else if (grepl("redhat", contents, ignore.case = TRUE)) - "redhat" - else - "unknown" - - # try to find a version component (very hacky) - version <- "unknown" - - parts <- strsplit(contents, "[[:space:]]")[[1L]] - for (part in parts) { - - nv <- tryCatch(numeric_version(part), error = identity) - if (inherits(nv, "error")) - next - - version <- nv[1, 1] - break - - } - - paste(c("linux", id, version), collapse = "-") - - } - - renv_bootstrap_library_root_name <- function(project) { - - # use project name as-is if requested - asis <- Sys.getenv("RENV_PATHS_LIBRARY_ROOT_ASIS", unset = "FALSE") - if (asis) - return(basename(project)) - - # otherwise, disambiguate based on project's path - id <- substring(renv_bootstrap_hash_text(project), 1L, 8L) - paste(basename(project), id, sep = "-") - - } - renv_bootstrap_library_root <- function(project) { path <- Sys.getenv("RENV_PATHS_LIBRARY", unset = NA) @@ -489,13 +269,10 @@ local({ return(path) path <- Sys.getenv("RENV_PATHS_LIBRARY_ROOT", unset = NA) - if (!is.na(path)) { - name <- renv_bootstrap_library_root_name(project) - return(file.path(path, name)) - } + if (!is.na(path)) + return(file.path(path, basename(project))) - prefix <- renv_bootstrap_profile_prefix() - paste(c(project, prefix, "renv/library"), collapse = "/") + file.path(project, "renv/library") } @@ -527,16 +304,6 @@ local({ } - renv_bootstrap_hash_text <- function(text) { - - hashfile <- tempfile("renv-hash-") - on.exit(unlink(hashfile), add = TRUE) - - writeLines(text, con = hashfile) - tools::md5sum(hashfile) - - } - renv_bootstrap_load <- function(project, libpath, version) { # try to load renv from the project library @@ -552,69 +319,12 @@ local({ TRUE } - - renv_bootstrap_profile_load <- function(project) { - - # if RENV_PROFILE is already set, just use that - profile <- Sys.getenv("RENV_PROFILE", unset = NA) - if (!is.na(profile) && nzchar(profile)) - return(profile) - - # check for a profile file (nothing to do if it doesn't exist) - path <- file.path(project, "renv/local/profile") - if (!file.exists(path)) - return(NULL) - - # read the profile, and set it if it exists - contents <- readLines(path, warn = FALSE) - if (length(contents) == 0L) - return(NULL) - - # set RENV_PROFILE - profile <- contents[[1L]] - if (nzchar(profile)) - Sys.setenv(RENV_PROFILE = profile) - - profile - - } - - renv_bootstrap_profile_prefix <- function() { - profile <- renv_bootstrap_profile_get() - if (!is.null(profile)) - return(file.path("renv/profiles", profile)) - } - - renv_bootstrap_profile_get <- function() { - profile <- Sys.getenv("RENV_PROFILE", unset = "") - renv_bootstrap_profile_normalize(profile) - } - - renv_bootstrap_profile_set <- function(profile) { - profile <- renv_bootstrap_profile_normalize(profile) - if (is.null(profile)) - Sys.unsetenv("RENV_PROFILE") - else - Sys.setenv(RENV_PROFILE = profile) - } - - renv_bootstrap_profile_normalize <- function(profile) { - - if (is.null(profile) || profile %in% c("", "default")) - return(NULL) - - profile - - } - - # load the renv profile, if any - renv_bootstrap_profile_load(project) # construct path to library root root <- renv_bootstrap_library_root(project) # construct library prefix for platform - prefix <- renv_bootstrap_platform_prefix() + prefix <- renv_bootstrap_prefix() # construct full libpath libpath <- file.path(root, prefix) @@ -623,13 +333,8 @@ local({ if (renv_bootstrap_load(project, libpath, version)) return(TRUE) - # load failed; inform user we're about to bootstrap - prefix <- paste("# Bootstrapping renv", version) - postfix <- paste(rep.int("-", 77L - nchar(prefix)), collapse = "") - header <- paste(prefix, postfix) - message(header) - - # perform bootstrap + # load failed; attempt to bootstrap + message("Bootstrapping renv ", version, " ...") bootstrap(version, libpath) # exit early if we're just testing bootstrap @@ -638,7 +343,7 @@ local({ # try again to load if (requireNamespace("renv", lib.loc = libpath, quietly = TRUE)) { - message("* Successfully installed and loaded renv ", version, ".") + message("Successfully installed and loaded renv ", version, ".") return(renv::load()) } diff --git a/src/RcppExports.cpp b/src/RcppExports.cpp index 5e857b32..0e67d644 100644 --- a/src/RcppExports.cpp +++ b/src/RcppExports.cpp @@ -6,6 +6,11 @@ using namespace Rcpp; +#ifdef RCPP_USE_GLOBAL_ROSTREAM +Rcpp::Rostream& Rcpp::Rcout = Rcpp::Rcpp_cout_get(); +Rcpp::Rostream& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get(); +#endif + // CPP_apply_R_function Rcpp::List CPP_apply_R_function(const Rcpp::List& x, const Rcpp::Function& fun, const bool& single_string, const tidysq::Letter& NA_letter); RcppExport SEXP _tidysq_CPP_apply_R_function(SEXP xSEXP, SEXP funSEXP, SEXP single_stringSEXP, SEXP NA_letterSEXP) { From edf5ff6ab253caf779c1561578a36bdbe8efec9e Mon Sep 17 00:00:00 2001 From: DominikRafacz Date: Sun, 11 Jul 2021 12:47:47 +0200 Subject: [PATCH 3/4] fix order of reading packed elements --- inst/include/tidysq/internal/pack.h | 98 +++++++++++++---------------- 1 file changed, 44 insertions(+), 54 deletions(-) diff --git a/inst/include/tidysq/internal/pack.h b/inst/include/tidysq/internal/pack.h index 9bc6b343..6d259f8e 100644 --- a/inst/include/tidysq/internal/pack.h +++ b/inst/include/tidysq/internal/pack.h @@ -14,11 +14,13 @@ namespace tidysq::internal { const Alphabet &alphabet) { LenSq out_byte = 0; auto interpreter = unpacked.template content_interpreter(alphabet); + LetterValue v1, v2, v3, v4; while (!interpreter.reached_end()) { - packed(out_byte) = (interpreter.get_next_value() ) | - (interpreter.get_next_value() << 2u) | - (interpreter.get_next_value() << 4u) | - (interpreter.get_next_value() << 6u) ; + v1 = interpreter.get_next_value(); + v2 = interpreter.get_next_value() << 2u; + v3 = interpreter.get_next_value() << 4u; + v4 = interpreter.get_next_value() << 6u; + packed(out_byte) = v1 | v2 | v3 | v4 ; ++out_byte; } packed.trim(interpreter.interpreted_letters(), alphabet); @@ -30,27 +32,23 @@ namespace tidysq::internal { const Alphabet &alphabet) { LenSq out_byte = 0; auto interpreter = unpacked.template content_interpreter(alphabet); - LetterValue tmp; + LetterValue v1, v2, v3, v4; while (!interpreter.reached_end()) { - packed(out_byte) = (interpreter.get_next_value() ) | - (interpreter.get_next_value() << 3u) ; - tmp = interpreter.get_next_value() ; - packed(out_byte) |= (tmp << 6u) ; - + v1 = interpreter.get_next_value(); + v2 = interpreter.get_next_value() << 3u; + v3 = interpreter.get_next_value(); + packed(out_byte) = v1 | v2 | (v3 << 6u) ; if (++out_byte == packed.size()) break; - - packed(out_byte) = (tmp >> 2u) | - (interpreter.get_next_value() << 1u) | - (interpreter.get_next_value() << 4u) ; - tmp = interpreter.get_next_value() ; - packed(out_byte) |= (tmp << 7u) ; + v1 = interpreter.get_next_value() << 1u; + v2 = interpreter.get_next_value() << 4u; + v4 = interpreter.get_next_value(); + packed(out_byte) = (v3 >> 2u) | v1 | v2 | (v4 << 7u) ; if (++out_byte == packed.size()) break; - packed(out_byte) = (tmp >> 1u) | - (interpreter.get_next_value() << 2u) | - (interpreter.get_next_value() << 5u) ; - + v1 = interpreter.get_next_value() << 2u; + v2 = interpreter.get_next_value() << 5u; + packed(out_byte) = (v4 >> 1u) | v1 | v2 ; ++out_byte; } packed.trim(interpreter.interpreted_letters(), alphabet); @@ -63,9 +61,11 @@ namespace tidysq::internal { const Alphabet &alphabet) { LenSq out_byte = 0; auto interpreter = unpacked.template content_interpreter(alphabet); + LetterValue v1, v2; while (!interpreter.reached_end()) { - packed(out_byte) = (interpreter.get_next_value() ) | - (interpreter.get_next_value() << 4u) ; + v1 = interpreter.get_next_value(); + v2 = interpreter.get_next_value() << 4u; + packed(out_byte) = v1 | v2 ; ++out_byte; } packed.trim(interpreter.interpreted_letters(), alphabet); @@ -77,36 +77,29 @@ namespace tidysq::internal { const Alphabet &alphabet) { LenSq out_byte = 0; auto interpreter = unpacked.template content_interpreter(alphabet); - LetterValue tmp; + LetterValue v1, v2, v3; while (!interpreter.reached_end()) { - packed(out_byte) = (interpreter.get_next_value() ) ; - tmp = interpreter.get_next_value() ; - packed(out_byte) |= (tmp << 5u) ; - + v1 = interpreter.get_next_value(); + v2 = interpreter.get_next_value(); + packed(out_byte) = v1 | (v2 << 5u) ; if (++out_byte == packed.size()) break; - packed(out_byte) = (tmp >> 3u) | - (interpreter.get_next_value() << 2u) ; - tmp = interpreter.get_next_value() ; - packed(out_byte) |= (tmp << 7u) ; - + v1 = interpreter.get_next_value() << 2u; + v3 = interpreter.get_next_value(); + packed(out_byte) = (v2 >> 3u) | v1 | (v3 << 7u) ; if (++out_byte == packed.size()) break; - packed(out_byte) = (tmp >> 1u) ; - tmp = interpreter.get_next_value() ; - packed(out_byte) |= (tmp << 4u) ; - + v1 = interpreter.get_next_value(); + packed(out_byte) = (v3 >> 1u) | (v1 << 4u) ; if (++out_byte == packed.size()) break; - packed(out_byte) = (tmp >> 4u) | - (interpreter.get_next_value() << 1u) ; - tmp = interpreter.get_next_value() ; - packed(out_byte) |= (tmp << 6u) ; - + v2 = interpreter.get_next_value() << 1u; + v3 = interpreter.get_next_value(); + packed(out_byte) = (v1 >> 4u) | v2 | (v3 << 6u) ; if (++out_byte == packed.size()) break; - packed(out_byte) = (tmp >> 2u) | - (interpreter.get_next_value() << 3u) ; + v1 = interpreter.get_next_value() << 3u; + packed(out_byte) = (v3 >> 2u) | v1 ; ++out_byte; } packed.trim(interpreter.interpreted_letters(), alphabet); @@ -118,22 +111,19 @@ namespace tidysq::internal { const Alphabet &alphabet) { LenSq out_byte = 0; auto interpreter = unpacked.template content_interpreter(alphabet); - LetterValue tmp; + LetterValue v1, v2; while (!interpreter.reached_end()) { - packed(out_byte) = (interpreter.get_next_value() ) ; - tmp = interpreter.get_next_value() ; - packed(out_byte) |= (tmp << 6u) ; - + v1 = interpreter.get_next_value(); + v2 = interpreter.get_next_value(); + packed(out_byte) = v1 | (v2 << 6u); if (++out_byte == packed.size()) break; - packed(out_byte) = (tmp >> 2u) ; - tmp = interpreter.get_next_value() ; - packed(out_byte) |= (tmp << 4u) ; - + v1 = interpreter.get_next_value(); + packed(out_byte) = (v2 >> 2u) | (v1 << 4u) ; if (++out_byte == packed.size()) break; - packed(out_byte) = (tmp >> 4u) | - (interpreter.get_next_value() << 2u) ; + v2 = interpreter.get_next_value() << 2u; + packed(out_byte) = (v1 >> 4u) | v2 ; ++out_byte; } packed.trim(interpreter.interpreted_letters(), alphabet); From 82b809e63700dbaa560c2aff305076c0b23866e6 Mon Sep 17 00:00:00 2001 From: DominikRafacz Date: Sun, 11 Jul 2021 12:48:06 +0200 Subject: [PATCH 4/4] fix early return for remove_ambiguous --- inst/include/tidysq/ops/remove_ambiguous.h | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/inst/include/tidysq/ops/remove_ambiguous.h b/inst/include/tidysq/ops/remove_ambiguous.h index c96e4d96..a147d266 100644 --- a/inst/include/tidysq/ops/remove_ambiguous.h +++ b/inst/include/tidysq/ops/remove_ambiguous.h @@ -6,20 +6,15 @@ namespace tidysq { namespace ops { template class OperationRemoveAmbiguous : public OperationRemoveOnCondition { - bool early_return_; - Alphabet match_dest_alph(const Alphabet &alphabet) { switch (alphabet.type()) { case AMI_BSC: - early_return_ = true; case AMI_EXT: return Alphabet(AMI_BSC); case DNA_BSC: - early_return_ = true; case DNA_EXT: return Alphabet(DNA_BSC); case RNA_BSC: - early_return_ = true; case RNA_EXT: return Alphabet(RNA_BSC); default: @@ -28,9 +23,13 @@ namespace tidysq { } bool may_return_early(const Sq &vector_in) override { - return early_return_; + SqType type = this->alph_.type(); + return type == AMI_BSC || type == DNA_BSC || type == RNA_BSC; } + Sq return_early(const Sq &vector_in) { + return vector_in; + } public: @@ -44,8 +43,7 @@ namespace tidysq { this->OperationRemoveOnCondition::alph_[value]) || this->OperationRemoveOnCondition::alph_.NA_value() == value; }, - by_letter), - early_return_(false) {}; + by_letter) {}; }; }