nodes: 0, module; 1, function_definition; 2, function_name:run_bwa; 3, parameters; 4, block; 5, identifier:job; 6, identifier:fastqs; 7, identifier:sample_type; 8, identifier:univ_options; 9, identifier:bwa_options; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, expression_statement; 15, expression_statement; 16, expression_statement; 17, with_statement; 18, comment:# samfile.name retains the path info; 19, expression_statement; 20, expression_statement; 21, expression_statement; 22, comment:# Return values get passed up the chain to here.  The return value will be a dict with; 23, comment:# SAMPLE_TYPE_fix_pg_sorted.bam: jobStoreID; 24, comment:# SAMPLE_TYPE_fix_pg_sorted.bam.bai: jobStoreID; 25, return_statement; 26, comment:"""
      This module aligns the SAMPLE_TYPE dna fastqs to the reference
  
      ARGUMENTS -- <ST> depicts the sample type. Substitute with 'tumor'/'normal'
      1. fastqs: Dict of list of input WGS/WXS fastqs
           fastqs
                +- '<ST>_dna': [<JSid for 1.fastq> , <JSid for 2.fastq>]
      2. sample_type: string of 'tumor_dna' or 'normal_dna'
      3. univ_options: Dict of universal arguments used by almost all tools
           univ_options
                  +- 'dockerhub': <dockerhub to use>
      4. bwa_options: Dict of parameters specific to bwa
           bwa_options
                |- 'index_tar': <JSid for the bwa index tarball>
                +- 'n': <number of threads to allocate>
  
      RETURN VALUES
      1. output_files: Dict of aligned bam + reference (nested return)
           output_files
               |- '<ST>_fix_pg_sorted.bam': <JSid>
               +- '<ST>_fix_pg_sorted.bam.bai': <JSid>
  
      This module corresponds to nodes 3 and 4 on the tree
      """; 27, call; 28, assignment; 29, assignment; 30, assignment; 31, assignment; 32, assignment; 33, with_clause; 34, block; 35, assignment; 36, assignment; 37, call; 38, call; 39, attribute; 40, argument_list; 41, identifier:work_dir; 42, call; 43, identifier:fq_extn; 44, conditional_expression:'.gz' if fastqs['gzipped'] else ''; 45, identifier:input_files; 46, dictionary; 47, identifier:input_files; 48, call; 49, identifier:parameters; 50, list; 51, with_item; 52, expression_statement; 53, identifier:output_file; 54, call; 55, identifier:samfile_processing; 56, call; 57, attribute; 58, argument_list; 59, attribute; 60, argument_list; 61, attribute; 62, identifier:logToMaster; 63, binary_operator:'Running bwa on %s:%s' % (univ_options['patient'], sample_type); 64, attribute; 65, argument_list; 66, string; 67, subscript; 68, string; 69, pair; 70, pair; 71, pair; 72, identifier:get_files_from_filestore; 73, argument_list; 74, string; 75, string; 76, call; 77, string; 78, string; 79, comment:# Don't print INFO messages to the stderr; 80, call; 81, subscript; 82, subscript; 83, as_pattern; 84, call; 85, attribute; 86, argument_list; 87, attribute; 88, argument_list; 89, identifier:job; 90, identifier:addChild; 91, identifier:samfile_processing; 92, identifier:samfile_processing; 93, identifier:rv; 94, identifier:job; 95, identifier:fileStore; 96, string; 97, tuple; 98, attribute; 99, identifier:getLocalTempDir; 100, string_content:.gz; 101, identifier:fastqs; 102, string; 103, binary_operator:'dna_1.fastq' + fq_extn; 104, subscript; 105, binary_operator:'dna_2.fastq' + fq_extn; 106, subscript; 107, string; 108, subscript; 109, identifier:job; 110, identifier:input_files; 111, identifier:work_dir; 112, keyword_argument; 113, string_content:mem; 114, string_content:-t; 115, identifier:str; 116, argument_list; 117, string_content:-v; 118, string_content:1; 119, attribute; 120, argument_list; 121, identifier:input_files; 122, string; 123, identifier:input_files; 124, string; 125, call; 126, as_pattern_target; 127, identifier:docker_call; 128, argument_list; 129, attribute; 130, identifier:writeGlobalFile; 131, attribute; 132, identifier:job; 133, identifier:wrapJobFn; 134, identifier:bam_conversion; 135, identifier:output_file; 136, identifier:sample_type; 137, identifier:univ_options; 138, keyword_argument; 139, string_content:Running bwa on %s:%s; 140, subscript; 141, identifier:sample_type; 142, identifier:job; 143, identifier:fileStore; 144, string_content:gzipped; 145, string; 146, identifier:fq_extn; 147, subscript; 148, integer:0; 149, string; 150, identifier:fq_extn; 151, subscript; 152, integer:1; 153, string_content:bwa_index.tar.gz; 154, identifier:bwa_options; 155, string; 156, identifier:docker; 157, True; 158, subscript; 159, string; 160, identifier:join; 161, list; 162, string_content:dna_1.fastq; 163, string_content:dna_2.fastq; 164, identifier:open; 165, argument_list; 166, identifier:samfile; 167, keyword_argument; 168, keyword_argument; 169, keyword_argument; 170, keyword_argument; 171, keyword_argument; 172, identifier:job; 173, identifier:fileStore; 174, identifier:samfile; 175, identifier:name; 176, identifier:disk; 177, string; 178, identifier:univ_options; 179, string; 180, string_content:dna_1.fastq; 181, identifier:fastqs; 182, identifier:sample_type; 183, string_content:dna_2.fastq; 184, identifier:fastqs; 185, identifier:sample_type; 186, string_content:index_tar; 187, identifier:bwa_options; 188, string; 189, string_content:/; 190, subscript; 191, string; 192, call; 193, string; 194, identifier:tool; 195, string; 196, identifier:tool_parameters; 197, identifier:parameters; 198, identifier:work_dir; 199, identifier:work_dir; 200, identifier:dockerhub; 201, subscript; 202, identifier:outfile; 203, identifier:samfile; 204, string_content:60G; 205, string_content:patient; 206, string_content:n; 207, identifier:input_files; 208, string; 209, string_content:hg19.fa; 210, attribute; 211, argument_list; 212, string_content:w; 213, string_content:bwa; 214, identifier:univ_options; 215, string; 216, string_content:bwa_index; 217, string; 218, identifier:join; 219, list; 220, string_content:dockerhub; 221, identifier:work_dir; 222, string; 223, identifier:sample_type; 224, string; 225, string_content:/; 226, string_content:_aligned.sam
code: def run_bwa(job, fastqs, sample_type, univ_options, bwa_options):
      """
      This module aligns the SAMPLE_TYPE dna fastqs to the reference
  
      ARGUMENTS -- <ST> depicts the sample type. Substitute with 'tumor'/'normal'
      1. fastqs: Dict of list of input WGS/WXS fastqs
           fastqs
                +- '<ST>_dna': [<JSid for 1.fastq> , <JSid for 2.fastq>]
      2. sample_type: string of 'tumor_dna' or 'normal_dna'
      3. univ_options: Dict of universal arguments used by almost all tools
           univ_options
                  +- 'dockerhub': <dockerhub to use>
      4. bwa_options: Dict of parameters specific to bwa
           bwa_options
                |- 'index_tar': <JSid for the bwa index tarball>
                +- 'n': <number of threads to allocate>
  
      RETURN VALUES
      1. output_files: Dict of aligned bam + reference (nested return)
           output_files
               |- '<ST>_fix_pg_sorted.bam': <JSid>
               +- '<ST>_fix_pg_sorted.bam.bai': <JSid>
  
      This module corresponds to nodes 3 and 4 on the tree
      """
      job.fileStore.logToMaster('Running bwa on %s:%s' % (univ_options['patient'], sample_type))
      work_dir = job.fileStore.getLocalTempDir()
      fq_extn = '.gz' if fastqs['gzipped'] else ''
      input_files = {
          'dna_1.fastq' + fq_extn: fastqs[sample_type][0],
          'dna_2.fastq' + fq_extn: fastqs[sample_type][1],
          'bwa_index.tar.gz': bwa_options['index_tar']}
      input_files = get_files_from_filestore(job, input_files, work_dir, docker=True)
      parameters = ['mem',
                    '-t', str(bwa_options['n']),
                    '-v', '1',  # Don't print INFO messages to the stderr
                    '/'.join([input_files['bwa_index'], 'hg19.fa']),
                    input_files['dna_1.fastq'],
                    input_files['dna_2.fastq']]
      with open(''.join([work_dir, '/', sample_type, '_aligned.sam']), 'w') as samfile:
          docker_call(tool='bwa', tool_parameters=parameters, work_dir=work_dir,
                      dockerhub=univ_options['dockerhub'], outfile=samfile)
      # samfile.name retains the path info
      output_file = job.fileStore.writeGlobalFile(samfile.name)
      samfile_processing = job.wrapJobFn(bam_conversion, output_file, sample_type, univ_options,
                                         disk='60G')
      job.addChild(samfile_processing)
      # Return values get passed up the chain to here.  The return value will be a dict with
      # SAMPLE_TYPE_fix_pg_sorted.bam: jobStoreID
      # SAMPLE_TYPE_fix_pg_sorted.bam.bai: jobStoreID
      return samfile_processing.rv()