Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version #46

Merged
merged 3 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ kmers
kmerstest
kmercamel
kmercameltest
src/version.h
🐫
bin/

Expand Down
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ cpptest: kmercameltest
converttest: convert_superstring_unittest.py
./convert_superstring_unittest.py

kmercamel: $(SRC)/main.cpp $(SRC)/$(wildcard *.cpp *.h *.hpp)
kmercamel: $(SRC)/main.cpp $(SRC)/$(wildcard *.cpp *.h *.hpp) src/version.h
$(CXX) $(CXXFLAGS) $(SRC)/main.cpp -o $@ $(LDFLAGS)
cp kmercamel 🐫 || true

Expand All @@ -32,9 +32,14 @@ kmercameltest: $(SRC)/unittest.cpp gtest-all.o $(SRC)/$(wildcard *.cpp *.h *.hpp
gtest-all.o: $(GTEST)/src/gtest-all.cc $(wildcard *.cpp *.h *.hpp)
$(CXX) $(CXXFLAGS) -isystem $(GTEST)/include -I $(GTEST)/include -I $(GTEST) -DGTEST_CREATE_SHARED_LIBRARY=1 -c -pthread $(GTEST)/src/gtest-all.cc -o $@

src/version.h: src/version
./create-version.sh


clean:
rm -f kmercamel
rm -f 🐫 || true
rm -f kmercameltest
rm -r -f ./bin
rm -f gtest-all.o
rm -f src/version.h
2 changes: 2 additions & 0 deletions create-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env bash
cat <(echo "#define VERSION \"") src/version <(echo -) <(git rev-parse HEAD | head -c6) <(echo \") | tr -d '\n' > src/version.h
13 changes: 11 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
#include <iostream>
#include <string>
#include "unistd.h"
#include "version.h"

void Help() {
std::cerr << "KmerCamel v0.2" << std::endl;
std::cerr << "KmerCamel version " << VERSION << std::endl;
std::cerr << "Accepted arguments:" << std::endl;
std::cerr << " -p path_to_fasta - required; valid path to fasta file" << std::endl;
std::cerr << " -k k_value - required; integer value for k" << std::endl;
Expand All @@ -20,10 +21,15 @@ void Help() {
std::cerr << " -d d_value - integer value for d_max; default 5" << std::endl;
std::cerr << " -c - treat k-mer and its reverse complement as equal" << std::endl;
std::cerr << " -h - print help" << std::endl;
std::cerr << " -v - print version" << std::endl;
std::cerr << "Example usage: ./kmercamel -p path_to_fasta -k 13 -d 5 -a local" << std::endl;
std::cerr << "Possible algorithms: global globalAC local localAC streaming" << std::endl;
}

void Version() {
std::cerr << VERSION << std::endl;
}

int main(int argc, char **argv) {
std::string path;
int k = 0;
Expand All @@ -35,7 +41,7 @@ int main(int argc, char **argv) {
bool d_set = false;
int opt;
try {
while ((opt = getopt(argc, argv, "p:k:d:a:o:hc")) != -1) {
while ((opt = getopt(argc, argv, "p:k:d:a:o:hcv")) != -1) {
switch(opt) {
case 'p':
path = optarg;
Expand All @@ -62,6 +68,9 @@ int main(int argc, char **argv) {
case 'c':
complements = true;
break;
case 'v':
Version();
return 0;
case 'h':
default:
Help();
Expand Down
1 change: 1 addition & 0 deletions src/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.2