Problems with Python transformation script

LabKey Support Forum
Problems with Python transformation script zromer  2018-02-14 12:31
Status: Closed
 
Hello,

I have a Python engine set up on my Atlas instance with $(runInfo) configured as the Program Command (screenshot of engine configuration attached). I also have a python transformation script added to a particular assay module. I'd like this transformation script to take the assay data being uploaded by the user before Atlas tries to match its columns to the assay data result set definition, do some preprocessing on it, then write the file out to be received by the assay module. I'm having two issues with this.

1) How do I ensure my transformation script is getting called? I'm currently trying to have my script send and email and write out a test file to the local execution directory but neither seems to be happening upon upload to the Assay Module my transformation script is a part of.

2) If I understand correctly, the Program Command with $(runInfo) will pass a runProperties.tsv file to my python script as a command-line parameter which I will then need to read in order to get the runDataUploaded property which contains the file path of the data uploaded by the user. Then I will do my transformation on the data after I've read it in. Then... outputting the transformation gets fuzzy to me.

Do I then write the transformed file out and replace the runDataUploadedFile attribute with the transformed file path, then write out the runProperties.tsv file to... where? Or do I replace the transformedRunPropertiesFile attribute with runProperties.tsv after I've updated the runDataUploadedFile attribute with the transformed file path? Or something else? It is generally unclear to me how the program picks up the output of a transformation script.
 
 
Jon (LabKey DevOps) responded:  2018-02-16 22:36
Hi,

To see if your transform script is getting called, you can enable the Save Script Data option in your Assay. Turning that feature on in the assay is a great way to debug your transform script and see what values it is passing across to the Assay Run and Assay Data tables. (
https://www.labkey.org/Documentation/wiki-page.view?name=programmaticQC)

Regarding the Program Command, if you enable the Save Script Data option, using that option in the Program Command will not be necessary. But if you do want to use it, I would recommend adding quotes around it like "${runInfo}". This is especially important if your path to python has spaces in it.

Regards,

Jon