Add latest files
This commit is contained in:
parent
428ba1ed99
commit
44b09bb496
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
*
|
||||||
|
!*.*
|
38
main.cpp
38
main.cpp
|
@ -5,7 +5,7 @@ using ll = long long;
|
||||||
string P[3];
|
string P[3];
|
||||||
double score[3][7];
|
double score[3][7];
|
||||||
|
|
||||||
vector<string> variant[7];
|
vector<string> vrt[7];
|
||||||
|
|
||||||
ll levenshtein(string &s, string &t){
|
ll levenshtein(string &s, string &t){
|
||||||
int n = s.size(), m = t.size();
|
int n = s.size(), m = t.size();
|
||||||
|
@ -44,31 +44,37 @@ bitset<k> test(string & probe) {
|
||||||
bitset<k> bs;
|
bitset<k> bs;
|
||||||
double avg[7];
|
double avg[7];
|
||||||
for (int i = 0; i < 7; ++i) {
|
for (int i = 0; i < 7; ++i) {
|
||||||
avg[i] = 0;
|
for (int j = 0; j < 10; ++j) {
|
||||||
for (int j = 0; j < 20; ++j)
|
int r = rand()%20;
|
||||||
avg[i] += sequenceCmp(probe, variant[i][j]);
|
avg[i] += sequenceCmp(probe, vrt[i][r]);
|
||||||
avg[i] /= 20;
|
}
|
||||||
|
avg[i] /= 2;
|
||||||
}
|
}
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
for (int i = 0; i < 7; ++i)
|
for (int i = 0; i < 7; ++i)
|
||||||
for (int j = i+1; j < 7; ++j)
|
for (int j = i+1; j < 7; ++j)
|
||||||
if (abs(avg[i]-avg[j]) > 10) bs[cnt++] = 1;
|
{
|
||||||
return cnt;
|
if (abs(avg[i]-avg[j]) > 10) bs[cnt] = 1;
|
||||||
|
cnt++;
|
||||||
|
}
|
||||||
|
return bs;
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<string> dp[4][1 << k];
|
vector<string> dp[4][1 << k];
|
||||||
void analyze_spike_sequences(){
|
void analyze_spike_sequences(){
|
||||||
freopen("spike_sequences.txt", "r", stdin);
|
freopen("spike_sequences.txt", "r", stdin);
|
||||||
for (int i = 0; i < 7; ++i) { // 7 variants
|
for (int i = 0; i < 7; ++i) { // 7 vrts
|
||||||
for (int j = 0; j < 20; ++j) {
|
for (int j = 0; j < 20; ++j) {
|
||||||
string s, t; cin >> s >> t;
|
string s, t; cin >> s >> t;
|
||||||
variant[i].push_back(t);
|
vrt[i].push_back(t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
int cnt = 0;
|
||||||
for (int i = 0; i < 7; ++i) {
|
for (int i = 0; i < 7; ++i) {
|
||||||
for (int j = 0; j <= variant[i][0].size()-150; ++j) {
|
for (int j = 0; j <= vrt[i][0].size()-150; j += rand()%100) {
|
||||||
string probe(begin(variant[i][0]), begin(variant[i][0])+150);
|
string probe(begin(vrt[i][0])+j, begin(vrt[i][0])+j+150);
|
||||||
bitset<k> bs = test(probe);
|
bitset<k> bs = test(probe);
|
||||||
|
cout << probe << ' ' << cnt++ << endl;
|
||||||
|
|
||||||
int bsint = 0; //change to int
|
int bsint = 0; //change to int
|
||||||
for(int i = 0; i < k; i++) bsint |= bs[i] << i;
|
for(int i = 0; i < k; i++) bsint |= bs[i] << i;
|
||||||
|
@ -89,7 +95,7 @@ void analyze_spike_sequences(){
|
||||||
|
|
||||||
int retx = 0, rety = 0;
|
int retx = 0, rety = 0;
|
||||||
//find best dp coverage
|
//find best dp coverage
|
||||||
for(int i = 1; i <= 3; i++)
|
for(int i = 3; i <= 3; i++)
|
||||||
for(int j = 0; j < (1 << k); j++){
|
for(int j = 0; j < (1 << k); j++){
|
||||||
if(!dp[i][j].empty() && __builtin_popcount(j) > __builtin_popcount(rety)){
|
if(!dp[i][j].empty() && __builtin_popcount(j) > __builtin_popcount(rety)){
|
||||||
retx = i, rety = j;
|
retx = i, rety = j;
|
||||||
|
@ -111,7 +117,7 @@ void mkscores() {
|
||||||
for (int j = 0; j < 7; ++j) {
|
for (int j = 0; j < 7; ++j) {
|
||||||
score[i][j] = 0;
|
score[i][j] = 0;
|
||||||
for (int k = 0; k < 20; ++k)
|
for (int k = 0; k < 20; ++k)
|
||||||
score[i][j] += sequenceCmp(P[i], variant[j][k]);
|
score[i][j] += sequenceCmp(P[i], vrt[j][k]);
|
||||||
score[i][j] /= 20;
|
score[i][j] /= 20;
|
||||||
cout << score[i][j];
|
cout << score[i][j];
|
||||||
if (j < 6) cout << ",";
|
if (j < 6) cout << ",";
|
||||||
|
@ -137,7 +143,7 @@ string types[7] = {"original",
|
||||||
"B.1.427",
|
"B.1.427",
|
||||||
"P.1",
|
"P.1",
|
||||||
"B.1.351",
|
"B.1.351",
|
||||||
"other_variant",
|
"other_vrt",
|
||||||
"not_sars_cov2"};
|
"not_sars_cov2"};
|
||||||
|
|
||||||
void answer(){
|
void answer(){
|
||||||
|
@ -156,10 +162,10 @@ int main(){
|
||||||
ios::sync_with_stdio(0);
|
ios::sync_with_stdio(0);
|
||||||
cin.tie(0);
|
cin.tie(0);
|
||||||
if (fopen("spike_sequences.txt", "r")) {
|
if (fopen("spike_sequences.txt", "r")) {
|
||||||
analyze_spike_sequences();
|
|
||||||
if (P[0] != "") mkscores();
|
if (P[0] != "") mkscores();
|
||||||
|
else analyze_spike_sequences();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
answer();
|
answer();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue