Hello Community, I'm trying to subset matrices of ASVs's associations that were produced from 2 different phyloseq objects.
For downstream analysis I need to subset the square matrices in a way that the exactly same taxa are contained in both matrices (In matrix 1 I have 700 taxa and in matrix 2 I have 400 taxa).
The row and column names of the matrices are the ASVs IDs (ASV1, ASV2, ASV3, ASV4.... ASVn). So with the assumption that ASVs ID's are to a specific taxa (e.g. ASV451 is to E. Coli) and that with the which()
R function I can locate the matching ASVs on the other matrix, I did the following:
new_matrix1_ASVs<- matrix1_ASVs[which(rownames(matrix_1_ASVs) %in% rownames(matrix2_ASVs)),
which(rownames(matrix_1_ASVs) %in% rownames(matrix2_ASVs))]
new_matrix2_ASVs <- matrix2_ASVs[which(rownames(matrix2_ASVs) %in% rownames(matrix1_ASVs)),
which(rownames(matrix2_ASVs) %in% rownames(matrix1_ASVs))]
By doing the above, I get both matrices with the same dimensions but not sure if the same ASVs IDs are to the same taxa, is the above mentioned assumption correct?
ASVs ID's are not taxa specific.
Ok so it was a bad approach to subset the matrices on that way.
Hi, did you succeed to deal with your two datasets? Giving the same ASV name for your two datasets?