Commit 3f1306ad authored by Andreas Tille's avatar Andreas Tille
Browse files

New upstream version 1.2.0-201605+dfsg

parent 0f42656b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line

all: 
		g++ -O3 -std=c++11 spaced.cc  variance.cpp patternset.cpp extkey.cpp -o spaced -fopenmp
		g++ -O3 -fopenmp -std=c++11 src/spaced.cc  src/variance.cpp src/patternset.cpp -o spaced
 

extkey.cpp

deleted100644 → 0
+0 −73
Original line number Diff line number Diff line
/** 
 * This programm calculates the variance/OC and/or the sensitivity of a set of pattern with the same weight.
 * It is possible to improve your patternset and read patterns from a file.
 *
 * extended key object file
 *
 * For theory please have a look at:
 *
 * B. Morgenstern, B. Zhu, S. Horwege, C.-A Leimeister (2015)
 * Estimating evolutionary distances between genomic sequences from spaced-word matches
 * Algorithms for Molecular Biology 10, 5. (http://www.almob.org/content/10/1/5/abstract)
 *
 *
 * @author: Lars Hahn - 26.10.2015, Georg-August-Universitaet Goettingen
 * @version: 1.0.2 11/2015
 */
#include "extkey.h"

/*---Variables---------------------------------------------------------------*/


/*===Main-Part===============================================================*/
/*---Constructor-& Init------------------------------------------------------*/
extkey::extkey(){
	extkey(1,1);
}

extkey::extkey(int pos, double value){
	this->pos = pos;
	this->value = value;
}


/*---Functions---------------------------------------------------------------*/
int extkey::GetPos(){
	return pos;
}

double extkey::GetValue(){
	return value;
}

void extkey::SetValue(double value){
	this->value = value;
}

bool extkey::operator < (extkey const& p) const{
		return (value < p.value);
}

bool extkey::operator <= (extkey const& p) const{
		return (value <= p.value);
}

bool extkey::operator > (extkey const& p) const{
		return (value > p.value);
}

bool extkey::operator >= (extkey const& p) const{
		return (value >= p.value);
}

bool extkey::operator == (extkey const& p) const{
		return (value == p.value);
}

bool extkey::operator || (extkey const& p) const{
		return (value || p.value);
}

bool extkey::operator != (extkey const& p) const{
		return (value != p.value);
}

extkey.h

deleted100644 → 0
+0 −41
Original line number Diff line number Diff line
/**
 * This programm calculates the variance/OC and/or the sensitivity of a set of pattern with the same weight.
 * It is possible to improve your patternset and read patterns from a file.
 *
 * extended key object header
 *
 * For theory please have a look at:
 *
 * B. Morgenstern, B. Zhu, S. Horwege, C.-A Leimeister (2015)
 * Estimating evolutionary distances between genomic sequences from spaced-word matches
 * Algorithms for Molecular Biology 10, 5. (http://www.almob.org/content/10/1/5/abstract)
 *
 *
 * @author: Lars Hahn - 26.10.2015, Georg-August-Universitaet Goettingen
 * @version: 1.0.2 11/2015
 */
#ifndef EXTKEY_H_
#define EXTKEY_H_

class extkey{
	public:
		extkey();
		extkey(int pos, double value);

		int GetPos();
		double GetValue();
		void SetValue(double value);
	
		bool operator < (extkey const& p) const;
		bool operator <= (extkey const& p) const;
		bool operator > (extkey const& p) const;
		bool operator >= (extkey const& p) const;
		bool operator == (extkey const& p) const;
		bool operator != (extkey const& p) const;
		bool operator || (extkey const& p) const;

	private:
		int pos;
		double value;
};
#endif

patternset.cpp

deleted100644 → 0
+0 −1050

File deleted.

Preview size limit exceeded, changes collapsed.

patternset.h

deleted100644 → 0
+0 −103
Original line number Diff line number Diff line
/**
 * This programm calculates the variance/OC and/or the sensitivity of a set of pattern with the same weight.
 * It is possible to improve your patternset and read patterns from a file.
 *
 * patternset object header
 *
 * For theory please have a look at:
 *
 * B. Morgenstern, B. Zhu, S. Horwege, C.-A Leimeister (2015)
 * Estimating evolutionary distances between genomic sequences from spaced-word matches
 * Algorithms for Molecular Biology 10, 5. (http://www.almob.org/content/10/1/5/abstract)
 *
 *
 * @author: Lars Hahn - 26.10.2015, Georg-August-Universitaet Goettingen
 * @version: 1.0.2 11/2015
 */
#ifndef PATTERNSET_H_
#define PATTERNSET_H_


#include <iostream>
#include <fstream>
#include <random>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include "extkey.h"

class patternset {
public:
	patternset();
	patternset(char* pattern_file);
	patternset(int size, int *length, int weight);
	patternset(char* pattern_file, int size, int *length, int weight);
	~patternset();

	void ReInitPattern();

	void ChangeBits(int number);
	uint64_t ChangeBitPos(int pos, int pos_one, int pos_zero);
	bool UniqPattern(int number);

	std::vector<std::string> GetStringPattern();
	std::string GetString(int number);
	uint64_t GetPattern(int number);
	int GetWeight();
	int GetSize();
	int* GetLength();
	int GetLengthMean();
	bool GetImprove();
	bool GetUpdate();

	double GetValue(int number);
	void SetPattern(int number, uint64_t patt);
	void Print();
	void Silent();
	void RandPatLength();

protected:
	void Clear();
	void TestPattern();
	void VerifyConditions();

	std::vector<std::string> SplitString(std::string pattern, char* tokens);
	bool ValidatePatternsFormat(std::string pattern_form);
	bool ValidatePatternConditions();
	int PatternWeight(std::string pattern_wght);
	int* PatternLength(std::vector<std::string> pattern_length);

	void CreateLengths();
	void CreateRandomPattern();
	bool IsSetScore(int pattern);
	int SymbolRandPos(int number, char symb);
	int SymbolCalcPos(int number, char symb);
	std::vector<int> GetSymbol(int number, char symb);

	void ToString();
	uint64_t ToBit(std::string p);
	std::string BitString(uint64_t p);

	double MaxNumberPattern(int p_weight, int p_length);
	double Faculty(int value);
	void SecureMessage(std::string errmsg, int pos);

private:
	std::vector<uint64_t> pattern_set;
	std::vector<std::string> string_pat;
	std::vector<int> lengths;	
	int size;
	int *length;
	int length_mean;
	int weight;
	char* pattern_file = NULL;
	bool improve;
	bool update;
	bool silent;
	bool randpatleng;
};
#endif
Loading