(self, index)
| 108 | return graph |
| 109 | |
| 110 | def __getitem__(self, index): |
| 111 | sequence_graph = self.mutated_sequences[index] |
| 112 | structure_graph = self.wild_type |
| 113 | surface_graph = self.surf_graph |
| 114 | |
| 115 | # we need to truncate structure if structure is longer than sequence |
| 116 | if structure_graph.start <= sequence_graph.start and structure_graph.end >= sequence_graph.end: |
| 117 | sequence_graph, structure_graph, surface_graph = self.truncate(sequence_graph, structure_graph, surface_graph) |
| 118 | elif structure_graph.start != sequence_graph.start or structure_graph.end != sequence_graph.end: |
| 119 | raise ValueError("the structure range (%d, %d) doesn't match the sequence range (%d, %d)" % |
| 120 | (structure_graph.start, structure_graph.end, sequence_graph.start, sequence_graph.end)) |
| 121 | |
| 122 | graph = self.assign_structure(sequence_graph, structure_graph) |
| 123 | item = {"graph": graph} |
| 124 | if surface_graph: |
| 125 | item["surf_graph"] = surface_graph |
| 126 | if self.transform: |
| 127 | item = self.transform(item) |
| 128 | return item |
| 129 | |
| 130 | |
| 131 | # pre-training dataset |
nothing calls this directly
no test coverage detected