dxpy.download_all_inputs()function downloads all input files into the
/home/dnanexus/indirectory. A folder will be created for each input and the file(s) will be downloaded to that directory. For convenience, the
dxpy.download_all_inputsfunction returns a dictionary containing the following keys:
<var>_path(string): full absolute path to where the file was downloaded.
<var>_name(string): name of the file, including extention.
<var>_prefix(string): name of the file minus the longest matching pattern found in the dxapp.json I/O pattern field.
10and set the workload per thread to
1chromosome at a time. There are various ways to achieve multithreaded processing in python. For the sake of simplicity, we use
multiprocessing.dummy, a wrapper around Python’s threading module.
subprocess.Popencall. We use the
multiprocessing.dummy.Pool.map(<func>, <iterable>)function to call the helper function
run_cmdfor each string in the iterable of view commands. Because we perform our multithreaded processing using
subprocess.Popen, we will not be alerted to any failed processes. We verify our closed workers in the
subprocess.Popento process and verify our results in
verify_pool_status. In general, it is considered good practice to use python’s built-in subprocess convenience functions. In this case,
subprocess.check_callwould achieve the same goal.
dxpy.upload_local_filefunction to upload and generate a DXFile corresponding to our result file. For python, job outputs have to be a dictionary of key-value pairs, with the keys being job output names as defined in the
dxapp.jsonand the values being the output values for corresponding output classes. For files, the output type is a DXLink. We use the
dxpy.dxlinkfunction to generate the appropriate DXLink value.