def run_radia(job, rna_bam, tumor_bam, normal_bam, univ_options, radia_options):
    """
    Spawn a RADIA job for each chromosome on the input bam trios.

    :param dict rna_bam: Dict of bam and bai for tumor DNA-Seq.  It can be one of two formats
           rna_bam:   # Just the genomic bam and bai
                |- 'rna_genome_sorted.bam': fsID
                +- 'rna_genome_sorted.bam.bai': fsID
           OR
           rna_bam:   # The output from run_star
               |- 'rna_transcriptome.bam': fsID
               |- 'rna_genome':     # Only this part will be used
                       |- 'rna_genome_sorted.bam': fsID
                       +- 'rna_genome_sorted.bam.bai': fsID
    :param dict tumor_bam: Dict of bam and bai for tumor DNA-Seq
    :param dict normal_bam: Dict of bam and bai for normal DNA-Seq
    :param dict univ_options: Dict of universal options used by almost all tools
    :param dict radia_options: Options specific to RADIA
    :return: Dict of results from running RADIA on every chromosome
             perchrom_radia:
                 |- 'chr1': fsID
                 |- 'chr2' fsID
                 |
                 |-...
                 |
                 +- 'chrM': fsID
    :rtype: dict
    """
    if 'rna_genome' in rna_bam.keys():
        rna_bam = rna_bam['rna_genome']
    elif set(rna_bam.keys()) == {'rna_genome_sorted.bam', 'rna_genome_sorted.bam.bai'}:
        pass
    else:
        raise RuntimeError('An improperly formatted dict was passed to rna_bam.')
        
    bams = {'tumor_rna': rna_bam['rna_genome_sorted.bam'],
            'tumor_rnai': rna_bam['rna_genome_sorted.bam.bai'],
            'tumor_dna': tumor_bam['tumor_dna_fix_pg_sorted.bam'],
            'tumor_dnai': tumor_bam['tumor_dna_fix_pg_sorted.bam.bai'],
            'normal_dna': normal_bam['normal_dna_fix_pg_sorted.bam'],
            'normal_dnai': normal_bam['normal_dna_fix_pg_sorted.bam.bai']}
    # Get a list of chromosomes to process
    if radia_options['chromosomes']:
        chromosomes = radia_options['chromosomes']
    else:
        chromosomes = sample_chromosomes(job, radia_options['genome_fai'])
    perchrom_radia = defaultdict()
    for chrom in chromosomes:
        radia = job.addChildJobFn(run_radia_perchrom, bams, univ_options, radia_options, chrom,
                                  memory='6G',
                                  disk=PromisedRequirement(
                                      radia_disk, tumor_bam['tumor_dna_fix_pg_sorted.bam'],
                                      normal_bam['normal_dna_fix_pg_sorted.bam'],
                                      rna_bam['rna_genome_sorted.bam'],
                                      radia_options['genome_fasta']))
        filter_radia = radia.addChildJobFn(run_filter_radia, bams, radia.rv(), univ_options,
                                           radia_options, chrom, memory='6G',
                                           disk=PromisedRequirement(
                                               radia_disk, tumor_bam['tumor_dna_fix_pg_sorted.bam'],
                                               normal_bam['normal_dna_fix_pg_sorted.bam'],
                                               rna_bam['rna_genome_sorted.bam'],
                                               radia_options['genome_fasta']))
        perchrom_radia[chrom] = filter_radia.rv()
    job.fileStore.logToMaster('Ran spawn_radia on %s successfully' % univ_options['patient'])
    return perchrom_radia
def run_radia ( job , rna_bam , tumor_bam , normal_bam , univ_options , radia_options ) : if 'rna_genome' in rna_bam . keys ( ) : rna_bam = rna_bam [ 'rna_genome' ] elif set ( rna_bam . keys ( ) ) == { 'rna_genome_sorted.bam' , 'rna_genome_sorted.bam.bai' } : pass else : raise RuntimeError ( 'An improperly formatted dict was passed to rna_bam.' ) bams = { 'tumor_rna' : rna_bam [ 'rna_genome_sorted.bam' ] , 'tumor_rnai' : rna_bam [ 'rna_genome_sorted.bam.bai' ] , 'tumor_dna' : tumor_bam [ 'tumor_dna_fix_pg_sorted.bam' ] , 'tumor_dnai' : tumor_bam [ 'tumor_dna_fix_pg_sorted.bam.bai' ] , 'normal_dna' : normal_bam [ 'normal_dna_fix_pg_sorted.bam' ] , 'normal_dnai' : normal_bam [ 'normal_dna_fix_pg_sorted.bam.bai' ] } if radia_options [ 'chromosomes' ] : chromosomes = radia_options [ 'chromosomes' ] else : chromosomes = sample_chromosomes ( job , radia_options [ 'genome_fai' ] ) perchrom_radia = defaultdict ( ) for chrom in chromosomes : radia = job . addChildJobFn ( run_radia_perchrom , bams , univ_options , radia_options , chrom , memory = '6G' , disk = PromisedRequirement ( radia_disk , tumor_bam [ 'tumor_dna_fix_pg_sorted.bam' ] , normal_bam [ 'normal_dna_fix_pg_sorted.bam' ] , rna_bam [ 'rna_genome_sorted.bam' ] , radia_options [ 'genome_fasta' ] ) ) filter_radia = radia . addChildJobFn ( run_filter_radia , bams , radia . rv ( ) , univ_options , radia_options , chrom , memory = '6G' , disk = PromisedRequirement ( radia_disk , tumor_bam [ 'tumor_dna_fix_pg_sorted.bam' ] , normal_bam [ 'normal_dna_fix_pg_sorted.bam' ] , rna_bam [ 'rna_genome_sorted.bam' ] , radia_options [ 'genome_fasta' ] ) ) perchrom_radia [ chrom ] = filter_radia . rv ( ) job . fileStore . logToMaster ( 'Ran spawn_radia on %s successfully' % univ_options [ 'patient' ] ) return perchrom_radia
Spawn a RADIA job for each chromosome on the input bam trios.

    :param dict rna_bam: Dict of bam and bai for tumor DNA-Seq.  It can be one of two formats
           rna_bam:   # Just the genomic bam and bai
                |- 'rna_genome_sorted.bam': fsID
                +- 'rna_genome_sorted.bam.bai': fsID
           OR
           rna_bam:   # The output from run_star
               |- 'rna_transcriptome.bam': fsID
               |- 'rna_genome':     # Only this part will be used
                       |- 'rna_genome_sorted.bam': fsID
                       +- 'rna_genome_sorted.bam.bai': fsID
    :param dict tumor_bam: Dict of bam and bai for tumor DNA-Seq
    :param dict normal_bam: Dict of bam and bai for normal DNA-Seq
    :param dict univ_options: Dict of universal options used by almost all tools
    :param dict radia_options: Options specific to RADIA
    :return: Dict of results from running RADIA on every chromosome
             perchrom_radia:
                 |- 'chr1': fsID
                 |- 'chr2' fsID
                 |
                 |-...
                 |
                 +- 'chrM': fsID
    :rtype: dict