Open
Conversation
Rename the original cleanData to cleanMetaData and add roxygen skeleton. Introduce a writeCompressedParquet helper and export cleaned metadata, AMR phenotype, genome data and original metadata to compressed Parquet files, then create a separate DuckDB (parquet-backed) with views for metadata, amr_phenotype, genome_data and original_metadata. Reintroduce a new cleanData function focused on feature matrices (genes/proteins/domains/etc.) that writes feature tables to Parquet and creates corresponding views; remove duplicated metadata parquet exports from the feature-matrix flow. Minor whitespace and path-handling adjustments to normalize paths and ensure output directories exist.
Fixed trailing zero bug, fixed FTP timeout bug (?), fixed empty files hanging downloads, fixed imbalanced genome data sets (e.g., no .fna, yes .faa, yes .gff)
AbhirupaGhosh
commented
Feb 27, 2026
| message(" amr_phenotype: ", n_amr_ids) | ||
| message(" genomes with 0 AMR rows: ", length(ids_zero_amr)) | ||
| if (length(ids_zero_amr)) { | ||
| message(" e.g.: ", paste(utils::head(ids_zero_amr, 10), collapse = ", ")) |
Contributor
Author
There was a problem hiding this comment.
It printed
Initial summary: targets=24421 | AMR genomes=24422 | genome_data genomes=24423
Final summary:
targets : 24421
bac_data : 24421
genome_data : 24423
amr_phenotype: 24422
genomes with 0 AMR rows: 2
e.g.: , genome.genome_id
So I am guessing it is considering column name as genome id!
Contributor
There was a problem hiding this comment.
We can strip this out. It was for debugging originally which is why it's messy. Alternatively, if it is useful to keep a summary, I can work on some improvements for it!
Contributor
Author
There was a problem hiding this comment.
I didn't find any logical impact of this misprinting. We can come back to this later. I have made an issue.
AbhirupaGhosh
commented
Feb 27, 2026
Comment on lines
+111
to
+118
| message("FTPS pass 1 (30s timeout)") | ||
| future::plan(future::multisession, workers = max(1, workers_first)) | ||
| res1 <- future.apply::future_lapply( | ||
| genome_ids, | ||
| function(gid) { | ||
| ok <- .ftpes_download_one(gid, out_dir, | ||
| connect_timeout = 10L, max_time = 30L, | ||
| speed_time = 30L, speed_limit = 2048L |
Contributor
Author
There was a problem hiding this comment.
Suggested change
| message("FTPS pass 1 (30s timeout)") | |
| future::plan(future::multisession, workers = max(1, workers_first)) | |
| res1 <- future.apply::future_lapply( | |
| genome_ids, | |
| function(gid) { | |
| ok <- .ftpes_download_one(gid, out_dir, | |
| connect_timeout = 10L, max_time = 30L, | |
| speed_time = 30L, speed_limit = 2048L | |
| message("FTPS pass 1 (45s timeout)") | |
| future::plan(future::multisession, workers = max(1, workers_first)) | |
| res1 <- future.apply::future_lapply( | |
| genome_ids, | |
| function(gid) { | |
| ok <- .ftpes_download_one(gid, out_dir, | |
| connect_timeout = 10L, max_time = 45L, | |
| speed_time = 30L, speed_limit = 2048L |
AbhirupaGhosh
commented
Feb 27, 2026
Comment on lines
+144
to
+156
| message("FTPS pass 2 (60s timeout) for failed genomes") | ||
| future::plan(future::multisession, workers = max(1, workers_second)) | ||
| res2 <- future.apply::future_lapply( | ||
| fail_ids, | ||
| function(gid) { | ||
| ok <- .ftpes_download_one(gid, out_dir, | ||
| connect_timeout = 10L, max_time = 60L, | ||
| speed_time = 30L, speed_limit = 2048L | ||
| ) | ||
| list(gid = gid, ok = ok) | ||
| }, | ||
| future.seed = TRUE | ||
| ) |
Contributor
Author
There was a problem hiding this comment.
Suggested change
| message("FTPS pass 2 (60s timeout) for failed genomes") | |
| future::plan(future::multisession, workers = max(1, workers_second)) | |
| res2 <- future.apply::future_lapply( | |
| fail_ids, | |
| function(gid) { | |
| ok <- .ftpes_download_one(gid, out_dir, | |
| connect_timeout = 10L, max_time = 60L, | |
| speed_time = 30L, speed_limit = 2048L | |
| ) | |
| list(gid = gid, ok = ok) | |
| }, | |
| future.seed = TRUE | |
| ) | |
| message("FTPS pass 2 (120s timeout) for failed genomes") | |
| future::plan(future::multisession, workers = max(1, workers_second)) | |
| res2 <- future.apply::future_lapply( | |
| fail_ids, | |
| function(gid) { | |
| ok <- .ftpes_download_one(gid, out_dir, | |
| connect_timeout = 10L, max_time = 120L, | |
| speed_time = 30L, speed_limit = 2048L | |
| ) | |
| list(gid = gid, ok = ok) | |
| }, | |
| future.seed = TRUE | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rename the original cleanData to cleanMetaData and add roxygen skeleton. Introduce a writeCompressedParquet helper and export cleaned metadata, AMR phenotype, genome data and original metadata to compressed Parquet files, then create a separate DuckDB (parquet-backed) with views for metadata, amr_phenotype, genome_data and original_metadata. Reintroduce a new cleanData function focused on feature matrices (genes/proteins/domains/etc.) that writes feature tables to Parquet and creates corresponding views; remove duplicated metadata parquet exports from the feature-matrix flow. Minor whitespace and path-handling adjustments to normalize paths and ensure output directories exist.
Description
What kind of change(s) are included?
Checklist
Please ensure that all boxes are checked before indicating that this pull request is ready for review.