Skip to content

Commit

Permalink
- adding bit-get-test-data program
Browse files Browse the repository at this point in the history
- removed the deprecated bit-median-ratio-norm, as that is encompassed in bit-normalize-table
- removed the stub-bit-GTDB-tax-to-NCBI-tax as that type of path is no longer needed, it is probably better to do a different quick taxonomy assignment method to NCBI, like with sourmash or other
  • Loading branch information
AstrobioMike committed May 4, 2024
1 parent e37af9a commit bfa19de
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 269 deletions.
91 changes: 91 additions & 0 deletions bit/bit-get-test-data
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#!/usr/bin/env python

"""
This is a program for downloading test data files.
"""

import sys
import os
import argparse
import textwrap

parser = argparse.ArgumentParser(description = "This is a helper program for downloading test data for use with bit workflows and programs. For bit verison info run `bit-version`. ",
epilog="Ex. usage: bit-get-test-data metagenomics\n")

required = parser.add_argument_group('required arguments')

required.add_argument('datatype', choices = ['metagenomics'],
help = "The first positional argument should be what type of test data you'd like to download")

if len(sys.argv)==1:
parser.print_help(sys.stderr)
sys.exit(0)

args = parser.parse_args()


################################################################################

def main():

dl_test_data()

################################################################################

### variables and functions ###

tty_colors = {
'green' : '\033[0;32m%s\033[0m',
'yellow' : '\033[0;33m%s\033[0m',
'red' : '\033[0;31m%s\033[0m'
}

def color_text(text, color='green'):
if sys.stdout.isatty():
return tty_colors[color] % text
else:
return text


def wprint(text):
print(textwrap.fill(text, width=80, initial_indent=" ",
subsequent_indent=" ", break_on_hyphens=False))


def report_message(message, color = "yellow"):
print("")
wprint(color_text(message, color))


def dl_test_data():

""" main function for downloading test data """

if args.datatype == "metagenomics":

report_message("Downloading and unpacking 2 paired-end Illumina metagenomics test samples (4 files, ~800 MB total; they are kinda large for test data so MAGs can be recovered):")
print("")

# getting the metagenomics test data
os.system("curl -L -o test-metagenomics-reads.zip https://figshare.com/ndownloader/files/46096083")

# extracting
os.system("unzip -qo test-metagenomics-reads.zip")

# removing archive
os.system("rm test-metagenomics-reads.zip")

report_message("Pulled metagenomics (Illumina) reads for two test samples from here:", "green")
print(" https://figshare.com/account/projects/203736/articles/25750935\n")

else:

report_message("The data type you requested is not currently available.", "red")

print("\n Please check the currently available data types with 'bit-get-test-data --help'\n")


################################################################################

if __name__ == "__main__":
main()
66 changes: 0 additions & 66 deletions bit/bit-median-ratio-norm

This file was deleted.

2 changes: 1 addition & 1 deletion bit/bit-version
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

version='1.9.0'
version='1.9.1'

GREEN='\033[0;32m'
NC='\033[0m'
Expand Down
202 changes: 0 additions & 202 deletions bit/stub-bit-GTDB-tax-to-NCBI-tax

This file was deleted.

0 comments on commit bfa19de

Please sign in to comment.