File: DNAFileSML.cpp

package info (click to toggle)
libmems 1.6.0%2B4725-9
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 2,120 kB
  • sloc: cpp: 21,579; ansic: 4,312; xml: 115; makefile: 103; sh: 26
file content (68 lines) | stat: -rw-r--r-- 1,912 bytes parent folder | download | duplicates (6)
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
/*******************************************************************************
 * $Id: DNAFileSML.cpp,v 1.4 2004/03/01 02:40:08 darling Exp $
 * This file is copyright 2002-2007 Aaron Darling and authors listed in the AUTHORS file.
 * Please see the file called COPYING for licensing, copying, and modification
 * Please see the file called COPYING for licensing details.
 * **************
 ******************************************************************************/

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "libGenome/gnSequence.h"
#include "libGenome/gnFilter.h"
#include "libMems/DNAFileSML.h"

using namespace std;
using namespace genome;
namespace mems {

DNAFileSML::DNAFileSML() : FileSML(){
	FileSML::header.version = FormatVersion();
}

DNAFileSML::DNAFileSML(const string& fname, const uint8* table, const uint32 alpha_bits){
	header.alphabet_bits = alpha_bits;
	memcpy(header.translation_table, table, UINT8_MAX);
	filename = fname;
	header.version = FormatVersion();
}

DNAFileSML& DNAFileSML::operator=(const DNAFileSML& msa ){
	FileSML::operator=(msa);
	return *this;
}

DNAFileSML* DNAFileSML::Clone() const{
	DNAFileSML *bdsa = new DNAFileSML();
	(*bdsa) = *this;
	return bdsa;
}

uint64 DNAFileSML::GetNeededMemory(gnSeqI len){
	uint64 neededmem = (len * FileSML::header.alphabet_bits) / 8;
	//forward and reverse copies of the sequence
	neededmem += len * 2;
	neededmem += sizeof(bmer) * len;
	return neededmem;
}

uint32 DNAFileSML::CalculateMaxMerSize() const{
	return 62 / header.alphabet_bits;
}

uint64 DNAFileSML::GetMer(gnSeqI position) const{
	return GetDnaMer( position );
}

uint64 DNAFileSML::GetSeedMer( gnSeqI offset ) const{
	return GetDnaSeedMer( offset );
}

void DNAFileSML::FillSML(const gnSequence& seq, vector<bmer>& sml_array)
{
	FillDnaSML(seq, sml_array);
}

} // namespace mems