rezakj / iCellR

Single (i) Cell R package (iCellR) is an interactive R package to work with high-throughput single cell sequencing technologies (i.e scRNA-seq, scVDJ-seq, scATAC-seq, CITE-Seq and Spatial Transcriptomics (ST)).
120 stars 19 forks source link

'replacement has 1 row, data has 0' when creating iCellR object #30

Open lucas-bishop opened 3 years ago

lucas-bishop commented 3 years ago

after reading in the all_contig_anotations.csv file as a data frame and trying to use the prep.vdj( ) function on that output, exactly the same as in the tutorial, I get this error (which seems to be related to the prep.vdj function):

my.vdj <- prep.vdj(vdj.data = my.vdj, cond.name = "NULL") Error in$<-.data.frame(tmp, "total.colonotype", value = 0L) : replacement has 1 row, data has 0

frazzette commented 3 years ago

@lucas-bishop Check how R is interpretting your "all_contig_anotations.csv" file, specifically the "productive" column. The formula for prep.vdj, F0039.R, includes a subset on line 22 that only keeps data if the value in the "productive" column is "True". However, when I investigated my "all_contig_anotations.csv" in RStudio, I found it was importing values in that columns as "true", "false" - the case of the first letter wasn't matching. So prep.vdj was subseting out all my data because technically R reads "True" as not equal to "true".

If that's your issue, this code worked for me

my.vdj$productive[my.vdj$productive == "true"] <- "True" My.VDJ <- prep.vdj(my.vdj)

lucas-bishop commented 3 years ago

@frazzette If I recall correctly I think I hacked together some code to coerce the "productive" column - similar to what you've done here. Thank you for the suggestion!

rezakj commented 3 years ago

Hi guys,

I am a bit busy but soon will look into this. But for now, I think it's important to know that the vdj analysis is mostly about plotting the clonotypes to spot them in UMAP, tSNE or KNetL. You can do this manually (outside of iCellR) too. Get the X and Y axes from the UMAP (in the umap.data slot) and plot the cells of interest in red and rest of the cells in gray for any clonotype. Hope this helps for now but once I have more time I will fix those functions and look into them.

Reza