Example 1: Word Count (wc)
Getting Started
Template Options
You can write your app in any programming language, but we provide
templates for the following supported languages: Python, bash
Programming language: PythonPython Template
#!/usr/bin/env python
# python_wc 0.1.0
# Generated by dx-app-wizard.
#
# Basic execution pattern: Your app will run on a single machine from
# beginning to end.
#
# See https://documentation.dnanexus.com/developer for documentation and
# tutorials on how to modify this file.
#
# DNAnexus Python Bindings (dxpy) documentation:
# http://autodoc.dnanexus.com/bindings/python/current/
import os
import dxpy
@dxpy.entry_point('main') # 1
def main(input_file): # 2
# The following line(s) initialize your data object inputs on the platform
# into dxpy.DXDataObject instances that you can start using immediately.
input_file = dxpy.DXFile(input_file) # 3
# The following line(s) download your file inputs to the local file system
# using variable names for the filenames.
dxpy.download_dxfile(input_file.get_id(), "input_file") # 4
# Fill in your application code here.
# The following line(s) use the Python bindings to upload your file outputs
# after you have created them on the local file system. It assumes that you
# have used the output field name for the filename for each output, but you
# can change that behavior to suit your needs.
outfile = dxpy.upload_local_file("outfile") # 5
# The following line fills in some basic dummy output and assumes
# that you have created variables to represent your output with
# the same name as your output fields.
output = {}
output["outfile"] = dxpy.dxlink(outfile) # 6
return output # 7
dxpy.run()Debugging Locally
Review
Resources
Last updated