def rescue_symbol(symbol, method = @rescue_method, rehearsal = false)
      return @rescue_history[symbol] if @rescue_history[symbol]

      case method
      when :auto
        auto_rescue = ''

        if @symbol2hgncid[symbol.upcase]
          auto_rescue = symbol.upcase
        elsif @symbol2hgncid[symbol.downcase]
          auto_rescue = symbol.downcase
        elsif @symbol2hgncid[symbol.delete('-')]
          auto_rescue = symbol.delete('-')
        elsif @symbol2hgncid[symbol.upcase.delete('-')]
          auto_rescue = symbol.upcase.delete('-')
        elsif @symbol2hgncid[symbol.downcase.delete('-')]
          auto_rescue = symbol.downcase.delete('-')
          # Add more rules here
        end

        # Record
        unless rehearsal
          BioTCM.logger.warn('HGNC') { "Unrecognized symbol \"#{symbol}\", \"#{auto_rescue}\" used instead" }
          @rescue_history[symbol] = auto_rescue
        end

        return auto_rescue
      when :manual
        # Try automatic rescue first
        if (auto_rescue = rescue_symbol(symbol, :auto, true)) != ''
          print "\"#{symbol}\" unrecognized. Use \"#{auto_rescue}\" instead? [Yn] "
          unless gets.chomp == 'n'
            @rescue_history[symbol] = auto_rescue unless rehearsal # rubocop:disable Metrics/BlockNesting
            return auto_rescue
          end
        end

        # Manually rescue
        loop do
          print "Please correct \"#{symbol}\" or press enter directly to return empty String instead:\n"
          unless (manual_rescue = gets.chomp) == '' || @symbol2hgncid[manual_rescue]
            puts "Failed to recognize \"#{manual_rescue}\""
            next
          end
          unless rehearsal
            @rescue_history[symbol] = manual_rescue
            File.open(@rescue_history_filepath, 'a').print(symbol, "\t", manual_rescue, "\n")
          end
          return manual_rescue
        end
      end
    end
def rescue_symbol(symbol, method = @rescue_method, rehearsal = false)
      return @rescue_history[symbol] if @rescue_history[symbol]

      case method
      when :auto
        auto_rescue = ''

        if @symbol2hgncid[symbol.upcase]
          auto_rescue = symbol.upcase
        elsif @symbol2hgncid[symbol.downcase]
          auto_rescue = symbol.downcase
        elsif @symbol2hgncid[symbol.delete('-')]
          auto_rescue = symbol.delete('-')
        elsif @symbol2hgncid[symbol.upcase.delete('-')]
          auto_rescue = symbol.upcase.delete('-')
        elsif @symbol2hgncid[symbol.downcase.delete('-')]
          auto_rescue = symbol.downcase.delete('-')
          # Add more rules here
        end

        # Record
        unless rehearsal
          BioTCM.logger.warn('HGNC') { "Unrecognized symbol \"#{symbol}\", \"#{auto_rescue}\" used instead" }
          @rescue_history[symbol] = auto_rescue
        end

        return auto_rescue
      when :manual
        # Try automatic rescue first
        if (auto_rescue = rescue_symbol(symbol, :auto, true)) != ''
          print "\"#{symbol}\" unrecognized. Use \"#{auto_rescue}\" instead? [Yn] "
          unless gets.chomp == 'n'
            @rescue_history[symbol] = auto_rescue unless rehearsal # rubocop:disable Metrics/BlockNesting
            return auto_rescue
          end
        end

        # Manually rescue
        loop do
          print "Please correct \"#{symbol}\" or press enter directly to return empty String instead:\n"
          unless (manual_rescue = gets.chomp) == '' || @symbol2hgncid[manual_rescue]
            puts "Failed to recognize \"#{manual_rescue}\""
            next
          end
          unless rehearsal
            @rescue_history[symbol] = manual_rescue
            File.open(@rescue_history_filepath, 'a').print(symbol, "\t", manual_rescue, "\n")
          end
          return manual_rescue
        end
      end
    end
Try to rescue a gene symbol
 @param symbol [String] Gene symbol
 @param method [Symbol] :auto or :manual
 @param rehearsal [Boolean] When set to true, neither outputing warnings nor modifying rescue history
 @return [String] "" if rescue failed