Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Parsing .2bit DNA files

by BrowserUk (Pope)
on Mar 06, 2008 at 04:37 UTC ( #672356=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
        $dna = join '', 
               map $conv{$_},
               unpack('(A2)*', unpack("B" . $bytes * BITS_PER_BYTE , $raw)
    +);
    
  2. or download this
    my %bitMap  =  ('00' => 'T', '01' => 'C', '10' => 'A', '11' => 'G');
    my @byteMap = map{ 
        join '', map $bitMap{ $_ }, unpack '(A2)4', unpack 'B8', chr 
    } 0 .. 255;
    
  3. or download this
    ## Omit the braces add a comma for a negligable further improvement
    my $DNA = join '', map{ $byteMap[ $_ ] } unpack 'C*', $raw;
    
  4. or download this
    my %bitMap  =  ('00' => 'T', '01' => 'C', '10' => 'A', '11' => 'G');
    my @byteMap = map{ 
    ...
    ...
    
    my $DNA = join '', map{ $wordMap[ $_ ] } unpack 'n*', $raw;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://672356]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2014-12-25 23:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (163 votes), past polls