docs: def add_assembly_names(opts):
      """add assembly names as aliases to existing sequences
  
      Specifically, associate aliases like GRCh37.p9:1 with existing
      refseq accessions
  
      ```
      [{'aliases': ['chr19'],
        'assembly_unit': 'Primary Assembly',
        'genbank_ac': 'CM000681.2',
        'length': 58617616,
        'name': '19',
        'refseq_ac': 'NC_000019.10',
        'relationship': '=',
        'sequence_role': 'assembled-molecule'}]
      ```
  
      For the above sample record, this function adds the following aliases:
        * genbank:CM000681.2
        * GRCh38:19
        * GRCh38:chr19
      to the sequence referred to by refseq:NC_000019.10.
  
      """
      seqrepo_dir = os.path.join(opts.root_directory, opts.instance_name)
      sr = SeqRepo(seqrepo_dir, writeable=True)
  
      assemblies = bioutils.assemblies.get_assemblies()
      if opts.reload_all:
          assemblies_to_load = sorted(assemblies)
      else:
          namespaces = [r["namespace"] for r in sr.aliases._db.execute("select distinct namespace from seqalias")]
          assemblies_to_load = sorted(k for k in assemblies if k not in namespaces)
      _logger.info("{} assemblies to load".format(len(assemblies_to_load)))
  
      ncbi_alias_map = {r["alias"]: r["seq_id"] for r in sr.aliases.find_aliases(namespace="NCBI", current_only=False)}
  
      for assy_name in tqdm.tqdm(assemblies_to_load, unit="assembly"):
          _logger.debug("loading " + assy_name)
          sequences = assemblies[assy_name]["sequences"]
          eq_sequences = [s for s in sequences if s["relationship"] in ("=", "<>")]
          if not eq_sequences:
              _logger.info("No '=' sequences to load for {an}; skipping".format(an=assy_name))
              continue
  
          # all assembled-molecules (1..22, X, Y, MT) have ncbi aliases in seqrepo
          not_in_seqrepo = [s["refseq_ac"] for s in eq_sequences if s["refseq_ac"] not in ncbi_alias_map]
          if not_in_seqrepo:
              _logger.warning("Assembly {an} references {n} accessions not in SeqRepo instance {opts.instance_name} (e.g., {acs})".format(
                  an=assy_name, n=len(not_in_seqrepo), opts=opts, acs=", ".join(not_in_seqrepo[:5]+["..."]), seqrepo_dir=seqrepo_dir))
              if not opts.partial_load:
                  _logger.warning("Skipping {an} (-p to enable partial loading)".format(an=assy_name))
                  continue
              
          eq_sequences = [es for es in eq_sequences if es["refseq_ac"] in ncbi_alias_map]
          _logger.info("Loading {n} new accessions for assembly {an}".format(an=assy_name, n=len(eq_sequences)))
  
          for s in eq_sequences:
              seq_id = ncbi_alias_map[s["refseq_ac"]]
              aliases = [{"namespace": assy_name, "alias": a} for a in [s["name"]] + s["aliases"]]
              if "genbank_ac" in s and s["genbank_ac"]:
                  aliases += [{"namespace": "genbank", "alias": s["genbank_ac"]}]
              for alias in aliases:
                  sr.aliases.store_alias(seq_id=seq_id, **alias)
                  _logger.debug("Added assembly alias {a[namespace]}:{a[alias]} for {seq_id}".format(a=alias, seq_id=seq_id))
          sr.commit()