mhoban / rainbow_bridge

GNU General Public License v3.0
5 stars 2 forks source link

Bullet Proofing LCA `nodes_dmp` `taxid_lineage_dump` #119

Closed cbird808 closed 2 weeks ago

cbird808 commented 2 weeks ago

In the following code in collapse_taxonomy.R, if either nodes or taxid lineage dump file are missing, it will error out. The | in the if should be &&. I added error handling if only one or the other exists. Both should exist, but I did run into this because an earlier version did not use taxid lineage dump.

if (file_exists(nodes_dump) | file_exists(taxid_lineage_dump)) {
  lca_getter <- LCA$new(nodes = nodes_dump, merged = merged_dump, taxid_lineage = taxid_lineage_dump)
  lca <- TRUE
}
if (file_exists(nodes_dump) && file_exists(taxid_lineage_dump)) {
  lca_getter <- LCA$new(nodes = nodes_dump, merged = merged_dump, taxid_lineage = taxid_lineage_dump)
  lca <- TRUE
} else {
  missing_files <- c()
  if (!file_exists(nodes_dump)) {
    missing_files <- c(missing_files, "nodes_dump")
  }
  if (!file_exists(taxid_lineage_dump)) {
    missing_files <- c(missing_files, "taxid_lineage_dump")
  }
  stop(paste("Error: The following file(s) are missing:", paste(missing_files, collapse = ", ")))
}
mhoban commented 2 weeks ago

Are you seeing an error? The LCA class is designed to work with either a nodes.dmp file or a taxidlineage.dmp file (mostly just because I first wrote it to use nodes and then realized that taxidlineage was right there and would work faster).

This section controls whether the script retrieves the taxid of the common ancestor.

cbird808 commented 2 weeks ago

If you don't have both, the way the script is written, it will throw an error

From: mykle hoban @.> Sent: Wednesday, October 23, 2024 3:55 PM To: mhoban/rainbow_bridge @.> Cc: Bird, Chris @.>; Author @.> Subject: Re: [mhoban/rainbow_bridge] Bullet Proofing LCA nodes_dmp taxid_lineage_dump (Issue #119)

Are you seeing an error? The LCA class is designed to work with either a nodes.dmp file or a taxidlineage.dmp file (mostly just because I first wrote it to use nodes and then realized that taxidlineage was right there and would work faster).

This section controls whether the script retrieves the taxid of the common ancestor.

- Reply to this email directly, view it on GitHubhttps://github.com/mhoban/rainbow_bridge/issues/119#issuecomment-2433446837, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADBV4SYZX2W4ELKKXAYRUNLZ5AELVAVCNFSM6AAAAABQO46FCCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMZTGQ2DMOBTG4. You are receiving this because you authored the thread.Message ID: @.**@.>>

cbird808 commented 2 weeks ago

I stand corrected, the error I encountered was because the var taxid_lineage_dump didn't exist. that should not happen within the normal running of rainbow_bridge