[EMBOSS] Problems understanding use of ajAZToBin

peter robinson Peter.Robinson at t-online.de
Tue Nov 4 09:45:06 UTC 2003


Dear EMBOSS friends,

I was wondering if someone could help me understand the following code.


codex = ajAZToBin(bases[0]); /* a "C" */
codey = ajAZToBin(bases[1]); /* a "G" */
(...snip...)
codea=codeb;
 codeb=ajAZToBin(seq[i+1]);
 if(codea && !(codea & (15-codex)))
 {
...do something.
}


I realize that ajAZToBin is a function that returns a binary OR'd 
representation of an IUB base where A=1, C=2, G=4 and T=8, so I imagine that 
that is where the 15 comes from in the above expression.

If we then have
15-codex <=>  00001111 - 00000010 = 00001101
and assume that codea is 00000010 ("C"), then
binary "AND"-ing it with 00001101 would result in false and the expression 
with ! would result in true.

Why can't one say:

if (codea && (codea & codex))  ??

Thanks

Peter




More information about the EMBOSS mailing list