Skip to content

Commit

Permalink
Merge pull request #13 from Psy-Fer/dev
Browse files Browse the repository at this point in the history
v0.1.1 to add pore_type
  • Loading branch information
Psy-Fer authored Jul 4, 2024
2 parents 2af0d24 + 0f41eed commit e83526d
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 52 deletions.
75 changes: 30 additions & 45 deletions .github/workflows/snake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion src/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__="0.1.0"
__version__="0.1.1"
39 changes: 34 additions & 5 deletions src/blue_crab.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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:
Expand All @@ -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)

Expand Down Expand Up @@ -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:
Expand All @@ -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)

Expand Down Expand Up @@ -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']
Expand All @@ -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)

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/test_extensive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e83526d

Please sign in to comment.