-- converts a spectra string to a float array for further use --
create or replace function convertSpectra(spectra text) returns float8[] AS $$
DECLARE
result float8[1000];
spectraSplit text[];
ionSplit text[];
array_len int;
ion int;
value float8;
BEGIN
spectraSplit = regexp_split_to_array(spectra,' ');
array_len = array_upper(spectraSplit,1);
for i in 1 .. array_len
LOOP
ionSplit = regexp_split_to_array(spectraSplit[i],':');
ion := ionSplit[1];
value := ionSplit[2];
result[ion] = value;
END LOOP;
RETURN result;
END;
$$ LANGUAGE plpgsql;
April + May
6 years ago
No comments:
Post a Comment