rrwick / Deepbinner

a signal-level demultiplexer for Oxford Nanopore reads
GNU General Public License v3.0
124 stars 23 forks source link

Setting up directory structure correctly #5

Closed lfaller closed 5 years ago

lfaller commented 6 years ago

Hi all,

I am running into an error and I am wondering if I set up my directory structure incorrectly. The error message I am getting is TypeError: argument should be string, bytes or integer, not PosixPath

To test deepbinner, I copied a handful of fast5 files into a test folder before running it using that test folder as the input directory.

Any advice is appreciated! ~Lina

mkdir test
cp GA40000/reads/0/* test/
cp GA40000/reads/99/* test/

INDIR=test
OUTDIR=demux2

deepbinner realtime --in_dir ${INDIR} --out_dir $OUTDIR -s /home/lina/Deepbinner/models/SQK-RBK004_read_starts

Using TensorFlow backend.

2018-07-17 13:59:00.736073: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
Loading /home/lina/Deepbinner/models/SQK-RBK004_read_starts... done

Making output directory: demux2/

Found 16,000 fast5 files in test
Classifying fast5s: 16000 / 16000 (100.0%)
Traceback (most recent call last):
  File "/usr/local/bin/deepbinner", line 11, in <module>
    load_entry_point('Deepbinner==0.1.1', 'console_scripts', 'deepbinner')()
  File "/usr/local/lib/python3.5/dist-packages/Deepbinner-0.1.1-py3.5.egg/deepbinner/deepbinner.py", line 68, in main
    realtime(args)
  File "/usr/local/lib/python3.5/dist-packages/Deepbinner-0.1.1-py3.5.egg/deepbinner/realtime.py", line 44, in realtime
    end_input_size, output_size)
  File "/usr/local/lib/python3.5/dist-packages/Deepbinner-0.1.1-py3.5.egg/deepbinner/realtime.py", line 79, in classify_and_move
    move_classified_fast5s(classifications, read_id_to_fast5_file, args, fast5s)
  File "/usr/local/lib/python3.5/dist-packages/Deepbinner-0.1.1-py3.5.egg/deepbinner/realtime.py", line 101, in move_classified_fast5s
    shutil.move(fast5_file, out_dir)
  File "/usr/lib/python3.5/shutil.py", line 527, in move
    if os.path.isdir(dst):
  File "/usr/lib/python3.5/genericpath.py", line 42, in isdir
    st = os.stat(s)
TypeError: argument should be string, bytes or integer, not PosixPath
Exception ignored in: <bound method BaseSession.__del__ of <tensorflow.python.client.session.Session object at 0x7fd8671aad30>>
Traceback (most recent call last):
  File "/home/lina/.local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 707, in __del__
TypeError: 'NoneType' object is not callable
lfaller commented 6 years ago

I just tried using the fast5 files in the test directory and I am getting the same error message:

$> deepbinner realtime --in_dir /home/lina/Deepbinner/tests/fast5_files --out_dir demultiplexed_fast5s -s /home/lina/Deepbinner/models/SQK-RBK004_read_starts
Using TensorFlow backend.

2018-07-17 15:51:48.109870: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
Loading /home/lina/Deepbinner/models/SQK-RBK004_read_starts... done

Making output directory: demultiplexed_fast5s/

Found 5 fast5 files in /home/lina/Deepbinner/tests/fast5_files
Classifying fast5s: 5 / 5 (100.0%)
Traceback (most recent call last):
  File "/usr/local/bin/deepbinner", line 11, in <module>
    load_entry_point('Deepbinner==0.1.1', 'console_scripts', 'deepbinner')()
  File "/usr/local/lib/python3.5/dist-packages/Deepbinner-0.1.1-py3.5.egg/deepbinner/deepbinner.py", line 68, in main
    realtime(args)
  File "/usr/local/lib/python3.5/dist-packages/Deepbinner-0.1.1-py3.5.egg/deepbinner/realtime.py", line 44, in realtime
    end_input_size, output_size)
  File "/usr/local/lib/python3.5/dist-packages/Deepbinner-0.1.1-py3.5.egg/deepbinner/realtime.py", line 79, in classify_and_move
    move_classified_fast5s(classifications, read_id_to_fast5_file, args, fast5s)
  File "/usr/local/lib/python3.5/dist-packages/Deepbinner-0.1.1-py3.5.egg/deepbinner/realtime.py", line 101, in move_classified_fast5s
    shutil.move(fast5_file, out_dir)
  File "/usr/lib/python3.5/shutil.py", line 527, in move
    if os.path.isdir(dst):
  File "/usr/lib/python3.5/genericpath.py", line 42, in isdir
    st = os.stat(s)
TypeError: argument should be string, bytes or integer, not PosixPath
rrwick commented 5 years ago

I think this is fixed in the current version. Give it a try again!

In case you're curious, I think it was a Python version thing: https://bugs.python.org/issue23241 https://www.python.org/dev/peps/pep-0519 Previously, it worked in Python 3.6, but crashed in Python 3.5. I think it will now work in both versions.

I'll close the issue now, but let me know if you're still hitting this one.

Ryan