// File: /workspace/github_cpp_makefile_star2_O1/gcollet[P]MstatX/src/msa.cpp
// Function: Msa::Msa(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
Msa :: Msa(string fname)
{
	/* Open file */
	if (Options::Get().verbose){
		cout << "Read Multiple Alignment in " << fname << "\n";
	}
	ifstream file(fname.c_str());
	if (!file.good()){
	  cerr << "Cannot open file " << fname << "\n";
		exit(0);
	}

	
	/* Read file */
	string s, tmp_seq;
	while (file.good() && (int) mali_seq.size() < Options::Get().nb_seq){
		getline(file,s);
		if (s[0] == '>'){
			if (mali_name.size() != 0){
			  mali_seq.push_back(tmp_seq);	
			}
			if ((int) mali_seq.size() < Options::Get().nb_seq){
  			mali_name.push_back(s.substr(1, s.find_first_of(' ') - 1));
			}
			tmp_seq.clear();
		} else {
			tmp_seq = tmp_seq + s;
		}
	}
	if ((int) mali_seq.size() < Options::Get().nb_seq){
	  mali_seq.push_back(tmp_seq);
	}
	
	nseq = (int) mali_name.size();
	ncol = (int) mali_seq[0].size();
	cout << "\nMultiple alignment : nb seq = "<<nseq<<", nb col = "<<ncol<<"\n";
	
	/* Change all mali.seq in upper case*/
	for (int i(0); i < nseq; ++i){
		for(int j(0); j < ncol; ++j){
			mali_seq[i][j] = toupper(mali_seq[i][j]);
		}
	}
	
	/* Analyse the multiple alignment */
	defineAlphabet();
	countGap();
	countFreq();
	countType();
	countEntropy();
	
	
	/* Print if verbose mode */
	if (Options::Get().verbose){
		cout << "\nAlphabet :\n";
	  for(int i(0); i < (int) alphabet.size(); ++i){
			cout << alphabet[i] << ";";
		}
		cout << "\n";
		cout << "\nMultiple Alignment :\n";
	  for(int i(0); i <nseq; ++i){
			cout << mali_seq[i] << "\n";
		}
		cout << "\nAA Frequencies :\n";
		for (int i(0); i < (int) aa_freq.size(); ++i){
			cout << aa_freq[i] << ";";
		}
		cout << "\n";
		cout << "\nGap counts :\n";
		for (int i(0); i < (int) gap_counts.size(); ++i){
			cout << gap_counts[i] << ";";
		}
		cout << "\n";
		cout << "\nAA Entropy :\n";
		for (int i(0); i < (int) entropy.size(); ++i){
			if (gap_counts[i] < nseq/10){
		  	cout << entropy[i] << ";";
			} else {
				cout << "-12.0;";
			}
		}
		cout << "\n";
		cout << "\nAA Types :\n";
		for (int i(0); i < (int) nb_type.size(); ++i){
				cout << nb_type[i] << ";";
		}
		cout << "\n";
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x288, %rsp            # imm = 0x288
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x10(%rdi), %r15
movq %r15, (%rdi)
movq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
addq $0x20, %rdi
leaq 0x38(%rbx), %rbp
movl $0xa8, %edx
movq %rdi, 0x18(%rsp)
xorl %esi, %esi
callq 0x4140
callq 0x4f1c
cmpb $0x1, 0xec(%rax)
jne 0xafb0
movq 0xb048(%rip), %rdi      # 0x15fc0
leaq 0x56a1(%rip), %rsi      # 0x10620
movl $0x1b, %edx
callq 0x42a0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq 0xb029(%rip), %rdi      # 0x15fc0
callq 0x42a0
leaq 0x5549(%rip), %rsi      # 0x104ec
movl $0x1, %edx
movq %rax, %rdi
callq 0x42a0
movq (%r14), %rsi
leaq 0x80(%rsp), %r12
movq %r12, %rdi
movl $0x8, %edx
callq 0x4480
movq %rbp, 0x8(%rsp)
movq %r15, 0x10(%rsp)
movq 0x80(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0xa0(%rsp,%rax)
jne 0xb686
leaq 0x70(%rsp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x50(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
movq 0x80(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0xa0(%rsp,%rax)
jne 0xb16f
leaq 0x60(%rsp), %r13
leaq 0x20(%rsp), %rbp
movq 0x38(%rbx), %r14
movq 0x40(%rbx), %r15
callq 0x4f1c
subq %r14, %r15
shrq $0x5, %r15
cmpl %r15d, 0xe8(%rax)
jle 0xb16f
movq 0x80(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x4220
movsbl %al, %edx
movq %r12, %rdi
movq %r13, %rsi
callq 0x4490
movq 0x60(%rsp), %rax
cmpb $0x3e, (%rax)
jne 0xb11b
movq 0x28(%rbx), %rax
cmpq 0x20(%rbx), %rax
je 0xb09f
movq 0x8(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0xc544
movq 0x38(%rbx), %r14
movq 0x40(%rbx), %r15
callq 0x4f1c
subq %r14, %r15
shrq $0x5, %r15
cmpl %r15d, 0xe8(%rax)
jle 0xb108
movq %r13, %rdi
movl $0x20, %esi
xorl %edx, %edx
callq 0x4330
leaq -0x1(%rax), %rcx
movl $0x1, %edx
movq %rbp, %rdi
movq %r13, %rsi
callq 0x4270
movq 0x18(%rsp), %rdi
movq %rbp, %rsi
callq 0xa328
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0xb108
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x4250
movq $0x0, 0x48(%rsp)
movq 0x40(%rsp), %rax
movb $0x0, (%rax)
jmp 0xb155
movq %rbp, %rdi
leaq 0x40(%rsp), %r14
movq %r14, %rsi
movq %r13, %rdx
callq 0xc581
movq %r14, %rdi
movq %rbp, %rsi
callq 0x4300
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0xb155
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x4250
movq 0x80(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0xa0(%rsp,%rax)
je 0xb030
movq 0x38(%rbx), %r15
movq 0x40(%rbx), %r14
movq 0x8(%rsp), %rbp
callq 0x4f1c
subq %r15, %r14
shrq $0x5, %r14
cmpl %r14d, 0xe8(%rax)
jle 0xb19e
leaq 0x40(%rsp), %rsi
movq %rbp, %rdi
callq 0xc544
movq 0x28(%rbx), %rax
movq 0x38(%rbx), %rcx
subq 0x20(%rbx), %rax
shrq $0x5, %rax
movl %eax, 0xc8(%rbx)
movl 0x8(%rcx), %eax
movl %eax, 0xcc(%rbx)
movq 0xadfc(%rip), %rdi      # 0x15fc0
leaq 0x5471(%rip), %rsi      # 0x1063c
movl $0x1f, %edx
callq 0x42a0
movl 0xc8(%rbx), %esi
movq 0xadde(%rip), %rdi      # 0x15fc0
callq 0x4420
movq %rax, %r14
leaq 0x546b(%rip), %rsi      # 0x1065c
movl $0xb, %edx
movq %rax, %rdi
callq 0x42a0
movl 0xcc(%rbx), %esi
movq %r14, %rdi
callq 0x4420
leaq 0x52d9(%rip), %rsi      # 0x104ec
movl $0x1, %edx
movq %rax, %rdi
callq 0x42a0
cmpl $0x0, 0xc8(%rbx)
jle 0xb275
xorl %r14d, %r14d
cmpl $0x0, 0xcc(%rbx)
jle 0xb266
movq %r14, %r15
shlq $0x5, %r15
xorl %r12d, %r12d
movq 0x38(%rbx), %rax
movq (%rax,%r15), %r13
movsbl (%r13,%r12), %edi
callq 0x44a0
movb %al, (%r13,%r12)
incq %r12
movslq 0xcc(%rbx), %rax
cmpq %rax, %r12
jl 0xb23f
incq %r14
movslq 0xc8(%rbx), %rax
cmpq %rax, %r14
jl 0xb22c
movq %rbx, %rdi
callq 0xb818
movq %rbx, %rdi
callq 0xb8ac
movq %rbx, %rdi
callq 0xb954
movq %rbx, %rdi
callq 0xbaec
movq %rbx, %rdi
callq 0xbc44
callq 0x4f1c
cmpb $0x1, 0xec(%rax)
jne 0xb62f
movq 0xad0a(%rip), %rdi      # 0x15fc0
leaq 0x53ab(%rip), %rsi      # 0x10668
movl $0xc, %edx
callq 0x42a0
cmpl $0x0, 0x8(%rbx)
jle 0xb31a
xorl %r15d, %r15d
movq 0xace9(%rip), %r14      # 0x15fc0
leaq 0x20(%rsp), %r12
leaq 0x53df(%rip), %r13      # 0x106c2
movq (%rbx), %rax
movb (%rax,%r15), %al
movb %al, 0x20(%rsp)
movl $0x1, %edx
movq %r14, %rdi
movq %r12, %rsi
callq 0x42a0
movl $0x1, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x42a0
incq %r15
movslq 0x8(%rbx), %rax
cmpq %rax, %r15
jl 0xb2e3
movq 0xac9f(%rip), %rdi      # 0x15fc0
leaq 0x51c4(%rip), %rsi      # 0x104ec
movl $0x1, %edx
callq 0x42a0
movq 0xac87(%rip), %rdi      # 0x15fc0
leaq 0x5335(%rip), %rsi      # 0x10675
movl $0x16, %edx
callq 0x42a0
cmpl $0x0, 0xc8(%rbx)
jle 0xb3a2
movl $0x8, %r15d
xorl %r13d, %r13d
movq 0xac5d(%rip), %r14      # 0x15fc0
leaq 0x5182(%rip), %r12      # 0x104ec
movq (%rbp), %rax
movq -0x8(%rax,%r15), %rsi
movq (%rax,%r15), %rdx
movq %r14, %rdi
callq 0x42a0
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x42a0
incq %r13
movslq 0xc8(%rbx), %rax
addq $0x20, %r15
cmpq %rax, %r13
jl 0xb36a
movq 0xac17(%rip), %rdi      # 0x15fc0
leaq 0x52dc(%rip), %rsi      # 0x1068c
movl $0x12, %edx
callq 0x42a0
movq 0x80(%rbx), %rax
movq 0x88(%rbx), %rcx
subq %rax, %rcx
shrq $0x2, %rcx
testl %ecx, %ecx
jle 0xb425
xorl %r15d, %r15d
movq 0xabe3(%rip), %r14      # 0x15fc0
leaq 0x52de(%rip), %r12      # 0x106c2
xorps %xmm0, %xmm0
cvtss2sd (%rax,%r15,4), %xmm0
movq %r14, %rdi
callq 0x43c0
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x42a0
incq %r15
movq 0x80(%rbx), %rax
movq 0x88(%rbx), %rcx
subq %rax, %rcx
shrq $0x2, %rcx
movslq %ecx, %rcx
cmpq %rcx, %r15
jl 0xb3e4
movq 0xab94(%rip), %rdi      # 0x15fc0
leaq 0x50b9(%rip), %rsi      # 0x104ec
movl $0x1, %edx
callq 0x42a0
movq 0xab7c(%rip), %rdi      # 0x15fc0
leaq 0x5254(%rip), %rsi      # 0x1069f
movl $0xe, %edx
callq 0x42a0
movq 0x68(%rbx), %rax
movq 0x70(%rbx), %rcx
subq %rax, %rcx
shrq $0x2, %rcx
testl %ecx, %ecx
jle 0xb4af
xorl %r15d, %r15d
movq 0xab4e(%rip), %r14      # 0x15fc0
leaq 0x5249(%rip), %r12      # 0x106c2
movl (%rax,%r15,4), %esi
movq %r14, %rdi
callq 0x4420
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x42a0
incq %r15
movq 0x68(%rbx), %rax
movq 0x70(%rbx), %rcx
subq %rax, %rcx
shrq $0x2, %rcx
movslq %ecx, %rcx
cmpq %rcx, %r15
jl 0xb479
movq 0xab0a(%rip), %rdi      # 0x15fc0
leaq 0x502f(%rip), %rsi      # 0x104ec
movl $0x1, %edx
callq 0x42a0
movq 0xaaf2(%rip), %r14      # 0x15fc0
leaq 0x51d9(%rip), %rsi      # 0x106ae
movl $0xe, %edx
movq %r14, %rdi
callq 0x42a0
movq 0x98(%rbx), %rcx
movq 0xa0(%rbx), %rax
subq %rcx, %rax
shrq $0x2, %rax
testl %eax, %eax
jle 0xb581
xorl %r15d, %r15d
leaq 0x51b4(%rip), %r12      # 0x106bd
leaq 0x51b2(%rip), %r13      # 0x106c2
movq 0x68(%rbx), %rdi
movslq 0xc8(%rbx), %rax
imulq $0x66666667, %rax, %r8  # imm = 0x66666667
movq %r8, %rax
shrq $0x3f, %rax
sarq $0x22, %r8
addl %eax, %r8d
movl $0x6, %edx
movq %r14, %rax
movq %r12, %rsi
cmpl %r8d, (%rdi,%r15,4)
jge 0xb55a
xorps %xmm0, %xmm0
cvtss2sd (%rcx,%r15,4), %xmm0
movq %r14, %rdi
callq 0x43c0
movl $0x1, %edx
movq %r13, %rsi
movq %rax, %rdi
callq 0x42a0
incq %r15
movq 0x98(%rbx), %rcx
movq 0xa0(%rbx), %rax
subq %rcx, %rax
shrq $0x2, %rax
cltq
cmpq %rax, %r15
jl 0xb510
movq 0xaa38(%rip), %rdi      # 0x15fc0
leaq 0x4f5d(%rip), %rsi      # 0x104ec
movl $0x1, %edx
callq 0x42a0
movq 0xaa20(%rip), %rdi      # 0x15fc0
leaq 0x511d(%rip), %rsi      # 0x106c4
movl $0xc, %edx
callq 0x42a0
movq 0xb0(%rbx), %rax
movq 0xb8(%rbx), %rcx
subq %rax, %rcx
shrq $0x2, %rcx
testl %ecx, %ecx
jle 0xb617
xorl %r15d, %r15d
movq 0xa9ec(%rip), %r14      # 0x15fc0
leaq 0x50e7(%rip), %r12      # 0x106c2
movl (%rax,%r15,4), %esi
movq %r14, %rdi
callq 0x4420
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x42a0
incq %r15
movq 0xb0(%rbx), %rax
movq 0xb8(%rbx), %rcx
subq %rax, %rcx
shrq $0x2, %rcx
movslq %ecx, %rcx
cmpq %rcx, %r15
jl 0xb5db
movq 0xa9a2(%rip), %rdi      # 0x15fc0
leaq 0x4ec7(%rip), %rsi      # 0x104ec
movl $0x1, %edx
callq 0x42a0
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0xb64b
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x4250
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0xb667
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4250
leaq 0x80(%rsp), %rdi
callq 0x4080
addq $0x288, %rsp            # imm = 0x288
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xa95b(%rip), %rdi      # 0x15fe8
leaq 0x498c(%rip), %rsi      # 0x10020
movl $0x11, %edx
callq 0x42a0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq 0xa93c(%rip), %rdi      # 0x15fe8
callq 0x42a0
leaq 0x4e34(%rip), %rsi      # 0x104ec
movq %rax, %rdi
callq 0x4230
xorl %edi, %edi
callq 0x42e0
movq %rax, %r12
movq 0x10(%rsp), %r15
movq 0x8(%rsp), %rbp
jmp 0xb75e
jmp 0xb708
movq %rax, %r12
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0xb80d
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x4250
jmp 0xb80d
jmp 0xb80a
movq %rax, %r12
jmp 0xb76b
jmp 0xb80a
jmp 0xb71e
jmp 0xb71e
jmp 0xb71e
jmp 0xb71e
jmp 0xb71e
jmp 0xb71e
movq %rax, %r12
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
movq 0x10(%rsp), %r15
je 0xb742
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x4250
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0xb75e
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4250
leaq 0x80(%rsp), %rdi
callq 0x4080
movq 0xb0(%rbx), %rdi
testq %rdi, %rdi
je 0xb786
movq 0xc0(%rbx), %rsi
subq %rdi, %rsi
callq 0x4250
movq 0x98(%rbx), %rdi
testq %rdi, %rdi
je 0xb7a1
movq 0xa8(%rbx), %rsi
subq %rdi, %rsi
callq 0x4250
movq 0x80(%rbx), %rdi
testq %rdi, %rdi
je 0xb7bc
movq 0x90(%rbx), %rsi
subq %rdi, %rsi
callq 0x4250
leaq 0x50(%rbx), %r14
movq 0x68(%rbx), %rdi
testq %rdi, %rdi
je 0xb7d5
movq 0x78(%rbx), %rsi
subq %rdi, %rsi
callq 0x4250
movq %r14, %rdi
callq 0x5074
movq %rbp, %rdi
callq 0x5074
movq 0x18(%rsp), %rdi
callq 0x5074
movq (%rbx), %rdi
cmpq %r15, %rdi
je 0xb802
movq (%r15), %rsi
incq %rsi
callq 0x4250
movq %r12, %rdi
callq 0x4440
movq %rax, %r12
movq 0x8(%rsp), %rbp
jmp 0xb721
nop