Open dbarrell opened 5 years ago
You want to use the StepReagentLot to access the list of ReagentLot. This is poorly implemented at the moment because at the time I did not realise it could be use to upload new reagents not just to read used reagents
You can use:
# s is your step
s.reagent_lots # will give you a list of reagent lot
s._reagent_lots # will give you the StepReagentLots entity
# Those two lists are the same
s._reagent_lots.reagent_lots == s.reagent_lots
# You'll need to find or create Reagentlot entity
lot = ReagentLot(l, id='...')
# Add them to the list
s._reagent_lots.reagent_lots.append(lot)
# upload the entity
s._reagent_lots.put()
# then advance the step
s.advance()
⚠️ In the future I will change the s.reagent_lots
to point to the StepReagentLots Entity which will break backward compatibility so beware of this. ⚠️
I must be missing something here since step.reagent_lots is 'None'. My code:
lot = ReagentLot(lims, id='124-219')
step._reagent_lots.reagent_lots.append(lot)
step._reagent_lots.put()
Returns:
step._reagent_lots.reagent_lots.append(lot)
AttributeError: 'NoneType' object has no attribute 'reagent_lots'
Should the 'step' be set up with the optional reagent_category attribute? Here is how I have initialised the step object:
step = Step.create(lims, protocol_step=protocol_step, inputs=artifacts,
container_type_name=ct.name)
Oh, and I'm using release v0.4.3
Yes I think you are right, you need to set the reagent_category
. At least that what the documentation says: https://www.genologics.com/files/permanent/API/4.2/data_stp.html#step-creation
I have not used this feature myself and don't have a good example to test so I'm not sure if this will work.
I'm looking for a way to automate the tracking of reagents using pyclarity-lims. Here I say that a step requires cfDNA_Proteinase_K to be tracked:
However, I cannot see a way to attach a ReagentKit/Lot to the step and therefore I get this error:
Looking at the documentation for step.create I thought I could create a new step with reagent_category=ReagentType.category but I noticed this in the code:
Is the tracking of reagents possible within pyclarity-lims or should I use udfs, or maybe, step.reagent_label?
This is the step that I am trying to automate: