Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
chfi committed Aug 2, 2019
2 parents 6ad0e65 + 6dd97d3 commit b233f0b
Show file tree
Hide file tree
Showing 27 changed files with 248,115 additions and 655 deletions.
10 changes: 8 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
/bower_components/
/node_modules/
/.pulp-cache/
/output/
/generated-docs/
/.psc-package/
/.psc*
/.purs*
/.psa*
/dist/app.js
/dist/data/
/.spago
/dist/*
/.cache
/build
25 changes: 17 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,26 +1,35 @@
BUILD = pulp $(FLAGS)
BUILD = spago $(FLAGS)

BUNDLE = $(BUILD) --psc-package browserify --skip-entry-point --no-check-main --standalone $(NAMESPACE) --main
NAMESPACE = GGB
BUNDLE = spago bundle-module -m $(MODULE) --to temp.js

PARCEL = parcel index.html

NAMESPACE = GenomeBrowser

OUT = ./dist/app.js
MODULE = Genetics.Browser.UI

.PHONY: $(OUT)
$(OUT): deps
$(BUNDLE) $(MODULE) --to $(OUT)
.PHONY: start
start: output
parcel index.html

build: $(OUT)
output:
spago build

.PHONY: build
build: output
parcel build -o index.js -d build index.js

.PHONY: test
test: deps
$(BUILD) test


.PHONY: clean
clean:
rm -rf ./output \
./node_modules \
./.psc-package \
./dist \
$(OUT)

npm = ./node_modules
Expand Down
33 changes: 11 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,26 @@ You need npm 5, as well as the Purescript compiler and build tools. The latter
can be installed with npm:

```shell
npm install -g purescript@"== 0.12.0" pulp psc-package
npm install -g purescript@"== 0.12.5" spago parcel

```

The browser can then be built using make, into the example folder at `./dist/app.js`:
The browser can be built for production using make, into `/dist/index.js`:

``` shell
make build
```

That produces `./dist/app.js`. Opening `./dist/index.html`
That produces `./dist/index.js`. Opening `./dist/index.html`
should now display the genome browser.

The output path can be changed with the OUT option:
`index.js` in the root folder can be changed to modify the way the
browser functions are exposed. By default, the PureScript module
`Genetics.Browser.UI` is bound to the global JS variable
`GenomeBrowser`.


``` shell
make OUT=otherdist/index.js build
```

Pass `FLAGS=-w` to `make` for rebuilding on source code change.

``` shell
make FLAGS=-w build
```

The output app.js file can be loaded into an HTML file, doing so exposes
the genome browser Track module at a global variable, `GGB` by default.


Unit tests and QuickCheck tests can be run with
```shell
make test
```
For development, start the parcel server with `make start` (or `parcel
index.html`), and compile the PureScript modules with either `spago
build`, start a spago build server with `spago build -w`, or start the
compiler using your IDE.
202 changes: 88 additions & 114 deletions dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,138 +3,112 @@
<html>
<head>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="style.css" rel="stylesheet" >
</head>
<link href="/style.e308ff8e.css" rel="stylesheet">
<script src="/style.e308ff8e.js"></script></head>
<body style="margin: 0">

<h1 style="font: bold normal 1.8em sans-serif; margin: 20px">Genetics Genome Browser</h1>
<!-- <h1 style="font: bold normal 1.8em sans-serif; margin: 20px">Genetics Genome Browser</h1> -->

<div id="info-line">
Powered by <a href="https://github.com/genenetwork/purescript-genetics-browser">genenetwork/purescript-genetics-browser</a>
</div>
<div id="browser">
<div id="controls">
<button id="scrollLeft" type="button" >
<button id="scrollLeft" type="button">
<i class="fas fa-arrow-left"></i>
</button>
<button id="scrollRight" type="button" >
<button id="scrollRight" type="button">
<i class="fas fa-arrow-right"></i>
</button>
<button id="zoomOut" type="button" >
<button id="zoomOut" type="button">
<i class="fas fa-search-minus"></i>
</button>
<button id="zoomIn" type="button" >
<button id="zoomIn" type="button">
<i class="fas fa-search-plus"></i>
</button>
<button id="reset" type="button" >Reset</button>
<button id="reset" type="button">Reset</button>
</div>
<div id="info-line">
Powered by <a href=https://github.com/chfi/purescript-genetics-browser>chfi/purescript-genetics-browser</a>
</div>
</div>

<script src="./app.js"></script>
<script>

var localUrls =
{ genes: "./data/mouse.json",
snps: "./data/gwas.json",
annotations: "./data/annotations.json"
};

var urlRoot = "https://raw.githubusercontent.com/chfi/genetics-browser-example/master/track/data/";

var githubUrls =
{ genes: urlRoot + "mouse.json",
snps: urlRoot + "gwas.json",
annotations: urlRoot + "annots_fake.json"
};


var vscaleWidth = 90.0;
var legendWidth = 140.0;

var score = { min: 0.0, max: 30.0, sig: 4 };

var gwasPadding = { top: 35.0,
bottom: 35.0,
left: vscaleWidth,
right: legendWidth };

var gwasHeight = 220.0;


var genePadding = { top: 10.0,
bottom: 35.0,
left: vscaleWidth,
right: legendWidth };

var geneHeight = 140.0;

var config =
{ trackHeight: 400.0,

padding: gwasPadding,

score: score,

urls: localUrls,

tracks: {
gwas: {
trackHeight: gwasHeight,
padding: gwasPadding,
snps: {
radius: 3.75,
lineWidth: 1.0,
color: { outline: "#FFFFFF",
fill: "#00008B" },
pixelOffset: {x: 0.0, y: 0.0}
},

annotations: {
radius: 5.5,
outline: "#000000",
snpColor: "#0074D9",
geneColor: "#FF4136"
},

score: score,

legend: {
fontSize: 14,
hPad: 0.2,
vPad: 0.2
},

vscale: {
color: "#000000",
hPad: 0.125,
numSteps: 3,
fonts: { labelSize: 18, scaleSize: 16 }
},



},

gene: {
trackHeight: geneHeight,
padding: genePadding
},

},

chrs: {
chrBG1: "#FFFFFF",
chrBG2: "#EEEEEE",
chrLabels: { fontSize: 16 },
},

initialChrs: { left: "1", right: "5" }
};

GGB.main(config)();

document.getElementById("controls").style.visibility = "visible";

</script>
<script src="/purescript-genetics-browser.e31bb0bc.js"></script>
<script>var localUrls = {
snps: "./gwas.json",
annotations: "./annotations.json"
};
var urlRoot = "https://raw.githubusercontent.com/chfi/genetics-browser-example/master/track/data/";
var githubUrls = {
snps: urlRoot + "gwas.json",
annotations: urlRoot + "annots_fake.json"
};
var vscaleWidth = 90.0;
var legendWidth = 140.0;
var score = {
min: 0.0,
max: 30.0,
sig: 4
};
var gwasPadding = {
top: 35.0,
bottom: 35.0,
left: vscaleWidth,
right: legendWidth
};
var gwasHeight = 320.0;
var config = {
score: score,
urls: localUrls,
tracks: {
gwas: {
trackHeight: gwasHeight,
padding: gwasPadding,
snps: {
radius: 3.75,
lineWidth: 1.0,
color: {
outline: "#FFFFFF",
fill: "#00008B"
},
pixelOffset: {
x: 0.0,
y: 0.0
}
},
annotations: {
radius: 5.5,
outline: "#000000",
snpColor: "#0074D9",
geneColor: "#FF4136"
},
score: score,
legend: {
fontSize: 14,
hPad: 0.2,
vPad: 0.2
},
vscale: {
color: "#000000",
hPad: 0.125,
numSteps: 3,
fonts: {
labelSize: 18,
scaleSize: 16
}
}
}
},
chrs: {
chrBG1: "#FFFFFF",
chrBG2: "#EEEEEE",
chrLabels: {
fontSize: 16
}
} // initialChrs: { left: "1", right: "5" }

};
GenomeBrowser.main(config)();
document.getElementById("controls").style.visibility = "visible";</script>
</body>
</html>
Loading

0 comments on commit b233f0b

Please sign in to comment.