I have a simple problem (I hope), but I can’t find a solution. I’m looking to create a pattern dynamically in VBA for conditional and or unique platemaps for things like lib prep, cleanups, etc that can optimize aliquoting with 8ch pods. An example is below:
Let’s say I want to use the 8ch Pod to aliquot diluent to the blue wells, then use the 96ch to mix columns 1-4 simultaneously. How would I create, access, change or otherwise modify a pattern to associate to 8ch pod transfer commands?
I can see that there are .Pattern and .SelectionInfo commands with [96] arrays, but not sure how/where to access for changes and which will modify the info I want. Possibly something like Positions(“P6”).Labware.Pattern arr(i)?
I realize that Biomek counts wells row wise THEN column so I need to figure out a couple functions as well to utilize patterns naturally, but its all WIP. Just finding out how to modify the patterns would be a huge step forward.
Well unfortunately there was not a lot of feedback on this question from the Biomek support line… but I was able to find the following solution. The following group of functions first convert input sample number into your typical well format, column-row wise (biomek uses row-column wise by default), and creates the specified pattern if it doesn’t yet exist. It loads an array with the wells after conversion to col-row and finally loads that array into the existing or created pattern. This can probably be pretty-fied with an additional sub to replace the array redim, but this is the MVP as it stands.
Option Explicit
Dim PatternName, SampleNumber, x, lwpat, pat, col, row
' Reorient well number to col-row wise. e.g., A1, B1, C1... becomes 1, 13, 25... '
function WellNumCountingDown ( wellNum )
col = ((wellNum-1) \ 8)+1
row = (wellNum-1) mod 8+1
WellNumCountingDown = col + ((row-1) * 12)
end function
' Check if pattern exists, create it otherwise. '
sub SafeCreatePattern ( patternName, wellsX, wellsY )
set lwpat = world.lwpatterns.variantdictionary
if not LwPat.isBound ( patternName ) then
set pat = createobject ( "Biomek5.eeor")
pat.Name = patternName
pat.WellsX = WellsX
pat.WellsY = WellsY
redim WellPatSelected (wellsX * wellsY - 1 )
pat.selected = wellpatSelected
world.Lwpatterns (patternName) = pat
end if
end sub
' Designate your desired sample number and pattern name '
SampleNumber = 38
patternName = "WellPattern1"
' Load array x() with sample number and make pattern accessible outside of script. '
redim x(95)
for i = 1 to SampleNumber
x(WellNumCountingDown (i)-1) = i <= SampleNumber
next
SafeCreatePattern "WellPattern1", 12, 8
world.lwpatterns(patternName).selected = x
Extra note, it appears as if patterns cannot be variable within transfer steps. In order to create custom patterns then use them, they have to share a similar name so the strategy is to either modify patterns as needed, or load a generic pattern as needed and refer to it in the transfer steps. Patterns, as I understand, are 0-index 96-item arrays and can be loaded into another pattern very easily.
world.lwpatterns("GenericPattern").selected = world.lwpatterns(PatternVariable).selected
In the above example, GenericPattern is a str, the name of an existing pattern, and PatternVariable is a variable containing the string name of a second pattern, existing or created.