Changeset 797 for cpp/frams/genetics/fB/fB_general.h
- Timestamp:
- 06/06/18 01:45:18 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/genetics/fB/fB_general.h
r780 r797 1 // This file is a part of Framsticks SDK. http://www.framsticks.com/ 2 // Copyright (C) 1999-2018 Maciej Komosinski and Szymon Ulatowski. 3 // See LICENSE.txt for details. 4 1 5 #ifndef _FB_GENERAL_H_ 2 6 #define _FB_GENERAL_H_ … … 10 14 { 11 15 int start = 0; 16 int prev = 0; 12 17 int count = -1; 13 18 do { 14 19 count++; 15 20 start = geno.indexOf("aa", start) + 1; // +1 is for progress, starting codons can overlap 21 int quotecount = 0; 22 for (int q = prev; q < start; q++) if (geno[q] == '\"') quotecount++; 23 prev = start; 24 if (quotecount % 2 != 0) count--; // 'aa' sequence is within quotes 16 25 } while (start - 1 != -1); 17 26 return count; … … 25 34 count++; 26 35 start = genotype.indexOf("aa", start) + 1; 36 int quotecount = 0; 37 for (int q = 0; q < start; q++) if (genotype[q] == '\"') quotecount++; 38 if (quotecount % 2 != 0) count--; // 'aa' sequence is within quotes 27 39 } while (start - 1 != -1 && count != i); 28 40 if (start - 1 == -1) // there is no gene with a given "i" … … 33 45 } 34 46 end = start; 35 end = genotype.indexOf("zz", end); 47 int quotecount = 0; 48 do { 49 quotecount = 0; 50 end = genotype.indexOf("zz", end); 51 if (end != -1) 52 { 53 for (int q = start; q < end; q++) if (genotype[q] == '\"') quotecount++; 54 if (quotecount % 2 != 0) end++; 55 } 56 } while (quotecount % 2 != 0 && end != -1); 57 36 58 if (end == -1) end = genotype.len(); 37 59 else end += 2;
Note: See TracChangeset
for help on using the changeset viewer.