davlu / Gene-Protein-Analysis-Tool

Returns analysis on a gene sequence or protein.
2 stars 5 forks source link

Introducing CLIck <-- get it! #4

Closed pcapel closed 7 years ago

pcapel commented 7 years ago

Alright, so I got seriously tired of doing calculus and decided that I wanted to go ahead and get Click integrated so that everyone can see how it works. It did require me to change the structure of the project somewhat, but I think it'll be an ok change.

Essentially went from a flat directory to a modular approach. MainAnalysis.py is still located at the root of the project structure, but the files that we'll be writing to mostly I moved into a directory called analytics. I added a setup.py to the main folder, as that is the desirable way to integrate Click into your projects. Check out the docs

I can get an update into the Readme on how to use click, but the documentation should have everything there already. I also added a .gitignore with the file extensions needed to hide some of the things that are auto-generated by the pip install -e . command and setup.py.

Those are the big changes. Beyond that, all I added to the code was a function in MainAnalysis to pull in the base counting function from DNAanalysis and run it on a string passed in by the user. If you want to try it out, here are the steps:

Create a directory to test in and cd into it, then you can copy and paste these:

# setup a virtualenv to install into
python -m venv env

# activate it
. env\bin\activate

# clone in my fork of the project with the changes in this PR
git clone https://github.com/pcapel/Gene-Protein-Analysis-Tool.git

# install the current directory with the editable flag
pip install -e .

# try out the function I wrote in!
gpa-tool -d AATGTCCGCGCGTAGGATAGCTGATGATTA

I definitely recommend giving that a go before you accept this PR just to make sure that's the kind of thing we're looking for! I really enjoy working with Click and have gotten pretty familiar with its internals though, so I'd be excited to use it/help everyone learn about it. There's a bit of a learning curve starting out, but it produces quality results cross platform (I program in both Windows and Linux regularly).

As far as directory/project structure goes, we can definitely discuss it. For a project this size, I think that having just the analytics module under the main directory should be plenty.

Cheers!

pcapel commented 7 years ago

Incidentally, I don't know why there are merge conflicts. That might have something to do with me futzing around while I was debugging things and creating a commit that didn't end up going anywhere. I can always dump these changes, delete my fork, and re-fork to make the changes a little more smoothly now that I've worked out the kinks.