[Solved] Finding regular expression with at least one repetition of each letter

You could find all substrings of length 4+, and then down select from those to find only the shortest possible combinations that contain one of each letter: s=”AAGTCCTAG” def get_shortest(s): l, b = len(s), set(‘ATCG’) options = [s[i:j+1] for i in range(l) for j in range(i,l) if (j+1)-i > 3] return [i for i in … Read more

[Solved] How to represent DNA sequences for neural networks?

Why not learn the numerical representations for each base? This is a common problem in Neural Machine Translation, where we seek to encode “words” with a meaning as (naively) numbers. The core idea is that different words should not be represented with simple numbers, but with a learned dense vector. The process of finding this … Read more

[Solved] I cannot process chars [closed]

Instead of setting a character variable which is discarded, I assume you want to use this character to build a new String. StringBuilder sb = new StringBuilder(); for (char ch : dna.toCharArray()) { switch (ch) { case ‘A’: sb.append(‘T’); break; case ‘T’: sb.append(‘A’); break; case ‘G’: sb.append(‘C’); break; case ‘C’: sb.append(‘G’); break; } } String … Read more