<commit_before>/*
 * TOPMUtils
 */
package net.maizegenetics.gbs.maps;

import java.io.File;
import net.maizegenetics.util.Utils;

/**
 *
 * @author terry
 */
public class TOPMUtils {

    private TOPMUtils() {
        // Utility
    }

    /**
     * This reads in a TOPM file. It can be .topm.txt, .topm.bin, or .topm.h5.
     *
     * @param filename filename
     *
     * @return TOPM
     */
    public static TOPMInterface readTOPM(String filename) {

        String temp = filename.trim().toLowerCase();

        if (temp.endsWith(".topm.txt")) {
            return new TagsOnPhysicalMap(filename, false);
        } else if (temp.endsWith(".topm.bin")) {
            return new TagsOnPhysicalMap(filename, true);
        } else if (temp.endsWith(".topm.h5")) {
            return new TagsOnPhysMapHDF5(filename);
        } else {
            throw new IllegalArgumentException("TOPMUtils: readTOPM: Unknown file extension: " + filename);
        }

    }

    public static void writeTOPM(TOPMInterface topm, String filename) {

        filename = Utils.addSuffixIfNeeded(filename, ".topm.h5", new String[]{".topm.bin", ".topm.txt", ".topm.h5"});<commit_msg>Now recognizes *.topm as a binary topm file (along with *.topm.bin)<commit_after>/*
 * TOPMUtils
 */
package net.maizegenetics.gbs.maps;

import java.io.File;
import net.maizegenetics.util.Utils;

/**
 *
 * @author terry
 */
public class TOPMUtils {

    private TOPMUtils() {
        // Utility
    }

    /**
     * This reads in a TOPM file. It can be .topm.txt, .topm.bin, or .topm.h5.
     *
     * @param filename filename
     *
     * @return TOPM
     */
    public static TOPMInterface readTOPM(String filename) {

        String temp = filename.trim().toLowerCase();

        if (temp.endsWith(".topm.txt")) {
            return new TagsOnPhysicalMap(filename, false);
        } else if (temp.endsWith(".topm.bin") || temp.endsWith(".topm")) {
            return new TagsOnPhysicalMap(filename, true);
        } else if (temp.endsWith(".topm.h5")) {
            return new TagsOnPhysMapHDF5(filename);
        } else {
            throw new IllegalArgumentException("TOPMUtils: readTOPM: Unknown file extension: " + filename);
        }

    }

    public static void writeTOPM(TOPMInterface topm, String filename) {

        filename = Utils.addSuffixIfNeeded(filename, ".topm.h5", new String[]{".topm.bin", ".topm.txt", ".topm.h5"});
{'fraction_non_alphanumeric': 0.13557213930348258, 'fraction_numerical': 0.0041459369817578775, 'mean_word_length': 2.4669540229885056, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4883326', 'n_tokens_mistral': 797, 'n_tokens_neox': 759, 'n_words': 178}