GeneLab_Data_Processing icon indicating copy to clipboard operation
GeneLab_Data_Processing copied to clipboard

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

Open cyouh95 opened this issue 1 year ago • 0 comments

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)
}

cyouh95 avatar May 30 '24 01:05 cyouh95