Skip to content

Commit

Permalink
V2.4.1 (#454)
Browse files Browse the repository at this point in the history
* Add grouping columns (and indices) to sequence-mtuation tables

* bump version

* Add omicron

* Fix capitalization in group label

* Add group aggregate download (#437)
  • Loading branch information
atc3 authored Nov 30, 2021
1 parent 7a578b4 commit f386107
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 8 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "covidcg",
"version": "2.4.0",
"version": "2.4.1",
"description": "",
"engines": {
"node": ">=8",
Expand Down Expand Up @@ -174,4 +174,4 @@
},
"globals": {}
}
}
}
4 changes: 4 additions & 0 deletions src/components/Sidebar/StatusBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const serializeCoordinates = (coordinateRanges) => {

const DOWNLOAD_OPTIONS = {
AGGREGATE_DATA: 'Aggregate Data',
GROUP_COUNTS: 'Group Counts',
CONSENSUS_MUTATIONS: 'Consensus Mutations',
SELECTED_SEQUENCE_METADATA: 'Sequence Metadata',
SELECTED_GENOMES: 'Selected Genomes',
Expand Down Expand Up @@ -64,6 +65,8 @@ const StatusBox = observer(() => {
const handleDownloadSelect = (option) => {
if (option === DOWNLOAD_OPTIONS.AGGREGATE_DATA) {
dataStore.downloadAggSequences();
} else if (option === DOWNLOAD_OPTIONS.GROUP_COUNTS) {
dataStore.downloadAggGroup();
} else if (option === DOWNLOAD_OPTIONS.CONSENSUS_MUTATIONS) {
showModal('downloadConsensusMutations');
} else if (option === DOWNLOAD_OPTIONS.SELECTED_SEQUENCE_METADATA) {
Expand Down Expand Up @@ -154,6 +157,7 @@ const StatusBox = observer(() => {

const downloadOptions = [
DOWNLOAD_OPTIONS.AGGREGATE_DATA,
DOWNLOAD_OPTIONS.GROUP_COUNTS,
DOWNLOAD_OPTIONS.CONSENSUS_MUTATIONS,
];
if (config.allow_metadata_download) {
Expand Down
4 changes: 2 additions & 2 deletions src/stores/configStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -420,9 +420,9 @@ export class ConfigStore {
return config.group_cols[groupKey].title;
} else if (groupKey === GROUP_MUTATION) {
if (dnaOrAa === DNA_OR_AA.DNA) {
return 'NT mutation';
return 'NT Mutation';
} else {
return 'AA mutation';
return 'AA Mutation';
}
}
}
Expand Down
24 changes: 24 additions & 0 deletions src/stores/dataStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,30 @@ export class DataStore {
downloadBlobURL(url, 'aggregate_sequences.csv');
}

downloadAggGroup() {
let csvString = `${rootStoreInstance.configStore.getGroupLabel()},count,percent\n`;
let intToMutationMap = rootStoreInstance.configStore.getIntToMutationMap();

this.groupCounts.forEach((row) => {
// Group
if (rootStoreInstance.configStore.groupKey === GROUP_MUTATION) {
csvString += `"${intToMutationMap[row.group_id].mutation_str}",`;
} else {
csvString += `"${row.group_id}",`;
}

// Counts
csvString += `${row.counts},`;
// Percent
csvString += `${row.counts / this.numSequencesAfterAllFiltering}\n`;
});

const blob = new Blob([csvString]);
const url = URL.createObjectURL(blob);

downloadBlobURL(url, `group_counts.csv`);
}

downloadAggGroupDate() {
// Write to a CSV string
let csvString = `collection_date,"${rootStoreInstance.configStore.getGroupLabel()}",count\n`;
Expand Down
2 changes: 1 addition & 1 deletion src/stores/groupDataStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { mutationHeatmapToPymolScript } from '../utils/pymol';

export const initialValues = {
activeGroupType: Object.keys(config['group_cols'])[0],
selectedGroups: ['AY.4', 'B.1.617.2', 'B.1.1.7', 'B.1.351', 'P.2'],
selectedGroups: ['B.1.1.529', 'AY.4', 'B.1.617.2', 'B.1.1.7', 'B.1.351', 'P.2'],
groupMutationType: 'protein_aa',
};

Expand Down
2 changes: 1 addition & 1 deletion src/utils/version.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const version = '2.4.0';
export const version = '2.4.1';

0 comments on commit f386107

Please sign in to comment.