<commit_before>test_dir = "/tmp/lederhosen_test_#{(0...8).map{65.+(rand(25)).chr}.join}/"

`mkdir -p #{test_dir}`

$stderr.puts "test dir: #{test_dir}"; sleep 1

describe 'the pipeline' do

  it 'should exist' do
    `./bin/lederhosen`
    $?.success?.should be_true
  end

  it 'should trim reads' do
    `./bin/lederhosen trim --reads-dir=spec/data/IL*.txt --out-dir=#{test_dir}/trimmed`
    $?.success?.should be_true
  end

  it 'should join reads' do
    `./bin/lederhosen join --trimmed=#{test_dir}/trimmed/*.fasta --output=#{test_dir}/joined.fasta`
    $?.success?.should be_true
  end

  it 'should sort reads' do
    `./bin/lederhosen sort --input=#{test_dir}/joined.fasta --output=#{test_dir}/sorted.fasta`
    $?.success?.should be_true
  end

  it 'should cluster reads' do
    `./bin/lederhosen cluster --identity=0.80 --input=#{test_dir}/sorted.fasta --output=#{test_dir}/clusters.uc`
    $?.success?.should be_true
  end

  it 'should build OTU abundance matrices' do
    `./bin/lederhosen otu_table --clusters=#{test_dir}/clusters.uc --output=#{test_dir}/test_tables --joined=#{test_dir}/joined.fasta`
    $?.success?.should be_true
  end

  it 'should split joined.fasta into reads for each cluster' do
    `./bin/lederhosen split --reads=#{test_dir}/joined.fasta --clusters=#{test_dir}/clusters.uc --out-dir=#{test_dir}/split --min-clst-size=1`
  end

	it 'should name clusters given a taxcollector database'
	
	it 'should add names to otu abundance matrix given blat output' do
		level = %w{kingdom domain phylum class order genus speces}.choice
    `./bin/lederhosen add_names --table=spec/data/otus.csv --blat=spec/data/blat.txt --level=#{level} --output=#{test_dir}/named_otus.csv`
		$?.success?.should be_true
	end

	it 'should squish otu abundance matrix by same name' do
		`./bin/lederhosen squish --csv-file=#{test_dir}/named_otus.csv --output=#{test_dir}/squished.csv"`
		$?.success?.should be_true
	end
end<commit_msg>typeo<commit_after>test_dir = ENV['TEST_DIR'] || "/tmp/lederhosen_test_#{(0...8).map{65.+(rand(25)).chr}.join}/"

`mkdir -p #{test_dir}`

$stderr.puts "test dir: #{test_dir}"; sleep 1

describe 'the pipeline' do

  it 'should exist' do
    `./bin/lederhosen`
    $?.success?.should be_true
  end

  it 'should trim reads' do
    `./bin/lederhosen trim --reads-dir=spec/data/IL*.txt --out-dir=#{test_dir}/trimmed`
    $?.success?.should be_true
  end

  it 'should join reads' do
    `./bin/lederhosen join --trimmed=#{test_dir}/trimmed/*.fasta --output=#{test_dir}/joined.fasta`
    $?.success?.should be_true
  end

  it 'should sort reads' do
    `./bin/lederhosen sort --input=#{test_dir}/joined.fasta --output=#{test_dir}/sorted.fasta`
    $?.success?.should be_true
  end

  it 'should cluster reads' do
    `./bin/lederhosen cluster --identity=0.80 --input=#{test_dir}/sorted.fasta --output=#{test_dir}/clusters.uc`
    $?.success?.should be_true
  end

  it 'should build OTU abundance matrices' do
    `./bin/lederhosen otu_table --clusters=#{test_dir}/clusters.uc --output=#{test_dir}/test_tables --joined=#{test_dir}/joined.fasta`
    $?.success?.should be_true
  end

  it 'should split joined.fasta into reads for each cluster' do
    `./bin/lederhosen split --reads=#{test_dir}/joined.fasta --clusters=#{test_dir}/clusters.uc --out-dir=#{test_dir}/split --min-clst-size=1`
  end

  it 'should name clusters given a taxcollector database'

  it 'should add names to otu abundance matrix given blat output' do
    level = %w{kingdom domain phylum class order genus speces}.choice
    `./bin/lederhosen add_names --table=spec/data/otus.csv --blat=spec/data/blat.txt --level=#{level} --output=#{test_dir}/named_otus.csv`
    $?.success?.should be_true
  end

  it 'should squish otu abundance matrix by same name' do
    `./bin/lederhosen squish --csv-file=#{test_dir}/named_otus.csv --output=#{test_dir}/squished.csv`
    $?.success?.should be_true
  end
end
{'fraction_non_alphanumeric': 0.16581502299437914, 'fraction_numerical': 0.005620848237097598, 'mean_word_length': 3.600470035252644, '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': '2843618', 'n_tokens_mistral': 1469, 'n_tokens_neox': 1421, 'n_words': 318}