draw(data, target, themeName = 'light', weights = null, infoOnly = false, highlight_atoms = [], weightsNormalized = false) {
    if (target === null || target === 'svg') {
      target = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
      target.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
      target.setAttribute('xmlns:xlink', 'http://www.w3.org/1999/xlink');
      target.setAttributeNS(null, 'width', this.opts.width);
      target.setAttributeNS(null, 'height', this.opts.height);
    } else if (target instanceof String) {
      target = document.getElementById(target);
    }

    let optionBackup = {
      padding: this.opts.padding,
      compactDrawing: this.opts.compactDrawing
    }; // Overwrite options when weights are added

    if (weights !== null) {
      this.opts.padding += this.opts.weights.additionalPadding;
      this.opts.compactDrawing = false;
    }

    let preprocessor = this.preprocessor;
    preprocessor.initDraw(data, themeName, infoOnly, highlight_atoms);

    if (!infoOnly) {
      this.themeManager = new ThemeManager(this.opts.themes, themeName);

      if (this.svgWrapper === null || this.clear) {
        this.svgWrapper = new SvgWrapper(this.themeManager, target, this.opts, this.clear);
      }
    }

    preprocessor.processGraph(); // Set the canvas to the appropriate size

    this.svgWrapper.determineDimensions(preprocessor.graph.vertices); // Do the actual drawing

    this.drawAtomHighlights(preprocessor.opts.debug);
    this.drawEdges(preprocessor.opts.debug);
    this.drawVertices(preprocessor.opts.debug);

    if (weights !== null) {
      this.drawWeights(weights, weightsNormalized);
    }

    if (preprocessor.opts.debug) {
      console.log(preprocessor.graph);
      console.log(preprocessor.rings);
      console.log(preprocessor.ringConnections);
    }

    this.svgWrapper.constructSvg(); // Reset options in case weights were added.

    if (weights !== null) {
      this.opts.padding = optionBackup.padding;
      this.opts.compactDrawing = optionBackup.padding;
    }

    return target;
  }
Draws the parsed smiles data to an svg element.

@param {Object} data The tree returned by the smiles parser.
@param {?(String|SVGElement)} target The id of the HTML svg element the structure is drawn to - or the element itself.
@param {String} themeName='dark' The name of the theme to use. Built-in themes are 'light' and 'dark'.
@param {Boolean} infoOnly=false Only output info on the molecule without drawing anything to the canvas.

@returns {SVGElement} The svg element