def get_pair_info(illumina_name):
    """
    take a filename from GERALD output and figure out whether it's the first
    or second read (or single-end read) and return a tuple
    (pair_index, second_file_name, new_output_name)
    """
    name_parts = illumina_name.split('.')
    for i in range(len(name_parts)):
        part = name_parts[i]
        subparts = part.split('_')
        if len(subparts) > 0:
            if subparts[0] == 's':
                if len(subparts) == 1:
                    continue
                pair_index = subparts[2]
                # lane = subparts[1]
                join_part = '_'.join(subparts[0:2] + subparts[3:])
                new_output_name = '.'.join(name_parts[0:i] + [join_part] +
                                           name_parts[i+1:])
                second_part = '_'.join(subparts[0:2] + ['2'] + subparts[3:])
                second_name = '.'.join(name_parts[0:i] + [second_part] +
                                       name_parts[i+1:])
                return (pair_index, second_name, new_output_name)
    return None