File: distancecommand.h

package info (click to toggle)
mothur 1.48.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,684 kB
  • sloc: cpp: 161,854; makefile: 122; sh: 31
file content (106 lines) | stat: -rwxr-xr-x 2,944 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#ifndef DISTANCECOMMAND_H
#define DISTANCECOMMAND_H

/*
 *  distancecommand.h
 *  Mothur
 *
 *  Created by Sarah Westcott on 5/7/09.
 *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
 *
 */

#include "mothur.h"
#include "command.hpp"
#include "validcalculator.h"
#include "calculator.h"
#include "sequencedb.h"
#include "ignoregaps.h"
#include "eachgapdist.h"
#include "eachgapignore.h"
#include "onegapdist.h"
#include "onegapignore.h"
#include "jtt.hpp"
#include "writer.h"
#include "proteindb.hpp"
#include "pmb.hpp"
#include "pam.hpp"
#include "kimura.hpp"

/**************************************************************************************************/
struct distanceData {
    long long startLine, endLine, numNewFasta, count;
	float cutoff;
    StorageDatabase* db;
    StorageDatabase* oldFastaDB;
	MothurOut* m;
	OutputWriter* threadWriter;
    string outputFileName, calc;
	bool countends, prot;
    Utils util;
	
	distanceData(){}
    distanceData(OutputWriter* ofn) {
        threadWriter = ofn;
        m = MothurOut::getInstance();
    }
    
    distanceData(string ofn) {
        outputFileName = ofn;
        m = MothurOut::getInstance();
    }
	void setVariables(int s, int e,  float c, StorageDatabase*& dbsp, StorageDatabase*& oldfn, string Est, bool met, long long num, bool cnt) {
		startLine = s;
		endLine = e;
		cutoff = c;
		db = dbsp;
        oldFastaDB = oldfn;
		calc = Est;
        prot = met;
		numNewFasta = num;
		countends = cnt;
        count = 0;
	}
};
/**************************************************************************************************/
class DistanceCommand : public Command {

public:
    DistanceCommand(string);
    DistanceCommand(StorageDatabase*&, string, double, string, int); //used by mothur's splitMatrix class to avoid rereading files
	~DistanceCommand() = default;
	
	vector<string> setParameters();
	string getCommandName()			{ return "dist.seqs";			}
	string getCommandCategory()		{ return "Sequence Processing";	}
	
	string getHelpString();	
    string getOutputPattern(string);	
	string getCitation() { return "Schloss PD (2010). The effects of alignment quality, distance calculation method, sequence filtering, and region on the analysis of 16S rRNA gene-based studies. PLoS Comput Biol 6: e1000844. \nhttp://www.mothur.org/wiki/Dist.seqs"; }
	string getDescription()		{ return "calculate the pairwaise distances between aligned sequences"; }

	int execute(); 
	void help() { m->mothurOut(getHelpString()); }	
	
	
private:
	
    StorageDatabase* db;
	string output, fastafile, calc,  oldfastafile, column;
    int processors;
    long long numNewFasta, numSeqs, numDistsBelowCutoff;
	float cutoff;
	
	bool abort, countends, fitCalc, prot, compress;
	vector<string> outputNames; 
	
	void createProcesses(string);
	bool sanityCheck();
};

#endif

/**************************************************************************************************/