dlesl / gb-io Goto Github PK
View Code? Open in Web Editor NEWA Rust library for parsing, writing and manipulating Genbank sequence files
License: MIT License
A Rust library for parsing, writing and manipulating Genbank sequence files
License: MIT License
Hi there, thanks for your work on this project!
I got a compiler warning in a project that sues gb-io
:
warning: the following packages contain code that will be rejected by a future version of Rust: nom v4.2.3
note: to see what the problems were, use the option `--future-incompat-report`, or run `cargo report future-incompatibilities --id 1`
This is fixed in subsequent version of nom. It looks like #7 already addresses this issue, but the PR is still open. As someone currently using this package, I figured I would make this issue to say 1) I appreciate this package and 2) it would also appreciate if #7 could be merged at some point.
Also happy to lend a hand if there are still any difficulties porting from nom 4 to nom 7.
When looking at a GenBank entry there often is interesting information in the "source" feature, which actually contains several subfields. From instance below one can see the "host" information:
I end up having to wrap the gb_io.Record
class with another class to access this information. Also I end up constantly having to replace newlines with spaces.
class GenBankRecord:
def __init__(self, rec):
"""Get a record instance from gb_io"""
self.rec = rec
@functools.cached_property
def source(self):
"""Parse the first feature which is always 'source'"""
return next(iter(self.rec.features))
@functools.cached_property
def fields(self):
"""Get all subfields of source."""
return self.source.qualifiers.to_dict()
@functools.cached_property
def host(self):
if 'host' in self.fields:
return self.fields['host'][0].replace('\n', ' ')
return ''
It would be nice to just do rec.host
no?
Hi David!
In v0.7.0
I noticed there is no way to use the GbParserError
type: the errors
module is private, and this struct is not publicly re-exported in the ::reader
module. I guess it would make sense to re-export it publicly there (the alternative, making errors
public, only makes sense if you also had the errors from the ::seq
module in there).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.