Closed dputhier closed 6 years ago
Note the if I turn the invert-match into a match, changing:
gtf_data_2 = clone._dll.select_by_key(clone._data, "feature", "gene", 1)
into
gtf_data_2 = clone._dll.select_by_key(clone._data, "feature", "gene", 0)
It will never break down, suggesting this is maybe a remaining problem on the C side.
I have updated the code. Sry
in that branch : feature_libgtftk_bc072e5 ?
On 05/24/2018 02:48 PM, Denis Puthier wrote:
I have updated the code. Sry
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dputhier/libgtftk/issues/73#issuecomment-391702043, or mute the thread https://github.com/notifications/unsubscribe-auth/APjIc9TiHTuCRMRzwmAGAULemI8CRURnks5t1qwcgaJpZM4UMKjy.
Fabrice Lopez INSERM U1090/TAGC Campus de Luminy 163 AVENUE DE LUMINY - CASE 928 13288 Marseille Cedex 9 Mail: fabrice.lopez@inserm.fr Tel: 04 91 82 87 24 -- Keep calm, reboot, and keep calm.
Sorry. No. I have included all changes in develop... Bad habit. I forgot this branch. To be clear I'm working with gtftk::develop::e2c639aac6f8dff022ed1c50a9e6cadda6e65f3b which integrate libgtftk::develop_3.3::8a3f5db666ebd70d3363c6a47a1b31836c143f61. That is it integrate your last push (CRC32 on get_sequence).
From Fafa:
I found that the clone function (in python side) crashes if you call it the same way 3 times :
from gtftk.utils import get_example_file
from gtftk.gtf_interface import GTF
a_file = get_example_file("simple", "gtf")[1]
gtf = GTF(a_file)
clone = gtf._clone(gtf._data)
clone = gtf._clone(gtf._data)
clone = gtf._clone(gtf._data)
But if you don't erase the clones, that works :
clone = gtf._clone(gtf._data)
clone2 = gtf._clone(gtf._data)
clone3 = gtf._clone(gtf._data)
What is strange is that the python clone function doesn't call any C library function if the GTF_DATA you give is not "None". It could take some time to fix this one ...
And next "I have identified the problem. The function "del" in gtf_interface deletes the data inside a GTF. When you build a clone, you don't duplicate the data inside. You just copy the address of the data, so it is not really a clone but a copy. So when you erase a clone, you destroy the data that is shared by all the clones. I think you should rewrite the clone function and make a real copy of the data."
From Denis:
In fact the example you provided that use _clone should never be used this way (maybe the method name is questionnable). I'm always calling _clone with a new pointer obtained through the dynamic library.
I will close this issue and open a new one in which I will clarify the problem.
Hi, Not completely sure this one is directly related to C or whether this is related to memory management in Python. However, we should be able to avoid any segfault whatever the commands.
In the example below I'm trying to use as little call as possible to the Python code (using the GTF._dll attribute). There are some dependencies however with the Python code when calling gtf._clone. However the purpose of this method is only to return a new GTF with an updated GTF_DATA (so I don't really think the issue is directly related to this function). Here is the issue: