Skip to content

Commit

Permalink
Merge pull request #35 from vpc-ccg/2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fhach authored Dec 18, 2019
2 parents fe2396b + c7559be commit e4d8dfb
Show file tree
Hide file tree
Showing 71 changed files with 5,269 additions and 5,241 deletions.
43 changes: 38 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,39 @@
sniper
recalibrate
remove_duplicate_insertions
partition_processor
.idea
pamir-obj/
.snakemake/
pamir/
src/include/logger.h
src/include/edlib.h
src/edlib.cc
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.sh
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app
9 changes: 6 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "mrsfast"]
path = mrsfast
url = https://github.com/sfu-compbio/mrsfast
[submodule "ext/util-logger"]
path = ext/util-logger
url = https://github.com/vpc-ccg/util-logger.git
[submodule "ext/edlib"]
path = ext/edlib
url = https://github.com/Martinsos/edlib.git
160 changes: 119 additions & 41 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,60 +1,138 @@
CXX=g++
FLAGS= -O3 -std=c++11
CFLAGS= -c $(FLAGS) -Wfatal-errors
SOURCE_FILES=partition.cc pamir.cc assembler.cc genome.cc aligner.cc extractor.cc common.cc bam_parser.cc sam_parser.cc record.cc sort.cc logger.cc
CXX ?= g++

RELEASE_OPT = -O2
DEBUG_OPT = -g -O0
PROFILE_OPT = -O2 -pg -g

EXT_PATH = ext
SRC_PATH = src
BUILD_PATH = pamir-obj
BIN_PATH = pamir

EXT = cc

LDFLAGS=-lm -lz
SRC_PATH = src
INCLUDES = -I $(SRC_PATH)/include
LOGGER_EXT_PATH = $(EXT_PATH)/util-logger/include/logger.h
LOGGER_HED_PATH = $(SRC_PATH)/include/logger.h


EDLIB_EXT_HED_PATH = $(EXT_PATH)/edlib/edlib/include/edlib.h
EDLIB_EXT_SRC_PATH = $(EXT_PATH)/edlib/edlib/src/edlib.cpp

EDLIB_SRC_PATH = $(SRC_PATH)/edlib.cc
EDLIB_HED_PATH = $(SRC_PATH)/include/edlib.h

SCRIPT_SOURCE = scripts
SCRIPT_PATH = $(BIN_PATH)/scripts
SRC_EXT = cc

SOURCE_FILES = pamir.cc aligner.cc common.cc genome.cc partition.cc assembler.cc sam_parser.cc extractor.cc smoother.cc process_orphans.cc process_range.cc edlib.cc sam_processing.cc recalibrate.cc


SCRIPT_FILES = merge_refs.py contig_graph.py filter_by_setcover.py filtering.py generate_setcover_input.py prep-ctgs.py remove_contaminations.py sort_vcf.py version_check.py process_repeats.py process_unique.py

OBJ_PATH = obj
SOURCES = $(patsubst %, $(SRC_PATH)/%, $(SOURCE_FILES))
OBJECTS=$(SOURCES:$(SRC_PATH)/%.cc=$(OBJ_PATH)/%.o)
EXECUTABLE=pamir
all: dirs snp rc es sm mf cm
basic: dirs snp rc es mf cm
OBJECTS = $(SOURCES:$(SRC_PATH)/%.$(SRC_EXT)=$(BUILD_PATH)/%.o)

.SECONDARY: $(UTIL_OBJ)

SCRIPTS = $(patsubst %, $(SCRIPT_SOURCE)/%, $(SCRIPT_FILES))
COPIED_SCRIPTS = $(patsubst %, $(SCRIPT_PATH)/%, $(SCRIPT_FILES))

rc:
g++ -O3 $(INCLUDES) -o recalibrate $(SRC_PATH)/recalibrate.cc
cm:
g++ -O3 $(INCLUDES) -o cleanmega $(SRC_PATH)/clean_megablast.cc
es:
g++ -O3 $(INCLUDES) -o extract_support $(SRC_PATH)/extract_support.cc $(SRC_PATH)/common.cc
sm:
g++ -O3 $(INCLUDES) -o smoother -g -std=c++1y -Wfatal-errors $(SRC_PATH)/smoother.cc
mf:
make -C mrsfast
EXE=pamir

dirs:
mkdir -p $(OBJ_PATH)
DEPS = $(OBJECTS:.o=.d) $(UTIL_OBJ:.o=.d) $(PROCESSING_OBJ:.o=.d)

snp: $(SOURCES) $(EXECUTABLE)
COMPILE_FLAGS = -std=c++14 #-Wall -Wextra #Removed because pamir gives way too many warnings
INCLUDES = -I $(SRC_PATH)/include/

LFLAGS = $(LDFLAGS) -lm -lz

$(EXECUTABLE): $(OBJECTS)
$(CXX) $(OBJECTS) $(INCLUDES) $(LDFLAGS) -o $@
.PHONY: default_make
default_make: release

.PHONY: release
.PHONY: debug
.PHONY: profile
.PHONY: install

$(OBJ_PATH)/%.o: $(SRC_PATH)/%.$(EXT)
$(CXX) $(CFLAGS) $(INCLUDES) -c $< -o $@

clean:
rm -f obj/*.o pamir recalibrate extract_support smoother cleanmega
rm -d $(OBJ_PATH)
release: export CXXFLAGS := $(CXXFLAGS) $(COMPILE_FLAGS) $(RELEASE_OPT)
release: dirs
@$(MAKE) all

debug: export CXXFLAGS := $(CXXFLAGS) $(COMPILE_FLAGS) $(DEBUG_OPT)
debug: dirs
@$(MAKE) all

.PHONY: rc
profile: export CXXFLAGS := $(CXXFLAGS) $(COMPILE_FLAGS) $(PROFILE_OPT)
profile: dirs
@$(MAKE) all

install: export CXXFLAGS := $(CXXFLAGS) $(COMPILE_FLAGS) $(RELEASE_OPT)
install: dirs
@$(MAKE) install_helper
# @$(MAKE) build_clean

.PHONY: cm
.PHONY: es
.PHONY: sm
.PHONY: mf
.PHONY: dirs
.PHONY: snp
.PHONY: all
.PHONY: basic
dirs:
@mkdir -p $(BUILD_PATH)
@mkdir -p $(BIN_PATH)

clean: build_clean bin_clean

.PHONY: clean

build_clean:
@$(RM) $(OBJECTS)
@$(RM) $(DEPS)
@$(RM) -d $(BUILD_PATH)
@$(RM) $(SRC_PATH)/edlib.cc
@$(RM) $(SRC_PATH)/include/edlib.h
@$(RM) $(SRC_PATH)/include/logger.h
.PHONY: build_clean

bin_clean:
$(RM) $(BIN_PATH)/$(EXE)
$(RM) $(BIN_PATH)/.snakemake/ -r
$(RM) $(BIN_PATH)/Snakefile
$(RM) -dr $(SCRIPT_PATH)
$(RM) -d $(BIN_PATH)

$(COPIED_SCRIPTS): dirs $(SCRIPTS)
@mkdir -p $(BIN_PATH)/scripts
@cp scripts/* $(BIN_PATH)/scripts
@cp Snakefile $(BIN_PATH)

-include $(DEPS)

$(LOGGER_EXT_PATH):
@echo Please clone the repository with --recursive option!; exit 1;

$(EDLIB_EXT_SRC_PATH):
@echo Please clone the repository with --recursive option!; exit 1;

$(EDLIB_EXT_HED_PATH):
@echo Please clone the repository with --recursive option!; exit 1;

$(LOGGER_HED_PATH): $(LOGGER_EXT_PATH)
@cp $(LOGGER_EXT_PATH) $(LOGGER_HED_PATH)

$(EDLIB_SRC_PATH): $(EDLIB_EXT_SRC_PATH)
@cp $(EDLIB_EXT_SRC_PATH) $(EDLIB_SRC_PATH)

$(EDLIB_HED_PATH): $(EDLIB_EXT_HED_PATH)
@cp $(EDLIB_EXT_HED_PATH) $(EDLIB_HED_PATH)


.PHONY: all
all: $(EDLIB_HED_PATH) $(EDLIB_SRC_PATH) $(LOGGER_HED_PATH) $(BIN_PATH)/$(EXE) $(COPIED_SCRIPTS)

.PHONY: install_helper

install_helper: $(BIN_PATH)/$(EXE) $(COPIED_SCRIPTS)
@printf "\nPlease add pamir to your path:\n\nexport PATH=\044PATH:`pwd`\n\nOR\n\nsudo mv pamir.sh /usr/bin\nsudo mv pamir /usr/bin\n\n"

$(BIN_PATH)/$(EXE): $(OBJECTS)
$(CXX) $(OBJECTS) $(LFLAGS) -o $@

$(BUILD_PATH)/%.o: $(SRC_PATH)/%.$(SRC_EXT)
$(CXX) $(CXXFLAGS) $(INCLUDES) -MP -MMD -c $< -o $@
Loading

0 comments on commit e4d8dfb

Please sign in to comment.