Skip to content

Commit

Permalink
Merge pull request #38 from chungongyu/dev
Browse files Browse the repository at this point in the history
dev
  • Loading branch information
chungongyu committed May 10, 2021
2 parents c6b2a09 + 2670270 commit fc7712f
Show file tree
Hide file tree
Showing 22 changed files with 369 additions and 137 deletions.
5 changes: 5 additions & 0 deletions 3rdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
add_library(3rdparty
bcr.h
bcr.c
)
target_include_directories(3rdparty PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
1 change: 1 addition & 0 deletions 3rdparty/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ noinst_LTLIBRARIES = lib3rdparty.la
lib3rdparty_la_SOURCES = \
bcr.c \
bcr.h
EXTRA_DIST=CMakeLists.txt
28 changes: 28 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
cmake_minimum_required(VERSION 3.11)

project(siga VERSION 0.10)

set(PROJECT_URL "http:https://bioinfo.ict.ac.cn/siga")
set(PACKAGE_BUGREPORT "[email protected]")

set(CMAKE_CXX_STANDARD 11)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")

find_package(Boost COMPONENTS filesystem iostreams program_options unit_test_framework REQUIRED)
find_package(OpenMP QUIET)
find_package(RapidJSON REQUIRED)

find_package(PkgConfig REQUIRED)
pkg_check_modules(LOG4CXX REQUIRED liblog4cxx>=0.10.0)
pkg_check_modules(TCMalloc QUIET libtcmalloc>=2.1)

find_program(HELP2MAN NAMES help2man)
find_program(BUNDLE NAMES bundle)

configure_file(siga.h.in config.h @ONLY)
enable_testing()

add_subdirectory(3rdparty)
add_subdirectory(docs)
add_subdirectory(src)
add_subdirectory(test)
4 changes: 3 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
SUBDIRS=3rdparty benchmark docs examples m4 src test
EXTRA_DIST=autogen.sh
EXTRA_DIST=autogen.sh \
CMakeLists.txt \
siga.h.in
8 changes: 8 additions & 0 deletions docs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
if(BUNDLE)
add_custom_target(html ALL
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/Gemfile ${CMAKE_CURRENT_BINARY_DIR}/Gemfile
COMMAND bundle install --path=vendor/bundle
COMMAND bundle exec jekyll build --source=${CMAKE_CURRENT_SOURCE_DIR} --layouts=${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS siga
)
endif(BUNDLE)
3 changes: 2 additions & 1 deletion docs/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ EXTRA_DIST=404.html \
_config.yml \
favicon.png \
index.md \
logo_with_text.png
logo_with_text.png \
CMakeLists.txt
html-env:
bundle install --path=vendor/bundle
html-local: html-env
Expand Down
7 changes: 7 additions & 0 deletions siga.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#cmakedefine OpenMP_FOUND

#define PACKAGE "@PROJECT_NAME@"
#define PACKAGE_NAME "@PROJECT_NAME@"
#define PACKAGE_VERSION "@PROJECT_VERSION@"
#define PACKAGE_URL "@PROJECT_URL@"
#define PACKAGE_BUGREPORT "@PROJECT_BUGREPORT@"
69 changes: 69 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
add_library(libsiga
alphabet.h
asqg.cpp
asqg.h
bigraph.cpp
bigraph.h
bigraph_search.cpp
bigraph_search.h
bigraph_visitors.cpp
bigraph_visitors.h
bwt.cpp
bwt.h
constant.h
correct_processor.cpp
correct_processor.h
coord.cpp
coord.h
fmindex.cpp
fmindex.h
kmerdistr.cpp
kmerdistr.h
kseq.cpp
kseq.h
mkqs.h
overlap_builder.cpp
overlap_builder.h
primer_screen.cpp
primer_screen.h
quality.h
reads.cpp
reads.h
rlstring.h
runner.h
sequence_process_framework.h
suffix_array.cpp
suffix_array.h
suffix_array_builder.cpp
suffix_array_builder.h
utils.cpp
utils.h
)
target_include_directories(libsiga PUBLIC ${CMAKE_BINARY_DIR} ${LOG4CXX_CFLAGS})
target_link_libraries(libsiga 3rdparty ${LOG4CXX_LDFLAGS} Boost::filesystem Boost::iostreams Boost::program_options)
if(TCMalloc_FOUND)
target_include_directories(libsiga PUBLIC ${TCMalloc_CFLAGS})
target_link_libraries(libsiga ${TCMalloc_LDFLAGS})
endif(TCMalloc_FOUND)

add_executable(siga
assembler.cpp
correct.cpp
indexer.cpp
match.cpp
overlap.cpp
preprocess.cpp
preqc.cpp
rmdup.cpp
subgraph.cpp
main.cpp
)
target_link_libraries(siga libsiga)
target_include_directories(siga PRIVATE ${CMAKE_BINARY_DIR})

if(HELP2MAN)
add_custom_target(man ALL
COMMAND help2man -o siga.1 $<TARGET_FILE:siga>
DEPENDS siga
)
endif(HELP2MAN)
4 changes: 2 additions & 2 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,5 @@ else
man_MANS=
endif !HELP2MAN

EXTRA_DIST=log4cxx.properties

EXTRA_DIST=log4cxx.properties \
CMakeLists.txt
30 changes: 17 additions & 13 deletions src/bigraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,22 @@ Vertex::Vertex(const Id& id, const std::string& seq, bool contained, const std::
c = std::stoi(item.substr(k + 1));
}
}
auto it = _indexTbl.find(barcode);
if (it != _indexTbl.end()) {
it->second += c;
} else {
_indexTbl[barcode] = c;
}
_indexTbl.insert(std::make_pair(barcode, c));
// auto it = _indexTbl.find(barcode);
// if (it != _indexTbl.end()) {
// it->second += c;
// } else {
// _indexTbl[barcode] = c;
// }
}
}
{
std::vector<std::string> vec;
ASQG::tokenize(vec, ext, ',');
for (const auto& item : vec) {
_ext.push_back(item);
if (!item.empty()) {
_ext.push_back(item);
}
}
}
}
Expand Down Expand Up @@ -149,12 +152,13 @@ void Vertex::merge(Edge* edge) {

// Update the index/barcode table of vertex
for (const auto& idx : edge->end()->_indexTbl) {
auto it = _indexTbl.find(idx.first);
if (it != _indexTbl.end()) {
it->second += idx.second;
} else {
_indexTbl[idx.first] = idx.second;
}
_indexTbl.insert(std::make_pair(idx.first, idx.second));
// auto it = _indexTbl.find(idx.first);
// if (it != _indexTbl.end()) {
// it->second += idx.second;
// } else {
// _indexTbl[idx.first] = idx.second;
// }
}

// Update the extension attributes
Expand Down
2 changes: 1 addition & 1 deletion src/bigraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ typedef std::vector<Edge *> EdgePtrList;
class Vertex {
public:
typedef std::string Id;
typedef std::unordered_map<std::string, size_t> IndexTable;
typedef std::unordered_multimap<std::string, size_t> IndexTable;
typedef std::vector<std::string> ExtList;

Vertex(const Id& id, const std::string& seq, bool contained=false, const std::string& index="", size_t coverage=1, const std::string& ext="");
Expand Down
1 change: 1 addition & 0 deletions src/kseq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ DNASeqReader* DNASeqReaderFactory::create(std::istream& stream) {
} else if (c == '>') {
return new FASTAReader(stream);
}
LOG4CXX_ERROR(logger, boost::format("failed to create dna reader: %c") % c);
}
return nullptr;
}
Expand Down
Loading

0 comments on commit fc7712f

Please sign in to comment.