Skip to content

Add tree and metadata options to importers#798

Open
0xMuluh wants to merge 4 commits intodevelfrom
imp
Open

Add tree and metadata options to importers#798
0xMuluh wants to merge 4 commits intodevelfrom
imp

Conversation

@0xMuluh
Copy link
Copy Markdown
Collaborator

@0xMuluh 0xMuluh commented Jan 5, 2026

ping #755

Comment thread R/convertFromBIOM.R
#' path of the sample metadata file (tsv). (Default: \code{NULL}).
#'
#' @param tree.file \code{Character scalar}. Optional path to a phylogenetic
#' tree. If provided, replaces any tree stored in the BIOM metadata.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to provide multiple trees?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In theory uses, but there is no any practical use-cases

Comment thread R/convertFromBIOM.R
Comment on lines +131 to +139
# Load/replace tree if provided
if (!is.null(tree.file)) {
if (!.is_non_empty_string(tree.file)) {
stop("'tree.file' must be a single character value or NULL.",
call. = FALSE)
}
tree <- ape::read.tree(tree.file)
rowTree(tse) <- tree
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The node names in tree must match exactly the rownames. Otherwise, the rows cannot be linked with the tree and it leads to warning that some rows were dropped (it is hard for user to know what is the problem):

Warning message:
18371 row(s) couldn't be matched to the tree and are/is removed.

One could provide links between rows and nodes of tree, but it becomes too complicated.

Proposal:

  • Pack this tree adding script into function
  • Check if rownames can be found from tree. If not, give error:

"Rownames do not match with tree labels. Construct TreeSE without tree (tree.file=NULL) and then add the tree manually with changeTree(tse, tree = tree_object, rowNodeLab = link_vector)"

Comment thread R/convertFromBIOM.R Outdated
rowTree(tse) <- tree
}

tse
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return(tse)

Comment thread R/convertFromBIOM.R
#' path of the sample metadata file (tsv). (Default: \code{NULL}).
#'
#' @param tree.file \code{Character scalar}. Optional path to a phylogenetic
#' tree. If provided, replaces any tree stored in the BIOM metadata.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In theory uses, but there is no any practical use-cases

Comment thread R/convertFromBIOM.R Outdated
stop("'tree.file' must be a single character value or NULL.",
call. = FALSE)
}
tree <- ape::read.tree(tree.file)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add importFrom and use without specifying the package

0xMuluh and others added 2 commits March 9, 2026 10:10
Signed-off-by: Daena Rys <rysdaena8@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants