This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Error "no rows to aggregate" using makeFunctionalPrediction() Tax4fun2

Hi ! ’m running Tax4Fun2 (v1.1.5) on Ubuntu via WSL2. The runRefBlast() step completed successfully, but when I call makeFunctionalPrediction(), I get the following error:

Error in aggregate.data.frame(x = otu_table_reduced[, -1], by = list(otu_table_reduced[,  :
  no rows to aggregate

Context and setup

  • R on Ubuntu 22.04 (via WSL2 on Windows 11)
  • Tax4Fun2 version: 1.1.5 (downloaded from Zenodo: https://zenodo.org/records/10035668)
  • Reference data: Tax4Fun2_ReferenceData_v2 (properly extracted and readable)
  • Database mode: "Ref99NR"

Path & script used :

fasta_file <- "rep-seqs_filtered.fasta"
temp_folder <- "~/Tax4fun_test_ubuntu/Tax4Fun2_temp_results"
ref_path <- "~/Tax4fun_test_ubuntu/Tax4Fun2_ReferenceData_v2"
if (!dir.exists(temp_folder)) dir.create(temp_folder)
res_tax4fun <- runRefBlast(path_to_otus = fasta_file,
                           path_to_reference_data = ref_path,
                           path_to_temp_folder = temp_folder,
                           database_mode = "Ref99NR",
                           use_force = TRUE,
                           num_threads = 4)
list.files(temp_folder)
# "logfile1.txt"  "ref_blast.txt" -> output here = ok

blast_res <- read.table(file.path(temp_folder, "ref_blast.txt"), sep = "\t", header = FALSE)
head(read.table("Tax4Fun2_temp_results/ref_blast.txt", nrows = 5)$V1)
# "Cluster_1" "Cluster_2" "Cluster_3" "Cluster_6" "Cluster_8" -> corresponding to my ASVs identifications

res_functional <- makeFunctionalPrediction(
  path_to_otu_table = "/home/msuchet/Tax4fun_test_ubuntu/otu_table_tax4fun2_corrected.txt",
  path_to_reference_data = ref_path,
  path_to_temp_folder = temp_folder,
  database_mode = "Ref99NR",
  normalize_by_copy_number = TRUE,
  min_identity_to_reference = 0.95,  
  normalize_pathways = FALSE)         
#Using minimum idenity cutoff of 95% to nearest neighbor
#Error in aggregate.data.frame(x = otu_table_reduced[, -1], by = list(otu_table_reduced[,  : no rows to aggregate

I verified that:

  • The OTU table and reference blast results exist and are readable.
  • OTU names match between my table and the ref_blast.txt output.
  • The min identity threshold isn't the problem.
  • The same error occurred previously on Windows, so it might not be system-dependent.
    otu <- read.table("otu_table_tax4fun2_corrected.txt", header = TRUE, row.names = 1)
    blast_res <- read.table(file.path(temp_folder, "ref_blast.txt"), sep = "\t", header = FALSE)
    table(rownames(otu) %in% blast_res$V1)
    # TRUE: 662
    setdiff(rownames(otu), blast_res$V1)
    # character(0)
    table(blast_res$V3 >= 95) # TRUE = 438 -> 438 ASV with % identity >95%
    
    So the question is, what could cause the error "no rows to aggregate" when I try to use makeFunctionalPrediction()? How to fix it ? Any help or clarification would be greatly appreciated. I can share detaisl or files if needed.

Best

r tax4fun2 prediction functional makefunctionalprediction

1 answer

This confusion pertains to the difference between the unicode character for 'greater-than-or-equal' and the more coding friendly '>='....

The error "'Only ASCII characters are allowed. Invalid character (8805)'" typically occurs when copying code from formatted sources (e.g., web browsers, PDFs) where >= gets converted to the fancy Unicode (U+2265). R's parser expects plain ASCII >= (two characters: > and =).

Solution:

  1. Open your R script in a plain text editor (e.g., Notepad++, VS Code, or RStudio's source pane).
  2. Search for the symbol unicode symbol for greater-than or equal (U+2265) (or the line with the comparison) and replace it with >=.
    • Specifically, in the debug code from step 1: Change the blast_res to blast_res$V3 >= 95.
    • Do the same for any other instances (e.g., in step 2: ref_blast_red <- blast_res[blast_res$V3 >= 95, ...]).
  3. Save and re-run the code block.

Prevention: Always paste code into a plain text editor before running in R, or type inequalities manually as >=, <=, etc.

If this doesn't resolve it (e.g., error persists elsewhere), share the exact line throwing the error. Back to debugging—rerun step 1 after the fix!

Kevin

Log in to answer this question.