Skip to content

Commit

Permalink
fix(website): Correct download of multiple segments from the edit page (
Browse files Browse the repository at this point in the history
#2137)

* Remove additional `\n` and do not join segments using a separator=comma for multi-segmented sequences.

* Fix sequences box on edit page to show which sequences are aligned and which are unaligned.
  • Loading branch information
anna-parker authored Jun 11, 2024
1 parent 1e834c9 commit 7cd776a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions website/src/components/Edit/EditPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ function generateAndDownloadFastaFile(editedSequences: Row[], editedData: Sequen
const fileContent =
editedSequences.length === 1
? `>${accessionVersion}\n${editedSequences[0].value}`
: editedSequences.map((sequence) => `>${accessionVersion}_${sequence.key}\n${sequence.value}\n\n`).join();
: editedSequences.map((sequence) => `>${accessionVersion}_${sequence.key}\n${sequence.value}\n`).join('');

const blob = new Blob([fileContent], { type: 'text/plain' });
const url = URL.createObjectURL(blob);
Expand Down Expand Up @@ -338,8 +338,12 @@ const extractProcessedSequences = (editedData: SequenceEntryToEdit) => {
].flatMap(({ type, sequences }) =>
Object.entries(sequences).map(([sequenceName, sequence]) => {
let label = sequenceName;
if (label === 'main' && type !== 'gene') {
label = type === 'unaligned' ? 'Sequence' : 'Aligned';
if (type !== 'gene') {
if (label === 'main') {
label = type === 'unaligned' ? 'Sequence' : 'Aligned';
} else {
label = type === 'unaligned' ? `${sequenceName} (unaligned)` : `${sequenceName} (aligned)`;
}
}
return { label, sequence };
}),
Expand Down

0 comments on commit 7cd776a

Please sign in to comment.