-
Notifications
You must be signed in to change notification settings - Fork 295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Read
accessible from python
#1492
Conversation
@@ -308,9 +352,66 @@ static PyGetSetDef khmer_Read_accessors [ ] = { | |||
}; | |||
|
|||
|
|||
static | |||
PyObject * | |||
khmer_Read_getattr(khmer_Read_Object *self, PyObject *attr_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary, since we have a PyGetSetDef
defined?
https://github.com/dib-lab/khmer/pull/1492/files#diff-944b784821ddf1048fc73488ee2ee675R329
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will try if raising the excepting in the getter works. Good idea!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You were right :)
9db6883
to
1822270
Compare
Current coverage is 95.80% (diff: 100%)
|
1822270
to
fcecdf6
Compare
Ready for review! @luizirber, @camillescott, @standage , or @ctb |
@@ -1,3 +1,7 @@ | |||
2016-10-27 Tim Head <betatim@gmail.com> | |||
|
|||
* Make khmer's Read type accesible from the python API. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
accessible - two ses :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coughcough fixed
const_cast<char *>("quality"), const_cast<char *>("annotations"), NULL | ||
}; | ||
|
||
if (!PyArg_ParseTupleAndKeywords(args, kwds, "|zzzz", kwlist, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Name and sequence shouldn't be optional, I think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Now we have khmer.Read(name, seq)
vs screed.Record(dict(name=name, sequence=sequence))
. Actually you can pass any kind of dict
to Record
.
Should we move Read
to this "pass a dict as only arg" interface? I prefer the named parameters, but if you frequently turn dicts into Read
s it will get tedious typing Read(*my_dict)
.
0d5c365
to
dd795bc
Compare
@luizirber do you have an opinion on the following: We have Should we move |
On Mon, Oct 31, 2016 at 01:16:58AM -0700, Tim Head wrote:
screed.Record should be changed to support that IMO. |
dd795bc
to
c58a450
Compare
Merge once travis is happy? |
Agreed. |
c58a450
to
aaa8675
Compare
Build failed. Update from latest master, fix build, => merge? |
This is the error message: https://travis-ci.org/dib-lab/khmer/jobs/171994487#L1841-L1870 |
This failing test is super weird. |
travis is happy right now...so merge?! |
I would prefer that the uncertainty be addressed explicitly so that we don't face this in every test going forward ;). |
Running the test in a loop 40 times also surfaced this failure mode
|
alas... well, perhaps fix it in #1495?
|
I would make a new PR to fix this. At least I have no good idea where to start looking for the race condition so. Empirically this test doesn't seem to happen that often: "a few times in 100 runs" There are indeed 98 kmers in the file: import tests.khmer_tst_utils as utils
def kmer(seq, k=17):
for i in range(0, len(seq)-k+1):
yield seq[i:i+k]
kmers = []
for rec in screed.open(utils.copy_test_data('test-abund-read-2.fa')):
kmers += list(kmer(rec.sequence)) in case we need this snippet again. |
On Wed, Nov 02, 2016 at 08:24:26AM -0700, Tim Head wrote:
It's clearly in the 'add' function in Hashtable; that's the only place |
94586a0
to
ec1c7f9
Compare
If one of the attributes is not set the instance should behave as if it does not have that attribute.
ec1c7f9
to
240d970
Compare
merge? (edit: no, just scrolled up far enough to realise there is homework left) |
I'm fine with merging... |
LGTM - if the thread issue (re)surfaces on CI, let's fix it then. |
Fixes #769
This makes
khmer.Read
accessible from python land. If you do not set one of the attributeshasattr
will returnFalse
.make test
Did it pass the tests?make clean diff-cover
If it introduces new functionality inscripts/
is it tested?make format diff_pylint_report cppcheck doc pydocstyle
Is it wellformatted?
ChangeLog
?http://en.wikipedia.org/wiki/Changelog#Format
changes were made?