Can I move the files from the Data section of the Global Environment to the Values? The ones that were meant for Data went into the Values section and now nothing is graphing!

I was following a tutorial on Youtube on how to run datasets and when the woman put her bottomly files into the script and then loaded them, they went into the Global Environment. I did the same, and they loaded into the environment too. Then she ran

Plot 2 replicate dataset

eset <- bottomly.2reps
cpm.mat <- log(cpm(exprs(eset)))
mean.vec <- apply(cpm.mat, 1, mean)
sdvec <- apply(cpm.mat, 1, sd)
plot(mean.vec, sdvec, pch=".", main="2 replicates", ylab="sd", xlab="Average logCPM")

Which I proceeded to copy and run one-by-one and all but the sdvec command went into the Data tab, when they should have gone to the Values tab. Then I tried running the last command which was to plot the data in the bottomly file and got an error. Please advise me on where I may have gone wrong.

Hi Tyler, it's hard to figure out why your code runs an error, based on your minimal information (we have no clue how your data looks like, what your data represents and where the function cpm() cames from...!). I can just guess what happend... But your plot will definitely not appear if the input variable sdvec is missing.

To make it more easy to help you, please try to use reprex in future. Below is a link to a cool FAQ from Andrés, try it out :slight_smile:

So, now some reprex in action, based on your code. I have added a sample data set (just some random numbers) and also load the Bioconductor package 'edgeR' (I hope that's your cpm()-function). :wink:

#load library 
#> Lade nötiges Paket: limma

#set seed for the random numbers
#sampling random numbers/counts (e.g. as example for your digital gene expression data loaded in R etc.)
y <- matrix(rnbinom(100,size=1,mu=10), ncol=2)

#compute cpm ('counts per million...?') and (natural) log-transform 
cpm.mat <- log(cpm(y))

#calculate mean/average out of the two replicates (each column represents a replicate...?) 
mean.vec <- apply(cpm.mat, 1, mean)
#calculate standard deviation/variability out of the two replicates
sdvec <- apply(cpm.mat, 1, sd)

#plot mean vs. standard deviation (set some plotting options)
plot(mean.vec, sdvec, main="2 replicates", ylab="sd", xlab="Average logCPM")

Created on 2019-02-08 by the reprex package (v0.2.1)

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.