<commit_before>/*
 *                      Nividic development code
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  If you do not have a copy,
 * see:
 *
 *      http://www.gnu.org/copyleft/lesser.html
 *
 * Copyright for this code is held jointly by the microarray platform
 * of the �cole Normale Sup�rieure and the individual authors.
 * These should be listed in @author doc comments.
 *
 * For more information on the Nividic project and its aims,
 * or to join the Nividic mailing list, visit the home page
 * at:
 *
 *      http://www.transcriptome.ens.fr/nividic
 *
 */

package fr.ens.transcriptome.nividic.om.io;

import java.io.File;
import java.io.InputStream;

/**
 * This class implement a GPR reader.
 * @author <NAME>
 */
public class GPRReader extends ATFReader {

  /** Fields names usualy readed in a GPR file. */
  private static final String[] fieldNameInGPR =
      {"Block", "Column", "Row", "Name", "ID", "F635 Median", "F532 Median",
          "Flags"};

  /** Name of integer field names. */
  private static final String[] intFieldNames =
      {"Block", "Column", "Row", "X", "Y", "Dia.", "F635 Median", "F635 Mean",
          "F635 SD", "F635 CV", "B635 CV", "B635", "B635 Median", "B635 Mean",
          "B635 SD", "% > B635+1SD", "% > B635+2SD", "F635 % Sat.",
          "F532 Median", "F532 Mean", "F532 SD", "F532 CV", "B532 CV", "B532",
          "B532 Median", "B532 Mean", "B532 SD", "% > B532+1SD",
          "% > B532+2SD", "F532 % Sat.", "F Pixels", "B Pixels",
          "Sum of Medians", "Sum of Means", "F635 Median - B635",
          "F532 Median - B532", "F635 Mean - B635", "F532 Mean - B532",
          "F635 Total Intensity", "F532 Total Intensity",
          "Sum of Medians (635/532)", "Sum of Means (635/532)", "Circularity",
          "Flags", "Normalize", "Autoflag"};

  /** Name of double field names. */
  private static final String[] doubleFieldNames =
  {"Ratio of Medians (635/532)", "Ratio of Means (635/532)",
      "Median of Ratios (635/532)", "Mean of Ratios (635/532)",
      "Ratios SD (635/532)", "Rgn Ratio (635/532)", "Rgn R2 (635/532)",
      "Log Ratio (635/532)", "SNR 635", "SNR 532"};
  
//  private static final String[] doubleFieldNames =
//      {"Ratio of Medians (635/532)", "Ratio of Means (635/532)",
//          "Median of Ratios (635/532)", "Mean of Ratios (635/532)",
//          "Ratios SD (635/532)", "Rgn Ratio (635/532)", "Rgn R2 (635/532)",
//          "Log Ratio (635/532)", "SNR 635", "SNR 532"};

//  "Mean of Ratios (635/532)"    "Ratio of Medians (635/532)"    "Sum of Medians (635/532)"  "Sum of Means (635/532)"    "Log Ratio (635/532)"   "Ratio of Means (635/532)"  "Median of Ratios (635/532)"    "Ratios SD (635/532)"   "Rgn R2 (635/532)"

  
  /**
   * Get the convert of fieldnames
   * @return The converter of fieldnames
   */
  public FieldNameConverter getFieldNameConverter() {
    return new GPRConverterFieldNames();
  }

  private void addDefaultFieldsToRead() {

    for (int i = 0; i < fieldNameInGPR.length; i++)
      addFieldToRead(fieldNameInGPR[i]);
  }

  /**
   * Get the names of the integer fields.
   * @return An string array of field names
   */
  public String[] getIntFieldNames() {
    return GPRReader.intFieldNames.clone();
  }

  /**
   * Get the names of the double fields.
   * @return An string array of field names
   */
  public String[] getDoubleFieldNames() {
    return GPRReader.doubleFieldNames.clone();
  }

  //
  // Constructors
  //

  /**
   * Public constructor.
   * @param file file to read
   * @throws NividicIOException if an error occurs while reading the file or if
   *           the file is null.
   */
  public GPRReader(final File file) throws NividicIOException {

    super(file);
    addDefaultFieldsToRead();
  }

  /**
   * Public constructor
   * @param is Input stream to read
   * @throws NividicIOException if the stream is null<commit_msg>Add a new constructor in GPRWriter to take the filename as argument<commit_after>/*
 *                      Nividic development code
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  If you do not have a copy,
 * see:
 *
 *      http://www.gnu.org/copyleft/lesser.html
 *
 * Copyright for this code is held jointly by the microarray platform
 * of the �cole Normale Sup�rieure and the individual authors.
 * These should be listed in @author doc comments.
 *
 * For more information on the Nividic project and its aims,
 * or to join the Nividic mailing list, visit the home page
 * at:
 *
 *      http://www.transcriptome.ens.fr/nividic
 *
 */

package fr.ens.transcriptome.nividic.om.io;

import java.io.File;
import java.io.InputStream;

/**
 * This class implement a GPR reader.
 * @author <NAME>
 */
public class GPRReader extends ATFReader {

  /** Fields names usualy readed in a GPR file. */
  private static final String[] fieldNameInGPR =
      {"Block", "Column", "Row", "Name", "ID", "F635 Median", "F532 Median",
          "Flags"};

  /** Name of integer field names. */
  private static final String[] intFieldNames =
      {"Block", "Column", "Row", "X", "Y", "Dia.", "F635 Median", "F635 Mean",
          "F635 SD", "F635 CV", "B635 CV", "B635", "B635 Median", "B635 Mean",
          "B635 SD", "% > B635+1SD", "% > B635+2SD", "F635 % Sat.",
          "F532 Median", "F532 Mean", "F532 SD", "F532 CV", "B532 CV", "B532",
          "B532 Median", "B532 Mean", "B532 SD", "% > B532+1SD",
          "% > B532+2SD", "F532 % Sat.", "F Pixels", "B Pixels",
          "Sum of Medians", "Sum of Means", "F635 Median - B635",
          "F532 Median - B532", "F635 Mean - B635", "F532 Mean - B532",
          "F635 Total Intensity", "F532 Total Intensity",
          "Sum of Medians (635/532)", "Sum of Means (635/532)", "Circularity",
          "Flags", "Normalize", "Autoflag"};

  /** Name of double field names. */
  private static final String[] doubleFieldNames =
      {"Ratio of Medians (635/532)", "Ratio of Means (635/532)",
          "Median of Ratios (635/532)", "Mean of Ratios (635/532)",
          "Ratios SD (635/532)", "Rgn Ratio (635/532)", "Rgn R2 (635/532)",
          "Log Ratio (635/532)", "SNR 635", "SNR 532"};

  // private static final String[] doubleFieldNames =
  // {"Ratio of Medians (635/532)", "Ratio of Means (635/532)",
  // "Median of Ratios (635/532)", "Mean of Ratios (635/532)",
  // "Ratios SD (635/532)", "Rgn Ratio (635/532)", "Rgn R2 (635/532)",
  // "Log Ratio (635/532)", "SNR 635", "SNR 532"};

  // "Mean of Ratios (635/532)" "Ratio of Medians (635/532)"
  // "Sum of Medians (635/532)" "Sum of Means (635/532)" "Log Ratio (635/532)"
  // "Ratio of Means (635/532)" "Median of Ratios (635/532)"
  // "Ratios SD (635/532)" "Rgn R2 (635/532)"

  /**
   * Get the convert of fieldnames
   * @return The converter of fieldnames
   */
  public FieldNameConverter getFieldNameConverter() {
    return new GPRConverterFieldNames();
  }

  private void addDefaultFieldsToRead() {

    for (int i = 0; i < fieldNameInGPR.length; i++)
      addFieldToRead(fieldNameInGPR[i]);
  }

  /**
   * Get the names of the integer fields.
   * @return An string array of field names
   */
  public String[] getIntFieldNames() {
    return GPRReader.intFieldNames.clone();
  }

  /**
   * Get the names of the double fields.
   * @return An string array of field names
   */
  public String[] getDoubleFieldNames() {
    return GPRReader.doubleFieldNames.clone();
  }

  //
  // Constructors
  //

  /**
   * Public constructor.
   * @param filename file to read
   * @throws NividicIOException if an error occurs while reading the file or if
   *           the file is null.
   */
  public GPRReader(final String filename) throws NividicIOException {

    this(new File(filename));
  }

  /**
   * Public constructor.
   * @param file file to read
   * @throws NividicIOException if an error occurs while reading the file or if
   *           the file is null.
   */
  public GPRReader(final File file) throws NividicIOException {

    super(file);
    addDefaultFieldsToRead();
  }

  /**
   * Public constructor
   * @param is Input stream to read
   * @throws NividicIOException if the stream is null
{'fraction_non_alphanumeric': 0.1417304015296367, 'fraction_numerical': 0.06931166347992351, 'mean_word_length': 2.7903079710144927, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '7391001', 'n_tokens_mistral': 3140, 'n_tokens_neox': 2657, 'n_words': 947}