diff --git a/.github/workflows/snake.yml b/.github/workflows/snake.yml index 2989e5e..300b02e 100644 --- a/.github/workflows/snake.yml +++ b/.github/workflows/snake.yml @@ -16,8 +16,8 @@ jobs: submodules: recursive - name: install packages run: sudo apt-get update && sudo apt-get install -y zlib1g-dev gcc python3 python3-pip && pip3 install setuptools cython numpy - - name: slow5lib-dev - run: git clone -b dev https://github.com/hasindu2008/slow5lib && cd slow5lib && python3 setup.py install --user && cd .. + - name: slow5lib + run: git clone https://github.com/hasindu2008/slow5lib && cd slow5lib && python3 setup.py install --user && cd .. - name: install run: python3 setup.py install --user && blue-crab --help - name: test @@ -31,8 +31,8 @@ jobs: submodules: recursive - name: install packages run: sudo apt-get update && sudo apt-get install -y zlib1g-dev gcc python3 python3-pip && pip3 install setuptools cython numpy - - name: slow5lib-dev - run: git clone -b dev https://github.com/hasindu2008/slow5lib && cd slow5lib && python3 setup.py install --user && cd .. + - name: slow5lib + run: git clone https://github.com/hasindu2008/slow5lib && cd slow5lib && python3 setup.py install --user && cd .. - name: install run: python3 setup.py install --user && blue-crab --help - name: test @@ -46,45 +46,30 @@ jobs: submodules: recursive - name: install packages run: sudo apt-get update && sudo apt-get install -y zlib1g-dev gcc python3 python3-pip && pip3 install --break-system-packages setuptools cython numpy - - name: slow5lib-dev - run: git clone -b dev https://github.com/hasindu2008/slow5lib && cd slow5lib && python3 setup.py install --user && cd .. + - name: slow5lib + run: git clone https://github.com/hasindu2008/slow5lib && cd slow5lib && python3 setup.py install --user && cd .. - name: install run: python3 setup.py install --user && blue-crab --help - name: test - run: test/test.sh - # arm64: - # name: pyslow5 ubuntu arm - # runs-on: ubuntu-latest - # steps: - # - run: docker run --rm --privileged multiarch/qemu-user-static:register --reset - # - uses: docker://multiarch/ubuntu-core:arm64-focal - # with: - # args: 'uname -a' - # - uses: actions/checkout@v1 - # - uses: docker://multiarch/ubuntu-core:arm64-focal - # with: - # args: > - # bash -c "apt-get update && - # apt-get install -y zlib1g-dev gcc make python3 python3-pip git wget && - # pip3 install setuptools cython numpy && - # ldd --version && gcc --version && python3 --version && - # git clone -b dev https://github.com/hasindu2008/slow5lib && cd slow5lib && python3 setup.py install && cd .. && - # python3 setup.py install && blue-crab --help && test/test.sh" - # os_x_11: - # name: macos-11 - # runs-on: macos-11 - # steps: - # - uses: actions/checkout@v2 - # with: - # submodules: recursive - # - name: install packages - # run: pip3 install numpy - # - name: slow5lib-dev - # run: git clone https://github.com/hasindu2008/slow5lib && cd slow5lib && pip3 install . && cd .. - # - name: install - # run: pip3 install . && blue-crab --help - # - name: test - # run: test/test.sh + run: test/test.sh + arm64: + name: pyslow5 ubuntu arm + runs-on: ubuntu-latest + steps: + - run: docker run --rm --privileged multiarch/qemu-user-static:register --reset + - uses: docker://multiarch/ubuntu-core:arm64-focal + with: + args: 'uname -a' + - uses: actions/checkout@v1 + - uses: docker://multiarch/ubuntu-core:arm64-focal + with: + args: > + bash -c "apt-get update && + apt-get install -y zlib1g-dev gcc make python3 python3-pip git wget && + pip3 install setuptools cython numpy && + ldd --version && gcc --version && python3 --version && + git clone https://github.com/hasindu2008/slow5lib && cd slow5lib && pip3 install . && cd .. && + pip3 install --upgrade pip && rm /usr/lib/python3/dist-packages/pip && pip3 --version && pip3 install . && blue-crab --help && test/test.sh" os_x_12: name: macos-12 runs-on: macos-12 @@ -94,7 +79,7 @@ jobs: submodules: recursive - name: install packages run: pip3 install numpy - - name: slow5lib-dev + - name: slow5lib run: git clone https://github.com/hasindu2008/slow5lib && cd slow5lib && pip3 install . && cd .. - name: install run: pip3 install . && blue-crab --help @@ -109,12 +94,12 @@ jobs: submodules: recursive - name: install packages run: pip3 install numpy - - name: slow5lib-dev + - name: slow5lib run: git clone https://github.com/hasindu2008/slow5lib && cd slow5lib && pip3 install . && cd .. - name: install run: pip3 install . && blue-crab --help - name: test - run: test/test.sh + run: test/test.sh os_x_14: name: macos-14 runs-on: macos-14 @@ -124,9 +109,9 @@ jobs: submodules: recursive - name: install packages run: pip3 install --break-system-packages numpy - - name: slow5lib-dev + - name: slow5lib run: git clone https://github.com/hasindu2008/slow5lib && cd slow5lib && pip3 install --break-system-packages . && cd .. - name: install run: pip3 install --break-system-packages . && blue-crab --help - name: test - run: test/test.sh + run: test/test.sh diff --git a/src/_version.py b/src/_version.py index 40692a7..b81b158 100644 --- a/src/_version.py +++ b/src/_version.py @@ -1 +1 @@ -__version__="0.1.0" +__version__="0.1.1" diff --git a/src/blue_crab.py b/src/blue_crab.py old mode 100644 new mode 100755 index 435c028..3da3e3d --- a/src/blue_crab.py +++ b/src/blue_crab.py @@ -137,7 +137,7 @@ def get_data_from_pod5_record(read): predicted_scaling = read.predicted_scaling predicted_scaling_shift = predicted_scaling.shift predicted_scaling_scale = predicted_scaling.scale - if pore_data.pore_type not in ["not_set", ""]: + if pore_data.pore_type not in ["not_set", "R10.4.1", ""]: logger.error("pore_type is '{}' expected to be 'not_set'. Please contact developers with this message.".format(pore_data.pore_type)) kill_program() @@ -753,6 +753,11 @@ def m2m_s2p_worker(args, input_queue, pod5_out): slow5_end_reason_labels = s5.get_aux_enum_labels("end_reason") except: slow5_end_reason_labels = ['unknown'] + + # if the above fails, it goes to unknown, but if it doesn't exist, it returns and empty list + # so let's set it to unknown + if len(slow5_end_reason_labels) < 1: + slow5_end_reason_labels = ['unknown'] # before ONT added DATA_SERVICE_UNBLOCK_MUX_CHANGE in the middle and removed partial... # slow5_end_reason_labels = ['unknown', 'partial', 'mux_change', 'unblock_mux_change', 'signal_positive', 'signal_negative'] for read in reads: @@ -774,7 +779,12 @@ def m2m_s2p_worker(args, input_queue, pod5_out): # sampling_frequency = read["sampling_rate"] # map end_reason if present # let's convert this to it's string equivalent - s5_end_reason = slow5_end_reason_labels[read.get("end_reason", 0)] + try: + s5_end_reason = slow5_end_reason_labels[read.get("end_reason", 0)] + except Exception as error: + print("An exception occurred while getting slow5 end_reason:", type(error).__name__, "-", error) + print("slow5_end_reason_labels: {}".format(slow5_end_reason_labels)) + sys.exit(1) reason, forced = s2p_end_reason_convert(s5_end_reason) end_reason = p5.EndReason(reason=reason, forced=forced) @@ -941,6 +951,11 @@ def m2s_s2p_worker(args, slow5_filepath_set, pod5_out): slow5_end_reason_labels = s5.get_aux_enum_labels("end_reason") except: slow5_end_reason_labels = ['unknown'] + + # if the above fails, it goes to unknown, but if it doesn't exist, it returns and empty list + # so let's set it to unknown + if len(slow5_end_reason_labels) < 1: + slow5_end_reason_labels = ['unknown'] # before ONT added DATA_SERVICE_UNBLOCK_MUX_CHANGE in the middle and removed partial... # slow5_end_reason_labels = ['unknown', 'partial', 'mux_change', 'unblock_mux_change', 'signal_positive', 'signal_negative'] for read in reads: @@ -962,7 +977,12 @@ def m2s_s2p_worker(args, slow5_filepath_set, pod5_out): # sampling_frequency = read["sampling_rate"] # map end_reason if present # let's convert this to it's string equivalent - s5_end_reason = slow5_end_reason_labels[read.get("end_reason", 0)] + try: + s5_end_reason = slow5_end_reason_labels[read.get("end_reason", 0)] + except Exception as error: + print("An exception occurred while getting slow5 end_reason:", type(error).__name__, "-", error) + print("slow5_end_reason_labels: {}".format(slow5_end_reason_labels)) + sys.exit(1) reason, forced = s2p_end_reason_convert(s5_end_reason) end_reason = p5.EndReason(reason=reason, forced=forced) @@ -1135,6 +1155,10 @@ def s2s_s2p_worker(args, sfile, pod5_out): slow5_end_reason_labels = s5.get_aux_enum_labels("end_reason") except: slow5_end_reason_labels = ['unknown'] + # if the above fails, it goes to unknown, but if it doesn't exist, it returns and empty list + # so let's set it to unknown + if len(slow5_end_reason_labels) < 1: + slow5_end_reason_labels = ['unknown'] run_info_cache = {} # before ONT added DATA_SERVICE_UNBLOCK_MUX_CHANGE in the middle and removed partial... # slow5_end_reason_labels = ['unknown', 'partial', 'mux_change', 'unblock_mux_change', 'signal_positive', 'signal_negative'] @@ -1158,7 +1182,12 @@ def s2s_s2p_worker(args, sfile, pod5_out): # sampling_frequency = read["sampling_rate"] # map end_reason if present # let's convert this to it's string equivalent - s5_end_reason = slow5_end_reason_labels[read.get("end_reason", 0)] + try: + s5_end_reason = slow5_end_reason_labels[read.get("end_reason", 0)] + except Exception as error: + print("An exception occurred while getting slow5 end_reason:", type(error).__name__, "-", error) + print("slow5_end_reason_labels: {}".format(slow5_end_reason_labels)) + sys.exit(1) reason, forced = s2p_end_reason_convert(s5_end_reason) end_reason = p5.EndReason(reason=reason, forced=forced) @@ -1368,7 +1397,7 @@ def main(): parser = MyParser(description="SLOW5/BLOW5 <-> POD5 converter", epilog=''' -See https://slow5.page.link/blue-crab for detailed description of these command-line options. +See https://slow5.bioinf.science/blue-crab for detailed description of these command-line options. Citation: Gamaarachchi, H., Samarakoon, H., Jenner, S.P. et al. Fast nanopore sequencing data analysis with SLOW5. Nat Biotechnol 40, 1026-1029 (2022). https://doi.org/10.1038/s41587-021-01147-4 diff --git a/test/test_extensive.sh b/test/test_extensive.sh index 7e0e6db..fedb0a4 100755 --- a/test/test_extensive.sh +++ b/test/test_extensive.sh @@ -51,7 +51,7 @@ slow5tools --version > /dev/null || die "slow5tools not in path" echo "********************************zymo****************************************" DATA_ZYMO=/data/jamfer/zymo/ -test -d $DATA_ZYMO || die "ERROR: $DATA_ZYMO not found. Download from https://slow5.page.link/na12878_prom_sub and extract" +test -d $DATA_ZYMO || die "ERROR: $DATA_ZYMO not found. Download from https://slow5.bioinf.science/na12878_prom_sub and extract" mkdir $TMP_DIR || die "Creating $TMP_DIR failed" test/test_with_guppy.sh $DATA_ZYMO/pod5 $TMP_DIR slow5tools /install/ont-guppy-6.5.7/bin/guppy_basecaller blue-crab &> test_s2p_with_guppy_sub.log || die "test_s2p_with_guppy failed" rm -r $TMP_DIR