src/genome.js
function (where) {
        if (where !== undefined) {
            if (where.gene !== undefined) {
                get_gene(where);
                return;
            } else {
                if (where.species === undefined) {
                    where.species = genome_browser.species();
                } else {
                    genome_browser.species(where.species);
                }
                if (where.chr === undefined) {
                    where.chr = genome_browser.chr();
                } else {
                    genome_browser.chr(where.chr);
                }
                if (where.from === undefined) {
                    where.from = genome_browser.from();
                } else {
                    genome_browser.from(where.from);
                }
                if (where.to === undefined) {
                    where.to = genome_browser.to();
                } else {
                    genome_browser.to(where.to);
                }
            }
        } else { // "where" is undef so look for gene or loc
            if (genome_browser.gene() !== undefined) {
                get_gene({ species : genome_browser.species(),
                    gene    : genome_browser.gene()
                });
                return;
            } else {
                where = {};
                where.species = genome_browser.species();
                where.chr     = genome_browser.chr();
                where.from    = genome_browser.from();
                where.to      = genome_browser.to();
            }
        }

        // Min is 0 by default or use the provided promise
        conf.min_coord
            .then (function (min) {
                genome_browser.min(min);
                if (!conf.max_coord) {
                    var url = ensembl_rest.url()
                        .endpoint("info/assembly/:species/:region_name")
                        .parameters({
                            species: where.species,
                            region_name: where.chr
                        });

                    conf.max_coord = ensembl_rest.call (url)
                        .then (function (resp) {
                            return resp.body.length;
                        });
                }
                return conf.max_coord;
            })
            .then (function (max) {
                genome_browser.max(max);
                genome_browser._start();

            });
    }
function (where) {
        if (where !== undefined) {
            if (where.gene !== undefined) {
                get_gene(where);
                return;
            } else {
                if (where.species === undefined) {
                    where.species = genome_browser.species();
                } else {
                    genome_browser.species(where.species);
                }
                if (where.chr === undefined) {
                    where.chr = genome_browser.chr();
                } else {
                    genome_browser.chr(where.chr);
                }
                if (where.from === undefined) {
                    where.from = genome_browser.from();
                } else {
                    genome_browser.from(where.from);
                }
                if (where.to === undefined) {
                    where.to = genome_browser.to();
                } else {
                    genome_browser.to(where.to);
                }
            }
        } else { // "where" is undef so look for gene or loc
            if (genome_browser.gene() !== undefined) {
                get_gene({ species : genome_browser.species(),
                    gene    : genome_browser.gene()
                });
                return;
            } else {
                where = {};
                where.species = genome_browser.species();
                where.chr     = genome_browser.chr();
                where.from    = genome_browser.from();
                where.to      = genome_browser.to();
            }
        }

        // Min is 0 by default or use the provided promise
        conf.min_coord
            .then (function (min) {
                genome_browser.min(min);
                if (!conf.max_coord) {
                    var url = ensembl_rest.url()
                        .endpoint("info/assembly/:species/:region_name")
                        .parameters({
                            species: where.species,
                            region_name: where.chr
                        });

                    conf.max_coord = ensembl_rest.call (url)
                        .then (function (resp) {
                            return resp.body.length;
                        });
                }
                return conf.max_coord;
            })
            .then (function (max) {
                genome_browser.max(max);
                genome_browser._start();

            });
    }
function ( where ) { if ( where !== undefined ) { if ( where . gene !== undefined ) { get_gene ( where ) ; return ; } else { if ( where . species === undefined ) { where . species = genome_browser . species ( ) ; } else { genome_browser . species ( where . species ) ; } if ( where . chr === undefined ) { where . chr = genome_browser . chr ( ) ; } else { genome_browser . chr ( where . chr ) ; } if ( where . from === undefined ) { where . from = genome_browser . from ( ) ; } else { genome_browser . from ( where . from ) ; } if ( where . to === undefined ) { where . to = genome_browser . to ( ) ; } else { genome_browser . to ( where . to ) ; } } } else { // "where" is undef so look for gene or loc if ( genome_browser . gene ( ) !== undefined ) { get_gene ( { species : genome_browser . species ( ) , gene : genome_browser . gene ( ) } ) ; return ; } else { where = { } ; where . species = genome_browser . species ( ) ; where . chr = genome_browser . chr ( ) ; where . from = genome_browser . from ( ) ; where . to = genome_browser . to ( ) ; } } // Min is 0 by default or use the provided promise conf . min_coord . then ( function ( min ) { genome_browser . min ( min ) ; if ( ! conf . max_coord ) { var url = ensembl_rest . url ( ) . endpoint ( "info/assembly/:species/:region_name" ) . parameters ( { species : where . species , region_name : where . chr } ) ; conf . max_coord = ensembl_rest . call ( url ) . then ( function ( resp ) { return resp . body . length ; } ) ; } return conf . max_coord ; } ) . then ( function ( max ) { genome_browser . max ( max ) ; genome_browser . _start ( ) ; } ) ; }
We hijack parent's start method
We hijack parent s start method