On Nov 16, 2012, at 7:49 AM, bioinfornatics
wrote:
> hi,
>
> I would like to count number of one ore more letter into a string or list of
> string (string[]) without use a for loop but instead using std.algorithm to
> compute efficiently.
>
> if you have:
> string seq1 = "ACGATCGATCGATCGCG
bioinfornatics:
should be faster, no ?
If your purpose is to write a fast function to do this, then I
suggest you to not use Phobos stuff in this function, and to not
use associative arrays in it, and possibly to not use the heap.
This is not going to give you assured faster code, but it's
thanks to all, then something as:
---
Tuple!(size_t[char],size_t) baseCounter( const ref string[]
sequences ){
alias Tuple!(size_t[char], size_t) Result;
Result result;
size_t length = 0;
size_t[char][] baseNumbers =
On 2012-11-16, 17:37, bearophile wrote:
Simen Kjaeraas:
There. Now it works, and returns a Tuple!(ulong,ulong)(8, 8).
One thing I think is ugly in my implementation is acc + (seq == 'G').
This
adds a bool and a ulong together. For more points, replace that with
acc + (seq == 'G' ? 1 : 0).
Simen Kjaeraas:
There. Now it works, and returns a Tuple!(ulong,ulong)(8, 8).
One thing I think is ugly in my implementation is acc + (seq ==
'G'). This
adds a bool and a ulong together. For more points, replace that
with
acc + (seq == 'G' ? 1 : 0).
I use a pragmatic approach: I use such h
On 2012-11-16, 16:49, bioinfornatics wrote:
hi,
I would like to count number of one ore more letter into a string or
list of string (string[]) without use a for loop but instead using
std.algorithm to compute efficiently.
if you have:
string seq1 = "ACGATCGATCGATCGCGCTAGCTAGCTAG";
s
bioinfornatics:
I would like to count number of one ore more letter into a
string or list of string (string[]) without use a for loop but
instead using std.algorithm to compute efficiently.
If it's speed you look for, then most times std.algorithm is not
the solution. Basic loops are usually
hi,
I would like to count number of one ore more letter into a string
or list of string (string[]) without use a for loop but instead
using std.algorithm to compute efficiently.
if you have:
string seq1 = "ACGATCGATCGATCGCGCTAGCTAGCTAG";
string[] seq2 = ["ACGATCGATCGATCGCGCTAGCTAGCTAG",