`my.getSampleData` <-
function (celsiusObject, id = c(), probesetNames=NULL) 
{
    require(celsius,quietly=TRUE)
    
    id = as.matrix(id)[, 1]
    mat = NULL
    j = 1
    check = rep(TRUE, length(id))
    
    probesetNamesDone <- !is.null(probesetNames)
    
    for (s in id) {
        egr = celsius:::.getWebData(celsiusObject, paste("/service/cel/cel?id=", 
            s, ";f=egr;p=", celsiusObject@protocol, sep = ""))
        if (celsiusObject@verbose) {
            cat(j, " sample ID ", s, " was retrieved for ", dim(egr)[1], 
                " features", "\n")
        }
        if (is.null(egr)) {
            check[j] = FALSE
        }
        else if (dim(egr)[2] == 2 && dim(egr)[1] > 1) {
          
            temp.names <- egr[-1, 1]
            temp.names <- gsub(pattern = ".+?:", replacement = "", x = temp.names)
            if (!probesetNamesDone) {
                probesetNames <- temp.names
                probesetNamesDone <- TRUE
            }
            
            egr = as.numeric(as.matrix(egr[-1, 2]))

            if((length(temp.names) != length(probesetNames)) || !all(temp.names==probesetNames)) {
                egr.old <- egr
                egr <- as.numeric(rep(NA,length(probesetNames)))
                names(egr) <- probesetNames
                egr[temp.names[temp.names %in% probesetNames]] <- egr.old[temp.names %in% probesetNames]
                names(egr) <- NULL
            }
            
        }
        else {
            egr = NULL
            check[j] = FALSE
        }
        mat = cbind(mat, egr)
        j = j + 1
    }
    if (any(check)) {
        colnames(mat) = id[check]
        rownames(mat) = probesetNames
    }
    badID = sum(!check)
    if (badID > 0) {
        if (badID == length(id)) {
            cat("\nThere is no data retrieved from the database! Please check your list of IDs!\n\n")
        }
        else {
            cat("\n", badID, " IDs were discarded from your list as they were either not in the database or did not contain any probesets.", 
                sep = "")
            cat("\nAnd they are:\n", id[!check], "\n\n")
        }
    }
    return(mat)
}