public class MSNumpress extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
ACC_NUMPRESS_LINEAR |
static String |
ACC_NUMPRESS_PIC |
static String |
ACC_NUMPRESS_SLOF |
| Constructor and Description |
|---|
MSNumpress() |
| Modifier and Type | Method and Description |
|---|---|
static double[] |
decode(String cvAccession,
byte[] data,
int dataSize)
Convenience function for decoding binary data encoded by MSNumpress.
|
static double |
decodeFixedPoint(byte[] data) |
static int |
decodeLinear(byte[] data,
int dataSize,
double[] result)
Decodes data encoded by encodeLinear.
|
static int |
decodePic(byte[] data,
int dataSize,
double[] result)
Decodes data encoded by encodePic
result vector guaranteed to be shorter of equal to |data| * 2
Note that this method may throw a ArrayIndexOutOfBoundsException if it deems the input data to
be corrupt, i.e.
|
static int |
decodeSlof(byte[] data,
int dataSize,
double[] result)
Decodes data encoded by encodeSlof
The result vector will be exactly (|data| - 8) / 2 doubles.
|
static void |
encodeFixedPoint(double fixedPoint,
byte[] result) |
protected static int |
encodeInt(long x,
byte[] res,
int resOffset)
This encoding works on a 4 byte integer, by truncating initial zeros or ones.
|
static int |
encodeLinear(double[] data,
int dataSize,
byte[] result,
double fixedPoint)
Encodes the doubles in data by first using a
- lossy conversion to a 4 byte 5 decimal fixed point repressentation
- storing the residuals from a linear prediction after first to values
- encoding by encodeInt (see above)
The resulting binary is maximally 8 + dataSize * 5 bytes, but much less if the
data is reasonably smooth on the first order.
|
static int |
encodePic(double[] data,
int dataSize,
byte[] result)
Encodes ion counts by simply rounding to the nearest 4 byte integer,
and compressing each integer with encodeInt.
|
static int |
encodeSlof(double[] data,
int dataSize,
byte[] result,
double fixedPoint)
Encodes ion counts by taking the natural logarithm, and storing a
fixed point representation of this.
|
static double |
optimalLinearFixedPoint(double[] data,
int dataSize) |
static double |
optimalSlofFixedPoint(double[] data,
int dataSize) |
public static final String ACC_NUMPRESS_LINEAR
public static final String ACC_NUMPRESS_PIC
public static final String ACC_NUMPRESS_SLOF
public static double[] decode(String cvAccession, byte[] data, int dataSize)
cvAccession - The PSI-MS obo CV accession of the encoded data.data - array of double to be encodeddataSize - number of doubles from data to encodeprotected static int encodeInt(long x,
byte[] res,
int resOffset)
x - the int to be encodedres - the byte array were halfbytes are storedresOffset - position in res were halfbytes are writtenpublic static void encodeFixedPoint(double fixedPoint,
byte[] result)
public static double decodeFixedPoint(byte[] data)
public static double optimalLinearFixedPoint(double[] data,
int dataSize)
public static int encodeLinear(double[] data,
int dataSize,
byte[] result,
double fixedPoint)
data - array of doubles to be encodeddataSize - number of doubles from data to encoderesult - array were resulting bytes should be storedfixedPoint - the scaling factor used for getting the fixed point repr.
This is stored in the binary and automatically extracted
on decoding.public static int decodeLinear(byte[] data,
int dataSize,
double[] result)
data - array of bytes to be decodeddataSize - number of bytes from data to decoderesult - array were resulting doubles should be storedpublic static int encodePic(double[] data,
int dataSize,
byte[] result)
data - array of doubles to be encodeddataSize - number of doubles from data to encoderesult - array were resulting bytes should be storedpublic static int decodePic(byte[] data,
int dataSize,
double[] result)
data - array of bytes to be decoded (need memorycont. repr.)dataSize - number of bytes from data to decoderesult - array were resulting doubles should be storedpublic static double optimalSlofFixedPoint(double[] data,
int dataSize)
public static int encodeSlof(double[] data,
int dataSize,
byte[] result,
double fixedPoint)
data - array of doubles to be encodeddataSize - number of doubles from data to encoderesult - array were resulting bytes should be storedfixedPoint - the scaling factor used for getting the fixed point repr.
This is stored in the binary and automatically extracted
on decoding.public static int decodeSlof(byte[] data,
int dataSize,
double[] result)
data - array of bytes to be decoded (need memorycont. repr.)dataSize - number of bytes from data to decoderesult - array were resulting doubles should be storedCopyright © 2017. All rights reserved.