R message "Can't subset columns that don't exist. x Locations 2, 3, 4, 5, 6, etc. don't exist. i There are only 1 column" MBCB packge

Viewed 5459

I am trying to do a background correction on my data sets that has only 3 columns, when submitting my code I get the error "Can't subset columns that don't exist. x Locations 2, 3, 4, 5, 6, etc. don't exist. i There are only 1 column". Actually my data has only 3 columns so I dont get the error.

This is the code:

MBCB::mbcb.main(GSE150738_Dataraw,GSE150738_Dataraw_ctrol,
    npBool=TRUE,
    rmaBool=FALSE,
    mleBool=FALSE,
    bayesBool=FALSE,
    gmleBool=FALSE,                      
    paramEstFile="/Users/juanitadussan/Dropbox/ESTUDIO/BIOMEDICA/TESIS/TESIS 1/Análisis de datos GSE/Datasets/Background correction_parameters.xlsx",
    bgCorrectedFile="/Users/juanitadussan/Dropbox/ESTUDIO/BIOMEDICA/TESIS/TESIS 1/Análisis de datos GSE/Datasets/Background correction_corrected.xlsx",
    iter=500,
    burn=200,
    normMethod="none",
    isRawBead=FALSE)

Error in stop_subscript(): ! Can't subset columns that don't exist. x Locations 2, 3, 4, 5, 6, etc. don't exist. i There are only 1 column.

Can anyone tell me what I am doing wrong?

Thanks!

A subset of the data is here:

Data 1:

dput(mydatasubset1)
structure(list(ID_REF = c("TC0100006437.hg.1", "TC0100006476.hg.1", 
"TC0100006479.hg.1", "TC0100006480.hg.1", "TC0100006483.hg.1"
), GSM4557962 = c("44.944035", "100.85072", "157.17555","89.425964", "68.77652"), GSM4557965 = c("42.962048", "126.33466", "139.22046", "139.04102", "79.80324")), row.names = c(NA, -5L), class = c("tbl_df", "tbl", "data.frame"))

Control:

dput(mydatasubset2)
structure(list(ID_REF = c("TC0100006437.hg.1", "TC0100006476.hg.1", 
"TC0100006479.hg.1", "TC0100006480.hg.1", "TC0100006483.hg.1"
), GSM4557961 = c("46.799675", "127.531555", "212.54181","121.27715", "70.95126"), GSM4557964 = c("49.06907", "147.042", "206.33817", "126.067024", "60.933674")), row.names = c(NA, -5L), class = c("tbl_df", "tbl", "data.frame"))
2 Answers

You need to make the numbers numeric fields and make the ids row names. Currently, these datasets are tibbles. You'll have to change them to data frames first. Since you're not using normalization, you could use mbcb.correct, as well.

This is how I prepared the data.

library(MBCB)

mydatasubset1 <- structure(list(
  ID_REF = c("TC0100006437.hg.1", "TC0100006476.hg.1",
             "TC0100006479.hg.1", "TC0100006480.hg.1", "TC0100006483.hg.1"),
  GSM4557962 = c("44.944035", "100.85072", "157.17555", "89.425964", "68.77652"), 
  GSM4557965 = c("42.962048", "126.33466","139.22046", "139.04102", "79.80324")),
  row.names = c(NA, -5L), class = c("tbl_df","tbl","data.frame"))

mydatasubset2 <- structure(list(
  ID_REF = c("TC0100006437.hg.1", "TC0100006476.hg.1","TC0100006479.hg.1", 
             "TC0100006480.hg.1", "TC0100006483.hg.1"),
  GSM4557961 = c("46.799675", "127.531555", "212.54181","121.27715", "70.95126"),
  GSM4557964 = c("49.06907", "147.042", "206.33817", "126.067024", "60.933674")), 
  row.names = c(NA, -5L), class = c("tbl_df", "tbl", "data.frame"))

mydatasubset1$GSM4557962 <- as.numeric(mydatasubset1$GSM4557962)
mydatasubset1$GSM4557965 <- as.numeric(mydatasubset1$GSM4557965)
mydatasubset2$GSM4557961 <- as.numeric(mydatasubset2$GSM4557961)
mydatasubset2$GSM4557964 <- as.numeric(mydatasubset2$GSM4557964)

str(mydatasubset1)
str(mydatasubset2)

md1 <- as.data.frame(mydatasubset1)
md2 <- as.data.frame(mydatasubset2)

row.names(md1) <- md1$ID_REF
row.names(md2) <- md2$ID_REF

(md1 <- md1[, 2:3])
(md2 <- md2[, 2:3])

I used temp files for the output.

t1 <- tempfile()
t2 <- tempfile()

MBCB::mbcb.main(md1,
                md2,
                npBool = TRUE,
                rmaBool = FALSE,
                mleBool = FALSE,
                bayesBool = FALSE,
                gmleBool = FALSE,                      
                paramEstFile = t1, 
                bgCorrectedFile = t2, 
                iter = 500,
                burn = 200,
                normMethod = "none",
                isRawBead = FALSE)
# 1 / 2  complete.
# 2 / 2  complete.

This is the setup for mbcb.correct.

tellMe <- mbcb.correct(md1,
                       md2,
                       npBool = TRUE,
                       rmaBool = FALSE,
                       mleBool = FALSE,
                       bayesBool = FALSE,
                       gmleBool = FALSE,                      
                       # paramEstFile = t1, 
                       # bgCorrectedFile = t2, 
                       iter = 500,
                       burn = 200,
                       # normMethod = "none",
                       isRawBead = FALSE)
# 1 / 2  complete.
# 2 / 2  complete.

I also had the same problem. After grouping the original database by airline, I could not sort the result by total count of airlines. The solution for me was very simple

The problematic code is below:

top_5_airLines <- (grouped[order(grouped$Total, decreasing = TRUE)]

The right code can be found here:

top_5_airLines <- (grouped[order(grouped$Total, decreasing = TRUE),])
Related