![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
SimpleBioC is a simple parser / builder for BioC data format. BioC is a simple XML format to share text documents and annotations. You can find more information about BioC from the official BioC web site (http://www.ncbi.nlm.nih.gov/CBBresearch/Dogan/BioC/)
Add this line to your application's Gemfile:
gem 'simple_bioc'
And then execute:
$ bundle
Or install it yourself as:
$ gem install simple_bioc
Include library
require 'simple_bioc'
Parse with a file name (path)
collection = SimpleBioC::from_xml(filename)
Traverse & Manipulate Data. Data structure are almost the same as the DTD. Please refer library documents and the BioC DTD.
puts collection.documents[2].passages[0].text
Build XML text from data
puts SimpleBioC::to_xml(collection)
Convert PubAnnotation JSON from data
puts SimpleBioC::to_pubann(collection, {
sourcedb: 'PubMed',
target: 'http://pubannotation.org/docs/sourcedb/PubMed/sourceid/18034444',
project: 'Ab3P-abbreviations'
}))
You can parse only a set of document elements in a large xml document instead of parsing all the document elements. It may decrease the processing time. For example, the following code will return a collection with two documents ("1234", "4567").
collection = SimpleBioc::from_xml(filename, {documents: ["1234", "4567"]})
By default, outputs of SimpleBioC::to_xml() will be formatted with whitespace. If you do not want this whitespace, you should pass 'save_with' option with 0 to the to_xml() function.
puts SimpleBioC::to_xml(collection, {save_with:0})
More samples can be found in Samples directory
require 'simple_bioc'
# Sample1: parse, traverse, manipulate, and build BioC data
require 'simple_bioc'
# parse BioC file
collection = SimpleBioC.from_xml("../xml/everything.xml")
# the returned object contains all the information in the BioC file
# traverse & read information
collection.documents.each do |document|
puts document
document.passages.each do |passage|
puts passage
end
end
# manipulate
doc = SimpleBioC::Document.new(collection)
doc.id = "23071747"
doc.infons["journal"] = "PLoS One"
collection.documents << doc
p = SimpleBioC::Passage.new(doc)
p.offset = 0
p.text = "TRIP database 2.0: a manually curated information hub for accessing TRP channel interaction network."
p.infons["type"] = "title"
doc.passages << p
# build BioC document from data
xml = SimpleBioC.to_xml(collection)
puts xml
# convert document to PubAnnotation JSON
require 'simple_bioc'
if ARGF.argv.size < 1
puts "usage: ruby convert_pubann.rb {filepath}"
exit
end
collection = SimpleBioC::from_xml(ARGF.argv[0])
puts SimpleBioC::to_pubann(collection, {
sourcedb: 'PubMed',
target: 'http://pubannotation.org/docs/sourcedb/PubMed/sourceid/18034444',
project: 'Ab3P-abbreviations'
})
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)Copyright © 2013, Dongseop Kwon
Released under the MIT License.
FAQs
Unknown package
We found that simple_bioc demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.