Skip to content

Instantly share code, notes, and snippets.

@dnbaker
Last active January 14, 2018 23:36
Show Gist options
  • Save dnbaker/4828d286df3d5d841f7cfd24bae5e423 to your computer and use it in GitHub Desktop.
Save dnbaker/4828d286df3d5d841f7cfd24bae5e423 to your computer and use it in GitHub Desktop.
Convert binary stream into DNA characters
#include <stdio.h>
int main() {
int i, c;
while((c = getc_unlocked(stdin)) != EOF)
for(i = 0; i < 3; fputc("ACGT"[(c >> (i++ << 1)) & 3], stdout));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment