nasa / GeneLab_Data_Processing

60 stars 42 forks source link

[Microarray] Issue combining dataframes using bind_rows() when getBM() returns no results #96

Open cyouh95 opened 3 months ago

cyouh95 commented 3 months ago

Description

The following error occurred when rendering Affymetrix.qmd for one dataset (but same issue could potentially arise in Agile1CMP.qmd too):

Error in `dplyr::bind_rows()`:
  ! Can't combine `..1$ensembl_gene_id` <logical> and `..2$ensembl_gene_id` <character>.

Error occurs when getBM() returns no rows, then ensembl_gene_id column is assumed to be logical type, causing the incompatibility in bind_rows().

https://github.com/nasa/GeneLab_Data_Processing/blob/90d6bb5d6a20d817fa17ac5cb0763d4f8f75966b/Microarray/Affymetrix/Workflow_Documentation/NF_MAAffymetrix/workflow_code/bin/Affymetrix.qmd#L636-L652

Solution

Check if chunk_results contains any rows before binding to df_mapping in Affymetrix.qmd / Agile1CMP.qmd:

if (nrow(chunk_results) > 0) {
    df_mapping <- df_mapping %>% dplyr::bind_rows(chunk_results)
}