cellengine / cellengine-r-toolkit Goto Github PK
View Code? Open in Web Editor NEWCellEngine R API toolkit
Home Page: https://cellengine.github.io/cellengine-r-toolkit/
CellEngine R API toolkit
Home Page: https://cellengine.github.io/cellengine-r-toolkit/
The getStatistics method is not accepting the "geometricmean" statistic. All the other ones appear available.
Missing the compensation
(or compensationId
) param.
Docs also still say compensatedQ
only applies to TSV format.
This would be very helpful for comparing events before and after post-processing.
Via @pfgherardini
We need to make a cookbook for common tasks. One of the recipes should be for tailoring gates, which is:
res=createPolygonGate(experimentId="5dcf4551b2b26508af8e63b7", "FSC-A", "FSC-H", "my gate", c(100, 200, 300), c(100, 200, 100), tailoredPerFile=TRUE)
res2=createPolygonGate(experimentId="5dcf4551b2b26508af8e63b7", "FSC-A", "FSC-H", "my gate", c(100, 200, 300), c(100, 200, 100), tailoredPerFile=TRUE, fcsFile="Specimen_001_Donor1 24h_001.fcs", gid=res$gate$gid, createPopulation=FALSE)
getEvents: no visible global function definition for ‘read.table’
Undefined global functions or variables:
read.table
Consider adding
importFrom("utils", "read.table")
Interface for this is TBD. It would probably need all of the gates converted first, then passed to toFlowCore
for the population conversion.
It would be nice to have a way to get experiments by name in the functions that require an experimentId parameter, similar to the way you can get parent populations by name when creating gates.
httr::write_disk supports an overwrite option. It'd be good to have getEvents accept an additional overwrite option and pass it down to httr::write_disk
Accept everything in the "Optional Body Parameters" of this table as a list.
POST /experiment/:experimentId/gates?createPopulation=true
does the same thing, better.
getFcsFiles(experimentId, params=list("query"="eq(deleted,3)")
returns an empty list, but the same without the query returns a data.frame. This inconsistency makes downstream code complicated. It should always be a data.frame.
The default behavior is check.names=T
, which removes spaces and dashes, making the names awkward.
This is a breaking change. Let's start a v1 branch and gather up these breaking changes in it.
From Federico Gherardini
There's no way to do this from the API currently. A helper function to do this client-side:
getPopByUniqueName <- function(uniqueName) {
myPops <- getPopulations(experimentId)
myPops[myPops$uniqueName %in% uniqueName,]
}
Right now getGates does not return the fcsFileId column if a gate is tailored but has not actually being tailored yet. This makes working with the return value more complicated. It'd be best to have the fcsFileId column to always be there
Request from Federico.
Our internal lookupByName
function won't work out of the box because it takes an API URL as the first argument; need specializations for each resource type. Some ideas:
lookupByName("gate", "my gate's name")
lookupGateByName("my gate's name")
lookup("gate", list(name = "my gate's name")) # generic lookup fn, probably too verbose
Should default to 0.5.
It would be useful to have getStatistics accept empy arguments for files and populations, defaulting to get statistics for all files and populations
byName does not work for deleteGates.R yet.
You could add it inside the if (!is.null(gateId)) block, but it will error out when gates are tailored (which is correct behavior -- tailored gates all have the same name), and when trying to delete compound gates (names vs name). That'd address simple usages, but no pressure to do it.
A better, long-term solution (not this PR) would be a helper function like findGateForFile(fcsFileId=NULL, gid=NULL, name=NULL) helper function that picks a gate by name and FCS file, and supports compound gate names.
For plotting FCS files.
That's more useful than the default colnames that are V1...VN.
Breaking change, goes in v1.
We only have getCompensations
(plural); need the others:
getCompensation()
createCompensation()
updateCompensation()
deleteCompensation()
Federico points out that it's not explained clearly in the R docs, and having uncomp as the default is sort of dangerous.
It's annoying to have scaleSet$scales
return a single-length nested list (see below); it would be better to return as a dataframe. This is a breaking change.
> scaleSet$scales
[[1]] # <- this is a pain
channelName scale.type scale.minimum scale.maximum scale.cofactor
1 FSC-A LogScale 1 100000 NA
2 FSC-W LinearScale 1 262144 NA
3 SSC-A ArcSinhScale -200 262144 150
4 Ax488-A ArcSinhScale -200 262144 150
For ease of use, look into splitting these up.
Deprecated in v0 in #87, to be removed in v1.
Right now we have separate lists for X and Y vertices, which is sort of awkward.
Probably use readline to prompt for the two-factor code if the first response is a 400 with the message "otp" is required.
.
When you retrieve entities in bulk (i.e. getFcsFiles
), and then get a single entity from the list (see code below), then a property that is a list (like annotations) are returned as a nested list.
files = getFcsFiles(id)
f = files[1,]
f$annotations
# prints:
[[1]]
name value
1 annotations 1 1
2 annotation 2 value
However,
f = getFcsFile(id, byName("myGreatFcsFile")
f$annotations
# prints:
name value
1 annotations 1 1
2 annotation 2 value
in addition to applyScale
, we should have a function to apply an entire ScaleSet, like:
applyScaleSet = function(scaleset) {
cols = lapply(1:nrow(scaleset), function (i) {
channelName = scaleset[i, "channelName"]
if (channelName %in% colnames(events)) {
applyScale(scaleset[i, "scale"], events[, channelName])
}
})
df = as.data.frame(do.call(cbind, cols))
colnames(df) = colnames(events)
df
}
also relevant:
col_names = vector(mode="character")
cols <- vector(mode = "list", length = nrow(scaleset))
for(i in 1:nrow(scaleset)) {
channelName = scaleset[i, "channelName"]
if (channelName %in% colnames(events)) {
col_names <- append(col_names, channelName)
cols[[i]] <- applyScale(scaleset[i, "scale"], events[, channelName])
}
}
df = as.data.frame(do.call(cbind, cols))
colnames(df) = col_names
out_data = data.matrix(df)
The docs for annotateFcsFile
rightly warn that using it will overwrite existing annotations and say to use getFcsFile
first. However, getFcsFile[s]
returns a list and annotateFcsFile
expects a list, so this is tedious to do.
Current method:
fa = data.frame(file$annotations)
annoList = as.list(with(fa, setNames(value, name)))
annoList[["New Anno"]] <- "abcd"
This function should return an individual file according to the description, instead all of them are returned
Currently only username/password authentication is supported.
Via @pfgherardini
Since R makes it impossible(?) to create the JSON string needed in some cases.
Alternatively:
> jsonlite::toJSON(list(`$and` = list("A", list(`$not` = "B"))), auto_unbox = T)
{"$and":["A",{"$not":"B"}]}
These are currently skipped:
══ Skipped ═════════════════════════════════════════════════════════════════════
1. fromFlowCore accepts `gid` as a splat keyword arg and passes it to the next function (test-convertFromFlowCore.R:6:3) - Reason: flowCore cannot be loaded
...
Added in 6bffbbb
deleteGates
is an advanced function primarily for deleting tailored gates. Doesn't delete populations. deletePopulationAuto
is the normal one to use.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.