Split an input bam to paired fastqs.

    :param str bamfile: Path to a bam file
    :param dict univ_options: Dict of universal options used by almost all tools
    :param dict picard_options: Dict of options specific to Picard
    :return: Path to the _1.fastq file
    :rtype: str

def bam2fastq(bamfile, univ_options, picard_options):
    """
    Split an input bam to paired fastqs.

    :param str bamfile: Path to a bam file
    :param dict univ_options: Dict of universal options used by almost all tools
    :param dict picard_options: Dict of options specific to Picard
    :return: Path to the _1.fastq file
    :rtype: str
    """
    work_dir = os.path.split(bamfile)[0]
    base_name = os.path.split(os.path.splitext(bamfile)[0])[1]
    parameters = ['SamToFastq',
                  ''.join(['I=', docker_path(bamfile)]),
                  ''.join(['F=/data/', base_name, '_1.fastq']),
                  ''.join(['F2=/data/', base_name, '_2.fastq']),
                  ''.join(['FU=/data/', base_name, '_UP.fastq'])]
    docker_call(tool='picard', tool_parameters=parameters, work_dir=work_dir,
                dockerhub=univ_options['dockerhub'], java_xmx=univ_options['java_Xmx'],
                tool_version=picard_options['version'])
    first_fastq = ''.join([work_dir, '/', base_name, '_1.fastq'])
    assert os.path.exists(first_fastq)
    return first_fastq