From 3165a31e321cbf4641f9afdcbea511ee66f673bb Mon Sep 17 00:00:00 2001 From: AndreaGuarracino Date: Fri, 28 Aug 2020 11:16:24 +0200 Subject: added control (locally and in the validation) that sample_id has to be the same in the metadata and in the FASTA header #103 --- bh20seqanalyzer/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'bh20seqanalyzer/main.py') diff --git a/bh20seqanalyzer/main.py b/bh20seqanalyzer/main.py index 11349e5..5f00080 100644 --- a/bh20seqanalyzer/main.py +++ b/bh20seqanalyzer/main.py @@ -83,12 +83,16 @@ class SeqAnalyzer: if n not in col: continue with col.open(n, 'rb') as qf: - tgt = qc_fasta(qf)[0] + tgt, seqlabel, seq_type = qc_fasta(qf) if tgt != n and tgt != paired.get(n): errors.append("Expected %s but magic says it should be %s", n, tgt) elif tgt in ("reads.fastq", "reads.fastq.gz", "reads_1.fastq", "reads_1.fastq.gz"): self.start_fastq_to_fasta(collection, n, sample_id) return False + + # If it is a FASTA + if sample_id != seqlabel: + errors.append("Expected sample_id == seqlabel, but %s != %s" % (sample_id, seqlabel)) if tgt is None: errors.append("Upload '%s' does not contain sequence.fasta, reads.fastq or reads_1.fastq", collection["name"]) except Exception as v: -- cgit v1.2.3