Zev - You can achieve this with PDL by saying
sum($dna1 == $dna2); Here's an example from the pdl shell: pdl> use PDL::Char pdl> $dna1 = PDL::Char->new( 'atc^c' ) pdl> $dna2 = PDL::Char->new( '^tcac' ) pdl> print sum($dna1 == $dna2) 3 pdl> print sum($dna1 != $dna2) 2 However, this doesn't generalize very well. You should probably look into Bryan's suggestion, or if you're going to be doing lots of DNA stuff, check out BioPerl. David On Wed, Jan 4, 2012 at 12:10 PM, zev <[email protected]> wrote: > Greetings, > > I am thinking about using PDL to compare strings (DNA) and count the > shared positions. > > for example: > > a = [a, t, c, ^, c] > b = [^, t, c, a, c] > > The intersection of A and B would be 3 since they have the same value in > columns 2, 3, 5. > > I have started to look into PDL::Char, but don't know if what I am trying > to do is easily achievable using PDL? > I though I would ask before sinking a bunch of time into this. > > Thanks! > > > > -- > Zev Kronenberg > Graduate Student > University of Utah > phone: 208-629-6224 > > > _______________________________________________ > Perldl mailing list > [email protected] > http://mailman.jach.hawaii.edu/mailman/listinfo/perldl > > -- Sent via my carrier pigeon.
_______________________________________________ Perldl mailing list [email protected] http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
