ECO_PSTU | Where the Genes Flow

Barisal

Team Updates

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
const string DNA = "ACTGCGACGGTACGCTTCGACGTAG";
const size_t taille = DNA.size();
size_t m = 3;
vector<string> v;
bool checkDNA(string &s);
string takeStrings(const string &s,size_t i, size_t m);
void FindSequenceDNA(vector<string>&s,string sq);
size_t incrementValue(size_t &m);
int main(){
string DNAuser;
cout << "Introduce the DNA: ";
cin >> DNAuser;
bool request;
cout << boolalpha;
request = DNAuser.find_first_not_of("AGCT");
cout << request << endl;
vector<string> vectorSq;
size_t auxiliar = 0;
string r;
size_t ocurrencies = DNA.size()-2;
cout << "DNA: " << DNA << endl;
while(auxiliar<ocurrencies){ // This gonna be works with the ocurriences, from 1 to end.
r = takeStrings(DNA,auxiliar,auxiliar+m);
auxiliar++;
if(r.size()==m){
vectorSq.push_back(r);
}
}
for(size_t i = 0; i< vectorSq.size(); i++){
cout << vectorSq[i] << endl;
}
return 0;
}
string takeStrings(const string &s,size_t i, size_t m){
string result;
size_t aux=i;
if(s.size()==0){
cout << "String is empty." << endl;
}
else{
for(;i<s.size()&&i!=m;i++){
result+=s[i];
aux++;
}
}
return result;
}
void FindSequenceDNA(vector<string>&s,string sq){
if(s.size()==0){
cout << "DNA invalid." << endl;
}
else{
for(size_t i=0;i<s.size();i++){
if(sq==s[i]){
cout << "function: " << endl;
cout << s[i] << endl;
}
}
}
}
bool checkDNA(string &s){
bool res;
if(s.size()==0 || s.size()<3){
cout << "DNA invalid" << endl;
}
else{
for(size_t i=0;i<s.size();i++){
if(s[i]=='A' || s[i]=='C' || s[i]=='G' || s[i]=='T')
{
res = true;
}
else{
res= false;
}
}
}
return res;
}
size_t incrementValue(size_t &m){
if(m<DNA.size()){
m++;
}
return m;
}
view raw DNAPat.cpp hosted with ❤ by GitHub
#include<stdio.h>
#include<conio.h>
#include<iostream>
using namespace std;
int c = 0, cost = 999;
int graph[4][4] = { { 0, 10, 15, 20 }, { 10, 0, 35, 25 }, { 15, 35, 0, 30 }, {20, 25, 30, 0 } };
void swap(int *x, int *y) {
int temp;
temp = *x;
*x = *y;
*y = temp;
}
void copy_array(int *a, int n) {
int i, sum = 0;
for (i = 0; i <= n; i++) {
sum += graph[a[i % 4]][a[(i + 1) % 4]];
}
if (cost > sum) {
cost = sum;
}
}
void permute(int *a, int i, int n) {
int j, k;
if (i == n) {
copy_array(a, n);
}
else {
for (j = i; j <= n; j++) {
swap((a + i), (a + j));
permute(a, i + 1, n);
swap((a + i), (a + j));
}
}
}
int main() {
int i, j;
int a[] = { 0, 1, 2, 3 };
permute(a, 0, 3);
cout << "minimum cost:" << cost << endl;
}
view raw NearestNeighbourhood hosted with ❤ by GitHub
arup840Arup Das
NASA Logo

SpaceApps is a NASA incubator innovation program.