-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script to auto-extract reference sequences
- Loading branch information
1 parent
958bb44
commit 00c6c51
Showing
6 changed files
with
28 additions
and
0 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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
package-lock.json | ||
.vscode/* | ||
auto-generated/reference_sequences.fasta | ||
auto-generated/reference_accessions.txt |
Empty file.
Empty file.
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,26 @@ | ||
#! bash | ||
|
||
# Remove file in case it exists | ||
rm auto-generated/reference_accessions.txt | ||
|
||
# Extract reference sequence accessions | ||
for file in lineages/*.yml; do | ||
yq '.reference_sequences | .[].accession' $file >>auto-generated/reference_accessions.txt | ||
done | ||
|
||
# Error if there are duplicates | ||
|
||
if [ -n "$(sort auto-generated/reference_accessions.txt | uniq -cd)" ]; then | ||
echo "Duplicate accessions found" | ||
sort auto-generated/reference_accessions.txt | uniq -cd | ||
fi | ||
|
||
# Download and extract reference sequences | ||
curl -fsSL \ | ||
--compressed https://data.nextstrain.org/files/workflows/monkeypox/sequences.fasta.xz | | ||
xz -d | | ||
seqkit grep \ | ||
-f auto-generated/reference_accessions.txt \ | ||
-w0 \ | ||
--quiet \ | ||
>auto-generated/reference_sequences.fasta |
Empty file.
Empty file.