def add_readgroups(job, bamfile, sample_type, univ_options):
    """
    This module adds the appropriate read groups to the bam file
    ARGUMENTS
    1. bamfile: <JSid for a bam file>
    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>
                +- 'java_Xmx': value for max heap passed to java
    RETURN VALUES
    1. output_files: REFER output_files in run_bwa()
    """
    job.fileStore.logToMaster('Running add_read_groups on %s:%s' % (univ_options['patient'],
                                                                    sample_type))
    work_dir = job.fileStore.getLocalTempDir()
    input_files = {
        'aligned_fixpg.bam': bamfile}
    get_files_from_filestore(job, input_files, work_dir, docker=True)
    parameters = ['AddOrReplaceReadGroups',
                  'CREATE_INDEX=false',
                  'I=/data/aligned_fixpg.bam',
                  'O=/data/aligned_fixpg_sorted_reheader.bam',
                  'SO=coordinate',
                  'ID=1',
                  ''.join(['LB=', univ_options['patient']]),
                  'PL=ILLUMINA',
                  'PU=12345',
                  ''.join(['SM=', sample_type.rstrip('_dna')])]
    docker_call(tool='picard', tool_parameters=parameters, work_dir=work_dir,
                dockerhub=univ_options['dockerhub'], java_opts=univ_options['java_Xmx'])
    output_file = job.fileStore.writeGlobalFile('/'.join([work_dir,
                                                          'aligned_fixpg_sorted_reheader.bam']))
    job.fileStore.deleteGlobalFile(bamfile)
    bam_index = job.wrapJobFn(index_bamfile, output_file, sample_type, univ_options, disk='60G')
    job.addChild(bam_index)
    return bam_index.rv()
def add_readgroups ( job , bamfile , sample_type , univ_options ) : job . fileStore . logToMaster ( 'Running add_read_groups on %s:%s' % ( univ_options [ 'patient' ] , sample_type ) ) work_dir = job . fileStore . getLocalTempDir ( ) input_files = { 'aligned_fixpg.bam' : bamfile } get_files_from_filestore ( job , input_files , work_dir , docker = True ) parameters = [ 'AddOrReplaceReadGroups' , 'CREATE_INDEX=false' , 'I=/data/aligned_fixpg.bam' , 'O=/data/aligned_fixpg_sorted_reheader.bam' , 'SO=coordinate' , 'ID=1' , '' . join ( [ 'LB=' , univ_options [ 'patient' ] ] ) , 'PL=ILLUMINA' , 'PU=12345' , '' . join ( [ 'SM=' , sample_type . rstrip ( '_dna' ) ] ) ] docker_call ( tool = 'picard' , tool_parameters = parameters , work_dir = work_dir , dockerhub = univ_options [ 'dockerhub' ] , java_opts = univ_options [ 'java_Xmx' ] ) output_file = job . fileStore . writeGlobalFile ( '/' . join ( [ work_dir , 'aligned_fixpg_sorted_reheader.bam' ] ) ) job . fileStore . deleteGlobalFile ( bamfile ) bam_index = job . wrapJobFn ( index_bamfile , output_file , sample_type , univ_options , disk = '60G' ) job . addChild ( bam_index ) return bam_index . rv ( )
This module adds the appropriate read groups to the bam file
    ARGUMENTS
    1. bamfile: <JSid for a bam file>
    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>
                +- 'java_Xmx': value for max heap passed to java
    RETURN VALUES
    1. output_files: REFER output_files in run_bwa()