Skip to content

Commit

Permalink
Merge pull request #1492 from nextstrain/feat/mutations-relative-to-n…
Browse files Browse the repository at this point in the history
…ode-ext
  • Loading branch information
ivan-aksamentov authored Jun 28, 2024
2 parents 6c34eb5 + f5fcd80 commit ef5ca4a
Show file tree
Hide file tree
Showing 55 changed files with 1,540 additions and 514 deletions.
60 changes: 60 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,63 @@
## Nextclade 3.7.4

### Nextclade Web

### Upgrade Auspice to 2.55.0, add polyfills

This definitively resolves crash due to missing JavaScript polyfills, which occurred in Nextclade Web 3.7.2

## Nextclade 3.7.3

### Nextclade Web

### Fix crash on tree page in Nextclade Web

Temporarily downgrade Auspice from 2.55.0 to 2.54.3 to prevent the tree page in Nextclade Web from crashing. The definitive fix will follow.

## Nextclade 3.7.2

### General

### [fix] Avoid duplicate node names in the output Auspice JSON tree

When multiple query samples were to be placed onto the same node on the reference tree, sometimes multiple auxiliary nodes could be created having the same name. Node names are expected to be unique for Auspice visualization to work correctly, so when visualizing the tree Auspice have been renaming these nodes and emitting warnings into browsers' dev console.

In this version we pick unique names for the auxiliary nodes during placement, so that there are no more warnings. Users may observe changes in some of the node names when inspecting output Auspice JSON file. However, this unlikely to affect most users' work.

### Nextclade Web

### [fix] Ensure dataset "updated at" date is displayed in Nextclade Web

Since 3.7.0 Nextclade Web is not showing "updated at" date for any datasets. This has been fixed.

### [fix] Ensure frame shift and insertion markers in sequence views can also be toggled

Most markers can be toggled on or off on the sequence views in "Settings" page in Nextclade Web, however frame shifts and insertions could not be. We added the missing toggles.

### [fix] Correctly style details/summary component

The text in details/summary ("collapse", "spoiler") component (e.g. the list of SC2 lineages) overflowing and producing garbled text in dataset readmes and changelogs. This has been fixed.

### [dep] Update Auspice tree visualization to 2.55.0

Auspice tree visualization package has been updated from 2.53.0 to 2.55.0. See Auspice changelog [here](https://github.com/nextstrain/auspice/releases).

### Internal

### [infra] Fix feature-policy and permission-policy HTTP headers

The deprecated `feature-policy` header was removed entirely and `interest-cohort` entry was removed from the `permission-policy` header. Latest versions of web browsers should no longer emit warnings into console.

### [test] Test Nextclade CLI on more Linx distros

Additionally to the previous, we now test Nextclade CLI on the following newer Linux distributions:

- Amazon Linux 2.0.2024
- Debian 12
- Fedora 41
- Oracle Linux 8.9
- Ubuntu 24.04

## Nextclade 3.7.1

### Warn if reference sequence does not match root sequence of the tree
Expand Down
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ exclude = [

[workspace.package]
name = "nextclade"
version = "3.7.1"
version = "3.7.4"
description = "Alignment, mutation calling, phylogenetic placement, clade assignment and quality control checks for viral genetic sequences. Library module."
repository = "https://github.com/nextstrain/nextclade"
documentation = "https://docs.nextstrain.org/projects/nextclade/en/stable/"
Expand Down
19 changes: 16 additions & 3 deletions docker/dev
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,13 @@ if ! docker inspect --format '{{.Id}}' "${DOCKER_REPO}:${DOCKER_TARGET}-${DOCKER
"${DOCKER_REPO}:${DOCKER_TARGET}-${DOCKER_IMAGE_VERSION}"
)

parallel 'docker pull -q {} >/dev/null 2>&1 || true' ::: "${images[@]}"
function docker_image_maybe_pull() {
if [ -z "$(docker images -q "$1" 2> /dev/null)" ]; then
docker pull -q "$1" >/dev/null 2>&1 || true
fi
}
export -f docker_image_maybe_pull
parallel docker_image_maybe_pull ::: "${images[@]}"

${NICE} docker buildx build \
--file="docker/docker-dev.dockerfile" \
Expand Down Expand Up @@ -488,9 +494,16 @@ elif [ "${BUILD}" == "1" ]; then
elif [ "${SMOKE_TEST}" == "1" ]; then
COMMAND="./tests/run-smoke-tests 'cargo run -q --target-dir='${BUILD_DIR_REL}' ${RUST_TARGET} ${RELEASE} --bin=nextclade'"
elif [ "${WASM}" == "1" ]; then
COMMAND="bash -c \"set -euo pipefail && cd packages/nextclade-web && yarn install && yarn wasm-${RELEASE}\""
COMMAND=${COMMAND:=yarn install && yarn wasm-${RELEASE}}
COMMAND="bash -c \"set -euo pipefail && cd packages/nextclade-web && ${COMMAND}\""
elif [ "${WEB}" == "1" ]; then
PORTS="-p 3000:3000"
if [[ "${RELEASE}" == *"dev"* ]]; then
WEB_PORT_DEV=${WEB_PORT_DEV:-3000}
PORTS="-p ${WEB_PORT_DEV}:${WEB_PORT_DEV}"
else
WEB_PORT_PROD=${WEB_PORT_PROD:-8080}
PORTS="-p ${WEB_PORT_PROD}:${WEB_PORT_PROD}"
fi
COMMAND=${COMMAND:=yarn install && yarn ${RELEASE}}
COMMAND="bash -c \"set -euo pipefail && cd packages/nextclade-web && ${COMMAND}\""
elif [ "${TEST}" == "1" ]; then
Expand Down
6 changes: 4 additions & 2 deletions docker/docker-dev.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ RUN set -euxo pipefail >/dev/null \
--create-home \
--shell /bin/bash \
--gid ${GROUP} \
--groups "${SUDO_GROUP},${GROUP}" \
--groups ${SUDO_GROUP},${GROUP} \
--uid ${UID} \
${USER}; \
else \
Expand All @@ -145,7 +145,7 @@ RUN set -euxo pipefail >/dev/null \
--move-home \
--shell /bin/bash \
--gid ${GROUP} \
--groups "${SUDO_GROUP},${GROUP}" \
--groups ${SUDO_GROUP},${GROUP} \
--append \
--uid ${UID} \
--login "${USER}" \
Expand Down Expand Up @@ -316,6 +316,8 @@ ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER=x86_64-linux-musl-gcc
# Cross-compilation to WebAssembly
FROM base as cross-wasm32-unknown-unknown

USER 0

SHELL ["bash", "-euxo", "pipefail", "-c"]

RUN set -euxo pipefail >/dev/null \
Expand Down
22 changes: 6 additions & 16 deletions packages/nextclade-cli/src/cli/nextclade_ordered_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use nextclade::io::results_json::ResultsJsonWriter;
use nextclade::run::nextclade_wasm::AnalysisOutput;
use nextclade::run::params::NextcladeInputParams;
use nextclade::translate::translate_genes::Translation;
use nextclade::tree::tree::{AuspiceRefNode, CladeNodeAttrKeyDesc};
use nextclade::tree::tree::{AuspiceRefNodesDesc, CladeNodeAttrKeyDesc};
use nextclade::types::outputs::NextcladeOutputs;
use nextclade::utils::error::report_to_string;
use nextclade::utils::option::OptionMapRefFallible;
Expand All @@ -35,9 +35,9 @@ pub struct NextcladeOrderedWriter {
impl NextcladeOrderedWriter {
pub fn new(
gene_map: &GeneMap,
clade_node_attr_key_descs: &[CladeNodeAttrKeyDesc],
clade_node_attr_descs: &[CladeNodeAttrKeyDesc],
phenotype_attr_key_desc: &[PhenotypeAttrDesc],
ref_nodes: &[AuspiceRefNode],
ref_nodes: &AuspiceRefNodesDesc,
aa_motifs_keys: &[String],
csv_column_config: &CsvColumnConfig,
output_params: &NextcladeRunOutputArgs,
Expand All @@ -50,21 +50,11 @@ impl NextcladeOrderedWriter {
.map_ref_fallible(|output_translations| FastaPeptideWriter::new(gene_map, output_translations))?;

let output_json_writer = output_params.output_json.map_ref_fallible(|output_json| {
ResultsJsonWriter::new(
output_json,
clade_node_attr_key_descs,
phenotype_attr_key_desc,
ref_nodes,
)
ResultsJsonWriter::new(output_json, clade_node_attr_descs, phenotype_attr_key_desc, ref_nodes)
})?;

let output_ndjson_writer = output_params.output_ndjson.map_ref_fallible(NdjsonFileWriter::new)?;

let clade_node_attr_keys = clade_node_attr_key_descs
.iter()
.map(|desc| desc.name.clone())
.collect_vec();

let phenotype_attr_keys = phenotype_attr_key_desc
.iter()
.map(|desc| desc.name.clone())
Expand All @@ -74,7 +64,7 @@ impl NextcladeOrderedWriter {
NextcladeResultsCsvFileWriter::new(
output_csv,
b';',
&clade_node_attr_keys,
clade_node_attr_descs,
&phenotype_attr_keys,
ref_nodes,
aa_motifs_keys,
Expand All @@ -86,7 +76,7 @@ impl NextcladeOrderedWriter {
NextcladeResultsCsvFileWriter::new(
output_tsv,
b'\t',
&clade_node_attr_keys,
clade_node_attr_descs,
&phenotype_attr_keys,
ref_nodes,
aa_motifs_keys,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,23 @@
// Usage: Create an AWS Lambda@Edge function and attach it to "Viewer Response"
// event of a Cloudfront distribution

const FEATURE_POLICY = {
accelerometer: `'none'`,
camera: `'none'`,
geolocation: `'none'`,
gyroscope: `'none'`,
magnetometer: `'none'`,
microphone: `'none'`,
payment: `'none'`,
usb: `'none'`,
}

function generateFeaturePolicyHeader(featurePolicyObject) {
return Object.entries(featurePolicyObject)
.map(([policy, value]) => `${policy} ${value}`)
.join('; ')
}

const PERMISSIONS_POLICY = {
'accelerometer': '()',
'camera': '()',
'geolocation': '()',
'gyroscope': '()',
'magnetometer': '()',
'microphone': '()',
'payment': '()',
'usb': '()',
'interest-cohort': '()',
accelerometer: '()',
camera: '()',
geolocation: '()',
gyroscope: '()',
magnetometer: '()',
microphone: '()',
payment: '()',
usb: '()',
}

function generatePermissionsPolicyHeader(permissionsPolicyObject) {
return Object.entries(permissionsPolicyObject)
.map(([policy, value]) => `${policy}=${value}`)
.join(', ')
}

const NEW_HEADERS = {
'Content-Security-Policy':
"default-src 'self'; script-src 'self' 'unsafe-eval' plausible.io; style-src 'self' 'unsafe-inline'; img-src 'self' data: *.githubusercontent.com; connect-src *",
Expand All @@ -51,7 +34,6 @@ const NEW_HEADERS = {
'X-Download-Options': 'noopen',
'X-Frame-Options': 'SAMEORIGIN',
'X-XSS-Protection': '1; mode=block',
'Feature-Policy': generateFeaturePolicyHeader(FEATURE_POLICY),
'Permissions-Policy': generatePermissionsPolicyHeader(PERMISSIONS_POLICY),
}

Expand Down
4 changes: 2 additions & 2 deletions packages/nextclade-web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nextstrain/nextclade-web",
"version": "3.7.1",
"version": "3.7.4",
"description": "Clade assignment, mutation calling, and sequence quality checks",
"homepage": "https://clades.nextstrain.org",
"repository": {
Expand Down Expand Up @@ -90,7 +90,7 @@
"@hapi/accept": "6.0.3",
"@hapi/content": "6.0.0",
"animate.css": "4.1.1",
"auspice": "2.54.3",
"auspice": "2.55.0",
"autoprefixer": "10.4.5",
"awesomplete": "1.1.5",
"axios": "0.27.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,16 @@ export function ExportTabColumnConfig({ setActiveTabId }: { setActiveTabId(id: s
if (state === CheckboxState.Checked) {
const newState = enableAllCategories(config, true)
newState.includeDynamic = true
newState.includeCladeFounderMuts = true
newState.includeRelMuts = true
return newState
}
if (state === CheckboxState.Unchecked) {
const newState = enableAllCategories(config, false)
newState.individual = []
newState.includeDynamic = false
newState.includeCladeFounderMuts = false
newState.includeRelMuts = false
return newState
}
return config
Expand All @@ -80,6 +84,36 @@ export function ExportTabColumnConfig({ setActiveTabId }: { setActiveTabId(id: s
[allState, onAllChange, t],
)

const cladeFounderMutsColumnState = useMemo(
() => csvColumnConfig?.includeCladeFounderMuts ?? false,
[csvColumnConfig?.includeCladeFounderMuts],
)

const onCladeFounderMutsColumnStateChange = useCallback(() => {
setCsvColumnConfig((config) =>
config
? {
...config,
includeCladeFounderMuts: !config.includeCladeFounderMuts,
}
: undefined,
)
}, [setCsvColumnConfig])

const cladeFounderMuts = useMemo(
() => (
<FormGroup inline check>
<Label check>
<Input type="checkbox" checked={cladeFounderMutsColumnState} onChange={onCladeFounderMutsColumnStateChange} />
<TextWithHelp title={t('Mutations relative to the founder of the corresponding clade')}>
{t('Mutations relative to clade founder')}
</TextWithHelp>
</Label>
</FormGroup>
),
[cladeFounderMutsColumnState, onCladeFounderMutsColumnStateChange, t],
)

const relMutsColumnsState = useMemo(() => csvColumnConfig?.includeRelMuts ?? false, [csvColumnConfig?.includeRelMuts])

const onRelMutsColumnsStateChange = useCallback(() => {
Expand Down Expand Up @@ -140,6 +174,7 @@ export function ExportTabColumnConfig({ setActiveTabId }: { setActiveTabId(id: s
<Form>
<CategoryCard header={all} />
{categories}
<CategoryCard header={cladeFounderMuts} />
<CategoryCard header={relMuts} />
<CategoryCard header={dynamic} />
</Form>
Expand Down
Loading

0 comments on commit ef5ca4a

Please sign in to comment.