code: def sample_annotation(data):
      
      names = data["rgnames"]['sample']
      tools = dd.get_expression_caller(data)
      work_dir = os.path.join(dd.get_work_dir(data), "mirbase")
      out_dir = os.path.join(work_dir, names)
      utils.safe_makedir(out_dir)
      out_file = op.join(out_dir, names)
      if dd.get_mirbase_hairpin(data):
          mirbase = op.abspath(op.dirname(dd.get_mirbase_hairpin(data)))
          if utils.file_exists(data["collapse"]):
              data['transcriptome_bam'] = _align(data["collapse"],
                                                 dd.get_mirbase_hairpin(data),
                                                 out_file,
                                                 data)
              data['seqbuster'] = _miraligner(data["collapse"], out_file,
                                              dd.get_species(data),
                                              mirbase,
                                              data['config'])
              data["mirtop"] = _mirtop(data['seqbuster'],
                                       dd.get_species(data),
                                       mirbase,
                                       out_dir,
                                       data['config'])
          else:
              logger.debug("Trimmed collapsed file is empty for %s." % names)
      else:
          logger.debug("No annotation file from miRBase.")
  
      sps = dd.get_species(data) if dd.get_species(data) else "None"
      logger.debug("Looking for mirdeep2 database for %s" % names)
      if file_exists(op.join(dd.get_work_dir(data), "mirdeep2", "novel", "hairpin.fa")):
          data['seqbuster_novel'] = _miraligner(data["collapse"], "%s_novel" % out_file, sps,
                                                op.join(dd.get_work_dir(data),
                                                        "mirdeep2", "novel"),
                                                data['config'])
  
      if "trna" in tools:
          data['trna'] = _mint_trna_annotation(data)
  
      data = spikein.counts_spikein(data)
      return [[data]]
docs: Annotate miRNAs using miRBase database with seqbuster tool