Skip to content

Commit

Permalink
Merge pull request #41 from pirovc/dev
Browse files Browse the repository at this point in the history
genome_updater version 0.3.0
  • Loading branch information
pirovc authored Jan 21, 2022
2 parents 67a320e + f173a83 commit 941da48
Show file tree
Hide file tree
Showing 151 changed files with 57,563 additions and 393 deletions.
12 changes: 12 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[submodule "tests/libs/bats"]
path = tests/libs/bats
url = https://github.com/bats-core/bats-core.git
[submodule "tests/libs/bats-assert"]
path = tests/libs/bats-assert
url = https://github.com/bats-core/bats-assert.git
[submodule "tests/libs/bats-file"]
path = tests/libs/bats-file
url = https://github.com/bats-core/bats-file.git
[submodule "tests/libs/bats-support"]
path = tests/libs/bats-support
url = https://github.com/bats-core/bats-support.git
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
language: bash

before_install:
- sudo apt-get install parallel

script:
- tests/libs/bats/bin/bats tests/integration_offline.bats

notifications:
email: false
4 changes: 2 additions & 2 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2020 - Vitor C. Piro - http://github.com/pirovc
Copyright (c) 2022 - Vitor C. Piro - http://github.com/pirovc
All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
Expand All @@ -19,4 +19,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
THE SOFTWARE.
185 changes: 103 additions & 82 deletions README.md

Large diffs are not rendered by default.

489 changes: 311 additions & 178 deletions genome_updater.sh

Large diffs are not rendered by default.

7 changes: 0 additions & 7 deletions tests/.travis.yml

This file was deleted.

5 changes: 5 additions & 0 deletions tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# genome_updater tests

genome_updater uses the [bats](https://github.com/bats-core/bats-core) testing framework for Bash.

Use the `download_test_set.sh` to re-create a random set of offline files to test. Files will be downloaded to `files/genomes`.
2 changes: 0 additions & 2 deletions tests/assembly_summary_fungi_refseq_cg_err.txt

This file was deleted.

7 changes: 0 additions & 7 deletions tests/assembly_summary_fungi_refseq_cg_mod.txt

This file was deleted.

2 changes: 0 additions & 2 deletions tests/assembly_summary_na_url.txt

This file was deleted.

4 changes: 0 additions & 4 deletions tests/assembly_summary_pseudomonas.txt

This file was deleted.

31 changes: 31 additions & 0 deletions tests/download_test_set.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

entries=20
outfld="files/"
mkdir -p ${outfld}
ext="assembly_report.txt" #,protein.faa.gz"
db="refseq,genbank"
og="archaea,fungi"

og="default,${og}"
for d in ${db//,/ }
do
for o in ${og//,/ }
do
if [[ ${o} == "default" ]]; then
mkdir -p "${outfld}genomes/${d}/"
wget --quiet --show-progress -O "full_assembly_summary.txt" "ftp://ftp.ncbi.nlm.nih.gov/genomes/${d}/assembly_summary_${d}.txt"
out_as="${outfld}genomes/${d}/assembly_summary_$d.txt"
else
mkdir -p "${outfld}genomes/${d}/${o}/"
wget --quiet --show-progress -O "full_assembly_summary.txt" "ftp://ftp.ncbi.nlm.nih.gov/genomes/${d}/${o}/assembly_summary.txt"
out_as="${outfld}genomes/${d}/${o}/assembly_summary.txt"
fi
head -n 2 "full_assembly_summary.txt" > "${out_as}"
tail -n+3 "full_assembly_summary.txt" | shuf | head -n ${entries} >> "${out_as}"
tail -n+3 "${out_as}" | cut -f 20 | sed 's/https:/ftp:/g' | xargs -P ${entries} wget --quiet --show-progress --directory-prefix="${outfld}" --recursive --level 2 --accept "${ext}"
cp -r "${outfld}ftp.ncbi.nlm.nih.gov/genomes/" "${outfld}"
rm -rf "full_assembly_summary.txt" "${outfld}ftp.ncbi.nlm.nih.gov/"
done
done

Loading

0 comments on commit 941da48

Please sign in to comment.