nodes: 0, module; 1, function_definition; 2, function_name:sort_and_index_star; 3, parameters; 4, block; 5, identifier:job; 6, identifier:star_bams; 7, identifier:univ_options; 8, identifier:star_options; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, expression_statement; 15, return_statement; 16, comment:"""
      A wrapper for sorting and indexing the genomic star bam generated by run_star. It is required
      since run_star returns a dict of 2 bams
  
      :param dict star_bams: The bams from run_star
      :param dict univ_options: Dict of universal options used by almost all tools
      :param dict star_options: Options specific to star
      :return: Dict containing input bam and the generated index (.bam.bai)
                       output_files:
                          |- 'rna_transcriptome.bam': fsID
                          +- 'rna_genome':
                                   |- 'rna_sorted.bam': fsID
                                   +- 'rna_sorted.bam.bai': fsID
                          +- 'rnaChimeric.out.junction': fsID
      :rtype: dict
      """; 17, assignment; 18, assignment; 19, assignment; 20, call; 21, call; 22, dictionary; 23, subscript; 24, subscript; 25, identifier:sort; 26, call; 27, identifier:index; 28, call; 29, attribute; 30, argument_list; 31, attribute; 32, argument_list; 33, pair; 34, pair; 35, pair; 36, subscript; 37, string; 38, identifier:star_options; 39, string; 40, attribute; 41, argument_list; 42, attribute; 43, argument_list; 44, identifier:job; 45, identifier:addChild; 46, identifier:sort; 47, identifier:sort; 48, identifier:addChild; 49, identifier:index; 50, string; 51, call; 52, string; 53, subscript; 54, string; 55, subscript; 56, identifier:star_options; 57, string; 58, string_content:n; 59, string_content:n; 60, identifier:job; 61, identifier:wrapJobFn; 62, identifier:sort_bamfile; 63, subscript; 64, string; 65, identifier:univ_options; 66, keyword_argument; 67, keyword_argument; 68, identifier:job; 69, identifier:wrapJobFn; 70, identifier:index_bamfile; 71, call; 72, string; 73, identifier:univ_options; 74, keyword_argument; 75, keyword_argument; 76, keyword_argument; 77, string_content:rna_genome; 78, attribute; 79, argument_list; 80, string_content:rna_transcriptome.bam; 81, identifier:star_bams; 82, string; 83, string_content:rnaChimeric.out.junction; 84, identifier:star_bams; 85, string; 86, string_content:samtools; 87, identifier:star_bams; 88, string; 89, string_content:rna; 90, identifier:samtools_options; 91, subscript; 92, identifier:disk; 93, call; 94, attribute; 95, argument_list; 96, string_content:rna; 97, identifier:samtools_options; 98, subscript; 99, identifier:sample_info; 100, string; 101, identifier:disk; 102, call; 103, identifier:index; 104, identifier:rv; 105, string_content:rnaAligned.toTranscriptome.out.bam; 106, string_content:rnaChimeric.out.junction; 107, string_content:rnaAligned.out.bam; 108, identifier:star_options; 109, string; 110, identifier:PromisedRequirement; 111, argument_list; 112, identifier:sort; 113, identifier:rv; 114, identifier:star_options; 115, string; 116, string_content:genome_sorted; 117, identifier:PromisedRequirement; 118, argument_list; 119, string_content:samtools; 120, identifier:sort_disk; 121, subscript; 122, string_content:samtools; 123, identifier:index_disk; 124, call; 125, identifier:star_bams; 126, string; 127, attribute; 128, argument_list; 129, string_content:rnaAligned.out.bam; 130, identifier:sort; 131, identifier:rv
code: def sort_and_index_star(job, star_bams, univ_options, star_options):
      """
      A wrapper for sorting and indexing the genomic star bam generated by run_star. It is required
      since run_star returns a dict of 2 bams
  
      :param dict star_bams: The bams from run_star
      :param dict univ_options: Dict of universal options used by almost all tools
      :param dict star_options: Options specific to star
      :return: Dict containing input bam and the generated index (.bam.bai)
                       output_files:
                          |- 'rna_transcriptome.bam': fsID
                          +- 'rna_genome':
                                   |- 'rna_sorted.bam': fsID
                                   +- 'rna_sorted.bam.bai': fsID
                          +- 'rnaChimeric.out.junction': fsID
      :rtype: dict
      """
      star_options['samtools']['n'] = star_options['n']
      sort = job.wrapJobFn(sort_bamfile, star_bams['rnaAligned.out.bam'], 'rna', univ_options,
                           samtools_options=star_options['samtools'],
                           disk=PromisedRequirement(sort_disk, star_bams['rnaAligned.out.bam']))
      index = job.wrapJobFn(index_bamfile, sort.rv(), 'rna', univ_options,
                            samtools_options=star_options['samtools'], sample_info='genome_sorted',
                            disk=PromisedRequirement(index_disk, sort.rv()))
      job.addChild(sort)
      sort.addChild(index)
      return {'rna_genome': index.rv(),
              'rna_transcriptome.bam': star_bams['rnaAligned.toTranscriptome.out.bam'],
              'rnaChimeric.out.junction': star_bams['rnaChimeric.out.junction']}