Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
a5c3fac
Enable lineage graph in "Graph Detail View"
labkey-nicka Apr 13, 2020
a183c37
Bump @labkey/components
labkey-nicka Apr 23, 2020
b847c82
Add expType property to lineage API response
labkey-kevink Apr 23, 2020
ca76a1f
Bump @labkey/components
labkey-nicka Apr 24, 2020
24fb455
Add ExperimentProtocolHandler to allow lineage API to provide query r…
labkey-kevink Apr 24, 2020
976e418
Merge branch 'develop' into fb_rungraph_deets
labkey-nicka Apr 25, 2020
e5c0f4b
Bump @labkey/components
labkey-nicka Apr 26, 2020
699afd3
Bump @labkey/components
labkey-nicka Apr 26, 2020
d47fc71
Bump @labkey/components
labkey-nicka Apr 27, 2020
ab437d6
Bump @labkey/components
labkey-nicka Apr 28, 2020
2bc3ed8
Merge branch 'develop' into fb_rungraph_deets
labkey-nicka Apr 28, 2020
750e480
Revert "Enable lineage graph in "Graph Detail View""
labkey-nicka Apr 28, 2020
75c6c01
code review feedback
labkey-kevink Apr 28, 2020
6e27b4a
Use generic URL for data that have DataType but no detail URL (e.g. A…
labkey-kevink Apr 28, 2020
bbcb201
Add "datafile" icon
labkey-nicka Apr 29, 2020
d0a212c
Add "file" icon
labkey-nicka Apr 29, 2020
82ff762
LineageFilter on null expType nodes
labkey-nicka Apr 29, 2020
c133172
Bump @labkey/components
labkey-nicka Apr 29, 2020
c268ce9
Use lineage node provided link
labkey-nicka Apr 29, 2020
5c5cb6d
Merge branch 'develop' into fb_rungraph_deets
labkey-nicka Apr 29, 2020
406fdc8
Bump @labkey/components
labkey-nicka Apr 29, 2020
bb3a3c7
Use SchemaKey in ExperimentRunType constructor
labkey-kevink Apr 29, 2020
db4916a
include container
labkey-kevink Apr 29, 2020
07805a1
return an empty lineage for unknown materials
labkey-kevink Apr 29, 2020
99d8890
Bump @labkey/components
labkey-nicka Apr 30, 2020
bcbb9ba
Set lineage API request options
labkey-nicka Apr 30, 2020
6b1a551
Merge branch 'develop' into fb_rungraph_deets
labkey-nicka Apr 30, 2020
0a5fd56
Bump @labkey/components
labkey-nicka Apr 30, 2020
aced0b9
betaGraph URL option
labkey-nicka Apr 30, 2020
1f987da
Bump @labkey/components
labkey-nicka Apr 30, 2020
456c780
Merge branch 'develop' into fb_rungraph_deets
labkey-nicka May 1, 2020
220f291
Bump @labkey/components
labkey-nicka May 1, 2020
1882579
Bump @labkey/components
labkey-nicka May 1, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/src/org/labkey/api/assay/AssayRunType.java
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,7 +48,7 @@ public class AssayRunType extends ExperimentRunType

public AssayRunType(ExpProtocol protocol, Container c)
{
super(protocol.getName(), SchemaKey.fromParts(AssaySchema.NAME, AssayService.get().getProvider(protocol).getResourceName(), protocol.getName()).toString(), AssayProtocolSchema.RUNS_TABLE_NAME);
super(protocol.getName(), AssayProtocolSchema.schemaName(AssayService.get().getProvider(protocol), protocol), AssayProtocolSchema.RUNS_TABLE_NAME);
_protocol = protocol;
}

Expand Down
28 changes: 28 additions & 0 deletions api/src/org/labkey/api/exp/ExperimentProtocolHandler.java
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
package org.labkey.api.exp;

import org.jetbrains.annotations.Nullable;
import org.labkey.api.exp.api.ExpProtocol;
import org.labkey.api.exp.api.ExpProtocolApplication;
import org.labkey.api.exp.api.ExpRun;
import org.labkey.api.query.QueryRowReference;

/**
* Provides some basic recognition for protocols of a particular type.
*/
public interface ExperimentProtocolHandler extends Handler<ExpProtocol>
{
/**
* Get a query reference for the protocol type.
*/
public @Nullable QueryRowReference getQueryRowReference(ExpProtocol protocol);

/**
* Get a query reference for the run of the protocol type.
*/
public @Nullable QueryRowReference getQueryRowReference(ExpProtocol protocol, ExpRun run);

/**
* Get a query reference for the protocol application of the protocol type.
*/
public @Nullable QueryRowReference getQueryRowReference(ExpProtocol protocol, ExpProtocolApplication app);
}
65 changes: 56 additions & 9 deletions api/src/org/labkey/api/exp/ExperimentRunType.java
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,11 +16,22 @@

package org.labkey.api.exp;

import org.labkey.api.data.*;
import org.jetbrains.annotations.Nullable;
import org.labkey.api.data.ButtonBar;
import org.labkey.api.data.Container;
import org.labkey.api.data.ContainerFilter;
import org.labkey.api.data.TableInfo;
import org.labkey.api.data.TableSelector;
import org.labkey.api.exp.api.ExpProtocol;
import org.labkey.api.exp.api.ExpProtocolApplication;
import org.labkey.api.exp.api.ExpRun;
import org.labkey.api.exp.query.ExpProtocolApplicationTable;
import org.labkey.api.exp.query.ExpRunTable;
import org.labkey.api.exp.query.ExpSchema;
import org.labkey.api.query.FieldKey;
import org.labkey.api.query.QueryRowReference;
import org.labkey.api.query.QueryService;
import org.labkey.api.query.SchemaKey;
import org.labkey.api.query.UserSchema;
import org.labkey.api.security.User;
import org.labkey.api.view.DataView;
Expand All@@ -37,20 +48,29 @@
* User: jeckels
* Date: Sep 25, 2006
*/
public abstract class ExperimentRunType implements Comparable<ExperimentRunType>, Handler<ExpProtocol>
public abstract class ExperimentRunType implements Comparable<ExperimentRunType>, ExperimentProtocolHandler
{
private final String _description;
private final String _schemaName;
private final String _tableName;
public static final ExperimentRunType ALL_RUNS_TYPE = new ExperimentRunType("All Runs", ExpSchema.SCHEMA_NAME, ExpSchema.TableType.Runs.toString())
public static final ExperimentRunType ALL_RUNS_TYPE = new ExperimentRunType("All Runs", ExpSchema.SCHEMA_EXP, ExpSchema.TableType.Runs.toString())
{
public Priority getPriority(ExpProtocol object)
public Priority getPriority(ExpProtocol protocol)
{
return Priority.LOW;
if (protocol.getApplicationType() == ExpProtocol.ApplicationType.ExperimentRun)
return Priority.LOW;

return null;
}
};

private final String _description;
private final SchemaKey _schemaName;
private final String _tableName;

public ExperimentRunType(String description, String schemaName, String tableName)
{
this(description, SchemaKey.fromString(schemaName), tableName);
}

public ExperimentRunType(String description, SchemaKey schemaName, String tableName)
{
_description = description;
_schemaName = schemaName;
Expand All@@ -62,7 +82,7 @@ public String getDescription()
return _description;
}

public String getSchemaName()
public SchemaKey getSchemaName()
{
return _schemaName;
}
Expand All@@ -72,6 +92,33 @@ public String getTableName()
return _tableName;
}

/**
* Reference to the row that represents the protocol for this run type.
*/
@Nullable
public QueryRowReference getQueryRowReference(ExpProtocol protocol)
{
return new QueryRowReference(protocol.getContainer(), ExpSchema.SCHEMA_EXP, ExpSchema.TableType.Protocols.name(), ExpProtocolApplicationTable.Column.RowId, protocol.getRowId());
}

/**
* Reference to the row that represents the run of for this run type.
*/
@Nullable
public QueryRowReference getQueryRowReference(ExpProtocol protocol, ExpRun run)
{
return new QueryRowReference(run.getContainer(), SchemaKey.fromParts(_schemaName), _tableName, ExpRunTable.Column.RowId, run.getRowId());
}

/**
* Reference to the row that represents the protocol application for this run type.
*/
@Nullable
public QueryRowReference getQueryRowReference(ExpProtocol protocol, ExpProtocolApplication app)
{
return new QueryRowReference(app.getContainer(), ExpSchema.SCHEMA_EXP, ExpSchema.TableType.ProtocolApplications.name(), ExpProtocolApplicationTable.Column.RowId, app.getRowId());
}

public long getRunCount(User user, Container c)
{
UserSchema schema = QueryService.get().getUserSchema(user, c, _schemaName);
Expand Down
6 changes: 4 additions & 2 deletions api/src/org/labkey/api/exp/api/ExpProtocol.java
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,11 +16,12 @@

package org.labkey.api.exp.api;

import org.jetbrains.annotations.Nullable;
import org.labkey.api.assay.AbstractAssayProvider;
import org.labkey.api.data.Container;
import org.labkey.api.exp.ObjectProperty;
import org.labkey.api.exp.ProtocolParameter;
import org.labkey.api.security.User;
import org.labkey.api.assay.AbstractAssayProvider;

import java.util.Collection;
import java.util.List;
Expand DownExpand Up@@ -105,7 +106,8 @@ enum ApplicationType
ApplicationType getApplicationType();
void setApplicationType(ApplicationType type);

ProtocolImplementation getImplementation();
@Nullable String getImplementationName();
@Nullable ProtocolImplementation getImplementation();

String getDescription();
void setDescription(String description);
Expand Down
19 changes: 19 additions & 0 deletions api/src/org/labkey/api/exp/api/ExperimentJSONConverter.java
Original file line numberDiff line numberDiff line change
Expand Up@@ -60,13 +60,16 @@ public class ExperimentJSONConverter
// General experiment object properties
public static final String ID = "id";
public static final String ROW_ID = "rowId";
public static final String CONTAINER = "container";
public static final String CREATED = "created";
public static final String CREATED_BY = "createdBy";
public static final String MODIFIED = "modified";
public static final String MODIFIED_BY = "modifiedBy";
public static final String NAME = "name";
public static final String LSID = "lsid";
public static final String CPAS_TYPE = "cpasType";
// Matches the expType parameter used in the linage api: "Data", "Material", "ExperimentRun", "Object"
public static final String EXP_TYPE = "expType";
public static final String URL = "url";
public static final String PROPERTIES = "properties";
public static final String COMMENT = "comment";
Expand DownExpand Up@@ -153,6 +156,11 @@ public Settings withIncludeInputsAndOutputs(boolean b)
{
return new Settings(includeProperties, b, includeRunSteps);
}

public Settings withIncludeRunSteps(boolean b)
{
return new Settings(includeProperties, includeInputsAndOutputs, b);
}
}

@NotNull
Expand All@@ -176,12 +184,14 @@ public static JSONObject serializeRunGroup(ExpExperiment runGroup, Domain domain
{
JSONObject jsonObject = serializeExpObject(runGroup, domain != null ? domain.getProperties() : Collections.emptyList(), settings);
jsonObject.put(COMMENT, runGroup.getComments());
jsonObject.put(ExperimentJSONConverter.EXP_TYPE, "Experiment");
return jsonObject;
}

public static JSONObject serializeRun(ExpRun run, Domain domain, User user, @NotNull Settings settings)
{
JSONObject jsonObject = serializeExpObject(run, domain == null ? null : domain.getProperties(), settings);
jsonObject.put(ExperimentJSONConverter.EXP_TYPE, "ExperimentRun");
if (settings.isIncludeProperties())
{
jsonObject.put(COMMENT, run.getComments());
Expand DownExpand Up@@ -252,6 +262,7 @@ public static JSONObject serializeProtocol(ExpProtocol protocol, User user)
// Just include basic protocol properties for now.
// See GetProtocolAction and GWTProtocol for serializing an assay protocol with domain fields.
JSONObject jsonObject = serializeExpObject(protocol, null, DEFAULT_SETTINGS.withIncludeProperties(false));
jsonObject.put(ExperimentJSONConverter.EXP_TYPE, "Protocol");
return jsonObject;
}

Expand DownExpand Up@@ -344,6 +355,7 @@ else if (runInput instanceof ExpMaterialRunInput)
protected static JSONObject serializeRunProtocolApplication(@NotNull ExpProtocolApplication protApp, ExpRun run, User user, Settings settings)
{
JSONObject json = serializeExpObject(protApp, null, settings);
json.put(ExperimentJSONConverter.EXP_TYPE, "ProtocolApplication");

json.put(ACTION_SEQUENCE, protApp.getActionSequence());
json.put(APPLICATION_TYPE, protApp.getApplicationType().toString());
Expand DownExpand Up@@ -474,6 +486,8 @@ private static JSONObject serializeIdentifiableBean(@NotNull Identifiable obj)
if (url != null)
json.put(URL, url);

json.put(CONTAINER, obj.getContainer().getId());

QueryRowReference rowRef = obj.getQueryRowReference();
if (rowRef != null)
{
Expand All@@ -492,6 +506,7 @@ private static JSONObject serializeIdentifiableBean(@NotNull Identifiable obj)
public static JSONObject serializeIdentifiable(@NotNull Identifiable obj, Settings settings)
{
JSONObject json = serializeIdentifiableBean(obj);
json.put(ExperimentJSONConverter.EXP_TYPE, (Object)null);

if (settings.isIncludeProperties())
{
Expand All@@ -516,6 +531,8 @@ public static JSONObject serializeExpObject(@NotNull ExpObject object, @Nullable
// instead and use serializeOntologyProperties(ExpObject) so the object properties will be
// fetched using ExpObject.getProperty().
JSONObject jsonObject = serializeIdentifiableBean(object);
jsonObject.put(ExperimentJSONConverter.EXP_TYPE, "Object");

int rowId = object.getRowId();
if (rowId != 0)
{
Expand DownExpand Up@@ -634,6 +651,7 @@ public static JSONObject serializeData(@NotNull ExpData data, @Nullable User use
final ExpDataClass dc = data.getDataClass(user);

JSONObject jsonObject = serializeExpObject(data, null, settings);
jsonObject.put(ExperimentJSONConverter.EXP_TYPE, "Data");

if (settings.isIncludeProperties())
{
Expand DownExpand Up@@ -702,6 +720,7 @@ public static JSONObject serializeMaterial(@NotNull ExpMaterial material, @NotNu
}

jsonObject.put(CPAS_TYPE, material.getCpasType());
jsonObject.put(ExperimentJSONConverter.EXP_TYPE, "Material");

return jsonObject;
}
Expand Down
11 changes: 10 additions & 1 deletion api/src/org/labkey/api/exp/api/ExperimentService.java
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,6 +28,7 @@
import org.labkey.api.data.TableInfo;
import org.labkey.api.exp.ExperimentDataHandler;
import org.labkey.api.exp.ExperimentException;
import org.labkey.api.exp.ExperimentProtocolHandler;
import org.labkey.api.exp.ExperimentRunListView;
import org.labkey.api.exp.ExperimentRunType;
import org.labkey.api.exp.ExperimentRunTypeSource;
Expand DownExpand Up@@ -760,9 +761,11 @@ ExpRun derive(Map<ExpMaterial, String> inputMaterials, Map<ExpData, String> inpu

void registerProtocolImplementation(ProtocolImplementation impl);

void registerProtocolHandler(ExperimentProtocolHandler handler);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since ProtocolImplementation is an implementation of ExperimentProtocolHandler, what's the expectation for registering one? Register as both? Just as a ProtocolImplementation?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to combine the ProtocolImplementation and ExperimentProtocolHandler implementations and I started to do this refactor, but it was a larger change than I wanted to make right now. The ProtocolImplementation is geared more toward ExperimentRun protocol and requires setting a property on the protocol (which would have required an upgrade script for SampleManager protocols). ExperimentProtocolHandler can be used for ProtocolApplication protocols (see SamplesWorkflowTaskProtocolHandler.)


void registerProtocolInputCriteria(ExpProtocolInputCriteria.Factory factory);

ProtocolImplementation getProtocolImplementation(String name);
@Nullable ProtocolImplementation getProtocolImplementation(String name);

ExpProtocolApplication getExpProtocolApplication(int rowId);

Expand DownExpand Up@@ -827,6 +830,12 @@ ExpRun derive(Map<ExpMaterial, String> inputMaterials, Map<ExpData, String> inpu

List<? extends ExpProtocol> getExpProtocolsUsedByRuns(Container c, ContainerFilter containerFilter);

@Nullable
ExperimentProtocolHandler getExperimentProtocolHandler(@NotNull ExpProtocol protocol);

@Nullable
ExperimentRunType getExperimentRunType(@NotNull ExpProtocol protocol);

@Nullable
ExperimentRunType getExperimentRunType(@NotNull String description, @Nullable Container container);

Expand Down
32 changes: 31 additions & 1 deletion api/src/org/labkey/api/exp/api/ProtocolImplementation.java
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,13 +16,15 @@

package org.labkey.api.exp.api;

import org.jetbrains.annotations.Nullable;
import org.labkey.api.data.Container;
import org.labkey.api.exp.ExperimentProtocolHandler;
import org.labkey.api.query.QueryRowReference;
import org.labkey.api.security.User;

import java.util.List;

public class ProtocolImplementation
public class ProtocolImplementation implements ExperimentProtocolHandler
{
final protected String _name;
public ProtocolImplementation(String name)
Expand DownExpand Up@@ -60,8 +62,36 @@ public void onRunDeleted(Container container, User user)
{
}

@Override
public @Nullable Priority getPriority(ExpProtocol protocol)
{
if (getName().equals(protocol.getImplementationName()))
return Priority.HIGH;

return null;
}

/**
* Get a query reference for the protocol type.
*/
public QueryRowReference getQueryRowReference(ExpProtocol protocol)
{
return null;
}

/**
* Get a query reference for the run of the protocol type.
*/
public QueryRowReference getQueryRowReference(ExpProtocol protocol, ExpRun run)
{
return null;
}

/**
* Get a query reference for the protocol application of the protocol type.
*/
public QueryRowReference getQueryRowReference(ExpProtocol protocol, ExpProtocolApplication app)
{
return null;
}
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,11 +27,17 @@ enum Column
{
RowId,
Name,
Comments,
LSID,
Protocol,
Run,
ActionSequence,
Type
Type,
ActivityDate,
StartTime,
EndTime,
RecordCount,
Properties
}

BaseColumnInfo createMaterialInputColumn(String alias, SamplesSchema schema, ExpSampleSet sampleSet, String... roleNames);
Expand Down
5 changes: 5 additions & 0 deletions api/src/org/labkey/api/query/QueryRowReference.java
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,6 +21,11 @@ public class QueryRowReference
final @NotNull String _queryName;
final @NotNull List<Pair<FieldKey, Object>> _pkFilters;

public QueryRowReference(@NotNull Container c, @NotNull SchemaKey schemaKey, @NotNull String queryName, @NotNull Enum pkCol, int pkValue)
{
this(c, schemaKey, queryName, List.of(Pair.of(FieldKey.fromParts(pkCol), pkValue)));
}

public QueryRowReference(@NotNull Container c, @NotNull SchemaKey schemaKey, @NotNull String queryName, @NotNull FieldKey pkCol, int pkValue)
{
this(c, schemaKey, queryName, List.of(Pair.of(pkCol, pkValue)));
Expand Down
Loading