-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
272 changed files
with
291,951 additions
and
2,253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "submodules"] | ||
path = submodules | ||
url = https://github.com/samtools/samtools.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#include <iostream> | ||
#include <fstream> | ||
#include <string> | ||
#include <vector> | ||
#include "panmat.hpp" | ||
|
||
using namespace std; | ||
|
||
class read_t | ||
{ | ||
public: | ||
vector<string> id; | ||
vector<vector<int8_t>> sequence; | ||
read_t(ifstream& f); | ||
|
||
}; | ||
|
||
read_t::read_t(ifstream& f) | ||
{ | ||
string d; | ||
vector<int8_t> seq; | ||
string s; | ||
while (true) | ||
{ | ||
getline(f, d); | ||
if (f.eof()) break; | ||
if (d[0] == '>') | ||
{ | ||
if (id.size() > 0) | ||
{ | ||
// Move pointer back | ||
// f.seekg(-d.size(), ios::cur); | ||
// break; | ||
|
||
for (auto i = 0; i < s.size(); i+=2) | ||
{ | ||
if (s[i] == '\n') continue; | ||
int8_t c = panmat::nuc2int8(s[i]) << 4; | ||
if (i <= s.size() - 2) | ||
c |= panmat::nuc2int8(s[i+1]); | ||
seq.push_back(c); | ||
} | ||
sequence.push_back(seq); | ||
seq.clear(); | ||
} | ||
|
||
id.push_back(d.substr(1)); | ||
} | ||
else | ||
s.append(d); | ||
|
||
d.clear(); | ||
|
||
} | ||
for (auto i = 0; i < s.size(); i+=2) | ||
{ | ||
if (s[i] == '\n') continue; | ||
int8_t c = panmat::nuc2int8(s[i]) << 4; | ||
if (i <= s.size() - 2) | ||
c |= panmat::nuc2int8(s[i+1]); | ||
seq.push_back(c); | ||
} | ||
sequence.push_back(seq); | ||
seq.clear(); | ||
|
||
|
||
}; | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#include <fstream> | ||
#include <unordered_map> | ||
#include <iostream> | ||
// #include "file_io.hpp" | ||
|
||
#define KMER_SIZE 17 | ||
|
||
using namespace std; | ||
|
||
int main(int argc, char* argv[]) | ||
{ | ||
ifstream f(argv[1]); | ||
|
||
string name; | ||
string seq; | ||
string d; | ||
getline(f, name); | ||
while (true) | ||
{ | ||
getline(f, d); | ||
if (f.eof()) break; | ||
seq.append(d); | ||
} | ||
|
||
unordered_map<string, int> splitters; | ||
unordered_map<string, int> splitters_pos; | ||
for (auto i = 0; i < seq.size(); i+=KMER_SIZE) | ||
{ | ||
string splitter = seq.substr(i, KMER_SIZE); | ||
if (splitters.find(splitter) == splitters.end()) | ||
{ | ||
splitters[splitter] = 1; | ||
splitters_pos[splitter] = i; | ||
} | ||
else | ||
{ | ||
splitters[splitter]++; | ||
} | ||
} | ||
|
||
// Printing | ||
cout << splitters.size() << std::endl; | ||
|
||
// filtering | ||
int c = 0; | ||
for (auto e: splitters) | ||
{ | ||
if (e.second == 1) | ||
{ | ||
c++; | ||
} | ||
} | ||
cout << "total splitters: " << c << endl; | ||
|
||
// // Printing | ||
// cout << splitters.size() << std::endl; | ||
|
||
} | ||
|
||
|
||
|
||
// int main(int argc, char *argv[]) | ||
// { | ||
// ifstream f(argv[1]); | ||
// read_t r (f); | ||
|
||
// for (auto i = 0; i < r.id.size(); i++) | ||
// { | ||
// std::cout << r.id[i] << std::endl; | ||
// for (auto j = 0; j< r.sequence[i].size(); j++) | ||
// { | ||
// pair<char, char> p = panmat::int82char(r.sequence[i][j]); | ||
// // std::cout << "int8_t: " << (r.sequence[i][j]&0xFF) << std::endl; | ||
// std::cout << p.first <<p.second; | ||
// // break; | ||
// } | ||
// std::cout << std::endl; | ||
// } | ||
|
||
// return 0; | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include "panmat.hpp" | ||
#include <unordered_map> | ||
#include <bits/stdc++.h> | ||
|
||
void panmat::sample::find_splitter(vector<int8_t> s, compression_param_t param) | ||
{ | ||
map<vector<int8_t>, int8_t> splitter_count; | ||
|
||
uint32_t kmer_length = param.kmer_length; | ||
uint32_t s_size = s.size(); | ||
|
||
for (auto i = 0; i < s_size; i += kmer_length/2) | ||
{ | ||
vector<int8_t> s_curr; | ||
for (auto j = i; j < i + kmer_length/2; j++) | ||
{ | ||
s_curr.push_back(s[j]); | ||
} | ||
splitter_count[s_curr]++; | ||
} | ||
|
||
for (auto s_curr: splitter_count) | ||
{ | ||
if (s_curr.second == 1) | ||
{ | ||
splitters.push_back(s_curr.first); | ||
} | ||
} | ||
} |
Oops, something went wrong.