Skip to content

Commit

Permalink
Add optional comments
Browse files Browse the repository at this point in the history
  • Loading branch information
veghp committed Apr 15, 2024
1 parent 5b64c8d commit 5c06838
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions seqreport/SeqCollection.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ class SeqCollection:
**projectname**
> The name of the project (`str`).
**comments**
> Any comments to be included in the report (`str`).
"""

def __init__(
Expand All @@ -30,6 +33,7 @@ def __init__(
cost_per_seq=0,
currency_symbol="£",
projectname="",
comments="",
):
self.fasta = fasta
self.cost_per_base = cost_per_base
Expand All @@ -45,3 +49,4 @@ def __init__(
self.n_bp = n_bp
self.cost = self.n_seq * self.cost_per_seq + self.n_bp * self.cost_per_base
self.projectname = projectname
self.comments = comments
5 changes: 4 additions & 1 deletion seqreport/report_assets/seq_report.pug
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ hr
p.
This document reports basic sequence statistics.

if seqcollection.projectname
if seqcollection.projectname
p.
Projectname: <b>{{ seqcollection.projectname }}</b>

Expand All @@ -21,6 +21,9 @@ p.
p.
Estimated cost: <b>{{ seqcollection.currency_symbol }} {{ seqcollection.cost }}</b>

if seqcollection.comments
p.
Comments: <i>{{ seqcollection.comments }}</i>

div(style="margin-top:1cm; margin-bottom:1cm;")

Expand Down
5 changes: 4 additions & 1 deletion tests/test_SeqCollection.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@


def test_SeqCollection(tmpdir):
seq_coll = seqreport.SeqCollection(fasta=seq_fasta, projectname="EGF24")
seq_coll = seqreport.SeqCollection(
fasta=seq_fasta, projectname="EGF24", comments="This is a test sequence set."
)
assert seq_coll.n_seq == 3
assert seq_coll.n_bp == 99
assert seq_coll.projectname == "EGF24"
assert seq_coll != ""

0 comments on commit 5c06838

Please sign in to comment.