johnlonginotto / acgtrie Goto Github PK
View Code? Open in Web Editor NEWA custom Numpy Trie for storing counts of sequences
A custom Numpy Trie for storing counts of sequences
Hello, I think your algorithm is very interesting and I'm trying to understand how it works. In the OUTPUT file, you give an example table of warp pipes for the string 'ACGACCC':
row A C T G COUNT SEQ
----------------------------------
0 1 2 0 3 7
1 0 5 0 4 2 C
2 0 7 0 6 4
3 0 0 0 0 1 ACCC
4 0 0 0 0 1 ACCC
5 0 0 0 0 1 C
6 0 0 0 0 1 ACCC
7 0 8 0 0 2
8 0 0 0 0 1
But unless I don't understand this correctly, I think there is an error. The above table seems to indicate the presence of a AG 2-mer (with SEQ ACCC) via the path of rows 0 -> 1 -> 4.
I think this was supposed to be a GA 2-mer, encoded in the table as follows:
row A C T G COUNT SEQ
----------------------------------
0 1 2 0 3 7
1 0 5 0 0 2 C
2 0 7 0 6 4
3 4 0 0 0 1 ACCC
4 0 0 0 0 1 CCC
5 0 0 0 0 1 C
6 0 0 0 0 1 ACCC
7 0 8 0 0 2
8 0 0 0 0 1
With the path 0 -> 3 -> 4 and SEQ CCC.
On top of that, I am wondering if the table should also have a warp pipe in row 4, column C, so as to store counts for GAC?
Or since SEQ contains CCC, can we assume that GAC, GACC, GACCC will all return a count of 1? In which case row 4 would be unnecessary, as this information would be contained in row 3.
Is the k-mer ACG account for in this table?
Thanks!
"Why use A-00, C-01, T-10, G-11? It's not in alphabetical order […] !!?‽"
Plus, it is confusing for humans.
Secondly, it's because there's a neat trick you can do to convert those four letters of ASCII directly into up2bit values. […] In some programming languages like C, we can cut out just those numbers very quickly.
I very much like your trick. 👍 To fix the order, another hack can be used.
char n; // the nucleotide
n &= 6; // mask
n >>= 1; // shift
n ^= (n >> 1); // fix lower bit
The lower bit is flipped only when the upper bit is 1 (i.e. G and T). In C this compiles down to five instructions, all bit-twiddling, making this method the fastest order-preserving "hash". (See also http://blog.kloetzl.info/hashing-nucleotides-to-two-bits/)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.