Skip to content

Commit

Permalink
Merge pull request #785 from wurmlab/tt/fixes2
Browse files Browse the repository at this point in the history
Run all tests by defaults, Maintenance improvements
  • Loading branch information
tadast committed Aug 23, 2024
2 parents 2a7f73f + 5982e50 commit d8144fb
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@

- name: Run main specs and import spec for BLAST 2.9.0+
id: rspec_tests
run: bundle exec rspec spec/*_spec.rb spec/blast_versions/blast_2.9.0/*
run: bundle exec rspec spec
continue-on-error: true

- name: upload rspec coverage report
Expand Down
2 changes: 1 addition & 1 deletion public/css/app.min.css

Large diffs are not rendered by default.

39 changes: 29 additions & 10 deletions public/js/hits.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,40 @@ class Hits extends Component {
this.nextQuery = 0;
this.nextHit = 0;
this.nextHSP = 0;
this.maxHSPs = 3; // max HSPs to render in a cycle
this.maxHSPs = 10; // max HSPs to render in a cycle
this.state = props.state;
this.state.pluginResults = [];
this.prepareAlignmentOfSelectedHits = this.prepareAlignmentOfSelectedHits.bind(this);
}

componentDidMount() {
this.props.plugins.init(this.onPluginResultsFetched.bind(this));
this.componentDidUpdate(this.props, this.state);
}

onPluginResultsFetched(pluginResults) {
this.setState({ pluginResults: pluginResults });
}

replacePluginResults(pluginResults) {
if (!pluginResults) return;

const updatedResults = this.props.plugins.replacePluginResults(this.state.results, pluginResults);
this.setState({ results: updatedResults, pluginResults: pluginResults });
}

/**
* Called for the first time after as BLAST results have been retrieved from
* the server and added to this.state by fetchResults. Only summary overview
* and circos would have been rendered at this point. At this stage we kick
* start iteratively adding 1 HSP to the page every 25 milli-seconds.
*/
componentDidUpdate(prevProps, prevState) {
componentDidUpdate(_prevProps, prevState) {
// Log to console how long the last update take?
// console.log((Date.now() - this.lastTimeStamp) / 1000);

// Lock sidebar in its position on the first update.
if (this.nextQuery == 0 && this.nextHit == 0 && this.nextHSP == 0) {
if (this.isFirstUpdate()) {
this.affixSidebar();
}

Expand All @@ -49,7 +62,13 @@ class Hits extends Component {
this.props.componentFinishedUpdating();
}

this.props.plugins.componentDidUpdate(prevProps, prevState);
if (this.state.pluginResults.length > 0 && prevState.pluginResults.length == 0) {
this.replacePluginResults(this.state.pluginResults);
}
}

isFirstUpdate() {
return this.nextQuery == 0 && this.nextHit == 0 && this.nextHSP == 0;
}

/* eslint complexity: ["error", 6] */
Expand All @@ -74,15 +93,15 @@ class Hits extends Component {
var query = this.state.queries[this.nextQuery];

// We may see a query multiple times during rendering because only
// 3 hsps are rendered in each cycle, but we want to create the
// 10 hsps are rendered in each cycle, but we want to create the
// corresponding Query component only the first time we see it.
if (this.nextHit == 0 && this.nextHSP == 0) {
results.items.push(this.renderReportQuery(query));
results.items.push(...this.props.plugins.queryResults(query));
results.items.push(this.props.plugins.queryResult(query, this.state.pluginResults));
}

this.processHits(results, query);
this.itterateLoops(['nextQuery', 'nextHit'], query.hits.length);
this.iterateLoops(['nextQuery', 'nextHit'], query.hits.length);
if (results.numHSPsProcessed == this.maxHSPs) break;
}
}
Expand All @@ -91,12 +110,12 @@ class Hits extends Component {
while (this.nextHit < query.hits.length) {
var hit = query.hits[this.nextHit];
// We may see a hit multiple times during rendering because only
// 10 hsps are rendered in each cycle, but we want to create the
// 3 hsps are rendered in each cycle, but we want to create the
// corresponding Hit component only the first time we see it.
if (this.nextHSP == 0) results.items.push(this.renderHit(query, hit));

this.processHSPS(results, query, hit);
this.itterateLoops(['nextHit', 'nextHSP'], hit.hsps.length);
this.iterateLoops(['nextHit', 'nextHSP'], hit.hsps.length);
if (results.numHSPsProcessed == this.maxHSPs) break;
}
}
Expand All @@ -116,7 +135,7 @@ class Hits extends Component {
/*
* this function check if 2nd argument is reach end of it
*/
itterateLoops(args, length) {
iterateLoops(args, length) {
if (this[args[1]] != length) return;

this[args[0]]++;
Expand Down
8 changes: 3 additions & 5 deletions public/js/null_plugins/report_plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ class ReportPlugins {
this.parent = parent;
}

init() {
init(_callback) {
}

componentDidUpdate(_prevProps, _prevState) {
}

queryResults(_query) {
return [];
queryResult(_query) {
return null;
}

generateStats() {
Expand Down
1 change: 0 additions & 1 deletion public/js/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ class Report extends Component {
*/
componentDidMount() {
this.fetchResults();
this.plugins.init();
// This sets up an event handler which enables users to select text from
// hit header without collapsing the hit.
this.preventCollapseOnSelection();
Expand Down
2 changes: 1 addition & 1 deletion public/sequenceserver-report.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/sequenceserver-report.min.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions spec/features/search_and_results_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -404,12 +404,12 @@ def nucleotide_query
within('#Query_1_hit_1 .kablammo.grapher') do
page.click_on('SVG')
wait_for_download
expect(File.basename(downloaded_file)).to eq('Kablammo-Query_1-SI2_2_0_06267.svg')
expect(File.basename(downloaded_file)).to eq('Kablammo_query-1_Query_1_SI2_2_0_06267.svg')
clear_downloads

page.click_on('PNG')
wait_for_download
expect(File.basename(downloaded_file)).to eq('Kablammo-Query_1-SI2_2_0_06267.png')
expect(File.basename(downloaded_file)).to eq('Kablammo_query-1_Query_1_SI2_2_0_06267.png')
clear_downloads
end
end
Expand Down

0 comments on commit d8144fb

Please sign in to comment.