LUMC / kPAL

Analysis toolkit and programming library for k-mer profiles
http://kpal.readthedocs.org/
Other
30 stars 6 forks source link

invalid ProfileFileType #2

Closed jfjlaros closed 9 years ago

jfjlaros commented 9 years ago

I am trying to use kPal to assess the quality of my sequence libraries, but have encountered some issues. When IT installed kPal on our server and tried to run the tutorial, there was an issue with the first step (i.e. running kpal count -k 8 *_1.fa reads_1.k8), which was:

kpal count: error: argument OUTPUT: invalid ProfileFileType(w) value: 'reads1.k8'

martijnvermaat commented 9 years ago

Looks like kpal.ProfileFileType.__call__ somehow raises a ValueError.

Unfortunately, argparse catches this exception, prints its own error message (the one you show), and calls sys.exit(1), leaving us no clue as to where the original exception was raised.

Not sure how best to debug this, but perhaps you could try running the following command from a terminal:

python -c 'import kpal; kpal.ProfileFileType("w")("reads_1.k8")'

And paste the output here. Any additional info about your system (operating system, Python version) would also be helpful.

stephyk commented 9 years ago

Here is the output from running the command you suggested:

Traceback (most recent call last): File "", line 1, in File "/sw/kpal/20141209/lib/python2.7/site-packages/kpal/init.py", line 108, in call raise argparse.ArgumentTypeError(message % (string, e)) argparse.ArgumentTypeError: can't open 'reads_1.k8': file exists

The system I am using is a Linux-based HPC cluster, and the version of Python is 2.7. Please let me know if there's any other information you need.

Thanks!

martijnvermaat commented 9 years ago

Thanks for the report @stephyk

It looks like the output file you define, reads_1.k8, already exists (it should not). You can try again by specifying a non-existing output file.

kPAL should give a more descriptive error message for this situation though. But I can't reproduce this, so I'm still not sure what's going on exactly.

stephyk commented 9 years ago

Hi Martijn,

Yes, I ran the command in the same folder as I had tried running kpal, so it had already tried to create a reads_1.k8 file.

I deleted the reads_1.k8 file and ran the command again. When I did this, it created a reads_1.k8 file but no output was printed on the command line. I've attached this file to this email.

I also tried running the command as python -c 'import kpal; kpal.ProfileFileType("w")("")'

which produced the following output:

Traceback (most recent call last): File "", line 1, in File "/sw/kpal/20141209/lib/python2.7/site-packages/kpal/init.py", line 92, in call handle = h5py.File(string, self._mode) File "/home/s4181438/anaconda/lib/python2.7/site-packages/h5py/_hl/files.py", line 222, in init fid = make_fid(name, mode, userblock_size, fapl) File "/home/s4181438/anaconda/lib/python2.7/site-packages/h5py/_hl/files.py", line 85, in make_fid fid = h5f.create(name, h5f.ACC_TRUNC, fapl=fapl, fcpl=fcpl) File "h5f.pyx", line 90, in h5py.h5f.create (h5py/h5f.c:1975) ValueError: Invalid file name (Invalid file name)

Hopefully one of these will help you find out what's wrong.

Thanks again for your help! Stephanie


From: Martijn Vermaat notifications@github.com Sent: Friday, 30 January 2015 10:22 PM To: LUMC/kPAL Cc: Miss Stephanie Kerr Subject: Re: [kPAL] invalid ProfileFileType (#2)

Thanks for the report @stephykhttps://github.com/stephyk

It looks like the output file you define, reads_1.k8, already exists (it should not). You can try again by specifying a non-existing output file.

kPAL should give a more descriptive error message for this situation though. But I can't reproduce this, so I'm still not sure what's going on exactly.

Reply to this email directly or view it on GitHubhttps://github.com/LUMC/kPAL/issues/2#issuecomment-72193380.

martijnvermaat commented 9 years ago

Hi Stephanie,

It is expected behaviour that no output is printed on the command line. You can inspect the resulting file for example using kpal info:

kpal info reads_1.k8

Other kPAL functions accepting k-mer profile files can now also work with this file. Currently the implemented functionality for extracting information from these files is limited, but the file format is documented.

Your latest error is also expected since the command you ran tries to create a file with a zero-length filename.

I'm closing this issue now, but feel free to let us know if you have any further problems.

stephyk commented 9 years ago

Hi Martijn, Unfortunately we are still unable to run the kpal functions with this file. I have included some commands below that our IT has run that shows some error code that wasn't included above.

uqepowe3@barrine3:/sw/kpal/20141209/PBS/kpal_example_input> ls a_1.fa a_2.fa b_1.fa b_2.fa c_1.fa c_2.fa d_1.fa d_2.fa reads_1.k8 uqepowe3@barrine3:/sw/kpal/20141209/PBS/kpal_example_input> rm reads_1.k8 uqepowe3@barrine3:/sw/kpal/20141209/PBS/kpal_example_input> kpal count -k 8 *_1.fa reads_1.k8 usage: kpal count [-h] [-p NAME [NAME ...]] [-k SIZE] [INPUT [INPUT ...]] OUTPUT kpal count: error: argument OUTPUT: invalid ProfileFileType(w) value: 'reads_1.k8' uqepowe3@barrine3:/sw/kpal/20141209/PBS/kpal_example_input> rm reads_1.k8 uqepowe3@barrine3:/sw/kpal/20141209/PBS/kpal_example_input> ls a_1.fa a_2.fa b_1.fa b_2.fa c_1.fa c_2.fa d_1.fa d_2.fa uqepowe3@barrine3:/sw/kpal/20141209/PBS/kpal_example_input> python -c 'import kpal; kpal.ProfileFileType("w")("reads_1.k8")' Traceback (most recent call last): File "", line 1, in File "/sw/kpal/20141209/lib/python2.7/site-packages/kpal/init.py", line 94, in call handle.attrs['format'] = 'kMer' File "/sw/python/2.7-epd-7.3-1/lib/python2.7/site-packages/h5py/_hl/attrs.py", line 53, in setitem self.create(name, data=value, dtype=base.guess_dtype(value)) File "/sw/python/2.7-epd-7.3-1/lib/python2.7/site-packages/h5py/_hl/attrs.py", line 91, in create htype = h5t.py_create(dtype, logical=True) File "h5t.pyx", line 1332, in h5py.h5t.py_create (h5py/h5t.c:12346) File "h5t.pyx", line 1408, in h5py.h5t.py_create (h5py/h5t.c:12235) TypeError: No conversion path for dtype: dtype('<U4') uqepowe3@barrine3:/sw/kpal/20141209/PBS/kpal_example_input>

martijnvermaat commented 9 years ago

I hopefully managed to figure out what's going wrong here. The likely cause of your problem is the version of the h5py package you are using. It should be at least version 2.1.0 (but preferably just the latest release).

I could reproduce the errors using h5py version 2.0.0, but not using 2.1.0. The kPAL installation script has been updated to take this into account for future users.

To fix your existing installation, please upgrade the h5py package, or ask you system administrator to do so, using for example:

pip install -U h5py

Thank you for your report and again, please let me know if this doesn't work for you.