Skip to content

Commit

Permalink
apple flag for aho
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremiah Wala committed May 16, 2015
1 parent 7eec4ae commit 85a63f0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
20 changes: 13 additions & 7 deletions src/MiniRules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,8 @@ bool AbstractRule::isValid(Read &r) {
}


#ifdef HAVE_AHOCORASICK_AHOCORASICK_H
//#ifdef HAVE_AHOCORASICK_AHOCORASICK_H
#ifndef __APPLE__
if (atm_file.length()) {
bool m = ahomatch(r);
if ( (!m && !atm_inv) || (m && atm_inv) )
Expand Down Expand Up @@ -811,7 +812,8 @@ std::ostream& operator<<(std::ostream &out, const AbstractRule &ar) {
out << "del:" << ar.del << " -- ";
if (ar.subsam_frac < 1)
out << "sub:" << ar.subsam_frac << " -- ";
#ifdef HAVE_AHOCORASICK_AHOCORASICK_H
#ifndef __APPLE__
//#ifdef HAVE_AHOCORASICK_AHOCORASICK_H
if (ar.atm_file != "")
out << "matching on " << ar.atm_count << " subsequences from file " << ar.atm_file << " -- ";
#endif
Expand Down Expand Up @@ -944,7 +946,8 @@ bool Flag::parseRuleLine(std::string &val, std::regex &reg) {

}

#ifdef HAVE_AHOCORASICK_AHOCORASICK_H
//#ifdef HAVE_AHOCORASICK_AHOCORASICK_H
#ifndef __APPLE__
// check if a string contains a substring using Aho Corasick algorithm
//bool AbstractRule::ahomatch(const string& seq) {
bool AbstractRule::ahomatch(Read &r) {
Expand All @@ -967,7 +970,8 @@ bool AbstractRule::ahomatch(Read &r) {
}
#endif

#ifdef HAVE_AHOCORASICK_AHOCORASICK_H
//#ifdef HAVE_AHOCORASICK_AHOCORASICK_H
#ifndef __APPLE__
// check if a string contains a substring using Aho Corasick algorithm
bool AbstractRule::ahomatch(const char * seq, unsigned len) {

Expand Down Expand Up @@ -996,8 +1000,9 @@ void AbstractRule::parseSeqLine(std::string line) {
line = match[1].str();
atm_file = line;

#ifndef HAVE_AHOCORASICK_AHOCORASICK_H
std::cerr << "Attempting to perform motif matching without Aho-Corasick library. Need to link to lahocorasick to do this." << std::endl;
//#ifndef HAVE_AHOCORASICK_AHOCORASICK_H
#ifdef __APPLE__
std::cerr << "NOT AVAILBLE ON APPLE -- Attempting to perform motif matching without Aho-Corasick library. Need to link to lahocorasick to do this." << std::endl;
exit(EXIT_FAILURE);
#endif

Expand All @@ -1019,7 +1024,8 @@ void AbstractRule::parseSeqLine(std::string line) {
inv = " -- Inverted -- ";
}

#ifdef HAVE_AHOCORASICK_AHOCORASICK_H
//#ifdef HAVE_AHOCORASICK_AHOCORASICK_H
#ifndef __APPLE__
// initialize it
atm = ac_automata_init(); //atm_ptr(ac_automata_init(), atm_free_delete);

Expand Down
11 changes: 7 additions & 4 deletions src/SnowTools/MiniRules.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
#include "SnowTools/SnowUtils.h"
#include "SnowTools/HTSTools.h"

#define HAVE_AHOCORASICK_AHOCORASICK_H 1
#ifdef HAVE_AHOCORASICK_AHOCORASICK_H
//#define HAVE_AHOCORASICK_AHOCORASICK_H 1
//#ifdef HAVE_AHOCORASICK_AHOCORASICK_H
#ifndef __APPLE__

#include "ahocorasick/ahocorasick.h"
#include <memory>
Expand Down Expand Up @@ -264,7 +265,8 @@ class AbstractRule {
// how many reads pass this rule?
size_t m_count = 0;

#ifdef HAVE_AHOCORASICK_AHOCORASICK_H
//#ifdef HAVE_AHOCORASICK_AHOCORASICK_H
#ifndef __APPLE__
//atm_ptr atm;
AC_AUTOMATA_t * atm = 0;
#endif
Expand All @@ -284,7 +286,8 @@ class AbstractRule {

void parseSubLine(std::string line);

#ifdef HAVE_AHOCORASICK_AHOCORASICK_H
//#ifdef HAVE_AHOCORASICK_AHOCORASICK_H
#ifndef __APPLE__
bool ahomatch(Read &r);

bool ahomatch(const char * seq, unsigned len);
Expand Down

0 comments on commit 85a63f0

Please sign in to comment.