Closed priyamnarain closed 4 years ago
Could you print head(sub[[1]])
? The error suggests this is missing column gene
.
When I did : head(sub[[1]] column gene is missing. Does that mean error in some earlier step? Where can i check this for?
Error in eval(quote(list(...)), env) : object 'gene' not found
head(sub[[1]]) named list()
The error you 1st posted had sub
, but in the code chunk below it, there is no sub
, so it is difficult for me to figure out exactly the issues. The best advice I can give is to run the code line-by-line and check in top
and sub
and the object used to create the list of sub
sets for whether gene
exists, and where it goes missing.
I DID IT STEP BY STEP AGAIN. BUT THE ERROR PERSISTS
DS ANALYSIS VIGNETTE
system.time(pbs <- aggregateData(sce)) user system elapsed 3.137 0.147 3.313 pbs class: SingleCellExperiment dim: 12278 8 metadata(3): experiment_info agg_pars n_cells assays(6): Endothelial Microglia ... CPE Neuron rownames(12278): ENSMUSG00000051951.Xkr4 ENSMUSG00000103377.Gm37180 ... ENSMUSG00000064370.mt-Cytb eGFP.eGFP rowData names(0): colnames(8): ZT2_1 ZT2_2 ... ZT13_3 ZT13_4 colData names(5): group_id orig.ident sum_drop detected_drop subsets_Mt_percent_drop reducedDimNames(0): altExpNames(0):
(p <- pbMDS(pbs) + scale_shape_manual(values = c("ZT2" = 17, "ZT13" = 8))) foo <- grepl("edgeR|limma|MM", names(res)) sub <- list(res, res[!foo], res[foo]) for (i in seq_along(sub)) {
- tbl <- mutate(bind_rows(sub[[i]]), hit = paste(gene, cluster_id))
- top <- filter(tbl, p_adj.loc < 0.05) %>% do(
- group_by(., mid) %>% summarize(hit = list(hit))) %>%
- group_by(mid) %>% summarize(hit = list(purrr::reduce(hit, c)))
- df1 <- fromList(set_names(top$hit, top$mid)) %>%
- dplyr::mutate(
- code = apply(.[top$mid], 1, paste, collapse = ""),
- degree = apply(.[top$mid], 1, sum),
- hit = unique(unlist(top$hit))) %>%
- mutate(., cluster_id = tbl$cluster_id[match(.$hit, tbl$hit)]) %>%
- add_count(code) %>% group_by(code) %>% ungroup
- m <- match(unique(df1$code), df1$code)
- keep <- pull(top_n(df1[m, ], 40, n), "code")
- df1 <- dplyr::filter(df1, code %in% keep)
- m <- match(unique(df1$code), df1$code)
- o <- order(df1$degree[m], -df1$n[m])
- df2 <- reshape2::melt(df1, variable.name = "mid",
- id.var = setdiff(names(df1), top$mid)) %>%
- group_by(code, mid) %>% dplyr::slice(1) %>%
- ungroup %>% mutate_at("mid", function(u)
- droplevels(factor(u, levels = names(res)[
- c(which(!foo), which(foo))])))
- df3 <- read.csv(file.path("..", config$mids), row.names = 1)
- df3$type <- factor(df3$type, levels = names(.typ_cols))
- df3 <- df3[df3$id %in% names(sub[[i]]), ]
- for (j in seq_len(3))
- assign(sprintf("sub%s_df%s", i, j), get(paste0("df", j)))
- }
Error in eval(quote(list(...)), env) : object 'gene' not found
head(sub[[1]]) named list()
Assuming you are running the same code as in the repo, I already have the code. As I suggested above, could you please run line-by-line and point down where the issue occurs. The gene
column should be in the res
ults table, so I suggest you start checking this first. Then check sub
. Then check top
, as I said above...
PS: I'm sorry but this is unreadable... Please try to post your issue in a more read-friendly manner. Ideally, limiting the code to the lines leading up to the issue, not the entire script. Thank you...
@priyamnarain I totally agree w/ @HelenaLC, this is almost impossible to parse.
If you haven't already discovered it, please have a look at "Fenced code blocks" here: https://help.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks#fenced-code-blocks .. that in itself will go a long way to making your code readable.
.. and, I would try and give the output of head()
or str()
or something compact for each of data.frames or other objects that you make in your script leading up to the error. Probably a little clear detective work will allow you or us to diagnose.
And, to me using assign()
at all is an unusual way to organize objects, so also explaining what it is you want to do may help. Maybe there is an logical alternative way.
Cheers, Mark
WHEN I RUN THE BELOW PREP.DATA I GET THE " Error in eval(quote(list(...)), env) : object 'gene' not found
for (i in seq_along(sub)) {
get gene-cluster combinations by method at FDR 5%
}