Pipe sort by name cmd in case sort by coordinates

def _prepare_bam_file(bam_file, tmp_dir, config):
    """
    Pipe sort by name cmd in case sort by coordinates
    """
    sort_mode = _get_sort_order(bam_file, config)
    if sort_mode != "queryname":
        bam_file = sort(bam_file, config, "queryname")
    return bam_file