def get_length_of_indexes(runfolder):
     """
     Will parse runfolder meta data to find the length of the index reads.
     :param runfolder: to get the length of the index reads from.
     :return: a dict with the read number as key and the length of each index as value e.g.:
              {2: 7, 3: 8}
     """
     meta_data = InteropMetadata(runfolder)
     index_read_info = filter(lambda x: x["is_index"],
                              meta_data.read_config)
     indexes_and_lengths = map(lambda x: (x["read_num"], x["cycles"]),
                               index_read_info)
     return dict(indexes_and_lengths)
    def get_bcl2fastq_version_from_run_parameters(runfolder, config):
        """
        Guess which bcl2fastq version to use based on the machine type
        specified in the runfolder meta data, and the corresponding
        mappings in the config file.
        :param runfolder: to get bcl2fastq version to use for
        :param config: to use matching machine type to bcl2fastq versions
        :return the version of bcl2fastq to use.
        """

        meta_data = InteropMetadata(runfolder)
        model = meta_data.model

        current_config = config
        version = current_config["machine_type"][model]["bcl2fastq_version"]

        return version
 def is_single_read(runfolder):
     meta_data = InteropMetadata(runfolder)
     number_of_reads = filter(lambda x: not x["is_index"],
                              meta_data.read_config)
     return len(number_of_reads) < 2