Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial setup for element aviti #432

Merged
merged 232 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from 191 commits
Commits
Show all changes
232 commits
Select commit Hold shift + click to select a range
22bbbcf
Initial setup for element aviti
ssjunnebo Aug 29, 2024
36dbafd
Updated outline for Aviti
ssjunnebo Aug 29, 2024
d005446
Process aviti data from sequencing to demux
ssjunnebo Aug 29, 2024
6b9e885
add aviti stuff to test conf tempdir
kedhammar Sep 2, 2024
36fc1c6
modularize
kedhammar Sep 2, 2024
bafbf6a
add test class
kedhammar Sep 2, 2024
7ff7a26
add tests
kedhammar Sep 2, 2024
781ef95
docs
kedhammar Sep 2, 2024
d32b7de
bugfix
kedhammar Sep 2, 2024
1d3408b
add tests
kedhammar Sep 2, 2024
b5d307c
differentiate element/aviti
kedhammar Sep 2, 2024
047ac22
add skip reasons
kedhammar Sep 2, 2024
fa473cd
add test
kedhammar Sep 2, 2024
7e84ac1
ruff format
kedhammar Sep 2, 2024
9052caa
ruff check
kedhammar Sep 2, 2024
b63cd4d
bugfix
kedhammar Sep 2, 2024
5ddd2f0
Add funktions for aviti processing
ssjunnebo Sep 4, 2024
3521443
Merge branch 'aviti' of https://github.com/ssjunnebo/TACA into aviti
ssjunnebo Sep 4, 2024
1a43207
Add status of a run
ssjunnebo Sep 10, 2024
38b3276
Get run manifests from lims instead
ssjunnebo Sep 11, 2024
ad65717
Draft for Element upload to statusdb
alneberg Sep 12, 2024
e2a6069
Merge remote-tracking branch 'ssjunnebo/aviti' into ssjunnebo_aviti
alneberg Sep 12, 2024
dcb4504
more functions
ssjunnebo Sep 12, 2024
d23be69
RunParameters parsing
alneberg Sep 12, 2024
5bd1233
Merge with upstream but also a lot of changes
alneberg Sep 12, 2024
6ac2bee
No need to give the status again
alneberg Sep 13, 2024
539bbee
Use run for printing
alneberg Sep 13, 2024
4c15b67
Read instrument generated files to doc obj and implemented the status…
alneberg Sep 13, 2024
86abdde
Merge pull request #2 from alneberg/ssjunnebo_aviti
ssjunnebo Sep 16, 2024
bf10187
Abort processing if RunParameters.json is not found
alneberg Sep 16, 2024
cd857d7
Restructure transfer logic
ssjunnebo Sep 16, 2024
2640328
Merge pull request #3 from alneberg/ssjunnebo_aviti
ssjunnebo Sep 16, 2024
3be5484
rename is_transferred function
ssjunnebo Sep 16, 2024
4ca441d
add methods for finding and copying LIMS-generated manifests
kedhammar Sep 16, 2024
66ae47b
Merge branch 'aviti' of github.com:ssjunnebo/TACA into aviti
kedhammar Sep 16, 2024
c840ea8
add very rushed function for deriving new composite demux manifests
kedhammar Sep 16, 2024
eda9f3f
Restructure transfer status
ssjunnebo Sep 17, 2024
918f16f
Merge branch 'aviti' of https://github.com/ssjunnebo/TACA into aviti
ssjunnebo Sep 17, 2024
0baa93c
refrase
ssjunnebo Sep 17, 2024
1fe015d
Add command for starting demux
ssjunnebo Sep 17, 2024
5790c1a
Check all demux dirs if demux is done
ssjunnebo Sep 17, 2024
32f812c
Aggregate demux results if more than one
ssjunnebo Sep 17, 2024
253b9d1
rsync function
ssjunnebo Sep 18, 2024
90bc0ed
A suggestion for structure for the _process function
alneberg Sep 18, 2024
08995cb
gather demux results and upload to statusdb
ssjunnebo Sep 18, 2024
ee38b71
Correct path finding
ssjunnebo Sep 18, 2024
c9acfb9
filtter out phix
ssjunnebo Sep 18, 2024
faa7f68
Fix dictionary
ssjunnebo Sep 18, 2024
70803cd
Remove config file for tests from Docker
alneberg Sep 19, 2024
c6667b2
Change order of init in aviti
alneberg Sep 19, 2024
0ec6924
Handle run post transfer
ssjunnebo Sep 19, 2024
0a3de0b
Some small bugfixes for Element Runs
alneberg Sep 19, 2024
d9581d5
Trying to use moch patch for element tests
alneberg Sep 19, 2024
b831d42
Added extensions to devcontainer
alneberg Sep 19, 2024
6844ab7
Fix mocking of statusb for element tests
alneberg Sep 19, 2024
871f7c4
For testing, sequencer_type was not defined
alneberg Sep 19, 2024
7aea542
Importing glob according to code usage
alneberg Sep 19, 2024
99c20ea
Changed mock behaviour
alneberg Sep 19, 2024
c9df021
Merge pull request #5 from alneberg/ssjunnebo_aviti2
ssjunnebo Sep 19, 2024
a9fc4f7
Fix check for manifest zip file
ssjunnebo Sep 19, 2024
8e3f05c
Merge branch 'aviti' of https://github.com/ssjunnebo/TACA into aviti
ssjunnebo Sep 19, 2024
591e633
Remove pdb
ssjunnebo Sep 19, 2024
79795a2
Merge branch 'aviti' into ssjunnebo_aviti
ssjunnebo Sep 19, 2024
7605a1d
Merge pull request #4 from alneberg/ssjunnebo_aviti
ssjunnebo Sep 19, 2024
babcbd0
TACA Aviti integration WIP
chuan-wang Sep 20, 2024
efe3e96
Fix undet
chuan-wang Sep 20, 2024
0480846
Fix typo
chuan-wang Sep 20, 2024
f01333d
Still WIP
chuan-wang Sep 20, 2024
d118931
Fix config settings
ssjunnebo Sep 23, 2024
73c54a3
Fix UnassignedSequences.csv
chuan-wang Sep 23, 2024
5b4f947
Fix IndexAssignment.csv
chuan-wang Sep 23, 2024
fac9912
Fix project run stats WIP
chuan-wang Sep 24, 2024
3a0b10a
bug fixes
ssjunnebo Sep 24, 2024
9e80a4f
Fix getting demux status
ssjunnebo Sep 24, 2024
feec321
Finalize scripts and fix bugs
chuan-wang Sep 24, 2024
23e9b64
Bug fixes
ssjunnebo Sep 25, 2024
c6cd477
Merge branch 'aviti' into dev
ssjunnebo Sep 25, 2024
ab99114
Update taca/element/Element_Runs.py
ssjunnebo Sep 26, 2024
cf64192
Update taca/element/Element_Runs.py
ssjunnebo Sep 26, 2024
2559ecc
Update taca/element/Element_Runs.py
ssjunnebo Sep 26, 2024
9627961
Remove unused function
chuan-wang Sep 26, 2024
65aa5c6
Merge pull request #6 from chuan-wang/dev
ssjunnebo Sep 26, 2024
3e8d3f1
Remove used function
chuan-wang Sep 26, 2024
8a9ce0f
fix references to functions
ssjunnebo Sep 26, 2024
80d03c4
make config to use for tests
kedhammar Sep 26, 2024
7936e8f
add config
kedhammar Sep 26, 2024
41dd477
bugfix
kedhammar Sep 26, 2024
48ec343
Upload more stuff to statusdb
ssjunnebo Sep 26, 2024
4939939
Merge branch 'aviti' of https://github.com/ssjunnebo/TACA into aviti
ssjunnebo Sep 26, 2024
d16ef8f
fix formatting of .toml and scale down defaults args of pytest to ena…
kedhammar Sep 26, 2024
04001fd
add aviti transfer log
kedhammar Sep 26, 2024
bcec98f
build config from tmp dir and update tests to pass
kedhammar Sep 26, 2024
eadc072
remove comment
kedhammar Sep 26, 2024
4e1c568
fix full command with inline results
kedhammar Sep 26, 2024
9c36a3c
Merge pull request #8 from kedhammar/ssjunnebo_aviti
ssjunnebo Sep 26, 2024
a0696b1
bugfix
kedhammar Sep 26, 2024
e36a66f
Merge branch 'dev' into aviti
chuan-wang Sep 27, 2024
94054cd
Merge pull request #35 from ssjunnebo/aviti
chuan-wang Sep 27, 2024
891595d
Add project name in IndexAssignment; Correct index percentage in undet
chuan-wang Sep 27, 2024
d6e2251
Add Sample_ in sample folder name
chuan-wang Sep 28, 2024
8a1a498
Refactors based on comments from SS
chuan-wang Sep 30, 2024
9a1c259
Replace hard-coded file names
chuan-wang Sep 30, 2024
6a21826
Merge pull request #9 from chuan-wang/dev
ssjunnebo Sep 30, 2024
8c0263e
Small fixes
ssjunnebo Sep 30, 2024
c86b6bf
Sync metadata
ssjunnebo Sep 30, 2024
f221c98
Also sync RunParameters.json
ssjunnebo Sep 30, 2024
da9222a
Cleanup
ssjunnebo Sep 30, 2024
58b7252
bugfix
kedhammar Oct 1, 2024
3b87b45
ruff
kedhammar Oct 1, 2024
e245d1c
add status section to mock config
kedhammar Oct 1, 2024
e772189
start analysis functional test
kedhammar Oct 1, 2024
9f2e66d
Merge remote-tracking branch 'ssjunnebo/aviti' into ssjunnebo_aviti
kedhammar Oct 1, 2024
f874871
attr for empty manifest
kedhammar Oct 1, 2024
7958caa
wip
kedhammar Oct 1, 2024
962a19c
build manifests based on masks
kedhammar Oct 1, 2024
bbc8440
ruff formatting
ssjunnebo Oct 1, 2024
8e93a92
Merge pull request #36 from ssjunnebo/aviti
chuan-wang Oct 1, 2024
43d8316
Add cycles in runparameters
chuan-wang Oct 1, 2024
1334043
polishing, adapt masks to true cycles
kedhammar Oct 1, 2024
a1c7cce
ruff
kedhammar Oct 1, 2024
9197ea4
ruff check
kedhammar Oct 1, 2024
8113ac1
Merge remote-tracking branch 'ssjunnebo/aviti' into ssjunnebo_aviti
kedhammar Oct 1, 2024
afe2af6
mypy fix
kedhammar Oct 1, 2024
0cddf72
Merge pull request #11 from kedhammar/ssjunnebo_aviti
ssjunnebo Oct 2, 2024
1ba1098
Merge pull request #10 from chuan-wang/dev
ssjunnebo Oct 2, 2024
b84a4f9
Merge remote-tracking branch 'ssjunnebo/aviti' into ssjunnebo_aviti
kedhammar Oct 2, 2024
4b1610c
use cycles from runparam for mask generation
kedhammar Oct 2, 2024
298bcbe
readability improvements, use runparam cycles for r1/r2 masks
kedhammar Oct 2, 2024
95a3258
syntax fix
kedhammar Oct 2, 2024
9116629
Merge pull request #12 from kedhammar/ssjunnebo_aviti
ssjunnebo Oct 2, 2024
8a28e89
Email warnings to operator
ssjunnebo Oct 2, 2024
1e168a2
Cleanup comments
ssjunnebo Oct 3, 2024
ec7b390
typo
kedhammar Oct 3, 2024
178683d
wip
kedhammar Oct 3, 2024
602b14f
troubleshooting
kedhammar Oct 3, 2024
102f223
mypy
kedhammar Oct 3, 2024
b57306d
Don't group by lane when creating submanifests. Add sanity check for …
kedhammar Oct 4, 2024
dda10c6
Merge pull request #13 from kedhammar/ssjunnebo_aviti
ssjunnebo Oct 7, 2024
ec786f1
Fix method definitions
ssjunnebo Oct 7, 2024
533f448
Handle masking when no R2
ssjunnebo Oct 7, 2024
0b030b1
Return empty string instead of None for missing I2
ssjunnebo Oct 7, 2024
f417788
fix sorting issue
ssjunnebo Oct 7, 2024
a0ec98d
Fixes for masks
ssjunnebo Oct 7, 2024
ec28bb7
Fixes to masks
ssjunnebo Oct 7, 2024
2874583
Clarify get_mask() and also use it to generate R1/R2 masks
kedhammar Oct 7, 2024
89e4236
Merge pull request #14 from kedhammar/ssjunnebo_aviti
ssjunnebo Oct 8, 2024
a55186c
Merge pull request #37 from ssjunnebo/aviti
chuan-wang Oct 8, 2024
920cc27
Fix bug that not all FastQ files are symplinked
chuan-wang Oct 8, 2024
7c7d787
Merge pull request #15 from chuan-wang/dev
ssjunnebo Oct 8, 2024
6582eb9
check if dir exists before creating one
ssjunnebo Oct 8, 2024
a4aab0e
Merge branch 'aviti' of https://github.com/ssjunnebo/TACA into aviti
ssjunnebo Oct 8, 2024
160b204
catch stderr from bases2fastq
ssjunnebo Oct 8, 2024
401c3a9
cleanup and versioning
ssjunnebo Oct 8, 2024
3746b09
Merge branch 'master' into aviti
ssjunnebo Oct 8, 2024
41b90eb
spaaace
ssjunnebo Oct 8, 2024
b8a6887
Merge branch 'aviti' of https://github.com/ssjunnebo/TACA into aviti
ssjunnebo Oct 8, 2024
e81460d
Parse UMI masks for both I1 and I2, can only use one though
kedhammar Oct 8, 2024
34e260f
stricter check
kedhammar Oct 8, 2024
0dd6038
Merge pull request #16 from kedhammar/ssjunnebo_aviti
ssjunnebo Oct 9, 2024
ae961e9
overwrite group settings by settings row specified in lims manifest
kedhammar Oct 9, 2024
01dd52f
fix ref
kedhammar Oct 9, 2024
d0c402a
Merge pull request #17 from kedhammar/ssjunnebo_aviti
ssjunnebo Oct 9, 2024
f20c3d7
use tree output for docs
kedhammar Oct 11, 2024
1d48b47
add files for func test
kedhammar Oct 11, 2024
e4635a8
Merge pull request #38 from ssjunnebo/aviti
chuan-wang Oct 11, 2024
76da6a5
fix presumed method call bug
kedhammar Oct 11, 2024
2fb014f
reset kwargs, update lims manifest, fix bugs, remove csv after zippin…
kedhammar Oct 11, 2024
120f947
mock subprocess, use default kwargs
kedhammar Oct 11, 2024
dd49177
add stop mocks
kedhammar Oct 11, 2024
e27bc66
Fix issue with 0 lane number; Add percentage int total unassigned
chuan-wang Oct 11, 2024
447045f
Fix bug'
chuan-wang Oct 11, 2024
cfcef68
ruff format
chuan-wang Oct 11, 2024
9e8b375
fix tests
kedhammar Oct 11, 2024
bd6ac21
stop mocks
kedhammar Oct 11, 2024
9b1a495
Refactor based on comments from JoA; Fix VERSIONLOG
chuan-wang Oct 11, 2024
81b91ea
fix faulty annotation
kedhammar Oct 11, 2024
fb92189
parametrization
kedhammar Oct 11, 2024
47e912d
test polishing
kedhammar Oct 11, 2024
b16423b
test troubleshooting
kedhammar Oct 11, 2024
81dcc40
all tests functional
kedhammar Oct 11, 2024
b0593da
add some parametrization
kedhammar Oct 11, 2024
b290bb5
mypy
kedhammar Oct 11, 2024
35248bd
remove empty, skipped tests
kedhammar Oct 11, 2024
2eff071
Merge pull request #18 from chuan-wang/dev
ssjunnebo Oct 14, 2024
326375f
Merge pull request #19 from kedhammar/ssjunnebo_aviti
ssjunnebo Oct 14, 2024
bb888bc
Reconfigure pytest arguments w / wo CI
kedhammar Oct 14, 2024
fd54a12
Small fixes
ssjunnebo Oct 15, 2024
8906630
Merge pull request #39 from ssjunnebo/aviti
chuan-wang Oct 16, 2024
5f46a2f
Fix bug with empty aggregated_unassigned_indexes
chuan-wang Oct 16, 2024
340de28
Fix wrong logic for collecting unassigned indexes
chuan-wang Oct 16, 2024
aad13f6
Merge pull request #20 from chuan-wang/dev
ssjunnebo Oct 16, 2024
8134461
Warn about missing files
ssjunnebo Oct 16, 2024
ad2d015
modernize ont test parametrization
kedhammar Oct 22, 2024
554d38a
remove rsync options causing vscode pytest crash due to outdated rsyn…
kedhammar Oct 22, 2024
4b2f8d8
add mock mail to config and overwrite functionality to element dir
kedhammar Oct 22, 2024
70d51bc
Add conftest fixture for logging when testing. Send to stdout and spe…
kedhammar Oct 22, 2024
825182e
start work on incremental test function
kedhammar Oct 22, 2024
f69beea
add package for checking dir hashes, add 2nd test increment
kedhammar Oct 22, 2024
f383665
suspected bug fix
kedhammar Oct 23, 2024
f659fa6
start working on nicer tests
kedhammar Oct 23, 2024
2ef5bae
syntax fix
kedhammar Oct 23, 2024
6db6378
add db mock assertions!
kedhammar Oct 23, 2024
4b649eb
use dict of mocks for flexibility
kedhammar Oct 23, 2024
ddfb365
prep for merge
kedhammar Oct 23, 2024
96159b1
Merge remote-tracking branch 'ssjunnebo/aviti' into ssjunnebo_aviti
kedhammar Oct 23, 2024
3527588
add mock bases2fastq executable
kedhammar Oct 23, 2024
8aef1c9
add demux test w assertions
kedhammar Oct 23, 2024
fa506dd
formatting
kedhammar Oct 23, 2024
e208826
IT'S ALIVE
kedhammar Oct 23, 2024
efffd89
ruff fix
kedhammar Oct 23, 2024
4807f74
mypy fix
kedhammar Oct 23, 2024
636dcdd
try to placate GHA
kedhammar Oct 23, 2024
9130d43
try different way of extracting mock call args
kedhammar Oct 24, 2024
a91d868
potential fix
kedhammar Oct 24, 2024
383a7b2
troubleshooting
kedhammar Oct 24, 2024
e2cefe8
more debugging
kedhammar Oct 24, 2024
63495ef
try getting python ver up to date and decreasing debugging resolution
kedhammar Oct 24, 2024
0a4fd33
more debugging
kedhammar Oct 24, 2024
60ed258
last commit worked! Try re-instating cov pytest
kedhammar Oct 24, 2024
e6c9043
last commit worked, try not capturing pytest output
kedhammar Oct 24, 2024
221a57a
last commit worked, try removing debug statement
kedhammar Oct 24, 2024
80c687b
try cleaner module purge
kedhammar Oct 24, 2024
c75ca89
Merge pull request #40 from ssjunnebo/aviti
chuan-wang Oct 24, 2024
db2b99e
Fix issue with redundant PhiX record
chuan-wang Oct 24, 2024
2de4994
ruff format change
chuan-wang Oct 24, 2024
05979c7
propagate bugfix
kedhammar Oct 24, 2024
5599bed
set required python version, same as for GHA build
kedhammar Oct 24, 2024
488cb39
propagate python version explication to Dockerfile
kedhammar Oct 24, 2024
807b02e
Merge pull request #22 from chuan-wang/dev
ssjunnebo Oct 25, 2024
5ec6323
Merge pull request #21 from kedhammar/ssjunnebo_aviti
ssjunnebo Oct 25, 2024
6b6e056
Rename archiving
ssjunnebo Oct 25, 2024
81ea936
Merge branch 'master' into aviti
ssjunnebo Oct 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@
"features": {},
"customizations": {
"vscode": {
"extensions": ["ms-python.python", "eamodio.gitlens"]
"extensions": [
"ms-python.python",
"eamodio.gitlens",
"charliermarsh.ruff",
"ms-python.mypy-type-checker"
]
}
},
// Features to add to the dev container. More info: https://containers.dev/features.
Expand Down
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ COPY requirements-dev.txt requirements-dev.txt
RUN python -m pip install -r requirements-dev.txt

RUN mkdir /root/.taca/
COPY tests/data/taca_test_cfg.yaml /root/.taca/taca.yaml

FROM base AS testing
COPY . /taca
Expand Down
12 changes: 12 additions & 0 deletions VERSIONLOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# TACA Version Log

## 20241016.1

Fix wrong logic for collecting unassigned indexes

## 20241011.1

Fix issue with 0 lane number; Add percentage of unassigned in total unassigned per lane

## 20241008.1

Add support for processing Element Aviti data

## 20241007.1

Update taca-ngi-pipeline repo URL in README
Expand Down
9 changes: 6 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
title = "taca"

# === LINTING ================================================================

[tool.ruff]
Expand Down Expand Up @@ -37,7 +35,12 @@ filterwarnings = [
'ignore::DeprecationWarning:couchdb.*',
'ignore::DeprecationWarning:pkg_resources.*',
]
addopts = "--cov=./taca --cov-report term-missing -vv --cache-clear tests/"
# Default addopts
addopts = "--ignore tests_old/"

# CLI coverage reports, messes with IDE debugging
# pytest --ignore tests_old/ --cov=./taca --cov-report term-missing -vv


[tool.coverage.run]
# The comment "# pragma: no cover" can be used to exclude a line from coverage
Expand Down
2 changes: 1 addition & 1 deletion taca/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Main TACA module"""

__version__ = "1.0.0"
__version__ = "1.1.0"
163 changes: 163 additions & 0 deletions taca/analysis/analysis_element.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
"""Analysis methods for sequencing runs produced by Element instruments."""

import glob
import logging
import os

from taca.element.Aviti_Runs import Aviti_Run
from taca.utils.config import CONFIG
from taca.utils.misc import send_mail

logger = logging.getLogger(__name__)


def run_preprocessing(given_run):
"""Run demultiplexing in all data directories.

:param str given_run: Process a particular run instead of looking for runs
"""

def _process(run):
"""Process a run/flowcell and transfer to analysis server.

:param taca.element.Run run: Run to be processed and transferred
"""
try:
run.parse_run_parameters()
except FileNotFoundError:
logger.warning(
f"Cannot reliably set NGI_run_id for {run} due to missing RunParameters.json. Aborting run processing"
)
email_subject = f"Issues processing {run}"
email_message = (
f"RunParameters.json missing for {run}. Processing was aborted."
kedhammar marked this conversation as resolved.
Show resolved Hide resolved
)
send_mail(email_subject, email_message, CONFIG["mail"]["recipients"])
raise

#### Sequencing status ####
sequencing_done = run.check_sequencing_status()
if not sequencing_done:
run.status = "sequencing"
if run.status_changed:
run.update_statusdb()
return

#### Demultiplexing status ####
demultiplexing_status = run.get_demultiplexing_status()
if demultiplexing_status == "not started":
lims_zip_path = run.find_lims_zip()
if lims_zip_path is not None:
os.mkdir(run.demux_dir)
run.copy_manifests(lims_zip_path)
demux_manifests = run.make_demux_manifests(
manifest_to_split=run.lims_manifest
)
sub_demux_count = 0
for demux_manifest in sorted(demux_manifests):
sub_demux_dir = os.path.join(
run.run_dir, f"Demultiplexing_{sub_demux_count}"
)
os.mkdir(sub_demux_dir)
run.start_demux(demux_manifest, sub_demux_dir)
sub_demux_count += 1
run.status = "demultiplexing"
if run.status_changed():
run.update_statusdb()
return
else:
logger.warning(
f"Run manifest is missing for {run}, demultiplexing aborted"
)
email_subject = f"Issues processing {run}"
email_message = (
f"Run manifest is missing for {run}, demultiplexing aborted"
)
send_mail(email_subject, email_message, CONFIG["mail"]["recipients"])
return
elif demultiplexing_status == "ongoing":
run.status = "demultiplexing"
if run.status_changed:
run.update_statusdb()
return

elif demultiplexing_status != "finished":
logger.warning(
f"Unknown demultiplexing status {demultiplexing_status} of run {run}. Please investigate."
)
email_subject = f"Issues processing {run}"
email_message = f"Unknown demultiplexing status {demultiplexing_status} of run {run}. Please investigate."
send_mail(email_subject, email_message, CONFIG["mail"]["recipients"])
return

#### Transfer status ####
transfer_status = run.get_transfer_status()
if transfer_status == "not started":
demux_results_dirs = glob.glob(
os.path.join(run.run_dir, "Demultiplexing_*")
)
run.aggregate_demux_results(demux_results_dirs)
run.sync_metadata()
run.make_transfer_indicator()
run.status = "transferring"
if run.status_changed:
run.update_statusdb()
# TODO: Also update statusdb with a timestamp of when the transfer started
run.transfer()
return
elif transfer_status == "ongoing":
run.status = "transferring"
if run.status_changed:
run.update_statusdb()
logger.info(
f"{run} is being transferred. Skipping."
) # TODO: fix formatting, currently prints "ElementRun(20240910_AV242106_B2403418431) is being transferred"
return
elif transfer_status == "rsync done":
if run.rsync_successful():
run.remove_transfer_indicator()
run.update_transfer_log()
run.status = "transferred"
if run.status_changed:
run.update_statusdb()
run.archive()
run.status = "archived"

if run.status_changed:
run.update_statusdb()
else:
run.status = "transfer failed"
logger.warning(
f"An issue occurred while transfering {run} to the analysis cluster."
)
email_subject = f"Issues processing {run}"
email_message = f"An issue occurred while transfering {run} to the analysis cluster."
send_mail(email_subject, email_message, CONFIG["mail"]["recipients"])
return
else:
logger.warning(
f"Unknown transfer status {transfer_status} of run {run}, please investigate."
)
email_subject = f"Issues processing {run}"
email_message = f"Unknown transfer status {transfer_status} of run {run}, please investigate."
send_mail(email_subject, email_message, CONFIG["mail"]["recipients"])
return

if given_run:
run = Aviti_Run(given_run, CONFIG)
_process(run)
else:
data_dirs = CONFIG.get("element_analysis").get("data_dirs")
for data_dir in data_dirs:
# Run folder looks like DATE_*_*, the last section is the FC side (A/B) and name
runs = glob.glob(os.path.join(data_dir, "[1-9]*_*_*"))
for run in runs:
runObj = Aviti_Run(run, CONFIG)
try:
_process(runObj)
except:
# This function might throw and exception,
# it is better to continue processing other runs
logger.warning(f"There was an error processing the run {run}")
# TODO: Think about how to avoid silent errors (email?)
pass
25 changes: 24 additions & 1 deletion taca/analysis/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import click

from taca.analysis import analysis as an
from taca.analysis import analysis_nanopore
from taca.analysis import analysis_element, analysis_nanopore


@click.group()
Expand Down Expand Up @@ -72,6 +72,29 @@ def updatedb(rundir, software):
an.upload_to_statusdb(rundir, software)


# Element analysis subcommands


@analysis.command()
@click.option(
"-r",
"--run",
type=click.Path(exists=True),
default=None,
help="Demultiplex only a particular run",
)
def demultiplex_element(run):
"""Demultiplex and transfer all runs present in the data directories."""
analysis_element.run_preprocessing(run)


@analysis.command()
@click.argument("run")
def element_updatedb(run):
"""Save the run to statusdb."""
analysis_element.upload_to_statusdb(run)


# Nanopore analysis subcommands


Expand Down
8 changes: 8 additions & 0 deletions taca/element/Aviti_Runs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from taca.element.Element_Runs import Run


class Aviti_Run(Run):
def __init__(self, run_dir, configuration):
self.sequencer_type = "Aviti"
self.demux_dir = "Demultiplexing"
super().__init__(run_dir, configuration)
Loading
Loading