Question: plotPlatePosition and plate_position
gravatar for TJ
11 months ago by
Stanford University
TJ0 wrote:

Hi All,

I am attempting to use the plotPlatePosition function in scater and having some issues with it. Specifically, I have a 96-well plate where the data are incomplete. I have "Cell.Position" as metadata data added to my sce object using colData() where locations are listed as A1, A2, A12, B2, B10, etc... However, this standard 96-well plate (rows A-H, columns 1-12) is missing cells. This is what I've tried:

# subseting my plate of interest, here Plate3 (this plate has 72 wells, therefore missing some positions)
example_sce2 <- subset(example_sce1, , Plate.Name=="Plate3")

# defining plate position as a 96-well plate
example_sce2$plate_position <- paste0(
  rep(LETTERS[1:8], each = 12),
  rep(formatC(1:12, width = 2, flag = "0"), 8))

Error in `[[<-`(`*tmp*`, name, value = c("A01", "A02", "A03", "A04", "A05",  :
  96 elements in value to replace 72 elements

# when I try running the following either after above or before, I get the same error
plotPlatePosition(example_sce2, colour_by = "total_counts")

Error in `[[<-`(`*tmp*`, name, value = c("A01", "A02", "A03", "A04", "A05",  :
  96 elements in value to replace 72 elements

If I replace the 96-well plate in plate_position to create a 72 well plate here by doing letters[1:6], it generates a plate plot with A-F instead of A-H that does not show original position of cells. Is there a way for "ignoring" the empty/unlisted positions in a 96-well plate?

Thank you in advance for all of your help!

R scater singlecellexperiment • 273 views
ADD COMMENTlink modified 11 months ago by Aaron Lun25k • written 11 months ago by TJ0
Answer: plotPlatePosition and plate_position
gravatar for Aaron Lun
11 months ago by
Aaron Lun25k
Cambridge, United Kingdom
Aaron Lun25k wrote:

Your question suggests some fundamental misunderstandings about how this works. example_sce2 only has 72 columns, so why are you trying to assign a vector with 96 elements to plate_position in the column data? Moreover, it's incorrect to subset LETTERS - as you've found out, just because you get a vector of the same length doesn't mean that the well identities are correct. And obviously, if you tell plotPlatePosition that the first library is at A1, then that's what it'll plot - what else could it do? 

You should have the relevant metadata for your experiment available somewhere. Load it from file, match up the rows of the metadata to the identity and ordering of columns in your SCE object, and use the matched values to populate the colData fields including plate_position.

ADD COMMENTlink modified 11 months ago • written 11 months ago by Aaron Lun25k

Thanks, Aaron! That makes sense re first paragraph - I was clearly confused/misunderstood. I do have my metadata loaded and matched to my SCE object, except that I had my cell positions in colData named Cell.Position instead of plate_position. I changed the field name to plate_position, now plotPlatePosition works! Thanks again.

ADD REPLYlink written 11 months ago by TJ0

I have a follow up question about plate_position please: I know that plate_position can used as a variable for  plotExplanatoryVariables. If I have several 96-well plates that all have certain positions empty in every well for control purposes (e.g. H7-H12), such that now I have 90 cells per plate for multiple plates, does it affect how plotExplanatoryVariables is calculated? Specifically, does this function assume that these are "0" read counts or gene counts at that same position over several plates and therefore plotExplanatoryVariables would assign a "heavier weight" for this?

ADD REPLYlink modified 10 months ago • written 10 months ago by TJ0

I assume that those 6 wells (H7-H12) don't even have libraries for any plate. If that is the case, plotExplanatoryVariables will just ignore them. It won't put zeroes, it won't do anything special - it would be as if you had a set of 90-well plates in the first place. It's not like plotExplanatoryVariables sees the plate_position variable and decides "oh, you must be working with 96-well plates" - for all intents and purposes, it's just another factor. Only plotPlatePosition does something special with plate_position, as befitting its purpose.

The situation gets more complex if you have a different set of empty wells for each plate. If so, the linear model fitted by plotExplanatoryVariables will implicitly give more weight to the wells that are occur more frequently across plates. This seems entirely reasonable to me, because that's where more of the information about the gene's variance is available.

ADD REPLYlink modified 10 months ago • written 10 months ago by Aaron Lun25k

Thank you, Aaron.

Got it, thanks for clarification. Looking at my plates individually, there are "missing" cells that were not selected for sequencing because they didn't make it past quality control steps.

ADD REPLYlink written 10 months ago by TJ0
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 197 users visited in the last hour