# Using CGViewBuilder
[CGViewBuilder](https://github.com/stothard-group/cgview-builder) is a ruby
script that converts a sequence file (e.g. GenBank, EMBL, FASTA) into JSON that
can be loaded into CGView.js.
This tutorial will create a map for the _Mycoplasma pneumoniae_ FH genome.
## Download CGViewBuilder
Download and install CGViewBuilder from [github](https://github.com/stothard-group/cgview-builder).
## Create JSON from a GenBank file
Download a GenBank file from NCBI.
- _Mycoplasma pneumoniae_ FH (NZ_CP010546) [[NCBI](https://www.ncbi.nlm.nih.gov/nuccore/NZ_CP010546.1),
Download]
Run CGViewBuilder to generate the CGView JSON from the GenBank file.
```bash
ruby cgview_builder_cli.rb \
--sequence NZ_CP010546.gbk \ # Input GenBank file
--outfile NZ_CP010546.json \ # Output CGView JSON
--config config_example.yaml # Optional config file
```
An optional config file can be provided to adjust the map ([config_example.yaml](../data/config/config_example.yaml))
JSON Output: [NZ_CP010546.json](../data/json/NZ_CP010546.json)
## Load JSON into CGView.js
See [JSON Map](tutorial-json.html) and [JSON Files](details-json-files.html) for more details on loading JSON files into CGview.js.
```js
// First create the viewer
cgv = new CGV.Viewer('#my-viewer', {
height: 500,
width: 500
});
```
```js
// Load the JSON file
var request = new XMLHttpRequest();
request.open('GET', '../data/json/NZ_CP010546.json', true);
request.onload = function() {
var response = request.response;
const json = JSON.parse(response);
cgv.io.loadJSON(json);
cgv.draw()
};
request.send();
```
## More Examples
See the CGView.js [examples](../examples/index.html) for more maps created by
CGViewBuilder. Each example, contains the original GenBank file, CGViewBuilder
config file and the resulting JSON file.
## Map
The resulting Viewer (id='my-viewer') is below. You can move the map around by clicking and dragging.
You can zoom, using your mouse scroll wheel. The Lenged colors can be changed by clicking on the swatches in the Legend.
If you want play around with the viewer object, open your browser web inspector. In the console, you can access the viewer as *cgv*.