• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Edinburgh-Genome-Foundry / DnaWeaver / 14138433357

28 Mar 2025 09:46PM UTC coverage: 81.455% (+0.1%) from 81.358%
14138433357

push

github

veghp
Set up automated documentation generation

1836 of 2254 relevant lines covered (81.46%)

0.81 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.0
/dnaweaver/DnaAssemblyMethod/DnaAssemblyMethod.py
1
class DnaAssemblyMethod(object):
1✔
2
    """General class for assembly methods.
3

4
    All assembly methods can store the following attributes:
5

6
    Parameters
7
    ----------
8

9
    duration
10
      Duration required for the assembly (e.g. an estimated upper bound). The
11
      time unit is left at the choice of the user.
12

13
    cost
14
      Cost of assembly.
15

16
    reference
17
      Reference to e.g. a paper or a protocol describing the method.
18

19
    cut_location_constraints
20
      List or tuple of functions `(sequence, int) -> bool` which return for
21
      a sequence and an index (cut location) whether the location should be
22
      considered as a cutting site compatible with this assembly method (True)
23
      or not.
24
      The locations considered in fine are the locations which pass every
25
      constraint in the `cut_location_contraints` list.
26

27
    segment_constraints
28
      List or tuple of functions `(sequence, start, end) -> bool` which returns
29
      for a subsegment `(start, end)` whether the segment is a valid segment
30
      for the assembly.
31
      The segments considered in fine are the segments which pass every
32
      constraint in the `segments_constraints` list.
33

34
    min_segment_length
35
      Minimum length of the fragments that this assembly method allows.
36

37
    max_segment_length
38
      Maximum length of the fragments that this assembly method allows.
39

40
    force_cuts
41
      A function `sequence->[i1, i2, i3...]` which for a given sequence returns
42
      forced cuts locations.
43

44
    suggest_cuts
45

46
    max_fragments
47
       Maximal number of fragments which can be assembled with this method.
48

49
    sequence_constraints
50
      General constraints on the sequence so that it can be built with this
51
      assembly method. It is a list of functions `seq->bool`. If one of
52
      these constraints returns False the sequence is refused.
53

54
    cuts_set_constraints
55
    """
56

57
    name = "None"
1✔
58

59
    def __init__(
1✔
60
        self,
61
        duration=0,
62
        cost=0,
63
        reference=None,
64
        cut_location_constraints=(),
65
        segment_constraints=(),
66
        min_segment_length=0,
67
        max_segment_length=None,
68
        force_cuts=(),
69
        suggest_cuts=(),
70
        max_fragments=None,
71
        sequence_constraints=(),
72
        cuts_set_constraints=(),
73
    ):
74
        self.duration = duration
1✔
75
        self.cost = cost
1✔
76
        self.cut_location_constraints = list(cut_location_constraints)
1✔
77
        self.segment_constraints = list(segment_constraints)
1✔
78
        self.min_segment_length = min_segment_length
1✔
79
        self.max_segment_length = max_segment_length
1✔
80
        self.sequence_constraints = list(sequence_constraints)
1✔
81
        self.max_fragments = max_fragments
1✔
82
        self.cuts_set_constraints = list(cuts_set_constraints)
1✔
83
        self.reference = reference
1✔
84

85
        if callable(suggest_cuts):
1✔
86
            self.suggest_cuts = suggest_cuts
×
87
        else:
88
            # means the cuts are a constant
89
            self.suggest_cuts = lambda *a: suggest_cuts
1✔
90

91
        if callable(force_cuts):
1✔
92
            self.force_cuts = force_cuts
×
93
        else:
94
            # means the forced cuts are a constant
95
            self.force_cuts = lambda *a: force_cuts
1✔
96

97
    def dict_description(self):
1✔
98
        result = {
1✔
99
            "name": self.name,
100
            "minimum segment length": self.min_segment_length,
101
            "maximum segment length": self.max_segment_length,
102
            "maximal number of fragments": self.max_fragments,
103
            "reference": self.reference,
104
            "duration": self.duration,
105
            "cost": self.cost,
106
        }
107
        result.update(self.additional_dict_description())
1✔
108
        return result
1✔
109

110
    # def extend_sequence(self, sequence):
111
    #     return sequence
112

113
    def additional_dict_description(self):
1✔
114
        return {}
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc