public class NAbRunsResponse extends CommandResponse
NAbRunsCommand
. This class
provides helpful getter method to access particular bits of the parsed
response data. Sample usage:
public static void main(String[] args) throws Exception
{
// expected parameters:
// args[0]: username
// args[1]: password
Connection conn = new Connection("http://myserver/labkey", args[0], args[1]);
double avg = getAverageNeutDilution(cn, "/home", "NAB", 50);
System.out.println("Average dilution where 50 percent neutralization occurs: " + avg);
}
public static double getAverageNeutDilution(Connection cn, String folderPath, String assayName, int neutPercent) throws CommandException, IOException
{
NAbRunsCommand nabCommand = new NAbRunsCommand();
nabCommand.setAssayName(assayName);
nabCommand.setCalculateNeut(true);
nabCommand.setIncludeFitParameters(false);
nabCommand.setIncludeStats(false);
nabCommand.setIncludeWells(false);
NAbRunsResponse runResponse = nabCommand.execute(cn, folderPath);
NAbRun[] runs = runResponse.getRuns();
int totalSamples = 0;
double totalDilution = 0;
for (NAbRun run : runs)
{
for (NAbSample sample : run.getSamples())
{
for (NAbNeutralizationResult neutResult : sample.getNeutralizationResults())
{
// only total non-infinite values (that is, results where we found a neutralizing dilution:
if (neutResult.getCutoff() == neutPercent && !Double.isInfinite(neutResult.getCurveBasedDilution()))
{
totalSamples++;
totalDilution += neutResult.getCurveBasedDilution();
}
}
}
}
return totalDilution/totalSamples;
}
Constructor and Description |
---|
NAbRunsResponse(java.lang.String text,
int statusCode,
java.lang.String contentType,
org.json.simple.JSONObject json,
Command sourceCommand)
Constructs a new CommandResponse, initialized with the provided
response text and status code.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAssayDescription() |
java.lang.Integer |
getAssayId() |
java.lang.String |
getAssayName() |
NAbRun[] |
getRuns() |
findObject, getContentType, getParsedData, getProperty, getProperty, getRequiredVersion, getSourceCommand, getStatusCode, getText
public NAbRunsResponse(java.lang.String text, int statusCode, java.lang.String contentType, org.json.simple.JSONObject json, Command sourceCommand)
text
- The response textstatusCode
- The HTTP status codecontentType
- The response content typejson
- The parsed JSONObject (or null if JSON was not returned).sourceCommand
- A copy of the command that created this responsepublic NAbRun[] getRuns()
public java.lang.String getAssayName()
public java.lang.Integer getAssayId()
public java.lang.String getAssayDescription()