Skip to content
Ben Tupper edited this page Jan 5, 2016 · 4 revisions

LimsRefClass provides uniform interface for basic GET, PUT, POST, DELETE, etc. transactions as wells as hybrid queries and requests get_containers, get_samples, get_processes, get_artifacts, get_researchers, getByLimsid, etc.

# note we need only provide the configuration file
lims <- Lims(configfile = "~/.clarityrc")
# Reference Class:"LimsRefClass"
#   Lims version: v2
#   Lims baseuri: http://server-name.com::portnumber/api/v2
#  Lims valid session: TRUE

NodeRefClass contains an instance of LimsRefClass as well as XML::xmlNode to provide uniform access to behaviors GET, PUT, POST etc. as well as access to attributes and child elements. The following inherit from NodeRefClass. Below is a quick reference to a few common subclasses. More details can be found for these subclasses and others using the links found on the sidebar.

  • ProcessRefClass
# get a Process node by limsid, note that a list is returned 
P <- lims$get_byLimsid('24-798', resource = "processes")[[1]]
P
# Reference Class: "ProcessRefClass"
#   Node uri: http://server-name.com::portnumber/api/v2/processes/24-798
#   Node children: type technician input-output-map field process-parameter
#   Process date-run: 
#   Process technician: Liz Fergusson
#   Process type: Dilution Step

We may also retrieve a list of process by getting a list of processes in one transaction. The search can be filtered using combiantions of query parameters such as type, projectname, inputartifactlimsid, technamefirst, technamelast, etc.

PP <- lims$get_processes(type = "Dilution Step")
length(PP)
# [1] 4
  • ContainerRefClass
C <- lims$get_byLimsid("27-1", resource = "containers")[[1]]
C
# Reference Class: "ContainerRefClass"
#   Node uri: http://server-name.com::portnumber/api/v2/containers/27-1
#   Node children: name type occupied-wells placement state
#   Container name: BEN_1
#   Container type: 96 well plate
#   Container state: Populated
#   Container occupied wells: 7 (89 empty)

We can also leverage the faster batch resource by getting multiple nodes in one transaction. We have retrieve, update and create batch resources for container and sample while artifact and file have only retrieve and update.

# get a list of containers by name
CC <- lims$get_containers(name = c("Liz_test_1", "Liz_test_2") )
CC
# $Liz_test_1
# Reference Class: "ContainerRefClass"
#   Node uri: http://server-name.com::portnumber/api/v2/containers/27-3
#   Node children: name type occupied-wells placement state
#   Container ame: Liz_test_1
#   Container type: Tube
#   Container state: Populated
#   Container occupied wells: 1 (0 empty)
# 
# $Liz_test_2
# Reference Class: "ContainerRefClass"
#   Node uri: http://server-name.com::portnumber/api/v2/containers/27-4
#   Node children: name type occupied-wells placement state
#   Container name: Liz_test_2
#   Container type: Tube
#   Container state: Populated
#   Container occupied wells: 1 (0 empty)
  • ArtifactRefClass

We can retrieve artifacts a number of ways. In this example we can request artifacts from the ContainerRefClass, C, above.

# we get a list of ArtifactRefClasses.
AA <- C$get_artifacts()
length(AA)
# [1] 7
AA[[1]]
# Reference Class: "ArtifactRefClass"
#   Node uri: http://server-name.com::portnumber/api/v2/artifacts/TUP2A1PA1
#   Node children: name type output-type qc-flag location working-flag sample workflow-stages
#   Artifact name: ben_spit_1
#   Artifact type: Analyte
#   Artifact parent-process: 
#   Artifact sample: http://server-name.com::portnumber/api/v2/samples/TUP2A1
#   Artifact location: 27-1_A:1
#   Artifact qc-flag: UNKNOWN
#   Artifact working-flag: true
  • SampleRefClass

We can also retrieve samples using the ContainerRefClass just as we retrieved artifacts.

SS <- C$get_samples()
length(SS)
# [1] 7
SS[[1]]
# Reference Class: "SampleRefClass"
#   Node uri: http://scgc-clarity-dev.bigelow.org:8080/api/v2/samples/TUP2A1
#   Node children: name date-received project submitter artifact field
#   Sample name: ben_spit_1
#   Sample type: 
#   Sample date_received: 2015-04-28
#   Sample date_completed: 
#   Sample biosource: 
Clone this wiki locally