<commit_before>package org.broadinstitute.hail.methods

import java.io.File

import breeze.linalg._
import org.apache.commons.math3.distribution.TDistribution
import org.apache.spark.rdd.RDD
import org.broadinstitute.hail.Utils._
import org.broadinstitute.hail.variant._

import scala.collection.mutable
import scala.io.Source

case class CovariateData(covSample: Array[Int], covName: Array[String], data: DenseMatrix[Double])

object CovariateData {

  def read(filename: String, sampleIds: Array[String]): CovariateData = {
    val src = Source.fromFile(new File(filename))
    val linesIterator = src.getLines().filterNot(_.isEmpty)
    val header = linesIterator.next()
    val lines = linesIterator.toArray
    src.close()

    val csName = header.split("\\s+").tail
    val nCov = csName.length
    val nCs = lines.length
    val csSample = Array.ofDim[Int](nCs)
    val sampleNameIndex: Map[String, Int] = sampleIds.zipWithIndex.toMap

    val data = DenseMatrix.zeros[Double](nCs, nCov)<commit_msg>// cs is short for covariateSample<commit_after>package org.broadinstitute.hail.methods

import java.io.File

import breeze.linalg._
import org.apache.commons.math3.distribution.TDistribution
import org.apache.spark.rdd.RDD
import org.broadinstitute.hail.Utils._
import org.broadinstitute.hail.variant._

import scala.collection.mutable
import scala.io.Source

case class CovariateData(covSample: Array[Int], covName: Array[String], data: DenseMatrix[Double])

object CovariateData {

  def read(filename: String, sampleIds: Array[String]): CovariateData = {
    val src = Source.fromFile(new File(filename))
    val linesIterator = src.getLines().filterNot(_.isEmpty)
    val header = linesIterator.next()
    val lines = linesIterator.toArray
    src.close()

    val csName = header.split("\\s+").tail // cs is short for covariateSample
    val nCov = csName.length
    val nCs = lines.length
    val csSample = Array.ofDim[Int](nCs)
    val sampleNameIndex: Map[String, Int] = sampleIds.zipWithIndex.toMap

    val data = DenseMatrix.zeros[Double](nCs, nCov)
{'fraction_non_alphanumeric': 0.1102514506769826, 'fraction_numerical': 0.0009671179883945841, 'mean_word_length': 4.502659574468085, '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': '17374', 'n_tokens_mistral': 678, 'n_tokens_neox': 654, 'n_words': 147}