Bruker TopSpin is a library that provides a set of classes for parsing Bruker TopSpin files in Ruby.
- Read and write
peaklist.xml
documents using Nokogiri.
require 'bruker/top_spin'
require 'nokogiri'
File.open('peaklist.xml', 'r') do |file|
nokogiri_xml_document = Nokogiri.XML(file, nil, 'UTF-8')
bruker_top_spin_peak_list_xml_document = Bruker::TopSpin::PeakList.XML(nokogiri_xml_document)
# do something with +bruker_top_spin_peak_list_xml_document+ object
end
- Read
.shifts
documents.
require 'bruker/top_spin'
File.open('example.shifts', 'r') do |file|
string = file.read
bruker_top_spin_shifts_tsv_table = Bruker::TopSpin::Shifts.TSV(string)
# do something with +bruker_top_spin_shifts_tsv_table+ object
end
- Read
t1peaks.txt
documents.
require 'rubygems'
require 'bruker/top_spin'
File.open('t1peaks.txt', 'r') do |file|
string = file.read
bruker_top_spin_t1_peaks_text_document = Bruker::TopSpin::T1Peaks.Text(string)
# do something with +bruker_top_spin_t1_peaks_text_document+ object
end
- The latest version of Bruker TopSpin can be installed with RubyGems:
$ gem install bruker-top_spin
Source code can be downloaded as part of the Bruker TopSpin project on GitHub:
Bruker TopSpin is released under the ECL-2.0 license:
Bug reports can be filed for the Bruker TopSpin project here: