Skip to content
Browse files

Removed unusued 'metagenome' subcommand

  • Loading branch information...
1 parent 4483901 commit ecd06c869045d4445f0d4f7e63168bf0a60eb168 @jts committed Mar 12, 2013
View
2 src/Algorithm/Makefile.am
@@ -33,7 +33,5 @@ libalgorithm_a_SOURCES = \
ExtensionDP.h ExtensionDP.cpp \
HaplotypeBuilder.h HaplotypeBuilder.cpp \
GapFillProcess.h GapFillProcess.cpp \
- MetAssembleProcess.h MetAssembleProcess.cpp \
- MetagenomeBuilder.h MetagenomeBuilder.cpp \
VariationBuilderCommon.h VariationBuilderCommon.cpp \
KmerOverlaps.h KmerOverlaps.cpp
View
224 src/Algorithm/MetAssembleProcess.cpp
@@ -1,224 +0,0 @@
-///----------------------------------------------
-// Copyright 2011 Wellcome Trust Sanger Institute
-// Written by Jared Simpson (js18@sanger.ac.uk)
-// Released under the GPL
-//-----------------------------------------------
-//
-// MetAssembleProcess - Find contigs in an
-// abstractly represented de Bruijn graph
-// of a metagenome
-//
-#include "MetAssembleProcess.h"
-#include "BWTAlgorithms.h"
-#include "SGAlgorithms.h"
-#include "SGSearch.h"
-#include "StdAlnTools.h"
-#include "MetagenomeBuilder.h"
-
-//
-//
-//
-MetAssemble::MetAssemble(const MetAssembleParameters& params) : m_parameters(params)
-{
-}
-
-//
-MetAssemble::~MetAssemble()
-{
-}
-
-MetAssembleResult MetAssemble::process(const SequenceWorkItem& item)
-{
- MetAssembleResult result;
- SeqRecord currRead = item.read;
- std::string w = item.read.seq.toString();
- if(w.size() <= m_parameters.kmer)
- {
- return result;
- }
-
- // Perform a backwards search using the read sequence
- // Check which k-mers have already been visited using the
- // shared bitvector. If any bit in the range [l,u] is set
- // for a suffix of the read, then we do not visit those kmers
- // later
- int len = w.size();
- int num_kmers = len - m_parameters.kmer + 1;
- std::vector<bool> visitedKmers(false, num_kmers);
-
- int j = len - 1;
- char curr = w[j];
- BWTInterval interval;
- BWTAlgorithms::initInterval(interval, curr, m_parameters.pBWT);
- --j;
-
- for(;j >= 0; --j)
- {
- curr = w[j];
- BWTAlgorithms::updateInterval(interval, curr, m_parameters.pBWT);
- assert(interval.isValid());
-
- // At this point interval represents the suffix [j,len)
- // Check if the starting point of this interval is set
- if(j < num_kmers)
- visitedKmers[j] = m_parameters.pBitVector->test(interval.lower);
- }
-
- // Process the kmers that have not been previously visited
- for(j = 0; j < num_kmers; ++j)
- {
- if(visitedKmers[j])
- continue; // skip
-
- std::string kmer = w.substr(j, m_parameters.kmer);
-
- // Get the interval for this kmer
- BWTInterval interval = BWTAlgorithms::findIntervalWithCache(m_parameters.pBWT, m_parameters.pBWTCache, kmer);
-
- // Check if this interval has been marked by a previous iteration of the loop
- assert(interval.isValid());
- if(m_parameters.pBitVector->test(interval.lower))
- continue;
-
- BWTInterval rc_interval = BWTAlgorithms::findIntervalWithCache(m_parameters.pBWT, m_parameters.pBWTCache, reverseComplement(kmer));
-
- size_t count = interval.size();
- if(rc_interval.isValid())
- count += rc_interval.size();
-
- if(count >= m_parameters.kmerThreshold)
- {
- // Process the kmer
- std::string contig = processKmer(kmer, count);
-
- // We must determine if this contig has been assembled by another thread.
- // Break the contig into lexicographically ordered set of kmers. The lowest kmer is chosen
- // to represent the contig. If this kmer has been marked as visited, we discard the contig
- // otherwise we mark all kmers in the contig and output the contig.
- StringVector kmers = getLexicographicKmers(contig);
-
- // Get the lowest kmer in the set
- assert(!kmers.empty());
- std::string lowest = kmers.front();
- BWTInterval lowInterval = BWTAlgorithms::findIntervalWithCache(m_parameters.pBWT, m_parameters.pBWTCache, lowest);
- BWTInterval lowRCInterval = BWTAlgorithms::findIntervalWithCache(m_parameters.pBWT, m_parameters.pBWTCache, reverseComplement(lowest));
- bool marked = false;
-
- // If the kmer exists in the read set (the interval is valid), we attempt to mark it
- // Otherwise, we attempt to mark its reverse complement. If either call succeeds
- // we output the contig. This block of code gives the synchronization between threads.
- // If multiple threads attempt to assemble the same contig, marked will be true for only
- // one of the threads.
- if(lowInterval.isValid())
- marked = m_parameters.pBitVector->updateCAS(lowInterval.lower, false, true);
- else
- marked = m_parameters.pBitVector->updateCAS(lowRCInterval.lower, false, true);
-
- // Mark all the kmers in the contig so they will not be visited again
- markSequenceKmers(contig);
-
- // If the collision check passed, output the contig
- if(marked)
- {
- if(contig.size() >= m_parameters.minLength)
- result.contigs.push_back(contig);
- }
- }
-
- // Update the bit vector for the source kmer
- for(int64_t i = interval.lower; i <= interval.upper; ++i)
- m_parameters.pBitVector->updateCAS(i, false, true);
-
- for(int64_t i = rc_interval.lower; i <= rc_interval.upper; ++i)
- m_parameters.pBitVector->updateCAS(i, false, true);
- }
-
- return result;
-}
-
-//
-std::string MetAssemble::processKmer(const std::string& str, int count)
-{
- MetagenomeBuilder builder;
- builder.setSource(str, count);
- builder.setKmerParameters(m_parameters.kmer, m_parameters.kmerThreshold);
- builder.setIndex(m_parameters.pBWT, m_parameters.pRevBWT, m_parameters.pBWTCache, m_parameters.pRevBWTCache);
- builder.run();
-
- StringVector contigs;
- builder.getContigs(contigs);
- std::string out = contigs.empty() ? "" : contigs.front();
- //std::cout << "Constructed " << contigs.size() << " contigs from kmer (size: " << out.size() << ")\n";
- return out;
-}
-
-// Update the bit vector with the kmers that were assembled into str
-void MetAssemble::markSequenceKmers(const std::string& str)
-{
- assert(str.size() >= m_parameters.kmer);
- size_t n = str.size() - m_parameters.kmer + 1;
-
- for(size_t i = 0; i < n; ++i)
- {
- std::string kseq = str.substr(i, m_parameters.kmer);
- BWTInterval interval = BWTAlgorithms::findIntervalWithCache(m_parameters.pBWT, m_parameters.pBWTCache, kseq);
- if(interval.isValid())
- {
- for(int64_t j = interval.lower; j <= interval.upper; ++j)
- m_parameters.pBitVector->updateCAS(j, false, true);
- }
-
- // Mark the reverse complement k-mers too
- std::string rc_kseq = reverseComplement(kseq);
- interval = BWTAlgorithms::findIntervalWithCache(m_parameters.pBWT, m_parameters.pBWTCache, rc_kseq);
- if(interval.isValid())
- {
- for(int64_t j = interval.lower; j <= interval.upper; ++j)
- m_parameters.pBitVector->updateCAS(j, false, true);
- }
- }
-}
-
-// Break a contig into a lexicographically ordered set of kmers
-StringVector MetAssemble::getLexicographicKmers(const std::string& contig) const
-{
- StringVector out;
- for(size_t i = 0; i < contig.size() - m_parameters.kmer + 1; ++i)
- {
- std::string ks = contig.substr(i, m_parameters.kmer);
- std::string rs = reverseComplement(ks);
- out.push_back(ks < rs ? ks : rs);
- }
-
- std::sort(out.begin(), out.end());
- return out;
-}
-
-//
-// MetAssembleAggregateResult
-//
-MetAssembleAggregateResults::MetAssembleAggregateResults(const std::string& filename) : m_numContigs(0), m_basesWritten(0)
-{
- //
- m_pWriter = createWriter(filename);
-}
-
-//
-MetAssembleAggregateResults::~MetAssembleAggregateResults()
-{
- delete m_pWriter;
-}
-
-void MetAssembleAggregateResults::process(const SequenceWorkItem& /*item*/, const MetAssembleResult& result)
-{
- // Write to the contigs file
- for(size_t i = 0; i < result.contigs.size(); ++i)
- {
- std::stringstream idMaker;
- idMaker << "contig-" << m_numContigs++;
-
- SeqItem item = { idMaker.str(), result.contigs[i] };
- m_basesWritten += result.contigs[i].length();
- item.write(*m_pWriter);
- }
-}
View
105 src/Algorithm/MetAssembleProcess.h
@@ -1,105 +0,0 @@
-///----------------------------------------------
-// Copyright 2011 Wellcome Trust Sanger Institute
-// Written by Jared Simpson (js18@sanger.ac.uk)
-// Released under the GPL
-//-----------------------------------------------
-//
-// MetAssembleProcess - Find contigs in an
-// abstractly represented de Bruijn graph
-// of a metagenome
-//
-#ifndef METASSEMBLE_PROCESS_H
-#define METASSEMBLE_PROCESS_H
-
-#include <list>
-#include <stack>
-#include <queue>
-#include "BWT.h"
-#include "BWTInterval.h"
-#include "SGUtil.h"
-#include "SGWalk.h"
-#include "BitVector.h"
-#include "VariationBuilderCommon.h"
-#include "SequenceProcessFramework.h"
-#include "BWTIntervalCache.h"
-
-// Parameters structure
-struct MetAssembleParameters
-{
- // BWTS
- const BWT* pBWT;
- const BWT* pRevBWT;
-
- // FM-index
- const BWTIntervalCache* pBWTCache;
- const BWTIntervalCache* pRevBWTCache;
-
- size_t kmer;
- size_t kmerThreshold;
- size_t minLength;
- BitVector* pBitVector;
-};
-
-struct MetAssembleResult
-{
- StringVector contigs;
-};
-
-//
-//
-//
-class MetAssemble
-{
- public:
-
- //
- // Functions
- //
- MetAssemble(const MetAssembleParameters& params);
- ~MetAssemble();
-
- // Process a read and all its kmers
- MetAssembleResult process(const SequenceWorkItem& item);
-
- private:
-
- //
- // Functions
- //
-
- // Perform an assemble starting at str
- std::string processKmer(const std::string& str, int count);
-
- // Mark all the kmers in str as being visited
- void markSequenceKmers(const std::string& str);
-
- // Break a contig into a lexicographically ordered set of kmers
- StringVector getLexicographicKmers(const std::string& contig) const;
-
- //
- // Data
- //
- MetAssembleParameters m_parameters;
-};
-
-// Shared result object that the threaded
-// GraphCompare instances write to. Protected
-// by a mutex
-class MetAssembleAggregateResults
-{
-
- public:
- MetAssembleAggregateResults(const std::string& filename);
- ~MetAssembleAggregateResults();
-
- void process(const SequenceWorkItem& item, const MetAssembleResult& result);
-
-
- private:
-
- std::ostream* m_pWriter;
- size_t m_numContigs;
- size_t m_basesWritten;
-};
-
-#endif
View
153 src/Algorithm/MetagenomeBuilder.cpp
@@ -1,153 +0,0 @@
-///----------------------------------------------
-// Copyright 2011 Wellcome Trust Sanger Institute
-// Written by Jared Simpson (js18@sanger.ac.uk)
-// Released under the GPL
-//-----------------------------------------------
-//
-// MetagenomeBuilder -- Implementation of the metagenome
-// assembly process. This class takes in a kmer and
-// assembles a contig locally around that sequence
-//
-#include "MetagenomeBuilder.h"
-#include "BWTAlgorithms.h"
-
-//
-MetagenomeBuilder::MetagenomeBuilder()
-{
- m_frequencyFilter = 0.5;
- m_hardMinCoverage = 3;
- m_pGraph = new StringGraph;
-}
-
-//
-MetagenomeBuilder::~MetagenomeBuilder()
-{
- delete m_pGraph;
-}
-
-void MetagenomeBuilder::setSource(const std::string& seq, int coverage)
-{
- Vertex* pVertex = new(m_pGraph->getVertexAllocator()) Vertex(seq, seq);
- addVertex(pVertex, coverage);
-
- // Add the vertex to the extension queue
- m_queue.push(BuilderExtensionNode(pVertex, ED_SENSE));
- m_queue.push(BuilderExtensionNode(pVertex, ED_ANTISENSE));
-}
-
-//
-void MetagenomeBuilder::setIndex(const BWT* pBWT, const BWT* pRevBWT,
- const BWTIntervalCache* pFwdCache, const BWTIntervalCache* pRevCache)
-{
- m_pBWT = pBWT;
- m_pRevBWT = pRevBWT;
- m_pBWTCache = pFwdCache;
- m_pRevBWTCache = pRevCache;
-}
-
-//
-void MetagenomeBuilder::setKmerParameters(size_t k, size_t threshold)
-{
- m_kmer = k;
- m_kmerThreshold = threshold;
-}
-
-//
-void MetagenomeBuilder::run()
-{
- assert(!m_queue.empty());
- size_t numIters = 0;
-
- while(!m_queue.empty())
- {
- numIters += 1;
- BuilderExtensionNode curr = m_queue.front();
- m_queue.pop();
-
- // Calculate de Bruijn extensions for this node
- std::string strX = curr.pVertex->getSeq().toString();
-
- // Count the number of branches from this sequence
- std::pair<std::string, int> nodeY = getBestEdgeNode(strX, m_vertexCoverageMap[strX], curr.direction);
- std::string& strY = nodeY.first;
- int coverageY = nodeY.second;
-
- if(strY != "")
- {
- // Get the best node in the opposite direction for
- std::pair<std::string, int> nodeZ = getBestEdgeNode(strY, coverageY, !curr.direction);
- std::string& strZ = nodeZ.first;
- if(strZ == "" || strZ != strX)
- {
- // Either Y does not have an unambiguous best connection or it is
- // not X. Either way, we stop the extension.
- continue;
- }
- }
- else
- {
- continue;
- }
-
- // Create the new vertex and edge in the graph
- // If this vertex already exists, the graph must contain a loop so we stop
- if(m_pGraph->getVertex(strY) != NULL)
- break;
-
- Vertex* pNewVertex = new(m_pGraph->getVertexAllocator()) Vertex(strY, strY);
- addVertex(pNewVertex, coverageY);
- VariationBuilderCommon::addSameStrandDeBruijnEdges(m_pGraph, curr.pVertex, pNewVertex, curr.direction);
-
- // Add the vertex to the extension queue
- m_queue.push(BuilderExtensionNode(pNewVertex, curr.direction));
- }
- // Done extension
-}
-
-// Get the best de Bruijn graph node connected to nodeX
-// If ambiguous, the empty string is returned
-std::pair<std::string, int> MetagenomeBuilder::getBestEdgeNode(const std::string& nodeX, size_t nodeCoverage, EdgeDir direction)
-{
- AlphaCount64 extensionCounts = BWTAlgorithms::calculateDeBruijnExtensions(nodeX,
- m_pBWT,
- m_pRevBWT,
- direction,
- m_pBWTCache,
- m_pRevBWTCache);
-
- size_t cov_threshold = static_cast<size_t>(std::max(m_frequencyFilter * nodeCoverage, (double)m_hardMinCoverage));
- bool uniqueExtension = extensionCounts.hasUniqueDNAChar() ||
- VariationBuilderCommon::countValidExtensions(extensionCounts, cov_threshold) == 1;
-
- std::pair<std::string, int> ret;
- // Fail due to ambiguity
- if(!uniqueExtension)
- return ret;
-
- // Output the sequence of the vertex linked
- for(size_t i = 0; i < DNA_ALPHABET::size; ++i)
- {
- char b = DNA_ALPHABET::getBase(i);
- size_t count = extensionCounts.get(b);
- if(!uniqueExtension || count < cov_threshold)
- continue;
- ret.first = VariationBuilderCommon::makeDeBruijnVertex(nodeX, b, direction);
- ret.second = count;
- return ret;
- }
- return ret;
-}
-
-void MetagenomeBuilder::getContigs(StringVector& contigs)
-{
- m_pGraph->simplify();
- m_pGraph->getVertexSequences(contigs);
-}
-
-
-// Add a vertex to the graph
-void MetagenomeBuilder::addVertex(Vertex* pVertex, int coverage)
-{
- m_pGraph->addVertex(pVertex);
- m_vertexCoverageMap[pVertex->getSeq().toString()] = coverage;
-}
View
67 src/Algorithm/MetagenomeBuilder.h
@@ -1,67 +0,0 @@
-///----------------------------------------------
-// Copyright 2011 Wellcome Trust Sanger Institute
-// Written by Jared Simpson (js18@sanger.ac.uk)
-// Released under the GPL
-//-----------------------------------------------
-//
-// MetagenomeBuilder -- Implementation of the metagenome
-// assembly process. This class takes in a kmer and
-// assembles a contig locally around that sequence
-//
-#ifndef METAGENOME_BUILDER_H
-#define METAGENOME_BUILDER_H
-
-#include "BWT.h"
-#include "BWTIntervalCache.h"
-#include "SGUtil.h"
-#include "VariationBuilderCommon.h"
-
-class MetagenomeBuilder
-{
- public:
-
- MetagenomeBuilder();
- ~MetagenomeBuilder();
-
- // Set parameters
- void setSource(const std::string& seq, int coverage);
- void setIndex(const BWT* pBWT,
- const BWT* pRevBWT,
- const BWTIntervalCache* pFwdCache,
- const BWTIntervalCache* pRevCache);
-
- void setKmerParameters(size_t k, size_t threshold);
-
- // run the assembly
- void run();
-
- // Get the contigs from the graph
- void getContigs(StringVector& contigs);
-
- private:
-
- // Functions
- // Add a vertex to the graph
- void addVertex(Vertex* pVertex, int coverage);
-
- // Calculate the best vertex linked to the passed in vertex
- std::pair<std::string, int> getBestEdgeNode(const std::string& nodeX, size_t nodeCoverage, EdgeDir direction);
-
- // Data
-
- StringGraph* m_pGraph;
- StrIntMap m_vertexCoverageMap;
- BuilderExtensionQueue m_queue;
-
- const BWT* m_pBWT;
- const BWT* m_pRevBWT;
- const BWTIntervalCache* m_pBWTCache;
- const BWTIntervalCache* m_pRevBWTCache;
- size_t m_kmer;
- size_t m_kmerThreshold;
-
- double m_frequencyFilter;
- int m_hardMinCoverage;
-};
-
-#endif
View
1 src/SGA/Makefile.am
@@ -54,7 +54,6 @@ sga_SOURCES = sga.cpp \
var2vcf.h var2vcf.cpp \
hapgen.h hapgen.cpp \
gapfill.h gapfill.cpp \
- metagenome.h metagenome.cpp \
variant-detectability.h variant-detectability.cpp \
rewrite-evidence-bam.h rewrite-evidence-bam.cpp \
haplotype-filter.h haplotype-filter.cpp \
View
215 src/SGA/metagenome.cpp
@@ -1,215 +0,0 @@
-//-----------------------------------------------
-// Copyright 2011 Wellcome Trust Sanger Institute
-// Written by Jared Simpson (js18@sanger.ac.uk)
-// Released under the GPL
-//-----------------------------------------------
-//
-// metagenome - Assemble metagenomics data
-//
-#include <iostream>
-#include <fstream>
-#include <sstream>
-#include <iterator>
-#include "Util.h"
-#include "SuffixArray.h"
-#include "BWT.h"
-#include "Timer.h"
-#include "BWTAlgorithms.h"
-#include "SequenceProcessFramework.h"
-#include "SGACommon.h"
-#include "BitVector.h"
-#include "MetAssembleProcess.h"
-#include "metagenome.h"
-
-// Defines to clarify awful template function calls
-#define PROCESS_METASSEMBLE_SERIAL SequenceProcessFramework::processSequencesSerial<SequenceWorkItem, MetAssembleResult, \
- MetAssemble, MetAssembleAggregateResults>
-
-#define PROCESS_METASSEMBLE_PARALLEL SequenceProcessFramework::processSequencesParallel<SequenceWorkItem, MetAssembleResult, \
- MetAssemble, MetAssembleAggregateResults>
-
-
-//
-// Getopt
-//
-#define SUBPROGRAM "metagenome"
-static const char *METAGENOME_VERSION_MESSAGE =
-SUBPROGRAM " Version " PACKAGE_VERSION "\n"
-"Written by Jared Simpson.\n"
-"\n"
-"Copyright 2011 Wellcome Trust Sanger Institute\n";
-
-static const char *METAGENOME_USAGE_MESSAGE =
-"Usage: " PACKAGE_NAME " " SUBPROGRAM " [OPTION] READS\n"
-"Assemble contigs from the metagenomics data in READS\n"
-"\n"
-" --help display this help and exit\n"
-" -v, --verbose display verbose output\n"
-" -k, --kmer=K use a k-mer size of size K\n"
-" -x, --kmer-threshold=T only use kmers seen at least T times\n"
-" -t, --threads=NUM use NUM computation threads\n"
-" -d, --sample-rate=N use occurrence array sample rate of N in the FM-index. Higher values use significantly\n"
-" less memory at the cost of higher runtime. This value must be a power of 2 (default: 128)\n"
-" -o, --outfile=FILE write contigs to FILE (default: contigs.fa)\n"
-"\nReport bugs to " PACKAGE_BUGREPORT "\n\n";
-
-static const char* PROGRAM_IDENT =
-PACKAGE_NAME "::" SUBPROGRAM;
-
-namespace opt
-{
- static unsigned int verbose;
- static int numThreads = 1;
- static int kmer = 51;
- static int kmerThreshold = 4;
- static int sampleRate = 128;
- static int cacheLength = 10;
- static size_t minLength = 200;
-
- static std::string inFile;
- static std::string outFile = "contigs.fa";
-}
-
-static const char* shortopts = "o:d:k:t:x:v";
-
-enum { OPT_HELP = 1, OPT_VERSION };
-
-static const struct option longopts[] = {
- { "verbose", no_argument, NULL, 'v' },
- { "threads", required_argument, NULL, 't' },
- { "outfile", required_argument, NULL, 'o' },
- { "kmer", required_argument, NULL, 'k' },
- { "kmer-threshold",required_argument, NULL, 'x' },
- { "sample-rate", required_argument, NULL, 'd' },
- { "help", no_argument, NULL, OPT_HELP },
- { "version", no_argument, NULL, OPT_VERSION },
- { NULL, 0, NULL, 0 }
-};
-
-//
-// Main
-//
-int metagenomeMain(int argc, char** argv)
-{
- Timer progTimer(PROGRAM_IDENT);
-
- parseMetagenomeOptions(argc, argv);
-
- // Create BWTS
- std::string prefix = stripFilename(opt::inFile);
- BWT* pBWT = new BWT(prefix + BWT_EXT, opt::sampleRate);
- BWT* pRevBWT = new BWT(prefix + RBWT_EXT, opt::sampleRate);
- pBWT->printInfo();
-
- // Create the shared bit vector and shared results aggregator
- BitVector* pSharedBitVector = new BitVector(pBWT->getBWLen());
-
- // Create interval caches to speed up k-mer lookups
- BWTIntervalCache* pBWTCache = new BWTIntervalCache(opt::cacheLength, pBWT);
- BWTIntervalCache* pRevBWTCache = new BWTIntervalCache(opt::cacheLength, pRevBWT);
-
- MetAssembleParameters sharedParameters;
- sharedParameters.pBWT = pBWT;
- sharedParameters.pRevBWT = pRevBWT;
- sharedParameters.pBWTCache = pBWTCache;
- sharedParameters.pRevBWTCache = pRevBWTCache;
- sharedParameters.kmer = opt::kmer;
- sharedParameters.kmerThreshold = opt::kmerThreshold;
- sharedParameters.pBitVector = pSharedBitVector;
- sharedParameters.minLength = opt::minLength;
-
- MetAssembleAggregateResults resultsProcess(opt::outFile);
-
- if(opt::numThreads <= 1)
- {
- printf("[%s] starting serial-mode assembly\n", PROGRAM_IDENT);
- MetAssemble assembleProcess(sharedParameters);
- PROCESS_METASSEMBLE_SERIAL(opt::inFile, &assembleProcess, &resultsProcess);
- }
- else
- {
- printf("[%s] starting parallel-mode assembly with %d threads\n", PROGRAM_IDENT, opt::numThreads);
-
- std::vector<MetAssemble*> processorVector;
- for(int i = 0; i < opt::numThreads; ++i)
- {
- MetAssemble* pProcessor = new MetAssemble(sharedParameters);
- processorVector.push_back(pProcessor);
- }
-
- PROCESS_METASSEMBLE_PARALLEL(opt::inFile, processorVector, &resultsProcess);
-
- for(size_t i = 0; i < processorVector.size(); ++i)
- {
- delete processorVector[i];
- processorVector[i] = NULL;
- }
- }
-
- // Cleanup
- delete pBWT;
- delete pRevBWT;
- delete pBWTCache;
- delete pRevBWTCache;
- delete pSharedBitVector;
-
- if(opt::numThreads > 1)
- pthread_exit(NULL);
-
- return 0;
-}
-
-//
-// Handle command line arguments
-//
-void parseMetagenomeOptions(int argc, char** argv)
-{
- bool die = false;
- for (char c; (c = getopt_long(argc, argv, shortopts, longopts, NULL)) != -1;)
- {
- std::istringstream arg(optarg != NULL ? optarg : "");
- switch (c)
- {
- case 'k': arg >> opt::kmer; break;
- case 'x': arg >> opt::kmerThreshold; break;
- case 'o': arg >> opt::outFile; break;
- case 't': arg >> opt::numThreads; break;
- case 'd': arg >> opt::sampleRate; break;
- case '?': die = true; break;
- case 'v': opt::verbose++; break;
- case OPT_HELP:
- std::cout << METAGENOME_USAGE_MESSAGE;
- exit(EXIT_SUCCESS);
- case OPT_VERSION:
- std::cout << METAGENOME_VERSION_MESSAGE;
- exit(EXIT_SUCCESS);
- }
- }
-
- // Validate parameters
- if (argc - optind < 1)
- {
- std::cerr << SUBPROGRAM ": missing arguments\n";
- die = true;
- }
-
- if (argc - optind > 1)
- {
- std::cerr << SUBPROGRAM ": too many arguments\n";
- die = true;
- }
-
- if(opt::numThreads <= 0)
- {
- std::cerr << SUBPROGRAM ": invalid number of threads: " << opt::numThreads << "\n";
- die = true;
- }
-
- if (die)
- {
- std::cout << "\n" << METAGENOME_USAGE_MESSAGE;
- exit(EXIT_FAILURE);
- }
-
- opt::inFile = argv[optind++];
-}
View
22 src/SGA/metagenome.h
@@ -1,22 +0,0 @@
-//-----------------------------------------------
-// Copyright 2011 Wellcome Trust Sanger Institute
-// Written by Jared Simpson (js18@sanger.ac.uk)
-// Released under the GPL
-//-----------------------------------------------
-//
-// metagenome - Assemble metagenomics data
-//
-#ifndef METAGENOME_H
-#define METAGENOME_H
-#include <getopt.h>
-#include "config.h"
-
-// functions
-
-//
-int metagenomeMain(int argc, char** argv);
-
-// options
-void parseMetagenomeOptions(int argc, char** argv);
-
-#endif
View
4 src/SGA/sga.cpp
@@ -35,7 +35,6 @@
#include "hapgen.h"
#include "var2vcf.h"
#include "gapfill.h"
-#include "metagenome.h"
#include "variant-detectability.h"
#include "rewrite-evidence-bam.h"
#include "haplotype-filter.h"
@@ -79,7 +78,6 @@ static const char *SGA_USAGE_MESSAGE =
" stats print summary statistics about a read set\n"
" filterBAM filter out contaminating mate-pair data in a BAM file\n"
" cluster find clusters of reads belonging to the same connected component in an assembly graph\n"
-" metagenome assemble contigs from metagenomics data\n"
//" correct-long correct long reads\n"
//" connect resolve the complete sequence of a paired-end fragment\n"
//" var2vcf convert aligned variant sequences found by graph-diff into a VCF file\n"
@@ -161,8 +159,6 @@ int main(int argc, char** argv)
hapgenMain(argc - 1, argv + 1);
else if(command == "gapfill")
gapfillMain(argc - 1, argv + 1);
- else if(command == "metagenome")
- metagenomeMain(argc - 1, argv + 1);
else if(command == "variant-detectability")
variantDetectabilityMain(argc - 1, argv + 1);
else if(command == "rewrite-evidence-bam")

0 comments on commit ecd06c8

Please sign in to comment.
Something went wrong with that request. Please try again.