aboutsummaryrefslogtreecommitdiff
path: root/bh20sequploader/main.py
diff options
context:
space:
mode:
Diffstat (limited to 'bh20sequploader/main.py')
-rw-r--r--bh20sequploader/main.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/bh20sequploader/main.py b/bh20sequploader/main.py
index 80c33c8..d2a6c5f 100644
--- a/bh20sequploader/main.py
+++ b/bh20sequploader/main.py
@@ -26,11 +26,14 @@ VALIDATED_PROJECT='lugli-j7d0g-5ct8p1i1wrgyjvp'
def qc_stuff(metadata, sequence_p1, sequence_p2, do_qc=True):
failed = False
+ sample_id = ''
try:
log.debug("Checking metadata" if do_qc else "Skipping metadata check")
- if do_qc and not qc_metadata(metadata.name):
- log.warning("Failed metadata QC")
- failed = True
+ if do_qc:
+ sample_id = qc_metadata(metadata.name)
+ if not sample_id:
+ log.warning("Failed metadata QC")
+ failed = True
except Exception as e:
log.exception("Failed metadata QC")
failed = True
@@ -46,6 +49,10 @@ def qc_stuff(metadata, sequence_p1, sequence_p2, do_qc=True):
target[0] = ("reads_1."+target[0][0][6:], target[0][1])
target[1] = ("reads_2."+target[1][0][6:], target[0][1])
+
+ if target[0][2] == 'text/fasta' and sample_id != target[0][1]:
+ raise ValueError("The sample_id field in the metadata must be the same as the FASTA header")
+
except Exception as e:
log.exception("Failed sequence QC")
failed = True