Skip to content

Commit

Permalink
Merge pull request #33 from vinisalazar/dev
Browse files Browse the repository at this point in the history
Merge v0.1.18
  • Loading branch information
vinisalazar authored Nov 6, 2020
2 parents 0fa737e + 9963544 commit ee154a5
Show file tree
Hide file tree
Showing 36 changed files with 103,864 additions and 104 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# BioProv
bioprov/db.json
bioprov/provstore_api.txt

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
18 changes: 10 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
### To-do
* Fix documentation issues [ ]
* Add subpackage docstrings [ ]
* Add subparsers for CLI commands [ ]
* Add support for ProvStore API (#23) [ ]
* Make File inherit from pathlib.Path [ ]
* Add Directories class to Files module [ ]
* Support globbing Directory outputs [ ]
* Make config.threads an integer to support manipulation [ ]
* Create methods for Sample and Project
* .describe []
* .iter_programs and .iter_files [ ]
* .write_paths_to_file and .copy_files_to_dir()
* .write_paths_to_file, .copy_files_to_dir(), .link_files_to_dir()

### v0.1.18
* Add support for ProvStore API (#23) [x]
* Add subparsers for CLI commands [x]
* Add Directories class to Files module [x]
* Support globbing Directory outputs [x]
* Increase test coverage [x]
* Added more example data [x]
* Make config.threads an integer to support operations [x]

### v0.1.17
* Add more database methods [x]
Expand Down
4 changes: 2 additions & 2 deletions bioprov/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
__license__ = "MIT"
__maintainer__ = "Vini Salazar"
__url__ = "https://github.com/vinisalazar/bioprov"
__version__ = "0.1.17"
__version__ = "0.1.18"


"""
Expand All @@ -12,7 +12,7 @@
"""

from .src.config import config, EnvProv, BioProvDB
from .src.files import File, SeqFile
from .src.files import File, SeqFile, Directory
from .src.main import (
Program,
PresetProgram,
Expand Down
2 changes: 1 addition & 1 deletion bioprov/bioprov
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ __author__ = "Vini Salazar"
__license__ = "MIT"
__maintainer__ = "Vini Salazar"
__url__ = "https://github.com/vinisalazar/bioprov"
__version__ = "0.1.17"
__version__ = "0.1.18"

"""
Executable that goes in $PATH. Code for the command-line is on the bioprov.py module.
Expand Down
73 changes: 60 additions & 13 deletions bioprov/bioprov.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
__license__ = "MIT"
__maintainer__ = "Vini Salazar"
__url__ = "https://github.com/vinisalazar/bioprov"
__version__ = "0.1.17"
__version__ = "0.1.18"

"""
BioProv command-line application. This module holds the main executable.
Expand All @@ -19,6 +19,7 @@
KaijuWorkflow,
)
from bioprov.utils import parser_help, dict_to_string
from pathlib import Path


def main(args=None):
Expand All @@ -39,6 +40,16 @@ def main(args=None):
commands.add_argument(
"--show_config", help="Show location of config file.", action="store_true"
)
commands.add_argument(
"--show_provstore",
help="Show location of ProvStore credentials file.",
action="store_true",
)
commands.add_argument(
"--create_provstore",
help="Create ProvStore file credentials file.",
action="store_true",
)
commands.add_argument(
"--show_db", help="Show location of database file.", action="store_true"
)
Expand Down Expand Up @@ -69,42 +80,78 @@ def main(args=None):
else:
args = bioprov_parser.parse_args() # no cover

# TODO: Must improve this if/else loop. Use a dictionary.
if args.show_config:
for command, value in args.__dict__.items():
if value:
try:
getattr(CommandOptionsParser, command)()
except AttributeError:
pass
parser = WorkflowOptionsParser() # no cover
try:
parser.parse_options(args) # no cover
except KeyError:
parser_help(bioprov_parser)


class CommandOptionsParser:
def __init__(self):
pass

@classmethod
def show_config(cls):
print(
"This is the location of the config module.\n"
"Edit it to alter your BioProv settings.\n\n",
f"'{bp_config_module.__file__}'\n",
)
print("These are your configuration settings:")
print(dict_to_string(config.__dict__))
print(dict_to_string(config.serializer()))

sys.exit(0)

@classmethod
def show_provstore(cls):
print(
"This is the location of your ProvStore credentials file.\n"
"Edit it to alter your BioProv settings.\n\n",
f"{config.provstore_file}\n",
)
if not Path(config.provstore_file).is_file():
print("It does not exist, but you can create one with the command:")
print(" $ bioprov --create_provstore")

sys.exit(0)

elif args.show_db:
@classmethod
def create_provstore(cls): # no cover
config.create_provstore_file()
sys.exit(0)

@classmethod
def show_db(cls):
print(
"This is the location of your BioProv database file.\n"
f"'{config.db_path}'\n",
)
sys.exit(0)

elif args.version:
@classmethod
def version(cls):
print(f"Local BioProv version is v{__version__}")
sys.exit(0)

elif args.list:
@classmethod
def list(cls):
tags = [f"'{project['tag']}'" for project in config.db.all()]
print(f"You have {len(tags)} Projects in your database.")
if tags:
print("\n".join(tags))
sys.exit(0)

elif args.clear_db: # no cover
config.db.clear_db() # no cover
sys.exit(0) # no cover

parser = WorkflowOptionsParser()
parser.parse_options(args)
@classmethod
def clear_db(cls): # no cover
config.db.clear_db()
sys.exit(0)


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion bioprov/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
__license__ = "MIT"
__maintainer__ = "Vini Salazar"
__url__ = "https://github.com/vinisalazar/bioprov"
__version__ = "0.1.17"
__version__ = "0.1.18"


"""
Expand Down
7 changes: 5 additions & 2 deletions bioprov/data/datasets/picocyano.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
sample-id,assembly,taxon
GCF_000010065.1_ASM1006v1,bioprov/data/genomes/GCF_000010065.1_ASM1006v1_genomic.fna,Synechococcus elongatus PCC 6301
GCF_000007925.1_ASM792v1,bioprov/data/genomes/GCF_000007925.1_ASM792v1_genomic.fna,Prochlorococcus marinus CCMP1375
GCF_000010065.1,bioprov/data/genomes/GCF_000010065.1_ASM1006v1_genomic.fna,Synechococcus elongatus PCC 6301
GCF_000007925.1,bioprov/data/genomes/GCF_000007925.1_ASM792v1_genomic.fna,Prochlorococcus marinus CCMP1375
GCA_000316515.1,bioprov/data/genomes/GCF_000316515.1_ASM31651v1_genomic.fna,Cyanobium gracile PCC 6307
GCF_000012625.1,bioprov/data/genomes/GCF_000012625.1_ASM1262v1_genomic.fna,Parasynechococcus africanus CC9605
GCF_000011485.1,bioprov/data/genomes/GCF_000011485.1_ASM1148v1_genomic.fna,Thaumococcus swingsii MIT9313
Loading

0 comments on commit ee154a5

Please sign in to comment.