Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjusting canvas height based GenotypeTrack height #12

Open
wants to merge 145 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
145 commits
Select commit Hold shift + click to select a range
aecdb78
pass all tests
dorisjlee Jun 20, 2016
01d8da0
pass all tests
dorisjlee Jun 20, 2016
c69cfaf
ga4gh data source loaded in, compatible with mango, no error
dorisjlee Jun 25, 2016
cd5bb58
starting reference
akmorrow13 Jun 11, 2016
067a91c
continued reference implementation
akmorrow13 Jun 12, 2016
cad3e82
added test resources for ADAM alignments
akmorrow13 Jun 18, 2016
7efc3ba
modified alignment json for test
akmorrow13 Jun 20, 2016
17b1539
continue reference
akmorrow13 Jun 20, 2016
b1acf6a
tests passing for reference
akmorrow13 Jun 21, 2016
e8adaa4
reference through server now works
akmorrow13 Jun 22, 2016
47569d2
variants now work
akmorrow13 Jun 25, 2016
e9c6669
added key to remote request
akmorrow13 Jun 28, 2016
7779b0d
starting reference
akmorrow13 Jun 11, 2016
12941d5
continued reference implementation
akmorrow13 Jun 12, 2016
319f89b
added test resources for ADAM alignments
akmorrow13 Jun 18, 2016
3a43924
continue reference
akmorrow13 Jun 20, 2016
7ed786f
tests passing for reference
akmorrow13 Jun 21, 2016
0cf415b
reference through server now works
akmorrow13 Jun 22, 2016
b05ee06
variants now works
akmorrow13 Jun 25, 2016
aed7e2c
pileup can now display genotypes
akmorrow13 Jul 1, 2016
632e514
completed the genotype feature and variant class files
Jun 17, 2016
41d8f4c
Create the FeatureDataSource.js file and tweak Feature.js Variant.js …
Jun 17, 2016
1e49de4
Completed the FeatureDataSource.js file and also completed most of Fe…
Jun 19, 2016
6495add
Finished FeatureDataSouce along with FeatureEndpoint files to work wi…
Jun 25, 2016
9a76d27
completed the feature test file
Jun 28, 2016
8e12814
finished feature.js featuredatasource.js and featuredatasource-test.js
Jun 28, 2016
c3f141a
removed genotype.js and variant.js since they were incomplete
Jun 28, 2016
6115ad7
added featuredatasource to pileup.js file
Jun 28, 2016
7c468da
completed the genotype feature and variant class files
Jun 17, 2016
bf523da
Create the FeatureDataSource.js file and tweak Feature.js Variant.js …
Jun 17, 2016
60895b0
Completed the FeatureDataSource.js file and also completed most of Fe…
Jun 19, 2016
2a830cd
removed genotype.js and variant.js since they were incomplete
Jun 28, 2016
5d0183e
finished merge conflicts in RemoteRequestjs
Jun 28, 2016
ed30b9d
Started working on creating featuredatasource-test.js
Jun 29, 2016
c9eb738
completed generic feature visualization
akmorrow13 Jul 2, 2016
b9011d5
added check for negative values and restricted alignment fetch size
akmorrow13 Jul 4, 2016
021b34e
completed gene endpoint
akmorrow13 Jul 12, 2016
43aaca9
removed prepush hooks
akmorrow13 Aug 20, 2016
ee44f18
Passing more tests
akmorrow13 Aug 24, 2016
f794b81
merge in main pileup updates and modified RemoteRequest
akmorrow13 Aug 25, 2016
ad3c799
customized ALT REF colors for variants, greyed genotype
dorisjlee Jul 1, 2016
f65ebcd
fixed versions, shorted build time
akmorrow13 Oct 4, 2016
0c5c4a4
small formatting nits and removing double 'strict' statement
akmorrow13 Oct 5, 2016
c9ebcb5
fixed genotype samples and added unit tests
akmorrow13 Oct 5, 2016
24160ef
Removed alignment test file and renamed Alignment test suite
akmorrow13 Oct 5, 2016
3a7f4ab
fixed ReferenceDataSource and added new test file for genotypes
akmorrow13 Oct 5, 2016
4ab931d
Minor fixes for zooming in and out on alignments and coverage
akmorrow13 Oct 12, 2016
17fccfe
added coverage endpoint
akmorrow13 Jul 20, 2016
61ae00e
Modified CoverageDataSource to bin by region size
akmorrow13 Jul 21, 2016
ff4b4e9
continued coverage vis
akmorrow13 Aug 9, 2016
d031a9d
Finished coverage with Resolution cache. Thresholded view to length o…
akmorrow13 Oct 15, 2016
05bc089
Variant end tracking
Georgehe4 Oct 31, 2016
14d3f91
completed coverage tracks and binning
akmorrow13 Nov 2, 2016
7b6374e
Merge pull request #4 from Georgehe4/variant_end
akmorrow13 Dec 11, 2016
402716a
fixed reference offset visualization
akmorrow13 Dec 11, 2016
c9942e0
Merge pull request #5 from akmorrow13/reference
akmorrow13 Dec 11, 2016
2aa9fd7
added checks for null data return types
akmorrow13 Dec 19, 2016
387c526
Merge pull request #6 from akmorrow13/remove-null
akmorrow13 Dec 20, 2016
2752cde
added score visualization for features
akmorrow13 Jan 2, 2017
5c30157
added click and loading functionality for features
akmorrow13 Jan 3, 2017
5588ad5
updated features to view correctly and show info on click
akmorrow13 Jan 8, 2017
9c95ccf
Merge pull request #7 from akmorrow13/standardizeFeatures
akmorrow13 Jan 10, 2017
25aba86
added limit for visualizing large Feature areas
akmorrow13 Jan 10, 2017
cbe865f
Interval.isCoveredBy() fix for regions not overlapping first interval
akmorrow13 Jan 12, 2017
3619fd1
bump version up top 0.6.7
armish Jul 5, 2016
204a610
rename poorly-named parameter
ryan-williams Jul 8, 2016
8bcf6e1
handle non-compressed BigBed files
ryan-williams Jul 8, 2016
6fe5499
relax BigBed version number constraint
ryan-williams Jul 8, 2016
17cbc85
spacing nit
ryan-williams Jul 8, 2016
8dc1471
CR: add types, clean up test
ryan-williams Jul 11, 2016
e9ae61c
Resolve load alignment jump issues
Georgehe4 Sep 14, 2016
4a96140
bump version up to 0.6.8
armish Sep 14, 2016
8c253b7
pass all tests
dorisjlee Jun 20, 2016
d538c0b
pass all tests
dorisjlee Jun 20, 2016
42490f6
ga4gh data source loaded in, compatible with mango, no error
dorisjlee Jun 25, 2016
ecc9f9c
starting reference
akmorrow13 Jun 11, 2016
c8ecd61
continued reference implementation
akmorrow13 Jun 12, 2016
e79bcc9
added test resources for ADAM alignments
akmorrow13 Jun 18, 2016
5c785cc
modified alignment json for test
akmorrow13 Jun 20, 2016
9064616
continue reference
akmorrow13 Jun 20, 2016
786ce32
tests passing for reference
akmorrow13 Jun 21, 2016
dce8bf6
reference through server now works
akmorrow13 Jun 22, 2016
0749feb
variants now work
akmorrow13 Jun 25, 2016
c941979
added key to remote request
akmorrow13 Jun 28, 2016
db41cf6
starting reference
akmorrow13 Jun 11, 2016
a0c3b98
continued reference implementation
akmorrow13 Jun 12, 2016
6451fcf
added test resources for ADAM alignments
akmorrow13 Jun 18, 2016
0b9f695
continue reference
akmorrow13 Jun 20, 2016
da58069
tests passing for reference
akmorrow13 Jun 21, 2016
0ea1937
reference through server now works
akmorrow13 Jun 22, 2016
bc3b44d
variants now works
akmorrow13 Jun 25, 2016
a06afa0
pileup can now display genotypes
akmorrow13 Jul 1, 2016
aca18ad
completed the genotype feature and variant class files
Jun 17, 2016
ca7cd92
Create the FeatureDataSource.js file and tweak Feature.js Variant.js …
Jun 17, 2016
f22d9bc
Completed the FeatureDataSource.js file and also completed most of Fe…
Jun 19, 2016
c2c9eec
Finished FeatureDataSouce along with FeatureEndpoint files to work wi…
Jun 25, 2016
0a5a1ca
completed the feature test file
Jun 28, 2016
969474c
finished feature.js featuredatasource.js and featuredatasource-test.js
Jun 28, 2016
7b20ebb
removed genotype.js and variant.js since they were incomplete
Jun 28, 2016
4d1817d
added featuredatasource to pileup.js file
Jun 28, 2016
f223fb9
completed the genotype feature and variant class files
Jun 17, 2016
ad608aa
Create the FeatureDataSource.js file and tweak Feature.js Variant.js …
Jun 17, 2016
338485d
Completed the FeatureDataSource.js file and also completed most of Fe…
Jun 19, 2016
f352e54
removed genotype.js and variant.js since they were incomplete
Jun 28, 2016
c78c424
finished merge conflicts in RemoteRequestjs
Jun 28, 2016
7d9480b
Started working on creating featuredatasource-test.js
Jun 29, 2016
692041a
completed generic feature visualization
akmorrow13 Jul 2, 2016
c69c8a7
added check for negative values and restricted alignment fetch size
akmorrow13 Jul 4, 2016
bcd3f1f
completed gene endpoint
akmorrow13 Jul 12, 2016
c4b982b
removed prepush hooks
akmorrow13 Aug 20, 2016
abe0d75
Passing more tests
akmorrow13 Aug 24, 2016
561287b
merge in main pileup updates and modified RemoteRequest
akmorrow13 Aug 25, 2016
1e2c147
customized ALT REF colors for variants, greyed genotype
dorisjlee Jul 1, 2016
15a9c6c
fixed versions, shorted build time
akmorrow13 Oct 4, 2016
a0f5c4d
small formatting nits and removing double 'strict' statement
akmorrow13 Oct 5, 2016
28451b3
fixed genotype samples and added unit tests
akmorrow13 Oct 5, 2016
737ca19
Removed alignment test file and renamed Alignment test suite
akmorrow13 Oct 5, 2016
8370952
fixed ReferenceDataSource and added new test file for genotypes
akmorrow13 Oct 5, 2016
22e419a
Minor fixes for zooming in and out on alignments and coverage
akmorrow13 Oct 12, 2016
28c6ab6
added coverage endpoint
akmorrow13 Jul 20, 2016
1c2a87c
Modified CoverageDataSource to bin by region size
akmorrow13 Jul 21, 2016
0827a2c
continued coverage vis
akmorrow13 Aug 9, 2016
4e52fc1
Finished coverage with Resolution cache. Thresholded view to length o…
akmorrow13 Oct 15, 2016
094d2dc
completed coverage tracks and binning
akmorrow13 Nov 2, 2016
c590d81
Variant end tracking
Georgehe4 Oct 31, 2016
59ecee2
fixed reference offset visualization
akmorrow13 Dec 11, 2016
52125ba
added checks for null data return types
akmorrow13 Dec 19, 2016
16be4bf
added score visualization for features
akmorrow13 Jan 2, 2017
72cdf26
added click and loading functionality for features
akmorrow13 Jan 3, 2017
1ce9a31
updated features to view correctly and show info on click
akmorrow13 Jan 8, 2017
7f85cda
added limit for visualizing large Feature areas
akmorrow13 Jan 10, 2017
dfc2d98
fixed no data error for alignments and max rows for PileupTrack
akmorrow13 Jan 14, 2017
9b4c67f
Merge branch 'master' of https://github.com/akmorrow13/pileup.js
akmorrow13 Jan 14, 2017
13424cb
Merge pull request #8 from akmorrow13/alignments
akmorrow13 Jan 14, 2017
fa00377
Added loading sign for variants and fixed click functionality
akmorrow13 Jan 20, 2017
304d39a
Added resolution cache to variants. Fixed resolution cache to not req…
akmorrow13 Jan 23, 2017
0d93189
finished genotypes
akmorrow13 Jan 27, 2017
7930db0
Merge pull request #9 from akmorrow13/variant-fixes
akmorrow13 Jan 27, 2017
f184085
binning for features
akmorrow13 Jan 27, 2017
85c6ff1
Fixed error in coverage
akmorrow13 Jan 31, 2017
054cb35
Merge branch 'master' of https://github.com/hammerlab/pileup.js
akmorrow13 Feb 21, 2017
3172c3e
Removed unused imports, tests for FeatureDataSource and VariantDataSo…
akmorrow13 Feb 22, 2017
87434a0
Set transparency of feature based on score value
snaheth Mar 6, 2017
ba2ce8b
Merge pull request #11 from snaheth/master
akmorrow13 Mar 6, 2017
bad7201
Adjusting canvas height based GenotypeTrack height
snaheth Apr 11, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ coverage

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Examples folder
examples

# Dependency directory
# Commenting this out is preferred by some people, see
Expand All @@ -41,3 +44,12 @@ dist
# Generated files
src/lib
*.pyc
.idea/.name
.idea/compiler.xml
.idea/misc.xml
.idea/modules.xml
.idea/pileup.js.iml
.idea/vcs.xml
.idea/workspace.xml
.idea/copyright/profiles_settings.xml
.idea/dictionaries/akmorrow.xml
Binary file added .vscode/.browse.VC.db
Binary file not shown.
8 changes: 8 additions & 0 deletions examples/json/reference.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"region": {
"contig": "chrM",
"start": "0",
"stop": "500"
},
"sequence": "GTTAATGTAGCTTAATAACAAAGCAAAGCACTGAAAATGCTTAGATGGATAATTGTATCCCATAAACACAAAGGTTTGGTCCTGGCCTTATAATTAATTAGAGGTAAAATTACACATGCAAACCTCCATAGACCGGTGTAAAATCCCTTAAACATTTACTTAAAATTTAAGGAGAGGGTATCAAGCACATTAAAATAGCTTAAGACACCTTGCCTAGCCACACCCCCACGGGACTCAGCAGTGATAAATATTAAGCAATAAACGAAAGTTTGACTAAGTTATACCTCTTAGGGTTGGTAAATTTCGTGCCAGCCACCGCGGTCATACGATTAACCCAAACTAATTATCTTCGGCGTAAAACGTGTCAACTATAAATAAATAAATAGAATTAAAATCCAACTTATATGTGAAAATTCATTGTTAGGACCTAAACTCAATAACGAAAGTAATTCTAGTCATTTATAATACACGACAGCTAAGACCCAAACTGGGATTAGATA"
}
10 changes: 3 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"flow": "flow status",
"flow-check": "flow check",
"coverage": "./scripts/generate-coverage.sh",
"build": "./scripts/build.sh"
"build": "./scripts/build.sh",
"quick-build": "./scripts/quick-build.sh"
},
"author": "Dan Vanderkam",
"contributors": [
Expand All @@ -45,9 +46,6 @@
"url": "https://github.com/hammerlab/pileup.js/issues"
},
"homepage": "https://github.com/hammerlab/pileup.js",
"prepush": [
"lint"
],
"dependencies": {
"backbone": "1.1.2",
"d3": "^3.5.5",
Expand All @@ -59,8 +57,7 @@
"react": "^0.14.0",
"react-dom": "^0.14.0",
"shallow-equals": "0.0.0",
"underscore": "^1.7.0",
"memory-cache": "0.1.6"
"underscore": "^1.7.0"
},
"devDependencies": {
"arraybuffer-slice": "^0.1.2",
Expand All @@ -84,7 +81,6 @@
"number-to-locale-string": "^1.0.0",
"parse-data-uri": "^0.2.0",
"phantomjs": "1.9.17",
"prepush-hook": "^0.1.0",
"react-addons-test-utils": "^0.14.0",
"sinon": "^1.12.2",
"smash": "0.0.14",
Expand Down
2 changes: 1 addition & 1 deletion scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ trap finish EXIT
sleep 1

# Start the tests
mocha-phantomjs http://localhost:8081/src/test/runner.html "$@"
mocha-phantomjs http://localhost:8081/src/test/runner.html
9 changes: 5 additions & 4 deletions src/main/GA4GHAlignment.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@ class GA4GHAlignment /* implements Alignment */ {
// https://github.com/ga4gh/schemas/blob/v0.5.1/src/main/resources/avro/reads.avdl
constructor(alignment: Object) {
this.alignment = alignment;
this.pos = alignment.alignment.position.position;
this.ref = alignment.alignment.position.referenceName;
this.name = alignment.fragmentName;
// console.log(alignment)
this.pos = alignment.alignment.position.position;
this.ref = alignment.alignment.position.referenceName;
this.name = alignment.fragmentName;

this.cigarOps = alignment.alignment.cigar.map(
this.cigarOps = alignment.alignment.cigar.map(
({operation, operationLength: length}) => ({ op: OP_MAP[operation], length }));
this._interval = new ContigInterval(this.ref,
this.pos,
Expand Down
80 changes: 48 additions & 32 deletions src/main/RemoteRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,71 +9,82 @@
import Q from 'q';
import ContigInterval from './ContigInterval';

var BASE_PAIRS_PER_FETCH = 1000;
var MONSTER_REQUEST = 5000000;

class RemoteRequest {
url: string;
cache: Object;
basePairsPerFetch: number;
numNetworkRequests: number; // track this for debugging/testing

constructor(url: string) {
this.cache = require('memory-cache');
constructor(url: string, basePairsPerFetch?: number) {
this.url = url;
if (!basePairsPerFetch)
this.basePairsPerFetch = BASE_PAIRS_PER_FETCH;
else
this.basePairsPerFetch = basePairsPerFetch;
this.numNetworkRequests = 0;
}

get(contig: string, start: number, stop: number): Q.Promise<Object> {
var length = stop - start;
expandRange(range: ContigInterval<string>): ContigInterval<string> {
var roundDown = x => x - x % this.basePairsPerFetch;
var newStart = Math.max(1, roundDown(range.start())),
newStop = roundDown(range.stop() + this.basePairsPerFetch - 1);

return new ContigInterval(range.contig, newStart, newStop);
}

getFeaturesInRange(range: ContigInterval<string>, modifier: string = ""): Q.Promise<Object> {
var expandedRange = this.expandRange(range);
return this.get(expandedRange, modifier);
}

get(range: ContigInterval<string>, modifier: string = ""): Q.Promise<Object> {

var length = range.stop() - range.start();
if (length <= 0) {
return Q.reject(`Requested <0 interval (${length}) from ${this.url}`);
} else if (length > MONSTER_REQUEST) {
throw `Monster request: Won't fetch ${length} sized ranges from ${this.url}`;
}

// First check the cache.
var contigInterval = new ContigInterval(contig, start, stop);
var buf = this.cache.get(contigInterval);
if (buf) {
return Q.when(buf);
}

// Need to fetch from the network.
return this.getFromNetwork(contig, start, stop);
// get endpoint
var endpoint = this.getEndpointFromContig(range.contig, range.start(), range.stop(), modifier);
// Fetch from the network
return this.getFromNetwork(endpoint);
}

/**
* Request must be of form "url/contig?start=start&end=stop"
*/
getFromNetwork(contig: string, start: number, stop: number): Q.Promise<Object> {
var length = stop - start;
if (length > 5000000) {
throw `Monster request: Won't fetch ${length} sized ranges from ${this.url}`;
}
getFromNetwork(endpoint: string): Q.Promise<Object> {
var xhr = new XMLHttpRequest();
var endpoint = this.getEndpointFromContig(contig, start, stop);
xhr.open('GET', endpoint);
xhr.responseType = 'json';
xhr.setRequestHeader('Content-Type', 'application/json');

return this.promiseXHR(xhr).then(json => {
// extract response from promise
var buffer = json[0];
var contigInterval = new ContigInterval(contig, start, stop);
this.cache.put(contigInterval, buffer);
return buffer;
return this.promiseXHR(xhr).then(e => {
// send back response and status
return e[0];
});
}

getEndpointFromContig(contig: string, start: number, stop: number): string {
return `${this.url}/${contig}?start=${start}&end=${stop}`;
getEndpointFromContig(contig: string, start: number, stop: number, modifier: string = ""): string {
if (modifier.length < 1)
return `${this.url}/${contig}?start=${start}&end=${stop}`;
else
return `${this.url}/${contig}?start=${start}&end=${stop}&${modifier}`;
}

// Wrapper to convert XHRs to Promises.
// The promised values are the response (e.g. an ArrayBuffer) and the Event.
promiseXHR(xhr: XMLHttpRequest): Q.Promise<[any, Event]> {
promiseXHR(xhr: XMLHttpRequest): Q.Promise<[any]> {
var url = this.url;
var deferred = Q.defer();
xhr.addEventListener('load', function(e) {
if (this.status >= 400) {
deferred.reject(`Request for ${url} failed with status: ${this.status} ${this.statusText}`);
} else {
deferred.resolve([this.response, e]);
deferred.resolve([this]);
}
});
xhr.addEventListener('error', function(e) {
Expand All @@ -85,4 +96,9 @@ class RemoteRequest {
}
}

module.exports = RemoteRequest;
module.exports = {
RemoteRequest,
MONSTER_REQUEST: MONSTER_REQUEST
};

//module.exports = RemoteRequest;
Loading