Example Config (Download) - defined in data/config/example.config.js
var exampleConfig =
# Examples
Example | Species | Size (bp) | Description
-------------------------------------|--------------------------| --------: |-------------------------------------------
[Plasmid](example-plasmid.html) | _Escherichia coli B171_ | 90,229 | Map of a bacterial plasmid
[Mitochondrion](example-mito.html) | _Reclinomonas americana_ | 69,034 | Map of a mitochondrial genome
[Small Bacterium](example-small.html) | _Mycoplasma genitalium_ | 580,076 | Map of a small bacterial genome
[Average Bacterium](example-average.html) | _Clostridium botulinum_ | 3,858,511 | Map of a average bacterial genome
[Contigs](example-contigs.html) | _Escherichia coli PA2_ | 5,246,924 | Map of bacterial genome with 109 contigs
[Large Bacterium](example-large.html) | _Lentzea guizhouensis_ | 9,997,872 | Map of a large bacterial genome
## How Examples were Created
All the examples were created with
[CGParse.js](https://github.com/sciguy/cgview-parse) (see the
[CGParse.js tutorial](../tutorials/tutorial-cgparse.html) for details).
Each example is created using the following function.
Where `path` is the path to the GenBank file and config is a JSON object
containing the configuration for the map (shown below).
```js
function createViewerAndLoadGenBank(path, config={}) {
// Create Viewer in default div: #my-viewer
const cgv = new CGView.Viewer('#my-viewer', {height: 500});
// Auto resize viewer
autoResizeMyViewer();
// Add viewer as global variable 'cgv'
window.cgv = cgv;
// Request data and draw map
var request = new XMLHttpRequest();
request.open('GET', path, true);
request.onload = function() {
// Get the GenBank file text
var genbank = request.response;
// Parse a file
var builder = new CGParse.CGViewBuilder(genbank, {
config: config,
// Recommended settings for parsing bacterial genomes
excludeFeatures: ['source', 'gene', 'exon'],
excludeQualifiers: ['translation'],
});
// Load the JSON into CGView.js
cgv.io.loadJSON(builder.toJSON());
// Draw the map
cgv.draw()
};
request.send();
}
```