Wrapper for bbmap. Assumes that bbmap executable is in your $PATH.
    :param reference: Reference fasta. Won't be written to disk by default. If you want it to be, add nodisk='t' as an arg.
    :param length: Length of reads to simulate
    :param reads: Number of reads to simulate
    :param out_fastq: Output file. Should end in .fastq or .fastq.gz
    :param paired: Create paired FASTQ files rather than single
    :param returncmd: If set to true, function will return the cmd string passed to subprocess as a third value.
    :param kwargs: Other arguments to give to bbmap in parameter=argument format. See documentation for full list.
    :return: out and err (and cmd if specified): stdout string and stderr string from running bbmap.

def randomreads(reference, length, reads, out_fastq, paired=False, returncmd=False, **kwargs):
    """
    Wrapper for bbmap. Assumes that bbmap executable is in your $PATH.
    :param reference: Reference fasta. Won't be written to disk by default. If you want it to be, add nodisk='t' as an arg.
    :param length: Length of reads to simulate
    :param reads: Number of reads to simulate
    :param out_fastq: Output file. Should end in .fastq or .fastq.gz
    :param paired: Create paired FASTQ files rather than single
    :param returncmd: If set to true, function will return the cmd string passed to subprocess as a third value.
    :param kwargs: Other arguments to give to bbmap in parameter=argument format. See documentation for full list.
    :return: out and err (and cmd if specified): stdout string and stderr string from running bbmap.
    """
    options = kwargs_to_string(kwargs)
    # If the paired option is selected, set the name of the reverse reads to be the same as the forward reads
    # but replace _R1 with _R2
    if paired:
        out_fastq2 = out_fastq.replace('_R1', '_R2')
        # Create the call to randomreads - use paired=t
        cmd = 'randomreads.sh ref={ref} out={out} out2={out2} length={length} reads={reads} paired=t{options}'\
            .format(ref=reference,
                    out=out_fastq,
                    out2=out_fastq2,
                    length=length,
                    reads=reads,
                    options=options)
    else:
        cmd = 'randomreads.sh ref={ref} out={out} length={length} reads={reads}{options}'\
            .format(ref=reference,
                    out=out_fastq,
                    length=length,
                    reads=reads,
                    options=options)
    if not os.path.isfile(out_fastq):
        out, err = accessoryfunctions.run_subprocess(cmd)
    else:
        out = str()
        err = str()
    if returncmd:
        return out, err, cmd
    else:
        return out, err