-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add differential expression #70
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great. I haven't tested it because I'm on the wrong machine and don't really have time to set everything up. I have a couple of comments and a question!
EntityDef entity = meta.getEntity(entityId).orElseThrow(); | ||
VariableDef computeEntityIdVarSpec = util.getEntityIdVarSpec(entityId); | ||
String computeEntityIdColName = util.toColNameOrEmpty(computeEntityIdVarSpec); | ||
// if we ever introduce limma we can go back to this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Limma is another method for differential abundance analysis. But it's no longer on the horizon. Comment removed 👍
VariableDef computeEntityIdVarSpec = util.getEntityIdVarSpec(entityId); | ||
String computeEntityIdColName = util.toColNameOrEmpty(computeEntityIdVarSpec); | ||
// if we ever introduce limma we can go back to this | ||
String method = computeConfig.getDifferentialExpressionMethod().getValue().equals("DESeq") ? "DESeq" : "unknown"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this throw an exception if it's not DESeq? There are no other options in the RAML.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it does error if it doesn't receive DESeq. The api doesn't let it pass, but then also the R code will err as well if the method isn't DESeq.
computeInputVars.addAll(util.getCollectionMembers(collectionSpec)); | ||
computeInputVars.addAll(idColumns); | ||
connection.voidEval(util.getVoidEvalFreadCommand(INPUT_DATA, computeInputVars)); | ||
connection.voidEval("countData <- " + INPUT_DATA); // Renaming here so we can go get the sampleMetadata later |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems a bit roundabout loading as R variable differential_expression_input
(aka INPUT_DATA) and then renaming immediately but I guess it's what we always do?
But, as you explain, we're reading the same file again into sampleMetadataVars
so it makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea I went back and forth on this a while, because you're right, it does seem a little roundabout. But I'm hoping it'll be a little faster this way!
|
||
// Turn the list of id columns into an array of strings for R | ||
List<String> dotNotatedIdColumns = idColumns.stream().map(VariableDef::toDotNotation).toList(); | ||
StringBuilder dotNotatedIdColumnsString = new StringBuilder("c("); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the following from our friend (assuming it works) might be more readable?
String dotNotatedIdColumnsString = "c(" +
dotNotatedIdColumns.stream()
.map(this::singleQuote)
.collect(Collectors.joining(",")) + ")";
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll give it a try!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it didn't work, unfortunately, even with a little tweaking. Perhaps when my java skills are sharper i can revisit!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries - sorry I didn't test it out myself!
@Override | ||
public PostAppsDifferentialexpressionVisualizationsVolcanoplotResponse postAppsDifferentialexpressionVisualizationsVolcanoplot(DifferentialExpressionVolcanoplotPostRequest entity) { | ||
return wrapPlugin(() -> PostAppsDifferentialexpressionVisualizationsVolcanoplotResponse.respond200WithApplicationJson( | ||
new DifferentialExpressionStatsResponseStream(processRequest(new DifferentialExpressionVolcanoplotPlugin(), entity)))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm puzzling where DifferentialExpressionStatsResponseStream
is defined...?
Is it in a previous PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DifferentialExpressionStatsResponseStream
gets automatically generated. The auto-generated files aren't usually tracked in git because there are too many of them. But it'll show up in eda/generated/model
.
Adds a differential expression compute to the "compute service".
Fully functional. Test with VEuPathDB/veupathUtils#50
Can use
send to
computes/differentialexpression/
For the volcanoplot, first ensure the above computation has finished, then send the following to
apps/differentialexpression/visualizations/volcanoplot