Here's how it can be done in Ruby, might give you some ideas for Perl:
---
    require 'zlib'

    NETWORK_FLOAT = 'g*'
    NETWORK_DOUBLE = 'G*'
    LITTLE_ENDIAN_FLOAT = 'e*'
    LITTLE_ENDIAN_DOUBLE = 'E*'
    BASE_64 = 'm*'

    def unpack_mzxml_string(str, precision=32, network_order=true,
compressed=false)
      unpack_code =
        case precision
        when 32 ; network_order ? NETWORK_FLOAT : LITTLE_ENDIAN_FLOAT
        when 64 ; network_order ? NETWORK_DOUBLE :
LITTLE_ENDIAN_DOUBLE
        else
          raise ArgumentError, "unknown precision (should be 32 or
64): #{precision}"
        end
      binary = str.unpack("#{BASE_64}").first
      binary = Zlib::Inflate.inflate(binary) if compressed
      binary.unpack(unpack_code)
    end
---

This is an exerpt from a simple command line program:
http://gist.github.com/406601

It is modified from ms-core:  lib/ms/data/lazy_io.rb [co-authored with
Simon Chiang]
http://github.com/jtprince/ms-core



On Apr 8, 10:52 am, jcmatese <[email protected]> wrote:
> Hi All,
>
> Is there a documentation or recipe for decoding zlib compressed peaks
> for mxXML version 3.1?  I had been using a variation of a perl recipe
> provided byZackBoothSimpsonand John Prince, documented 
> here:http://sashimi.sourceforge.net/schema_revision/mzXML_2.1/Doc/mzXML_2....
>
> However, it does not account for compressionType="zlib" and
> compressedLen attributes.
>
> I cannot find much documentation on 3.1 (and compressionType and
> compressedLen).  I presume that one would just take the peaks-as-text
> string and inflate it (using some zlib package from CPAN, presumably)
> prior to decoding base64.
>
> Does anyone have a favorite recipe or a pointer to documentation
> similar to the 2.1 tutorial above (a tutorial for mzXML 3.1)?
>
> Thanks,
> John

-- 
You received this message because you are subscribed to the Google Groups 
"spctools-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/spctools-discuss?hl=en.

Reply via email to