Samad14 commited on
Commit
d70fadb
·
verified ·
1 Parent(s): bdbf62d

Upload folder using huggingface_hub (part 2)

Browse files
Files changed (1) hide show
  1. tests/test_blast_resilience.py +56 -0
tests/test_blast_resilience.py CHANGED
@@ -549,3 +549,59 @@ class TestBlastDownstreamFeatureRestoration:
549
  assert result["source"] == "esmfold"
550
  assert result["structure_type"] == "predicted"
551
  assert result["uniprot_accession"] == "P11111"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
549
  assert result["source"] == "esmfold"
550
  assert result["structure_type"] == "predicted"
551
  assert result["uniprot_accession"] == "P11111"
552
+
553
+
554
+ class TestBlastStructureAnalysisRestoration:
555
+ """BLAST downstream structure panels must operate on carried evidence honestly."""
556
+
557
+ def test_secondary_structure_accepts_raw_sequence_and_is_labelled_heuristic(self):
558
+ from app.routers.structure_analysis import _predict_secondary_structure
559
+
560
+ result = _predict_secondary_structure(PROTEIN_SEQ, "BLAST query")
561
+ assert result["method"] == "Chou-Fasman propensity heuristic"
562
+ assert result["evidence_class"] == "heuristic"
563
+ assert result["source"] == "BLAST query"
564
+ assert len(result["residues"]) == len(PROTEIN_SEQ)
565
+ assert {row.ss for row in result["residues"]} <= {"H", "E", "C"}
566
+
567
+ def test_ramachandran_basin_labels_are_descriptive_not_quality_outliers(self):
568
+ from app.routers.structure_analysis import classify_rama
569
+
570
+ assert classify_rama(-63, -43) == "alpha"
571
+ assert classify_rama(-120, 125) == "beta"
572
+ assert classify_rama(60, 40) == "left_handed"
573
+ assert classify_rama(170, -170) == "other"
574
+ assert "outlier" not in {
575
+ classify_rama(-63, -43),
576
+ classify_rama(-120, 125),
577
+ classify_rama(60, 40),
578
+ classify_rama(170, -170),
579
+ }
580
+
581
+ def test_ramachandran_calculates_angles_from_inline_carried_structure(self):
582
+ from app.routers.structure_analysis import _ramachandran_points
583
+
584
+ pdb = """\
585
+ ATOM 1 N ALA A 1 17.047 14.099 3.625 1.00 0.00 N
586
+ ATOM 2 CA ALA A 1 16.967 12.784 4.338 1.00 0.00 C
587
+ ATOM 3 C ALA A 1 15.685 12.755 5.133 1.00 0.00 C
588
+ ATOM 4 O ALA A 1 15.268 13.825 5.594 1.00 0.00 O
589
+ ATOM 5 CB ALA A 1 18.170 12.703 5.337 1.00 0.00 C
590
+ ATOM 6 N ALA A 2 15.115 11.555 5.265 1.00 0.00 N
591
+ ATOM 7 CA ALA A 2 13.856 11.469 6.066 1.00 0.00 C
592
+ ATOM 8 C ALA A 2 14.164 10.785 7.379 1.00 0.00 C
593
+ ATOM 9 O ALA A 2 14.993 9.862 7.443 1.00 0.00 O
594
+ ATOM 10 CB ALA A 2 12.732 10.711 5.261 1.00 0.00 C
595
+ ATOM 11 N ALA A 3 13.550 10.300 8.450 1.00 0.00 N
596
+ ATOM 12 CA ALA A 3 13.700 9.600 9.700 1.00 0.00 C
597
+ ATOM 13 C ALA A 3 12.500 9.800 10.600 1.00 0.00 C
598
+ ATOM 14 O ALA A 3 11.400 9.350 10.300 1.00 0.00 O
599
+ ATOM 15 CB ALA A 3 15.000 9.900 10.400 1.00 0.00 C
600
+ TER 16 ALA A 3
601
+ END
602
+ """
603
+ points = _ramachandran_points(pdb, "A")
604
+ assert points
605
+ assert any(point.resnum == 2 for point in points)
606
+ assert all(-180.0 <= point.phi <= 180.0 for point in points)
607
+ assert all(-180.0 <= point.psi <= 180.0 for point in points)