def update(self, **kwargs):
input_sequence_path = kwargs.pop('<STR_LIT>')<EOL>input_taxonomy_path = kwargs.pop('<STR_LIT>', None)<EOL>input_graftm_package_path = kwargs.pop('<STR_LIT>')<EOL>output_graftm_package_path = kwargs.pop('<STR_LIT>')<EOL>threads = kwargs.pop('<STR_LIT>', UpdateDefaultOptions.threads) <EOL>if len(kwargs) > <NUM_LIT:0>:<EOL><INDENT>raise Exception("<STR_LIT>" % kwargs)<EOL><DEDENT>logging.info("<STR_LIT>")<EOL>old_gpkg = GraftMPackage.acquire(input_graftm_package_path)<EOL>min_input_version = <NUM_LIT:3><EOL>if old_gpkg.version < min_input_version:<EOL><INDENT>raise InsufficientGraftMPackageVersion(<EOL>"<STR_LIT>" % min_input_version +<EOL>"<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>new_gpkg = UpdatedGraftMPackage()<EOL>new_gpkg.output = output_graftm_package_path<EOL>new_gpkg.name = output_graftm_package_path.replace("<STR_LIT>", "<STR_LIT>")<EOL>logging.info("<STR_LIT>")<EOL>new_gpkg.unaligned_sequences = "<STR_LIT>" % (new_gpkg.name) <EOL>self._concatenate_file([old_gpkg.unaligned_sequence_database_path(),<EOL>input_sequence_path],<EOL>new_gpkg.unaligned_sequences)<EOL>if input_taxonomy_path:<EOL><INDENT>logging.info("<STR_LIT>")<EOL>input_taxonomy = GreenGenesTaxonomy.read_file(input_taxonomy_path)<EOL>original_taxonomy_hash = old_gpkg.taxonomy_hash()<EOL>total_taxonomy_hash = original_taxonomy_hash.copy()<EOL>total_taxonomy_hash.update(input_taxonomy.taxonomy)<EOL>num_duplicate_taxonomies = len(total_taxonomy_hash) -len(input_taxonomy.taxonomy) -len(original_taxonomy_hash)<EOL>logging.debug("<STR_LIT>" % num_duplicate_taxonomies)<EOL>if num_duplicate_taxonomies > <NUM_LIT:0>:<EOL><INDENT>logging.warn("<STR_LIT>" % num_duplicate_taxonomies)<EOL><DEDENT><DEDENT>logging.info("<STR_LIT>")<EOL>new_gpkg.aligned_sequences = "<STR_LIT>" % (new_gpkg.name)<EOL>self._align_sequences(new_gpkg.unaligned_sequences, new_gpkg.aligned_sequences, threads)<EOL>logging.info("<STR_LIT>")<EOL>new_gpkg.hmm = "<STR_LIT>" % (new_gpkg.name)<EOL>new_gpkg.hmm_alignment = "<STR_LIT>" % (new_gpkg.name)<EOL>self._get_hmm_from_alignment(new_gpkg.aligned_sequences, new_gpkg.hmm, new_gpkg.hmm_alignment)<EOL>logging.info("<STR_LIT>")<EOL>new_gpkg.unrooted_tree = "<STR_LIT>" % (new_gpkg.name)<EOL>new_gpkg.unrooted_tree_log = "<STR_LIT>" % (new_gpkg.name)<EOL>new_gpkg.package_type, new_gpkg.hmm_length = self._pipe_type(old_gpkg.alignment_hmm_path())<EOL>new_gpkg.unrooted_gpkg_tree_log, new_gpkg.unrooted_gpkg_tree =self._build_tree(new_gpkg.hmm_alignment, new_gpkg.name,<EOL>new_gpkg.package_type, self.fasttree)<EOL>if input_taxonomy_path:<EOL><INDENT>new_gpkg.gpkg_tree_log = new_gpkg.unrooted_tree_log<EOL>new_gpkg.gpkg_tree = new_gpkg.unrooted_gpkg_tree<EOL><DEDENT>else:<EOL><INDENT>logging.info("<STR_LIT>")<EOL>rerooter = Rerooter()<EOL>old_tree = Tree.get(path=old_gpkg.reference_package_tree_path(),<EOL>schema='<STR_LIT>')<EOL>new_tree = Tree.get(path=new_gpkg.unrooted_gpkg_tree,<EOL>schema='<STR_LIT>')<EOL>old_tree = rerooter.reroot(old_tree)<EOL>new_tree = rerooter.reroot(new_tree)<EOL>rerooted_tree = rerooter.reroot_by_tree(old_tree, new_tree)<EOL>new_gpkg.gpkg_tree = "<STR_LIT>" % new_gpkg.name<EOL>td = TreeDecorator(<EOL>rerooted_tree,<EOL>old_gpkg.taxtastic_taxonomy_path(),<EOL>old_gpkg.taxtastic_seqinfo_path())<EOL>with tempfile.NamedTemporaryFile(suffix='<STR_LIT>') as taxonomy:<EOL><INDENT>td.decorate(new_gpkg.gpkg_tree, taxonomy.name, True) <EOL>total_taxonomy_hash = GreenGenesTaxonomy.read_file(taxonomy.name).taxonomy<EOL><DEDENT>logging.info("<STR_LIT>")<EOL>new_gpkg.gpkg_tree = "<STR_LIT>" % new_gpkg.name<EOL>new_gpkg.gpkg_tree_log = "<STR_LIT>" % new_gpkg.name<EOL>self._generate_tree_log_file(new_gpkg.unrooted_tree,<EOL>new_gpkg.hmm_alignment,<EOL>new_gpkg.gpkg_tree,<EOL>new_gpkg.gpkg_tree_log,<EOL>new_gpkg.package_type,<EOL>self.fasttree)<EOL><DEDENT>logging.info("<STR_LIT>")<EOL>new_gpkg.tt_seqinfo = "<STR_LIT>" % new_gpkg.name<EOL>new_gpkg.tt_taxonomy = "<STR_LIT>" % new_gpkg.name<EOL>gtns = Getaxnseq()<EOL>gtns.write_taxonomy_and_seqinfo_files(<EOL>total_taxonomy_hash,<EOL>new_gpkg.tt_taxonomy,<EOL>new_gpkg.tt_seqinfo)<EOL>logging.info("<STR_LIT>")<EOL>new_gpkg.refpkg = "<STR_LIT>" % (new_gpkg.name)<EOL>refpkg = self._taxit_create(new_gpkg.name,<EOL>new_gpkg.hmm_alignment,<EOL>new_gpkg.gpkg_tree,<EOL>new_gpkg.gpkg_tree_log,<EOL>new_gpkg.tt_taxonomy,<EOL>new_gpkg.tt_seqinfo,<EOL>new_gpkg.refpkg,<EOL>True)<EOL>logging.info("<STR_LIT>")<EOL>new_gpkg.diamond_database = "<STR_LIT>" % (new_gpkg.name)<EOL>self._create_dmnd_database(new_gpkg.unaligned_sequences, new_gpkg.name)<EOL>logging.info("<STR_LIT>")<EOL>new_gpkg.name = "<STR_LIT>" % new_gpkg.name<EOL>GraftMPackageVersion3.compile(new_gpkg.name, new_gpkg.refpkg,<EOL>new_gpkg.hmm, new_gpkg.diamond_database,<EOL>self._define_range(new_gpkg.unaligned_sequences),<EOL>new_gpkg.unaligned_sequences,<EOL>search_hmm_files=old_gpkg.search_hmm_paths())<EOL>logging.info("<STR_LIT>")<EOL>self._test_package(new_gpkg.name)<EOL>logging.info("<STR_LIT>")<EOL>
Update an existing GraftM package with new sequences and taxonomy. If no
taxonomy is provided, attempt to decorate the new sequences with
pre-existing taxonomy.

Parameters
----------
input_sequence_path: str
    Path to FASTA file containing sequences to add to the update GraftM
    package
input_taxonomy_path: str
    Taxonomy corresponding to the sequences in input_sequence_path. If None,
    then attempt to assign taxonomy by decorating the tree made out of all
    sequences.
input_graftm_package_path: str
    Path to the directory of the GraftM package that is to be updated
output_graftm_package_path: str
    Path to the directory to which the new GraftM package will be
    written to