del_attr test no more working and passing tests
dputhier opened this issue · comments
Denis Puthier commented
In the previous version of pygtftk, this test on del_attr used to pass:
>>> from pygtftk.utils import get_example_file
>>> from pygtftk.gtf_interface import GTF
>>> from pygtftk.utils import TAB
>>> a_file = get_example_file()[0]
>>> a_gtf = GTF(a_file)
>>> # The force arg indicate not to raise an error when deleting gene_id/tx_id keys.
>>> assert a_gtf.del_attr(keys="gene_id,exon_id,ccds_id", force=True).get_attr_list() == ['transcript_id']
But it seems it is no more functional. Consider:
>>> from pygtftk.utils import get_example_file
>>> from pygtftk.gtf_interface import GTF
>>> a_file = get_example_file()[0]
>>> a_gtf = GTF(a_file)
>>> assert sum(a_gtf.is_defined("transcript_id")) == 60
>>> gn_val = ('.', '.', '.', '.', 1, 2, 3, 4, '?', '?')
>>> gn_ids = tuple(a_gtf.get_gn_ids(nr=True))
>>> b_gtf = a_gtf.add_attr_from_list(feat="gene", key="gene_id", key_value=(gn_ids), new_key="foo", new_key_value=gn_val)
>>> print(b_gtf)
>>> print(b_gtf.del_attr(keys='foo'))
fafa13 commented
I've just pushed a fix for this bug. I cannot test it because it seems that some python3 module (future) is missing in blackflag ...
Let me know if that's better.
Denis Puthier commented
ab19e8d did the trick. Closing