Skip to content

Commit 85c3a1f

Browse files
committed
some getters
1 parent 913204c commit 85c3a1f

File tree

6 files changed

+16
-2
lines changed

6 files changed

+16
-2
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

ribctl/lib/libseq.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,18 +304,19 @@ def calculate_position_entropy(aligned_sequences: List[str], position: int) -> f
304304
return entropy
305305

306306
def get_conservation_scores(fasta_obj: Fasta) -> Dict[int, float]:
307+
307308
"""
308309
Calculate conservation scores for each position in aligned sequences.
309310
Returns a dictionary mapping structural indices to conservation scores.
310311
"""
311312
# Get alignment using existing MUSCLE implementation
312313
aligned_records = muscle_align_N_seq(fasta_obj.records)
313-
314+
314315
# Convert to list of strings for easier processing
315316
aligned_sequences = [str(record.seq) for record in aligned_records]
316317

317318
# Detect sequence type
318-
seq_type = detect_sequence_type(aligned_sequences)
319+
seq_type = detect_sequence_type(aligned_sequences)
319320
max_entropy = get_max_entropy(seq_type)
320321

321322
# Calculate entropy for each position

ribctl/ribosome_ops.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,19 @@ def taxid(self)->int:
3636
def profile(self) -> RibosomeStructure:
3737
return self.assets.profile()
3838

39+
def get_biopython_chain_by_polymer_class(self, polymer_class: PolymerClass) -> Chain:
40+
struct = self.assets.biopython_structure()[0]
41+
poly = self.get_poly_by_polyclass(polymer_class)
42+
if poly == None:
43+
raise KeyError("No polymer found with class: {}".format(polymer_class))
44+
return struct.child_dict[0].child_dict[poly.auth_asym_id]
45+
46+
47+
48+
def get_biopython_chain_by_auth_asym_id(self, auth_asym_id: str) -> Chain:
49+
struct = self.assets.biopython_structure()[0]
50+
return struct.child_dict[0].child_dict[auth_asym_id]
51+
3952
def nomenclature_table(self, verbose: bool = False) -> dict[str, dict]:
4053
prof = self.assets.profile()
4154
m = {}

0 commit comments

Comments
 (0)