NVBIO
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Hello DNA!
This page will teach you to familiarize with some of NVBIO's basic containers and concepts, showing you how to instantiate a PackedVector to store some DNA string. Packed vectors are useful to represent streams of symbols using a few bits per symbol. For a DNA alphabet, we'll only need 2-bits:
void main()
{
// our hello world ASCII string
const char dna_string[] = "ACGTTGCA";
const uint32 len = uint32( strlen( dna_string ) );
// our DNA alphabet size, in bits
const uint32 ALPHABET_SIZE = AlphabetTraits<DNA>::SYMBOL_SIZE;
// instantiate a packed host vector
// and fill it in with the contents of our original string, converted
// to a 2-bit DNA alphabet (i.e. A = 0, C = 1, G = 2, T = 3)
nvbio::assign( len, nvbio::from_string<DNA>( dna_string ), h_dna.begin() );
// copy the packed vector to the device
}

Next: Hello DNA! - Part 2 Top: NVBIO