Ejemplo n.º 1
0
 def test_run_kmer_counts_vectors(self, tmpdir):
     infasta = "tests/data/example.fa"
     infasta = pkg_resources.resource_filename("seekr", infasta)
     mean_vector = "tests/data/example_mean.npy"
     mean_vector = pkg_resources.resource_filename("seekr", mean_vector)
     std_vector = "tests/data/example_std.npy"
     std_vector = pkg_resources.resource_filename("seekr", std_vector)
     outfile = str(tmpdir.join("2mers_vectors.npy"))
     console_scripts._run_kmer_counts(
         fasta=infasta,
         outfile=outfile,
         kmer=2,
         binary=True,
         centered=False,
         standardized=False,
         log2=Log2.post.name,
         remove_labels=True,
         mean_vector=mean_vector,
         std_vector=std_vector,
         alphabet="AGTC",
     )
     kmers = np.load(outfile)
     expected = "tests/data/example_2mers_count.npy"
     expected = pkg_resources.resource_filename("seekr", expected)
     expected = np.load(expected)
     assert np.allclose(kmers, expected)
Ejemplo n.º 2
0
 def test_run_kmer_counts_raw_csv(self, tmpdir):
     infasta = 'tests/data/example.fa'
     infasta = pkg_resources.resource_filename('seekr', infasta)
     outfile = str(tmpdir.join('3mers.csv'))
     console_scripts._run_kmer_counts(fasta=infasta,
                                      outfile=outfile,
                                      kmer=3,
                                      binary=False,
                                      centered=False,
                                      standardized=False,
                                      log2=False,
                                      remove_labels=True,
                                      mean_vector=None,
                                      std_vector=None)
     kmers = pd.read_csv(outfile, header=None)
     expected = 'tests/data/example_3mers_raw.csv'
     expected = pkg_resources.resource_filename('seekr', expected)
     expected = pd.read_csv(expected, header=None)
     assert np.allclose(kmers.values, expected.values)
Ejemplo n.º 3
0
 def test_run_kmer_counts(self, tmpdir):
     infasta = 'tests/data/example.fa'
     infasta = pkg_resources.resource_filename('seekr', infasta)
     outfile = str(tmpdir.join('2mers.npy'))
     console_scripts._run_kmer_counts(fasta=infasta,
                                      outfile=outfile,
                                      kmer=2,
                                      binary=True,
                                      centered=True,
                                      standardized=True,
                                      log2=True,
                                      remove_labels=True,
                                      mean_vector=None,
                                      std_vector=None)
     kmers = np.load(outfile)
     expected = 'tests/data/example_2mers.npy'
     expected = pkg_resources.resource_filename('seekr', expected)
     expected = np.load(expected)
     assert np.allclose(kmers, expected)
Ejemplo n.º 4
0
 def test_run_kmer_counts_raw_csv(self, tmpdir):
     infasta = "tests/data/example.fa"
     infasta = pkg_resources.resource_filename("seekr", infasta)
     outfile = str(tmpdir.join("3mers.csv"))
     console_scripts._run_kmer_counts(
         fasta=infasta,
         outfile=outfile,
         kmer=3,
         binary=False,
         centered=False,
         standardized=False,
         log2=Log2.none.name,
         remove_labels=True,
         mean_vector=None,
         std_vector=None,
         alphabet="AGTC",
     )
     kmers = pd.read_csv(outfile, header=None)
     expected = "tests/data/example_3mers_raw.csv"
     expected = pkg_resources.resource_filename("seekr", expected)
     expected = pd.read_csv(expected, header=None)
     print(kmers.values)
     print(expected)
     assert np.allclose(kmers.values, expected.values)