Bash Helpers
Learn to build an applet that performs a basic SAMtools count with the aid of bash helper variables.
Source Code
View full source code on GitHub
Step 1. Download BAM Files
Download input files using the dx-download-all-inputs
command. The dx-download-all-inputs
command will go through all inputs and download into folders with the pattern /home/dnanexus/in/[VARIABLE]/[file or subfolder with files]
.
Step 2. Create an Output Directory
We create an output directory in preparation for dx-upload-all-outputs
DNAnexus command in the (Upload Results)[#Upload Result] section.
Step 3. Run SAMtools View
After executing the dx-download-all-inputs
command, there are three helper variables created to aid in scripting. For this applet, the input variable name mappings_bam
with platform filename my_mappings.bam
will have a helper variables:
We use the bash helper variable mappings_bam_path
to reference the location of a file after it has been downloaded using dx-download-all-inputs
.
Step 4. Upload Result
We use the dx-upload-all-outputs
command to upload data to the platform and specify it as the job’s output. The dx-upload-all-outputs
command expects to find file paths matching the pattern /home/dnanexus/out/[VARIABLE]/*
. It will upload matching files and then associate them as the output corresponding to [VARIABLE]
. In this case, the output is called counts_txt
. Earlier we created the folders, and we can now place the outputs there.
Last updated