SydneyBioX / spicyR

https://sydneybiox.github.io/spicyR/
8 stars 4 forks source link

Multi-column intensities raise an error #5

Closed celsomilne closed 2 years ago

celsomilne commented 4 years ago

The documentation for SegmentedCells implies that intensityString can be a vector of column names, but doing so raises an error:

df <- data.frame(x=runif(100),
                 y=runif(100),
                 intensity1=runif(100),
                 intensity2=runif(100),
                 cellType=runif(100) >= 0.5)
SegmentedCells(df, intensityString = c("intensity1", "intensity2"))
... [other warnings]
Error in `colnames<-`(`*tmp*`, value = gsub(intensityString, "", colnames(markers))) : 
  attempt to set 'colnames' on an object with less than two dimensions

In addition: Warning messages:
1: In grepl(intensityString, colnames(cellData)) :
  argument 'pattern' has length > 1 and only the first element will be used
2: In if (!any(grepl(intensityString, colnames(cellData))) & intensityString !=  :
  the condition has length > 1 and only the first element will be used
3: In grepl(intensityString, colnames(cellData)) :
  argument 'pattern' has length > 1 and only the first element will be used
4: In grep(intensityString, colnames(cellData)) :
  argument 'pattern' has length > 1 and only the first element will be used
5: In gsub(intensityString, "", colnames(markers)) :
  argument 'pattern' has length > 1 and only the first element will be used

The offending line in ?SegmentedCells:

intensityString | A string which can be used to identify the columns which contain marker intensities. (This needs to be extended to take the column names themselves.)

ellispatrick commented 4 years ago

That's a good idea! At the moment I had just been using it as "intensity_" to pull out "intensity_CD8" and "intenstity_CD14" ...

It makes sense to have it able to do both.