示例#1
0
class Tests(unittest.TestCase):
    def setUp(self):
        self.output_directory_path = os.path.join(my_path, 'test-decomposition-threaded')
        self.decomposer = Decomposer()
        self.decomposer.alignment = os.path.join(my_path, 'files/reads-noisy.fa')
        self.decomposer.min_entropy = 0.3
        self.decomposer.min_actual_abundance = 0
        self.decomposer.min_substantive_abundance = 2
        self.decomposer.skip_check_input_file = True
        self.decomposer.number_of_discriminants = 1
        self.decomposer.progress.verbose = False
        self.decomposer.run.verbose = False
        self.decomposer.skip_removing_outliers = False
        self.decomposer.relocate_outliers = True
        self.decomposer.skip_agglomerating_nodes = True
        self.decomposer.threading = True
        self.decomposer.output_directory = self.output_directory_path 


    def tearDown(self):
        pass

    def test_02_Decompose(self):
        self.decomposer.decompose()

    def test_02_Environment(self):
        self.assertTrue(files_are_the_same(os.path.join(my_path, 'files/reads-noisy-environment.txt'),
                                           os.path.join(self.output_directory_path, 'ENVIRONMENT.txt')))

    def test_03_MatrixPercent(self):
        self.assertTrue(files_are_the_same(os.path.join(my_path, 'files/reads-noisy-matrix-percent.txt'),
                                           os.path.join(self.output_directory_path, 'MATRIX-PERCENT.txt')))

    def test_99_CleanUp(self):
        shutil.rmtree(self.output_directory_path)
class Tests(unittest.TestCase):
    def setUp(self):
        self.output_directory_path = os.path.join(my_path, 'test-decomposition-threaded')
        self.decomposer = Decomposer()
        self.decomposer.alignment = os.path.join(my_path, 'files/reads-noisy.fa')
        self.decomposer.min_entropy = 0.3
        self.decomposer.min_actual_abundance = 0
        self.decomposer.min_substantive_abundance = 2
        self.decomposer.number_of_discriminants = 1
        self.decomposer.progress.verbose = False
        self.decomposer.run.verbose = False
        self.decomposer.skip_removing_outliers = False
        self.decomposer.relocate_outliers = True
        self.decomposer.skip_agglomerating_nodes = True
        self.decomposer.threading = True
        self.decomposer.output_directory = self.output_directory_path 


    def tearDown(self):
        pass

    def test_02_Decompose(self):
        self.decomposer.decompose()

    def test_02_Environment(self):
        self.assertTrue(files_are_the_same(os.path.join(my_path, 'files/reads-noisy-environment.txt'),
                                           os.path.join(self.output_directory_path, 'ENVIRONMENT.txt')))

    def test_03_MatrixPercent(self):
        self.assertTrue(files_are_the_same(os.path.join(my_path, 'files/reads-noisy-matrix-percent.txt'),
                                           os.path.join(self.output_directory_path, 'MATRIX-PERCENT.txt')))

    def test_99_CleanUp(self):
        shutil.rmtree(self.output_directory_path)
示例#3
0
class Tests(unittest.TestCase):
    def setUp(self):
        self.output_directory_path = os.path.join(my_path,
                                                  'test-decomposition')
        self.decomposer = Decomposer()
        self.decomposer.alignment = os.path.join(my_path,
                                                 'files/clone43-v6v4.fa')
        self.decomposer.min_entropy = 0.2
        self.decomposer.min_actual_abundance = 1
        self.decomposer.min_substantive_abundance = 1
        self.decomposer.skip_check_input_file = True
        self.decomposer.number_of_discriminants = 3
        self.decomposer.progress.verbose = False
        self.decomposer.run.verbose = False
        self.decomposer.skip_removing_outliers = True
        self.decomposer.skip_agglomerating_nodes = True
        self.decomposer.output_directory = self.output_directory_path

    def tearDown(self):
        pass

    def test_01_PrefixGenerator(self):
        prefix = self.decomposer.get_prefix()
        self.assertTrue(prefix == 'm0.20-A1-M1-d3')

    def test_02_Decompose(self):
        self.decomposer.decompose()
        self.assertTrue(self.decomposer.topology.nodes['root'].discriminants ==
                        [292, 296, 293])
        self.assertTrue(
            self.decomposer.topology.nodes['root'].entropy_tpls[0:5] == [(
                292, 2.2031591775819033), (
                    296, 2.1539606786564707), (
                        293, 2.1279277605456857), (
                            298, 2.1170394670626229), (300,
                                                       2.107517097722345)])
        self.assertTrue(len(self.decomposer.topology.nodes) == 54)
        self.assertTrue(len(self.decomposer.topology.final_nodes) == 43)

    def test_03_Environment(self):
        self.assertTrue(
            files_are_the_same(
                os.path.join(my_path, 'files/clone43-v6v4-environment.txt'),
                os.path.join(self.output_directory_path, 'ENVIRONMENT.txt')))

    def test_04_MatrixPercent(self):
        self.assertTrue(
            files_are_the_same(
                os.path.join(my_path, 'files/clone43-v6v4-matrix-percent.txt'),
                os.path.join(self.output_directory_path,
                             'MATRIX-PERCENT.txt')))

    def test_99_CleanUp(self):
        shutil.rmtree(self.output_directory_path)
示例#4
0
 def setUp(self):
     self.output_directory_path = os.path.join(my_path,
                                               'test-decomposition')
     self.decomposer = Decomposer()
     self.decomposer.alignment = os.path.join(my_path,
                                              'files/clone43-v6v4.fa')
     self.decomposer.min_entropy = 0.2
     self.decomposer.min_actual_abundance = 1
     self.decomposer.min_substantive_abundance = 0
     self.decomposer.number_of_discriminants = 3
     self.decomposer.progress.verbose = False
     self.decomposer.run.verbose = False
     self.decomposer.skip_removing_outliers = True
     self.decomposer.skip_agglomerating_nodes = True
     self.decomposer.output_directory = self.output_directory_path
示例#5
0
 def setUp(self):
     self.output_directory_path = os.path.join(my_path, 'test-decomposition-threaded')
     self.decomposer = Decomposer()
     self.decomposer.alignment = os.path.join(my_path, 'files/reads-noisy.fa')
     self.decomposer.min_entropy = 0.3
     self.decomposer.min_actual_abundance = 0
     self.decomposer.min_substantive_abundance = 2
     self.decomposer.skip_check_input_file = True
     self.decomposer.number_of_discriminants = 1
     self.decomposer.progress.verbose = False
     self.decomposer.run.verbose = False
     self.decomposer.skip_removing_outliers = False
     self.decomposer.relocate_outliers = True
     self.decomposer.skip_agglomerating_nodes = True
     self.decomposer.threading = True
     self.decomposer.output_directory = self.output_directory_path 
class Tests(unittest.TestCase):
    def setUp(self):
        self.output_directory_path = os.path.join(my_path, 'test-decomposition')
        self.decomposer = Decomposer()
        self.decomposer.alignment = os.path.join(my_path, 'files/clone43-v6v4.fa')
        self.decomposer.min_entropy = 0.2
        self.decomposer.min_actual_abundance = 1
        self.decomposer.min_substantive_abundance = 1
        self.decomposer.skip_check_input_file = True
        self.decomposer.number_of_discriminants = 3
        self.decomposer.progress.verbose = False
        self.decomposer.run.verbose = False
        self.decomposer.skip_removing_outliers = True
        self.decomposer.skip_agglomerating_nodes = True
        self.decomposer.output_directory = self.output_directory_path 


    def tearDown(self):
        pass

    def test_01_PrefixGenerator(self):
        prefix = self.decomposer.get_prefix()
        self.assertTrue(prefix == 'm0.20-A1-M1-d3')

    def test_02_Decompose(self):
        self.decomposer.decompose()
        self.assertTrue(self.decomposer.topology.nodes['root'].discriminants == [292, 296, 293])
        self.assertTrue(self.decomposer.topology.nodes['root'].entropy_tpls[0:5] == [(292, 2.2031591775819033), (296, 2.1539606786564707), (293, 2.1279277605456857), (298, 2.1170394670626229), (300, 2.107517097722345)])
        self.assertTrue(len(self.decomposer.topology.nodes) == 54)
        self.assertTrue(len(self.decomposer.topology.final_nodes) == 43)

    def test_03_Environment(self):
        self.assertTrue(files_are_the_same(os.path.join(my_path, 'files/clone43-v6v4-environment.txt'),
                                           os.path.join(self.output_directory_path, 'ENVIRONMENT.txt')))

    def test_04_MatrixPercent(self):
        self.assertTrue(files_are_the_same(os.path.join(my_path, 'files/clone43-v6v4-matrix-percent.txt'),
                                           os.path.join(self.output_directory_path, 'MATRIX-PERCENT.txt')))

    def test_99_CleanUp(self):
        shutil.rmtree(self.output_directory_path)
示例#7
0
 def setUp(self):
     self.output_directory_path = os.path.join(my_path, 'test-decomposition')
     self.decomposer = Decomposer()
     self.decomposer.alignment = os.path.join(my_path, 'files/clone43-v6v4.fa')
     self.decomposer.min_entropy = 0.2
     self.decomposer.min_actual_abundance = 1
     self.decomposer.min_substantive_abundance = 0
     self.decomposer.number_of_discriminants = 3
     self.decomposer.progress.verbose = False
     self.decomposer.run.verbose = False
     self.decomposer.skip_removing_outliers = True
     self.decomposer.skip_agglomerating_nodes = True
     self.decomposer.output_directory = self.output_directory_path 
 def setUp(self):
     self.output_directory_path = os.path.join(my_path, 'test-decomposition-threaded')
     self.decomposer = Decomposer()
     self.decomposer.alignment = os.path.join(my_path, 'files/reads-noisy.fa')
     self.decomposer.min_entropy = 0.3
     self.decomposer.min_actual_abundance = 0
     self.decomposer.min_substantive_abundance = 2
     self.decomposer.number_of_discriminants = 1
     self.decomposer.progress.verbose = False
     self.decomposer.run.verbose = False
     self.decomposer.skip_removing_outliers = False
     self.decomposer.relocate_outliers = True
     self.decomposer.skip_agglomerating_nodes = True
     self.decomposer.threading = True
     self.decomposer.output_directory = self.output_directory_path 
示例#9
0
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# Please read the COPYING file.

import os
import sys

from Oligotyping.lib.decomposer import Decomposer
from Oligotyping.utils.utils import ConfigError
from Oligotyping.utils import parsers


# med_out_dir = '/Users/humebc/phylogenetic_software/med_hume'
# path_to_file = '/Users/humebc/phylogenetic_software/med_hume/test_fasta.fasta'

# ['-M', '4', '--skip-gexf-files', '--skip-gen-figures', '--skip-gen-html', '--skip-check-input', '-o', med_out_dir,
#  path_to_file]
parser = parsers.decomposer()
decomposer = Decomposer(parser.parse_args())

try:
    decomposer.decompose()
except ConfigError as e:
    print(e)
    sys.exit(-1)

# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# Please read the COPYING file.

import os
import sys
import cPickle

from Oligotyping.lib.decomposer import Decomposer
from Oligotyping.utils.utils import get_samples_dict_from_environment_file

runinfo = cPickle.load(open(sys.argv[1]))
sample_mapping = sys.argv[2]

decomposer = Decomposer()
decomposer.matrix_percent_file_path = runinfo['matrix_percent_file_path']
decomposer.matrix_count_file_path = runinfo['matrix_count_file_path']
decomposer.tmp_directory = runinfo['tmp_directory']
decomposer.output_directory = runinfo['output_directory']
decomposer.figures_directory = os.path.join(os.path.dirname(runinfo['figures_directory']), 'FIGURES')

if not os.path.exists(decomposer.tmp_directory):
    os.makedirs(decomposer.tmp_directory)

decomposer.sample_mapping = sample_mapping
decomposer._init_logger('exclusive_figures.log')
decomposer.samples_dict = get_samples_dict_from_environment_file(runinfo['environment_file_path'])
decomposer.samples = sorted(decomposer.samples_dict.keys())

decomposer._generate_exclusive_figures()
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# Please read the COPYING file.

import os
import sys
import cPickle

from Oligotyping.lib.decomposer import Decomposer
from Oligotyping.utils.utils import get_samples_dict_from_environment_file

runinfo = cPickle.load(open(sys.argv[1]))
sample_mapping = sys.argv[2]

decomposer = Decomposer()
decomposer.matrix_percent_file_path = runinfo['matrix_percent_file_path']
decomposer.matrix_count_file_path = runinfo['matrix_count_file_path']
decomposer.tmp_directory = runinfo['tmp_directory']
decomposer.output_directory = runinfo['output_directory']
decomposer.figures_directory = os.path.join(
    os.path.dirname(runinfo['figures_directory']), 'FIGURES')

if not os.path.exists(decomposer.tmp_directory):
    os.makedirs(decomposer.tmp_directory)

decomposer.sample_mapping = sample_mapping
decomposer._init_logger('exclusive_figures.log')
decomposer.samples_dict = get_samples_dict_from_environment_file(
    runinfo['environment_file_path'])
decomposer.samples = sorted(decomposer.samples_dict.keys())