class VariantTrack extends FeatureTrack {

    constructor(args) {
        super(args);

        this.DEFAULT_EXCLUDE = "studies,annotation";

        // set user args
        Object.assign(this, args);

        // init dataAdapter and renderer
        this.histogramRenderer = new HistogramRenderer(args);
        this._init();

        this.resource = this.dataAdapter.resource;
        this.species = this.dataAdapter.species;
    }

    _init() {
        // Set OpenCGA adapter as default. OpenCGA Client constructor(client, category, subcategory, resource, params = {}, options = {}, handlers = {}) {
        if (typeof this.dataAdapter === "undefined" || this.dataAdapter === null) {
            if (typeof this.opencga !== "undefined" && this.opencga !== null) {
                let opencgaClientConfig = new OpenCGAClientConfig(this.opencga.host, this.opencga.version);
                // opencgaConfig.cache.active = false;
                this.dataAdapter = new OpencgaAdapter(new OpenCGAClient(opencgaClientConfig), "analysis/variant", "", "query", {
                    studies: this.opencga.studies,
                    exclude: this.DEFAULT_EXCLUDE
                }, {
                    chunkSize: 20000
                });

                if (typeof this.opencga.samples !== "undefined" && this.opencga.samples !== null) {
                    this.dataAdapter.params.exclude = "studies.files,studies.stats,annotation";
                    this.dataAdapter.params.returnedSamples = this.opencga.samples;
                }
            } else {
                console.error("No 'dataAdapter' or 'opencga' object provided");
            }
        }

        // Set FeatureRenderer as default
        if (typeof this.renderer === "undefined" || this.renderer === null) {
            // this.renderer = new VariantRenderer(FEATURE_TYPES.variant);
            if (typeof this.opencga.samples === "undefined" || this.opencga.samples === null) {
                this.renderer = new FeatureRenderer(FEATURE_TYPES.variant);
            } else {
                FEATURE_TYPES.variant.sampleNames = this.opencga.samples;
                this.renderer = new VariantRenderer(FEATURE_TYPES.variant);
            }
        }
        this.renderer.track = this;

        // Check if samples are provided, we need to configure  the right Renderer
        // if (typeof this.samples !== "undefined" && this.samples !== null) {
        //     // this.renderer.mode = "compact".....
        //     this.exclude = "studies.files,studies.stats,annotation";
        //     this.dataAdapter.params.exclude = "studies.files,studies.stats,annotation";
        //     // this.dataAdapter.params.returnedSamples = "HG00096,HG00097,HG00099";
        //     this.dataAdapter.params.returnedSamples = this.samples.names["reference_grch37:1kG_phase3"];
        //
        //
        //     // let opencgaConfig = new OpenCGAClientConfig(this.opencga.host, this.opencga.version);
        //     // this.dataAdapter = new OpencgaAdapter(new OpenCGAClient(opencgaConfig), "analysis/variant", "", "query", {
        //     //     studies: this.opencga.studies,
        //     //     exclude: "studies.files,studies.stats,annotation",
        //     //     outputSamples: "HG00096,HG00097,HG00099"
        //     // }, {
        //     //     chunkSize: 100000
        //     // });
        //
        //     FEATURE_TYPES.variant.sampleNames = this.samples.names;
        //     this.renderer = new VariantRenderer(FEATURE_TYPES.variant);
        //     this.renderer.track = this;
        // }
    }

    initializeDom(targetId) {
        //TODO Create a button for configuration
        this._initializeDom(targetId);

        this.main = SVG.addChild(this.contentDiv, "svg", {
            "class": "trackSvg",
            "x": 0,
            "y": 0,
            "width": this.width
        });

        this.svgCanvasFeatures = SVG.addChild(this.main, "svg", {
            "class": "features",
            "x": -this.pixelPosition,
            "width": this.svgCanvasWidth
        });

        this.updateHeight();
        this.renderer.init();
    }

}

@@ -1226,32 +1226,48 @@
             %7D);%0A
+                
 %0A               
@@ -1339,32 +1339,69 @@
 samples !== null
+ && this.opencga.samples.length !== 0
 ) %7B%0A            
@@ -1991,32 +1991,69 @@
 samples === null
+ %7C%7C this.opencga.samples.length === 0
 ) %7B%0A            

check samples array is not empty to properly configure renderer