Exemplo n.º 1
0
    def setUp(self):
        # ensure necessary settings are made
        sepp.scheduler._jobPool = None
        sys.argv = [sys.argv[0], "-c", get_data_path("configs/test2.config")]
        self.x = ExhaustiveAlgorithm()
        self.x.options.alignment_file = open(
            get_data_path(
                "q2-fragment-insertion/reference_alignment_tiny.fasta"), "r")
        self.x.options.info_file = open(
            get_data_path(
                "q2-fragment-insertion/RAxML_info-reference-gg-raxml-bl.info"),
            "r")
        self.x.options.tree_file = open(
            get_data_path(
                "q2-fragment-insertion/reference_phylogeny_tiny.nwk"), "r")
        self.x.options.outdir = tempfile.mkdtemp()

        suff_bit = "-64" if sys.maxsize > 2**32 else "-32"
        if platform.system() == 'Darwin':
            suff_bit = ""
        for prog in ['hmmalign', 'hmmbuild', 'hmmsearch', 'pplacer']:
            setattr(
                self.x.options, prog,
                Namespace(
                    path=get_data_path("../../../tools/bundled/%s/%s%s" %
                                       (platform.system(), prog, suff_bit))))
Exemplo n.º 2
0
 def __init__(self):
     ExhaustiveAlgorithm.__init__(self)
     self.alignment_threshold = self.options.alignment_threshold
     self.placer = self.options.exhaustive.placer.lower()
     self.push_down = True if self.options.push_down is True else False
     _LOG.info("Will push fragments %s from their placement edge." % (
         "down" if self.push_down else "up"))
Exemplo n.º 3
0
class Test(unittest.TestCase):
    x = None

    def setUp(self):
        self.x = ExhaustiveAlgorithm()
        self.x.options.alignment_file = open(
            "data/q2-fragment-insertion/reference_alignment_tiny.fasta", "r")
        self.x.options.info_file = open(
            "data/q2-fragment-insertion/RAxML_info-reference-gg-raxml-bl.info",
            "r")
        self.x.options.tree_file = open(
            "data/q2-fragment-insertion/reference_phylogeny_tiny.nwk", "r")
        self.x.options.outdir = tempfile.mkdtemp()

    def tearDown(self):
        self.x.options.alignment_file.close()
        self.x.options.info_file.close()
        self.x.options.tree_file.close()
        self.x.options.fragment_file.close()
        shutil.rmtree(self.x.options.outdir, ignore_errors=True)

    def test_id_collision_working(self):
        self.x.options.fragment_file = open(
            "data/q2-fragment-insertion/input_fragments.fasta", "r")
        self.x.run()
        self.assertTrue(self.x.results is not None)

    def test_id_collision_collision(self):
        self.x.options.fragment_file = open(
            "data/q2-fragment-insertion/input_fragments_collide.fasta", "r")
        with self.assertRaisesRegex(
                ValueError,
                ' whose names overlap with names in your reference'):
            self.x.run()
        self.assertTrue(self.x.results is None)
Exemplo n.º 4
0
 def check_and_set_sizes(self, total):
     assert (self.options.placement_size is None) or (
             self.options.placement_size >= total), \
             ("currently UPP works with only one placement subset."
              " Please leave placement subset size option blank.")
     ExhaustiveAlgorithm.check_and_set_sizes(self, total)
     self.options.placement_size = total
Exemplo n.º 5
0
 def __init__(self):
     ExhaustiveAlgorithm.__init__(self)
     self.alignment_threshold = self.options.alignment_threshold
     self.placer = self.options.exhaustive.placer.lower()
     self.push_down = True if self.options.push_down == True else False
     _LOG.info("Will push fragments %s from their placement edge." %
               ("down" if self.push_down else "up"))
Exemplo n.º 6
0
 def check_and_set_sizes(self, total):
     assert (self.options.placement_size is None) or (
             self.options.placement_size >= total), \
             ("currently UPP works with only one placement subset."
              " Please leave placement subset size option blank.")
     ExhaustiveAlgorithm.check_and_set_sizes(self, total)
     self.options.placement_size = total
Exemplo n.º 7
0
 def check_options(self, supply=[]):
     if (options().reference_pkg is not None):
         self.load_reference(os.path.join(options().reference.path, 'refpkg/%s.refpkg/' % options().reference_pkg))                  
     if (options().taxonomy_file is None):
         supply = supply + ["taxonomy file"]
     if (options().taxonomy_name_mapping_file is None):
         supply = supply + ["taxonomy name mapping file"]
     ExhaustiveAlgorithm.check_options(self, supply)
Exemplo n.º 8
0
 def check_options(self, supply=[]):
     if (options().reference_pkg is not None):
         self.load_reference(os.path.join(options().reference.path, 'refpkg/%s.refpkg/' % options().reference_pkg))                  
     if (options().taxonomy_file is None):
         supply = supply + ["taxonomy file"]
     if (options().taxonomy_name_mapping_file is None):
         supply = supply + ["taxonomy name mapping file"]
     ExhaustiveAlgorithm.check_options(self, supply)
Exemplo n.º 9
0
 def setUp(self):
     self.x = ExhaustiveAlgorithm()
     self.x.options.alignment_file = open(
         "data/q2-fragment-insertion/reference_alignment_tiny.fasta", "r")
     self.x.options.info_file = open(
         "data/q2-fragment-insertion/RAxML_info-reference-gg-raxml-bl.info",
         "r")
     self.x.options.tree_file = open(
         "data/q2-fragment-insertion/reference_phylogeny_tiny.nwk", "r")
     self.x.options.outdir = tempfile.mkdtemp()
Exemplo n.º 10
0
class Test(unittest.TestCase):
    x = None

    def resetSepp(self):
        sepp.scheduler._jobPool = None
        self.x = ExhaustiveAlgorithm()
        self.x.options.alignment_file = open(
            get_data_path(
                "q2-fragment-insertion/reference_alignment_tiny.fasta"), "r")
        self.x.options.info_file = open(
            get_data_path(
                "q2-fragment-insertion/RAxML_info-reference-gg-raxml-bl.info"),
            "r")
        self.x.options.tree_file = open(
            get_data_path(
                "q2-fragment-insertion/reference_phylogeny_tiny.nwk"), "r")
        self.x.options.outdir = tempfile.mkdtemp()

        suff_bit = "-64" if sys.maxsize > 2**32 else "-32"
        if platform.system() == 'Darwin':
            suff_bit = ""
        for prog in ['hmmalign', 'hmmbuild', 'hmmsearch', 'pplacer']:
            setattr(
                self.x.options, prog,
                Namespace(
                    path=get_data_path("../../../tools/bundled/%s/%s%s" %
                                       (platform.system(), prog, suff_bit))))

    def setUp(self):
        # ensure necessary settings are made
        sys.argv = [sys.argv[0], "-c", get_data_path("configs/test2.config")]
        self.resetSepp()

    def tearDown(self):
        shutil.rmtree(self.x.options.outdir, ignore_errors=True)
        self.resetSepp()

    def test_diamMid(self):
        self.x.options.fragment_file = open(
            get_data_path("q2-fragment-insertion/input_fragments.fasta"), "r")
        self.x.options.maxDiam = 0.1
        self.x.options.fragmentChunkSize = 1
        self.x.options.decomp_strategy = "midpoint"
        self.x.run()
        self.assertTrue(self.x.results is not None)

    def test_diamCent(self):
        self.x.options.fragment_file = open(
            get_data_path("q2-fragment-insertion/input_fragments.fasta"), "r")
        self.x.options.maxDiam = 0.1
        self.x.options.fragmentChunkSize = 1
        self.x.options.decomp_strategy = "centroid"
        self.x.run()
        self.assertTrue(self.x.results is not None)
Exemplo n.º 11
0
class Test(unittest.TestCase):
    x = None

    def resetSepp(self):
        sepp.scheduler._jobPool = None
        self.x = ExhaustiveAlgorithm()
        self.x.options.alignment_file = open(
            get_data_path(
                "q2-fragment-insertion/reference_alignment_tiny.fasta"), "r")
        self.x.options.info_file = open(
            get_data_path(
                "q2-fragment-insertion/RAxML_info-reference-gg-raxml-bl.info"),
            "r")
        self.x.options.tree_file = open(
            get_data_path(
                "q2-fragment-insertion/reference_phylogeny_tiny.nwk"), "r")
        self.x.options.outdir = tempfile.mkdtemp()

        suff_bit = "-64" if sys.maxsize > 2**32 else "-32"
        if platform.system() == 'Darwin':
            suff_bit = ""
        for prog in ['hmmalign', 'hmmbuild', 'hmmsearch', 'pplacer']:
            setattr(self.x.options, prog, Namespace(
                path=get_data_path("../../../tools/bundled/%s/%s%s" % (
                    platform.system(), prog, suff_bit))))

    def setUp(self):
        # ensure necessary settings are made
        sys.argv = [sys.argv[0], "-c", get_data_path("configs/test2.config")]
        self.resetSepp()

    def tearDown(self):
        shutil.rmtree(self.x.options.outdir, ignore_errors=True)
        self.resetSepp()

    def test_diamMid(self):
        self.x.options.fragment_file = open(
            get_data_path(
                "q2-fragment-insertion/input_fragments.fasta"), "r")
        self.x.options.maxDiam = 0.1
        self.x.options.fragmentChunkSize = 1
        self.x.options.decomp_strategy = "midpoint"
        self.x.run()
        self.assertTrue(self.x.results is not None)

    def test_diamCent(self):
        self.x.options.fragment_file = open(
            get_data_path(
                "q2-fragment-insertion/input_fragments.fasta"), "r")
        self.x.options.maxDiam = 0.1
        self.x.options.fragmentChunkSize = 1
        self.x.options.decomp_strategy = "centroid"
        self.x.run()
        self.assertTrue(self.x.results is not None)
Exemplo n.º 12
0
    def check_options(self):
        self.check_outputprefix()
        options().info_file = "A_dummy_value"

        # Check to see if tree/alignment/fragment file provided, if not,
        # generate it from sequence file
        if ((not options().tree_file is None)
                and (not options().alignment_file is None)
                and (not options().sequence_file is None)):
            options().fragment_file = options().sequence_file
        elif ((options().tree_file is None)
              and (options().alignment_file is None)
              and (not options().sequence_file is None)):
            self.generate_backbone()
        else:
            _LOG.error(
                ("Either specify the backbone alignment and tree and query "
                 "sequences or only the query sequences.  Any other "
                 "combination is invalid"))
            exit(-1)
        sequences = MutableAlignment()
        sequences.read_file_object(open(self.options.alignment_file.name))
        backbone_size = sequences.get_num_taxa()
        if options().backbone_size is None:
            options().backbone_size = backbone_size
        assert options().backbone_size == backbone_size, (
            ("Backbone parameter needs to match actual size of backbone; "
             "backbone parameter:%s backbone_size:%s") %
            (options().backbone_size, backbone_size))
        if options().placement_size is None:
            options().placement_size = options().backbone_size
        return ExhaustiveAlgorithm.check_options(self)
Exemplo n.º 13
0
    def check_options(self):
        options().info_file = "A_dummy_value"

        if options().tree_file is None or options().alignment_file is None:
            _LOG.error("Specify the backbone alignment and tree and query sequences")
            exit(-1)
        sequences = MutableAlignment()
        sequences.read_file_object(open(self.options.alignment_file.name))
        return ExhaustiveAlgorithm.check_options(self)
Exemplo n.º 14
0
    def check_options(self):
        options().info_file = "A_dummy_value"

        if options().tree_file is None or options().alignment_file is None:
            _LOG.error("Specify the backbone alignment and tree and query sequences")
            exit(-1)
        sequences = MutableAlignment()
        sequences.read_file_object(open(self.options.alignment_file.name))  
        return ExhaustiveAlgorithm.check_options(self)
Exemplo n.º 15
0
 def resetSepp(self):
     # ensure necessary settings are made
     sepp.scheduler._jobPool = None
     sepp.scheduler._parser = None
     self.x = ExhaustiveAlgorithm()
     self.x.options.alignment_file = open(
         get_data_path(
             "q2-fragment-insertion/reference_alignment_tiny.fasta"), "r")
     self.x.options.info_file = open(
         get_data_path(
             "q2-fragment-insertion/RAxML_info-reference-gg-raxml-bl.info"),
         "r")
     self.x.options.tree_file = open(
         get_data_path(
             "q2-fragment-insertion/reference_phylogeny_tiny.nwk"), "r")
     self.x.options.fragment_file = open(
         get_data_path(
             "q2-fragment-insertion/input_fragments.fasta"), "r")
     self.x.options.outdir = tempfile.mkdtemp()
     self.x.options.placement_size = 20
Exemplo n.º 16
0
class Test(unittest.TestCase):
    x = None

    def resetSepp(self):
        # ensure necessary settings are made
        sepp.scheduler._jobPool = None
        sepp.scheduler._parser = None
        self.x = ExhaustiveAlgorithm()
        self.x.options.alignment_file = open(
            get_data_path(
                "q2-fragment-insertion/reference_alignment_tiny.fasta"), "r")
        self.x.options.info_file = open(
            get_data_path(
                "q2-fragment-insertion/RAxML_info-reference-gg-raxml-bl.info"),
            "r")
        self.x.options.tree_file = open(
            get_data_path(
                "q2-fragment-insertion/reference_phylogeny_tiny.nwk"), "r")
        self.x.options.fragment_file = open(
            get_data_path(
                "q2-fragment-insertion/input_fragments.fasta"), "r")
        self.x.options.outdir = tempfile.mkdtemp()
        self.x.options.placement_size = 20

    def setUp(self):
        sys.argv = [sys.argv[0]]
        self.resetSepp()
        self._checkpointfile = tempfile.mktemp()

    def tearDown(self):
        shutil.rmtree(self.x.options.outdir, ignore_errors=True)
        self.resetSepp()

    def test_make_checkpoints(self):
        self.x.options.checkpoint = set_checkpoint(self._checkpointfile)
        self.x.options.checkpoint_interval = 5
        self.x.run()
        self.assertTrue(self.x.results is not None)
Exemplo n.º 17
0
    def check_options(self):
        options().info_file = "A_dummy_value"

        #Check to see if tree/alignment/fragment file provided, if not, generate it
        #from sequence file
        if not options().tree_file is None and not options(
        ).alignment_file is None and not options().sequence_file is None:
            options().fragment_file = options().sequence_file
        elif options().tree_file is None and options(
        ).alignment_file is None and not options().sequence_file is None:
            self.generate_backbone()
        else:
            _LOG.error(
                "Either specify the backbone alignment and tree and query sequences or only the query sequences.  Any other combination is invalid"
            )
            exit(-1)
        sequences = MutableAlignment()
        sequences.read_file_object(open(self.options.alignment_file.name))
        backbone_size = sequences.get_num_taxa()
        if options().backbone_size is None:
            options().backbone_size = backbone_size
        assert options().backbone_size == backbone_size, (
            "Backbone parameter needs to match actual size of backbone; backbone parameter:%s backbone_size:%s"
            % (options().backbone_size, backbone_size))
        if options().placement_size is None:
            options().placement_size = options().backbone_size
        if options().alignment_size is None:
            _LOG.info(
                "Alignment subset size not given.  Calculating subset size. ")
            alignment = MutableAlignment()
            alignment.read_file_object(open(self.options.alignment_file.name))
            if (options().molecule == 'amino'):
                _LOG.warning(
                    "Automated alignment subset selection not implemented for protein alignment.  Setting to 10."
                )
                options().alignment_size = 10
            else:
                (averagep, maxp) = alignment.get_p_distance()
                align_size = 10
                if (averagep > .60):
                    while (align_size * 2 < alignment.get_num_taxa()):
                        align_size = align_size * 2
                _LOG.info(
                    "Average p-distance of backbone is %f0.2.  Alignment subset size set to %d. "
                    % (averagep, align_size))
                options().alignment_size = align_size
        return ExhaustiveAlgorithm.check_options(self)
Exemplo n.º 18
0
    def check_options(self):
        options().info_file = "A_dummy_value"

        #Check to see if tree/alignment/fragment file provided, if not, generate it
        #from sequence file                
        if not options().tree_file is None and not options().alignment_file is None and not options().sequence_file is None:
            options().fragment_file = options().sequence_file        
        elif options().tree_file is None and options().alignment_file is None and not options().sequence_file is None:            
            self.generate_backbone()
        else:
            _LOG.error("Either specify the backbone alignment and tree and query sequences or only the query sequences.  Any other combination is invalid")
            exit(-1)
        sequences = MutableAlignment()
        sequences.read_file_object(open(self.options.alignment_file.name))            
        backbone_size = sequences.get_num_taxa()
        if options().backbone_size is None:
            options().backbone_size = backbone_size        
        assert options().backbone_size == backbone_size, ("Backbone parameter needs to match actual size of backbone; backbone parameter:%s backbone_size:%s" 
                %(options().backbone_size, backbone_size))                    
        if options().placement_size is None:
            options().placement_size = options().backbone_size
        return ExhaustiveAlgorithm.check_options(self)
Exemplo n.º 19
0
    def resetSepp(self):
        sepp.scheduler._jobPool = None
        self.x = ExhaustiveAlgorithm()
        self.x.options.alignment_file = open(
            get_data_path(
                "q2-fragment-insertion/reference_alignment_tiny.fasta"), "r")
        self.x.options.info_file = open(
            get_data_path(
                "q2-fragment-insertion/RAxML_info-reference-gg-raxml-bl.info"),
            "r")
        self.x.options.tree_file = open(
            get_data_path(
                "q2-fragment-insertion/reference_phylogeny_tiny.nwk"), "r")
        self.x.options.outdir = tempfile.mkdtemp()

        suff_bit = "-64" if sys.maxsize > 2**32 else "-32"
        if platform.system() == 'Darwin':
            suff_bit = ""
        for prog in ['hmmalign', 'hmmbuild', 'hmmsearch', 'pplacer']:
            setattr(self.x.options, prog, Namespace(
                path=get_data_path("../../../tools/bundled/%s/%s%s" % (
                    platform.system(), prog, suff_bit))))
Exemplo n.º 20
0
    def check_options(self):
        options().info_file = "A_dummy_value"

        #Check to see if tree/alignment/fragment file provided, if not, generate it
        #from sequence file                
        if not options().tree_file is None and not options().alignment_file is None and not options().sequence_file is None:
            options().fragment_file = options().sequence_file        
        elif options().tree_file is None and options().alignment_file is None and not options().sequence_file is None:
            self.generate_backbone()
        else:
            _LOG.error("Either specify the backbone alignment and tree and query sequences or only the query sequences.  Any other combination is invalid")
            exit(-1)
        sequences = MutableAlignment()
        sequences.read_file_object(open(self.options.alignment_file.name))            
        backbone_size = sequences.get_num_taxa()
        if options().backbone_size is None:
            options().backbone_size = backbone_size
        assert options().backbone_size == backbone_size, ("Backbone parameter needs to match actual size of backbone; backbone parameter:%s backbone_size:%s" 
                %(options().backbone_size, backbone_size))                    
        if options().placement_size is None:
            options().placement_size = options().backbone_size
        if options().alignment_size is None:
            _LOG.info("Alignment subset size not given.  Calculating subset size. ")
            alignment = MutableAlignment()
            alignment.read_file_object(open(self.options.alignment_file.name))
            if (options().molecule == 'amino'):
                _LOG.warning("Automated alignment subset selection not implemented for protein alignment.  Setting to 10.")
                options().alignment_size = 10        
            else:
                (averagep,maxp) = alignment.get_p_distance()            
                align_size = 10
                if (averagep > .60):                
                    while (align_size*2 < alignment.get_num_taxa()):
                        align_size = align_size * 2            
                _LOG.info("Average p-distance of backbone is %f0.2.  Alignment subset size set to %d. " % (averagep,align_size))    
                options().alignment_size = align_size
        return ExhaustiveAlgorithm.check_options(self)
Exemplo n.º 21
0
 def check_options(self, supply=[]):
     if (options().taxonomy_file is None):
         supply = supply + ["taxonomy file"]
     if (options().taxonomy_name_mapping_file is None):
         supply = supply + ["taxonomy name mapping file"]
     ExhaustiveAlgorithm.check_options(self, supply)
Exemplo n.º 22
0
 def __init__(self):
     ExhaustiveAlgorithm.__init__(self)
     self.pasta_only = False
Exemplo n.º 23
0
 def __init__(self):
     ExhaustiveAlgorithm.__init__(self)
     self.pasta_only = False
     self.filtered_taxa = []
Exemplo n.º 24
0
class Test(unittest.TestCase):
    x = None

    def setUp(self):
        # ensure necessary settings are made
        sepp.scheduler._jobPool = None
        sys.argv = [sys.argv[0], "-c", get_data_path("configs/test2.config")]
        self.x = ExhaustiveAlgorithm()
        self.x.options.alignment_file = open(
            get_data_path(
                "q2-fragment-insertion/reference_alignment_tiny.fasta"), "r")
        self.x.options.info_file = open(
            get_data_path(
                "q2-fragment-insertion/RAxML_info-reference-gg-raxml-bl.info"),
            "r")
        self.x.options.tree_file = open(
            get_data_path(
                "q2-fragment-insertion/reference_phylogeny_tiny.nwk"), "r")
        self.x.options.outdir = tempfile.mkdtemp()

        suff_bit = "-64" if sys.maxsize > 2**32 else "-32"
        if platform.system() == 'Darwin':
            suff_bit = ""
        for prog in ['hmmalign', 'hmmbuild', 'hmmsearch', 'pplacer']:
            setattr(
                self.x.options, prog,
                Namespace(
                    path=get_data_path("../../../tools/bundled/%s/%s%s" %
                                       (platform.system(), prog, suff_bit))))

    def tearDown(self):
        self.x.options.alignment_file.close()
        self.x.options.info_file.close()
        self.x.options.tree_file.close()
        self.x.options.fragment_file.close()
        sepp.scheduler._jobPool = None
        shutil.rmtree(self.x.options.outdir, ignore_errors=True)

    def test_id_collision_working(self):
        self.x.options.fragment_file = open(
            get_data_path("q2-fragment-insertion/input_fragments.fasta"), "r")
        self.x.run()
        self.assertTrue(self.x.results is not None)

    def test_id_collision_collision(self):
        self.x.options.fragment_file = open(
            get_data_path(
                "q2-fragment-insertion/input_fragments_collide.fasta"), "r")
        with self.assertRaisesRegex(
                ValueError,
                ' whose names overlap with names in your reference'):
            self.x.run()
        self.assertTrue(self.x.results is None)

    def test_seqnames_whitespaces(self):
        self.x.options.fragment_file = open(
            get_data_path(
                "q2-fragment-insertion/input_fragments_spaces.fasta"), "r")
        with self.assertRaisesRegex(ValueError,
                                    "contain either whitespaces: "):
            self.x.run()
        self.assertTrue(self.x.results is None)
Exemplo n.º 25
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from sepp.exhaustive import ExhaustiveAlgorithm

# #########################################################################, a#
#    Copyright 2012 Siavash Mirarab, Nam Nguyen, and Tandy Warnow.
#    This file is part of SEPP.
#
#    SEPP 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 3 of the License, or
#    (at your option) any later version.
#
#    SEPP is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with SEPP.  If not, see <http://www.gnu.org/licenses/>.
# ##########################################################################

# MAIN
if __name__ == '__main__':
    ExhaustiveAlgorithm().run()
Exemplo n.º 26
0
 def __init__(self):
     ExhaustiveAlgorithm.__init__(self)
Exemplo n.º 27
0
 def __init__(self):
     ExhaustiveAlgorithm.__init__(self)
     self.symfrac = False
     self.elim = None
     self.filters = True
Exemplo n.º 28
0
class Test(unittest.TestCase):
    x = None

    def setUp(self):
        # ensure necessary settings are made
        sepp.scheduler._jobPool = None
        sys.argv = [sys.argv[0], "-c", get_data_path("configs/test2.config")]
        self.x = ExhaustiveAlgorithm()
        self.x.options.alignment_file = open(
            get_data_path(
                "q2-fragment-insertion/reference_alignment_tiny.fasta"), "r")
        self.x.options.info_file = open(
            get_data_path(
                "q2-fragment-insertion/RAxML_info-reference-gg-raxml-bl.info"),
            "r")
        self.x.options.tree_file = open(
            get_data_path(
                "q2-fragment-insertion/reference_phylogeny_tiny.nwk"), "r")
        self.x.options.outdir = tempfile.mkdtemp()

        suff_bit = "-64" if sys.maxsize > 2**32 else "-32"
        if platform.system() == 'Darwin':
            suff_bit = ""
        for prog in ['hmmalign', 'hmmbuild', 'hmmsearch', 'pplacer']:
            setattr(self.x.options, prog, Namespace(
                path=get_data_path("../../../tools/bundled/%s/%s%s" % (
                    platform.system(), prog, suff_bit))))

    def tearDown(self):
        self.x.options.alignment_file.close()
        self.x.options.info_file.close()
        self.x.options.tree_file.close()
        self.x.options.fragment_file.close()
        sepp.scheduler._jobPool = None
        shutil.rmtree(self.x.options.outdir, ignore_errors=True)

    def test_id_collision_working(self):
        self.x.options.fragment_file = open(
            get_data_path(
                "q2-fragment-insertion/input_fragments.fasta"), "r")
        self.x.run()
        self.assertTrue(self.x.results is not None)

    def test_id_collision_collision(self):
        self.x.options.fragment_file = open(
            get_data_path(
                "q2-fragment-insertion/input_fragments_collide.fasta"), "r")
        with self.assertRaisesRegex(
                ValueError,
                ' whose names overlap with names in your reference'):
            self.x.run()
        self.assertTrue(self.x.results is None)

    def test_seqnames_whitespaces(self):
        self.x.options.fragment_file = open(
            get_data_path(
                "q2-fragment-insertion/input_fragments_spaces.fasta"), "r")
        with self.assertRaisesRegex(
                ValueError,
                "contain either whitespaces: "):
            self.x.run()
        self.assertTrue(self.x.results is None)
Exemplo n.º 29
0
 def __init__(self):
     ExhaustiveAlgorithm.__init__(self)
     self.pasta_only = False
Exemplo n.º 30
0
 def __init__(self):
     ExhaustiveAlgorithm.__init__(self)
     self.symfrac = False
     self.elim = None
     self.filters = True
Exemplo n.º 31
0
 def __init__(self):
     ExhaustiveAlgorithm.__init__(self)