Hi,
I get the error of:
Error in write.table(dxr1, "AS_differential.txt", sep = "\t", quote = F) :
unimplemented type 'list' in 'EncodeElement'
Execution halted
while I'm running a Rscript in Ubuntu. I think it might be due to having a list but my tries for flattening the list (which I don't know which column might be) didn't work. I don't have access to view the result again cause it's in a Rscript and have access to my experiment design that I can't feed it in manual way and using Rstudio. tried this flattening code: df <- apply(df,2,as.character) and then tried to write.csv but no luck, either. I tried some similar issues suggestions but my issue is that I can't see what's going on and can't even view the results or getting the head() and other things.
Before that error there is a warning as well:
converting counts to integer mode
Warning message:
In DESeqDataSet(rse, design, ignoreRank = TRUE) :
some variables in design formula are characters, converting to factors
I should also mention that I get one text file (AS_differential.txt) but it just has one row and obviously had been halted before finishing the work! Library is DEXSeq, and these are last lines of the script:
JUM = estimateExonFoldChanges(JUM, fitExpToVar="condition")
dxr1 = DEXSeqResults(JUM)
write.table(dxr1, "AS_differential.txt", sep="\t", quote=F)
q()
Can someone help to solve this issue please? Thanks a lot. :)
Solved: My data was insanely huge and consisted multi-layers of lists in the DEXSeqResults that I wasn't able to either convert to data.frame nor doing anything on it. At last, I saved the results of analysis in a .RData Image by:
save.image(file='file.RData')
And then opened it in a Rstudio to see what's going on. At the end, I took a subset of my results with pvalue less than 0.05 and then did write.table from that.
dxr1.sig <- as.data.frame(dxr1[dxr1$pvalue < 0.05 & !is.na(dxr1$pvalue),])
write.table(dxr1.sig, "AS_differential.txt", sep="\t", quote=F)
Rscript and Ubuntu have little to nothing to do with your problem. Are you sure you can
write.table
a DEXSeqResults object?At this point, I have to find a way to have the results printed/viewed but nothing works even write.csv and data.frame conversion of result. It says that it's data.frame already then halts the process. The reason that I mentioned it's a Rscript code is that it's automatic and I can't check output of each step. Here's the code I use:
Can you create a copy of the R script and edit it? It's not it's a binary file that you cannot tweak the code in.
Of course, I can and I did. That's why I said I am trying to find a way to change write.table that doesn't work, to something that works like write.csv maybe. But I keep getting other errors. My issue is that I don't know how to print/view/save the results of DEXSeq or DEXSeqResults.
What does
class(dxr1)
give you?Is there anyway I can figure it out which of my columns is a list? Like running a code that scan all the columns and tell me which one is list? If I figure that out, I can mutate/unlist it so then can add to data.frame and then to write.table.
I have to run the whole analysis again to add that class(dxr1), so will let u know when finished.
Follow jv's advice - they're further along than me in your track, so their advice will be more pertinent.
unimplemented type 'list' in 'EncodeElement' error in a Rscript run in Ubuntu terminal
You can also run R in the terminal and run the script line by line.
Solved: My data was insanely huge and consisted multi-layers of lists in the DEXSeqResults that I wasn't able to either convert to data.frame nor doing anything on it. At last, I saved the results of analysis in a .RData Image by:
And then opened it in a GUI Rstudio to study what's going on. My tries there to convert subsets of this result to data.frame was also not successful. At the end, I took a subset of my results less tha pvalue 0.05 and then did write.table from that.
Instead of
save.image
,saveRDS(dxr1)
might have worked better as you're saving just the object that you need, not the entire environment.Great tip. Thanks!