rna-structure-audit 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (464) hide show
  1. rna_structure_audit-0.1.0/.github/workflows/publish.yml +21 -0
  2. rna_structure_audit-0.1.0/.gitignore +15 -0
  3. rna_structure_audit-0.1.0/FACTORIZATION_SPEC.md +83 -0
  4. rna_structure_audit-0.1.0/PKG-INFO +137 -0
  5. rna_structure_audit-0.1.0/PREREGISTRATION.md +367 -0
  6. rna_structure_audit-0.1.0/PREREGISTRATION_DAS.md +329 -0
  7. rna_structure_audit-0.1.0/PREREGISTRATION_PHASE6_COMPENSATORY_MUTATION.md +179 -0
  8. rna_structure_audit-0.1.0/PREREGISTRATION_PHASE6_V2.md +163 -0
  9. rna_structure_audit-0.1.0/PREREGISTRATION_PHASE6_V2_predraft.md +163 -0
  10. rna_structure_audit-0.1.0/PREREGISTRATION_STRUCTURE_METRICS.md +459 -0
  11. rna_structure_audit-0.1.0/PREREGISTRATION_V1.md +198 -0
  12. rna_structure_audit-0.1.0/PREREGISTRATION_WEIGHT_GEOMETRY.md +184 -0
  13. rna_structure_audit-0.1.0/README.md +105 -0
  14. rna_structure_audit-0.1.0/analysis.py +484 -0
  15. rna_structure_audit-0.1.0/batch1_layer1_controls.py +301 -0
  16. rna_structure_audit-0.1.0/batch1_sanity.py +314 -0
  17. rna_structure_audit-0.1.0/batch2/PREREGISTRATION.md +429 -0
  18. rna_structure_audit-0.1.0/batch2/README.md +41 -0
  19. rna_structure_audit-0.1.0/batch2/activation_patching.py +477 -0
  20. rna_structure_audit-0.1.0/batch2/cross_gene_directions.py +133 -0
  21. rna_structure_audit-0.1.0/batch2/das_counterfactual.py +754 -0
  22. rna_structure_audit-0.1.0/batch2/eap_ig_circuit.py +417 -0
  23. rna_structure_audit-0.1.0/batch2/phase_separation.py +378 -0
  24. rna_structure_audit-0.1.0/batch2/sae_training_spec.py +148 -0
  25. rna_structure_audit-0.1.0/batch2/splice_site_di.py +332 -0
  26. rna_structure_audit-0.1.0/data/AR_NM_000044.6.fasta +155 -0
  27. rna_structure_audit-0.1.0/data/ATN1_NM_001940.4.fasta +70 -0
  28. rna_structure_audit-0.1.0/data/ATXN1_NM_000332.4.fasta +154 -0
  29. rna_structure_audit-0.1.0/data/ATXN2_NM_002973.4.fasta +65 -0
  30. rna_structure_audit-0.1.0/data/ATXN3_NM_004993.6.fasta +101 -0
  31. rna_structure_audit-0.1.0/data/HTT_NM_002111.7.fasta +229 -0
  32. rna_structure_audit-0.1.0/data/druggability_benchmark_v2.tsv +17 -0
  33. rna_structure_audit-0.1.0/data/gpu_results/all_phases_utrlm +1376 -0
  34. rna_structure_audit-0.1.0/data/gpu_results/expanded_rfam/caduceus_phase6_ps.json +1712 -0
  35. rna_structure_audit-0.1.0/data/gpu_results/expanded_rfam/caduceus_phases_1_to_5.json +552 -0
  36. rna_structure_audit-0.1.0/data/gpu_results/expanded_rfam/dnabert2_expanded_20260713_200727.json +1072 -0
  37. rna_structure_audit-0.1.0/data/gpu_results/expanded_rfam/dnabert2_expanded_20260713_201316.json +1072 -0
  38. rna_structure_audit-0.1.0/data/gpu_results/expanded_rfam/ernierna_expanded_20260713_193217.json +1275 -0
  39. rna_structure_audit-0.1.0/data/gpu_results/expanded_rfam/evo_phases_1_to_5.json +646 -0
  40. rna_structure_audit-0.1.0/data/gpu_results/expanded_rfam/splicebert_expanded_20260713_193419.json +1239 -0
  41. rna_structure_audit-0.1.0/data/gpu_results/expanded_rfam/utrlm_phases_1_to_5.json +684 -0
  42. rna_structure_audit-0.1.0/data/gpu_results/expanded_rfam_rerun/hyenadna_phases15_20260716_180202 +478 -0
  43. rna_structure_audit-0.1.0/data/gpu_results/expanded_rfam_rerun/nt_phases15_20260716_175433 +745 -0
  44. rna_structure_audit-0.1.0/data/gpu_results/expanded_rfam_rerun/rnafm_phases15_20260716_175429 +721 -0
  45. rna_structure_audit-0.1.0/data/gpu_results/htt_experiments/HTT_RESULTS_SUMMARY.md +125 -0
  46. rna_structure_audit-0.1.0/data/gpu_results/htt_experiments/htt_ernierna_20260713_204244.json +399 -0
  47. rna_structure_audit-0.1.0/data/gpu_results/htt_experiments/htt_experiments/htt_ernierna_20260713_204244.json +399 -0
  48. rna_structure_audit-0.1.0/data/gpu_results/htt_experiments/htt_experiments/htt_ernierna_20260713_204354.json +399 -0
  49. rna_structure_audit-0.1.0/data/gpu_results/htt_experiments/htt_experiments/htt_ernierna_20260713_205408.json +399 -0
  50. rna_structure_audit-0.1.0/data/gpu_results/htt_experiments/htt_experiments/htt_nt_20260713_204246.json +399 -0
  51. rna_structure_audit-0.1.0/data/gpu_results/htt_experiments/htt_experiments/htt_rinalmo_20260713_204428.json +483 -0
  52. rna_structure_audit-0.1.0/data/gpu_results/htt_experiments/htt_experiments/htt_rinalmo_20260713_205108.json +483 -0
  53. rna_structure_audit-0.1.0/data/gpu_results/htt_experiments/htt_experiments/htt_rnafm_20260713_204237.json +399 -0
  54. rna_structure_audit-0.1.0/data/gpu_results/htt_experiments/htt_experiments/htt_rnafm_20260713_204347.json +399 -0
  55. rna_structure_audit-0.1.0/data/gpu_results/htt_experiments/htt_experiments/htt_splicebert_20260713_204318.json +375 -0
  56. rna_structure_audit-0.1.0/data/gpu_results/htt_experiments/htt_experiments/htt_splicebert_20260713_204717.json +375 -0
  57. rna_structure_audit-0.1.0/data/gpu_results/htt_experiments/htt_experiments/htt_utrlm_20260713_205029.json +375 -0
  58. rna_structure_audit-0.1.0/data/gpu_results/htt_experiments/htt_nt_20260713_204246.json +399 -0
  59. rna_structure_audit-0.1.0/data/gpu_results/htt_experiments/htt_rinalmo_20260713_204428.json +483 -0
  60. rna_structure_audit-0.1.0/data/gpu_results/htt_experiments/htt_rnafm_20260713_204237.json +399 -0
  61. rna_structure_audit-0.1.0/data/gpu_results/htt_experiments/htt_splicebert_20260713_204318.json +375 -0
  62. rna_structure_audit-0.1.0/data/gpu_results/htt_experiments/htt_utrlm_20260713_205029.json +375 -0
  63. rna_structure_audit-0.1.0/data/gpu_results/phase6_compensatory/ernierna_phase6_ps.json +1566 -0
  64. rna_structure_audit-0.1.0/data/gpu_results/phase6_compensatory/ernierna_untrained_phase6.json +1586 -0
  65. rna_structure_audit-0.1.0/data/gpu_results/phase6_compensatory/hyenadna_phase6_ps.json +1263 -0
  66. rna_structure_audit-0.1.0/data/gpu_results/phase6_compensatory/phase6_evo_20260715_073218/evo_phase6_ps.json +2225 -0
  67. rna_structure_audit-0.1.0/data/gpu_results/phase6_compensatory/phase6_nt_modal +452 -0
  68. rna_structure_audit-0.1.0/data/gpu_results/phase6_compensatory/phase6_rnafm_modal +1586 -0
  69. rna_structure_audit-0.1.0/data/gpu_results/phase6_compensatory/phase6_synthetic_ernierna_20260715_003418/ernierna_synthetic_covariation.json +9157 -0
  70. rna_structure_audit-0.1.0/data/gpu_results/phase6_compensatory/phase6_synthetic_evo_20260715_073305 +13288 -0
  71. rna_structure_audit-0.1.0/data/gpu_results/phase6_compensatory/phase6_synthetic_evo_20260715_073305_dl +13288 -0
  72. rna_structure_audit-0.1.0/data/gpu_results/phase6_compensatory/phase6_synthetic_hyenadna_20260715_052703/hyenadna_synthetic_covariation.json +7369 -0
  73. rna_structure_audit-0.1.0/data/gpu_results/phase6_compensatory/phase6_synthetic_rinalmo_20260715_002812/rinalmo_synthetic_covariation.json +13568 -0
  74. rna_structure_audit-0.1.0/data/gpu_results/phase6_compensatory/phase6_synthetic_rnafm_20260715_062750/rnafm_synthetic_covariation.json +9317 -0
  75. rna_structure_audit-0.1.0/data/gpu_results/phase6_compensatory/phase6_synthetic_splicebert_20260715_003436/splicebert_synthetic_covariation.json +7962 -0
  76. rna_structure_audit-0.1.0/data/gpu_results/phase6_compensatory/phase6_synthetic_utrlm_20260715_002839/utrlm_synthetic_covariation.json +7979 -0
  77. rna_structure_audit-0.1.0/data/gpu_results/phase6_compensatory/rnafm_phase6_20260713_225743.json +36 -0
  78. rna_structure_audit-0.1.0/data/gpu_results/phase6_compensatory/rnafm_phase6_20260713_230012.json +36 -0
  79. rna_structure_audit-0.1.0/data/gpu_results/phase6_compensatory/rnafm_phase6_20260713_230139.json +62 -0
  80. rna_structure_audit-0.1.0/data/gpu_results/phase6_compensatory/rnafm_phase6_20260713_231202.json +62 -0
  81. rna_structure_audit-0.1.0/data/gpu_results/phase6_compensatory/rnafm_phase6_ps_20260713_235315.json +92 -0
  82. rna_structure_audit-0.1.0/data/gpu_results/phase6_compensatory/rnafm_phase6_ps_20260713_235609.json +131 -0
  83. rna_structure_audit-0.1.0/data/gpu_results/phase6_compensatory/splicebert_phase6_ps.json +1369 -0
  84. rna_structure_audit-0.1.0/data/gpu_results/phase6_compensatory/utrlm_phase6_ps.json +1376 -0
  85. rna_structure_audit-0.1.0/data/multi_model/audit_combined_20260711_164307.json +196 -0
  86. rna_structure_audit-0.1.0/data/multi_model/audit_combined_20260711_164356.json +196 -0
  87. rna_structure_audit-0.1.0/data/multi_model/audit_combined_20260711_164414.json +1 -0
  88. rna_structure_audit-0.1.0/data/multi_model/audit_combined_20260711_164614.json +151 -0
  89. rna_structure_audit-0.1.0/data/multi_model/audit_combined_20260711_164748.json +557 -0
  90. rna_structure_audit-0.1.0/data/multi_model/audit_hyenadna_20260711_164614.json +149 -0
  91. rna_structure_audit-0.1.0/data/multi_model/audit_hyenadna_20260711_164748.json +155 -0
  92. rna_structure_audit-0.1.0/data/multi_model/audit_nt_20260711_164356.json +194 -0
  93. rna_structure_audit-0.1.0/data/multi_model/audit_nt_20260711_164741.json +200 -0
  94. rna_structure_audit-0.1.0/data/multi_model/audit_rnafm_20260711_164307.json +194 -0
  95. rna_structure_audit-0.1.0/data/multi_model/audit_rnafm_20260711_164721.json +200 -0
  96. rna_structure_audit-0.1.0/data/multi_sequence/5S_rRNA_ecoli_multi.json +40 -0
  97. rna_structure_audit-0.1.0/data/multi_sequence/6S_RNA_multi.json +40 -0
  98. rna_structure_audit-0.1.0/data/multi_sequence/7SK_RNA_multi.json +40 -0
  99. rna_structure_audit-0.1.0/data/multi_sequence/Bacterial_SRP_multi.json +40 -0
  100. rna_structure_audit-0.1.0/data/multi_sequence/CRISPR_leader_multi.json +40 -0
  101. rna_structure_audit-0.1.0/data/multi_sequence/Corona_5UTR_multi.json +40 -0
  102. rna_structure_audit-0.1.0/data/multi_sequence/Corona_s2m_multi.json +40 -0
  103. rna_structure_audit-0.1.0/data/multi_sequence/CrPV_IRES_multi.json +40 -0
  104. rna_structure_audit-0.1.0/data/multi_sequence/FMN_riboswitch_multi.json +40 -0
  105. rna_structure_audit-0.1.0/data/multi_sequence/HDV_ribozyme_multi.json +40 -0
  106. rna_structure_audit-0.1.0/data/multi_sequence/Hepatitis_C_IRES_III_multi.json +40 -0
  107. rna_structure_audit-0.1.0/data/multi_sequence/Histone_3prime_multi.json +40 -0
  108. rna_structure_audit-0.1.0/data/multi_sequence/IRE_stem_loop_multi.json +40 -0
  109. rna_structure_audit-0.1.0/data/multi_sequence/RNaseP_specificity_multi.json +40 -0
  110. rna_structure_audit-0.1.0/data/multi_sequence/SAH_riboswitch_multi.json +40 -0
  111. rna_structure_audit-0.1.0/data/multi_sequence/SAM_riboswitch_multi.json +40 -0
  112. rna_structure_audit-0.1.0/data/multi_sequence/SECIS_element_multi.json +40 -0
  113. rna_structure_audit-0.1.0/data/multi_sequence/SRP_RNA_helix8_multi.json +40 -0
  114. rna_structure_audit-0.1.0/data/multi_sequence/THF_riboswitch_multi.json +40 -0
  115. rna_structure_audit-0.1.0/data/multi_sequence/TPP_riboswitch_multi.json +40 -0
  116. rna_structure_audit-0.1.0/data/multi_sequence/T_box_leader_multi.json +40 -0
  117. rna_structure_audit-0.1.0/data/multi_sequence/U1_snRNA_multi.json +40 -0
  118. rna_structure_audit-0.1.0/data/multi_sequence/U2_snRNA_stem_multi.json +40 -0
  119. rna_structure_audit-0.1.0/data/multi_sequence/U4_snRNA_multi.json +40 -0
  120. rna_structure_audit-0.1.0/data/multi_sequence/U5_snRNA_multi.json +40 -0
  121. rna_structure_audit-0.1.0/data/multi_sequence/U6_snRNA_multi.json +40 -0
  122. rna_structure_audit-0.1.0/data/multi_sequence/Vault_RNA_multi.json +40 -0
  123. rna_structure_audit-0.1.0/data/multi_sequence/Y_RNA_multi.json +40 -0
  124. rna_structure_audit-0.1.0/data/multi_sequence/ZMP_riboswitch_multi.json +40 -0
  125. rna_structure_audit-0.1.0/data/multi_sequence/c_di_GMP_riboswitch_multi.json +40 -0
  126. rna_structure_audit-0.1.0/data/multi_sequence/cobalamin_riboswitch_multi.json +40 -0
  127. rna_structure_audit-0.1.0/data/multi_sequence/fluoride_riboswitch_multi.json +40 -0
  128. rna_structure_audit-0.1.0/data/multi_sequence/glmS_ribozyme_multi.json +40 -0
  129. rna_structure_audit-0.1.0/data/multi_sequence/glycine_riboswitch_multi.json +40 -0
  130. rna_structure_audit-0.1.0/data/multi_sequence/group_II_intron_D5_multi.json +40 -0
  131. rna_structure_audit-0.1.0/data/multi_sequence/group_I_intron_P4P6_multi.json +28 -0
  132. rna_structure_audit-0.1.0/data/multi_sequence/hammerhead_ribozyme_multi.json +40 -0
  133. rna_structure_audit-0.1.0/data/multi_sequence/hatchet_ribozyme_multi.json +40 -0
  134. rna_structure_audit-0.1.0/data/multi_sequence/lysine_riboswitch_multi.json +40 -0
  135. rna_structure_audit-0.1.0/data/multi_sequence/manganese_riboswitch_multi.json +40 -0
  136. rna_structure_audit-0.1.0/data/multi_sequence/mir_122_precursor_multi.json +40 -0
  137. rna_structure_audit-0.1.0/data/multi_sequence/mir_155_precursor_multi.json +40 -0
  138. rna_structure_audit-0.1.0/data/multi_sequence/mir_21_precursor_multi.json +40 -0
  139. rna_structure_audit-0.1.0/data/multi_sequence/mir_let7_precursor_multi.json +40 -0
  140. rna_structure_audit-0.1.0/data/multi_sequence/pistol_ribozyme_multi.json +40 -0
  141. rna_structure_audit-0.1.0/data/multi_sequence/preQ1_riboswitch_multi.json +40 -0
  142. rna_structure_audit-0.1.0/data/multi_sequence/purine_riboswitch_multi.json +40 -0
  143. rna_structure_audit-0.1.0/data/multi_sequence/summary.json +257 -0
  144. rna_structure_audit-0.1.0/data/multi_sequence/tRNA_Ala_human_multi.json +40 -0
  145. rna_structure_audit-0.1.0/data/multi_sequence/tRNA_Phe_yeast_multi.json +40 -0
  146. rna_structure_audit-0.1.0/data/multi_sequence/tmRNA_multi.json +40 -0
  147. rna_structure_audit-0.1.0/data/multi_sequence/twister_ribozyme_multi.json +40 -0
  148. rna_structure_audit-0.1.0/data/orthologs/chicken_HTT.fasta +10 -0
  149. rna_structure_audit-0.1.0/data/orthologs/human_HTT.fasta +119 -0
  150. rna_structure_audit-0.1.0/data/orthologs/mouse_HTT.fasta +119 -0
  151. rna_structure_audit-0.1.0/data/orthologs/pig_HTT.fasta +27 -0
  152. rna_structure_audit-0.1.0/data/orthologs/zebrafish_HTT.fasta +119 -0
  153. rna_structure_audit-0.1.0/data/preregistration_E1_druggability_gate_v2.md +147 -0
  154. rna_structure_audit-0.1.0/data/preregistration_E1_druggability_gate_v3.md +258 -0
  155. rna_structure_audit-0.1.0/data/preregistration_revision_experiments.md +98 -0
  156. rna_structure_audit-0.1.0/data/rfam_families/5S_rRNA_ecoli.json +8 -0
  157. rna_structure_audit-0.1.0/data/rfam_families/6S_RNA.json +10 -0
  158. rna_structure_audit-0.1.0/data/rfam_families/7SK_RNA.json +10 -0
  159. rna_structure_audit-0.1.0/data/rfam_families/Bacterial_SRP.json +10 -0
  160. rna_structure_audit-0.1.0/data/rfam_families/CRISPR_leader.json +10 -0
  161. rna_structure_audit-0.1.0/data/rfam_families/Corona_5UTR.json +10 -0
  162. rna_structure_audit-0.1.0/data/rfam_families/Corona_s2m.json +10 -0
  163. rna_structure_audit-0.1.0/data/rfam_families/CrPV_IRES.json +10 -0
  164. rna_structure_audit-0.1.0/data/rfam_families/FMN_riboswitch.json +10 -0
  165. rna_structure_audit-0.1.0/data/rfam_families/HDV_ribozyme.json +8 -0
  166. rna_structure_audit-0.1.0/data/rfam_families/Hepatitis_C_IRES_III.json +10 -0
  167. rna_structure_audit-0.1.0/data/rfam_families/Histone_3prime.json +10 -0
  168. rna_structure_audit-0.1.0/data/rfam_families/IRES_HCV_domainII.json +8 -0
  169. rna_structure_audit-0.1.0/data/rfam_families/IRE_stem_loop.json +10 -0
  170. rna_structure_audit-0.1.0/data/rfam_families/RNaseP_specificity.json +8 -0
  171. rna_structure_audit-0.1.0/data/rfam_families/SAH_riboswitch.json +10 -0
  172. rna_structure_audit-0.1.0/data/rfam_families/SAM_riboswitch.json +8 -0
  173. rna_structure_audit-0.1.0/data/rfam_families/SECIS_element.json +10 -0
  174. rna_structure_audit-0.1.0/data/rfam_families/SRP_RNA_helix8.json +8 -0
  175. rna_structure_audit-0.1.0/data/rfam_families/THF_riboswitch.json +10 -0
  176. rna_structure_audit-0.1.0/data/rfam_families/TPP_riboswitch.json +8 -0
  177. rna_structure_audit-0.1.0/data/rfam_families/T_box_leader.json +10 -0
  178. rna_structure_audit-0.1.0/data/rfam_families/U1_snRNA.json +10 -0
  179. rna_structure_audit-0.1.0/data/rfam_families/U2_snRNA_stem.json +8 -0
  180. rna_structure_audit-0.1.0/data/rfam_families/U4_snRNA.json +10 -0
  181. rna_structure_audit-0.1.0/data/rfam_families/U5_snRNA.json +10 -0
  182. rna_structure_audit-0.1.0/data/rfam_families/U6_snRNA.json +10 -0
  183. rna_structure_audit-0.1.0/data/rfam_families/Vault_RNA.json +10 -0
  184. rna_structure_audit-0.1.0/data/rfam_families/Y_RNA.json +10 -0
  185. rna_structure_audit-0.1.0/data/rfam_families/ZMP_riboswitch.json +10 -0
  186. rna_structure_audit-0.1.0/data/rfam_families/c_di_GMP_riboswitch.json +10 -0
  187. rna_structure_audit-0.1.0/data/rfam_families/cobalamin_riboswitch.json +10 -0
  188. rna_structure_audit-0.1.0/data/rfam_families/fluoride_riboswitch.json +10 -0
  189. rna_structure_audit-0.1.0/data/rfam_families/glmS_ribozyme.json +10 -0
  190. rna_structure_audit-0.1.0/data/rfam_families/glycine_riboswitch.json +10 -0
  191. rna_structure_audit-0.1.0/data/rfam_families/group_II_intron_D5.json +10 -0
  192. rna_structure_audit-0.1.0/data/rfam_families/group_I_intron_P4P6.json +10 -0
  193. rna_structure_audit-0.1.0/data/rfam_families/hammerhead_ribozyme.json +8 -0
  194. rna_structure_audit-0.1.0/data/rfam_families/hatchet_ribozyme.json +10 -0
  195. rna_structure_audit-0.1.0/data/rfam_families/lysine_riboswitch.json +10 -0
  196. rna_structure_audit-0.1.0/data/rfam_families/manganese_riboswitch.json +10 -0
  197. rna_structure_audit-0.1.0/data/rfam_families/mir_122_precursor.json +10 -0
  198. rna_structure_audit-0.1.0/data/rfam_families/mir_155_precursor.json +10 -0
  199. rna_structure_audit-0.1.0/data/rfam_families/mir_21_precursor.json +8 -0
  200. rna_structure_audit-0.1.0/data/rfam_families/mir_let7_precursor.json +10 -0
  201. rna_structure_audit-0.1.0/data/rfam_families/pistol_ribozyme.json +10 -0
  202. rna_structure_audit-0.1.0/data/rfam_families/preQ1_riboswitch.json +10 -0
  203. rna_structure_audit-0.1.0/data/rfam_families/purine_riboswitch.json +10 -0
  204. rna_structure_audit-0.1.0/data/rfam_families/tRNA_Ala_human.json +8 -0
  205. rna_structure_audit-0.1.0/data/rfam_families/tRNA_Phe_yeast.json +8 -0
  206. rna_structure_audit-0.1.0/data/rfam_families/tmRNA.json +10 -0
  207. rna_structure_audit-0.1.0/data/rfam_families/twister_ribozyme.json +10 -0
  208. rna_structure_audit-0.1.0/data/rfam_seeds/RF00001.sto +1482 -0
  209. rna_structure_audit-0.1.0/data/rfam_seeds/RF00003.sto +282 -0
  210. rna_structure_audit-0.1.0/data/rfam_seeds/RF00004.sto +473 -0
  211. rna_structure_audit-0.1.0/data/rfam_seeds/RF00005.sto +999 -0
  212. rna_structure_audit-0.1.0/data/rfam_seeds/RF00006.sto +107 -0
  213. rna_structure_audit-0.1.0/data/rfam_seeds/RF00010.sto +2358 -0
  214. rna_structure_audit-0.1.0/data/rfam_seeds/RF00013.sto +370 -0
  215. rna_structure_audit-0.1.0/data/rfam_seeds/RF00015.sto +500 -0
  216. rna_structure_audit-0.1.0/data/rfam_seeds/RF00017.sto +358 -0
  217. rna_structure_audit-0.1.0/data/rfam_seeds/RF00019.sto +163 -0
  218. rna_structure_audit-0.1.0/data/rfam_seeds/RF00020.sto +226 -0
  219. rna_structure_audit-0.1.0/data/rfam_seeds/RF00023.sto +2464 -0
  220. rna_structure_audit-0.1.0/data/rfam_seeds/RF00026.sto +429 -0
  221. rna_structure_audit-0.1.0/data/rfam_seeds/RF00028.sto +115 -0
  222. rna_structure_audit-0.1.0/data/rfam_seeds/RF00029.sto +145 -0
  223. rna_structure_audit-0.1.0/data/rfam_seeds/RF00031.sto +103 -0
  224. rna_structure_audit-0.1.0/data/rfam_seeds/RF00032.sto +131 -0
  225. rna_structure_audit-0.1.0/data/rfam_seeds/RF00037.sto +126 -0
  226. rna_structure_audit-0.1.0/data/rfam_seeds/RF00050.sto +379 -0
  227. rna_structure_audit-0.1.0/data/rfam_seeds/RF00059.sto +414 -0
  228. rna_structure_audit-0.1.0/data/rfam_seeds/RF00061.sto +155 -0
  229. rna_structure_audit-0.1.0/data/rfam_seeds/RF00094.sto +79 -0
  230. rna_structure_audit-0.1.0/data/rfam_seeds/RF00100.sto +184 -0
  231. rna_structure_audit-0.1.0/data/rfam_seeds/RF00162.sto +1090 -0
  232. rna_structure_audit-0.1.0/data/rfam_seeds/RF00163.sto +78 -0
  233. rna_structure_audit-0.1.0/data/rfam_seeds/RF00164.sto +79 -0
  234. rna_structure_audit-0.1.0/data/rfam_seeds/RF00167.sto +191 -0
  235. rna_structure_audit-0.1.0/data/rfam_seeds/RF00168.sto +149 -0
  236. rna_structure_audit-0.1.0/data/rfam_seeds/RF00169.sto +323 -0
  237. rna_structure_audit-0.1.0/data/rfam_seeds/RF00174.sto +1439 -0
  238. rna_structure_audit-0.1.0/data/rfam_seeds/RF00230.sto +204 -0
  239. rna_structure_audit-0.1.0/data/rfam_seeds/RF00234.sto +83 -0
  240. rna_structure_audit-0.1.0/data/rfam_seeds/RF00458.sto +160 -0
  241. rna_structure_audit-0.1.0/data/rfam_seeds/RF00504.sto +139 -0
  242. rna_structure_audit-0.1.0/data/rfam_seeds/RF00522.sto +163 -0
  243. rna_structure_audit-0.1.0/data/rfam_seeds/RF01051.sto +196 -0
  244. rna_structure_audit-0.1.0/data/rfam_seeds/RF01057.sto +82 -0
  245. rna_structure_audit-0.1.0/data/rfam_seeds/RF01315.sto +49 -0
  246. rna_structure_audit-0.1.0/data/rfam_seeds/RF01734.sto +346 -0
  247. rna_structure_audit-0.1.0/data/rfam_seeds/RF01750.sto +473 -0
  248. rna_structure_audit-0.1.0/data/rfam_seeds/RF01786.sto +96 -0
  249. rna_structure_audit-0.1.0/data/rfam_seeds/RF01831.sto +169 -0
  250. rna_structure_audit-0.1.0/data/rfam_seeds/RF02678.sto +363 -0
  251. rna_structure_audit-0.1.0/data/rfam_seeds/RF02679.sto +93 -0
  252. rna_structure_audit-0.1.0/data/rfam_seeds/RF02681.sto +153 -0
  253. rna_structure_audit-0.1.0/data/rfam_seeds/RF03120.sto +105 -0
  254. rna_structure_audit-0.1.0/data/weight_geometry/eap_ig_ablation_20260712_102041.json +366 -0
  255. rna_structure_audit-0.1.0/data/weight_geometry/eap_ig_ablation_20260712_121433.json +366 -0
  256. rna_structure_audit-0.1.0/direction_instability.py +622 -0
  257. rna_structure_audit-0.1.0/direction_instability_v1.py +328 -0
  258. rna_structure_audit-0.1.0/docs/PAPER_C_rna_structure_awareness_v1.md +185 -0
  259. rna_structure_audit-0.1.0/docs/PAPER_C_rna_structure_awareness_v2.md +225 -0
  260. rna_structure_audit-0.1.0/docs/PAPER_C_rna_structure_awareness_v3.md +368 -0
  261. rna_structure_audit-0.1.0/docs/PAPER_C_rna_structure_awareness_v4.md +334 -0
  262. rna_structure_audit-0.1.0/docs/PHASE6_PS_RESULTS_V1.md +148 -0
  263. rna_structure_audit-0.1.0/docs/PREREGISTRATION_EXPANDED_RFAM.md +152 -0
  264. rna_structure_audit-0.1.0/docs/PREREG_PHASE3_RNA_PRETRAINED.md +67 -0
  265. rna_structure_audit-0.1.0/docs/PREREG_PHASE4_EXPANDED_MODELS.md +206 -0
  266. rna_structure_audit-0.1.0/docs/STRATIFIED_NULL_RESULTS.md +171 -0
  267. rna_structure_audit-0.1.0/docs/STRATIFIED_NULL_RESULTS_V1.md +151 -0
  268. rna_structure_audit-0.1.0/docs/STRATIFIED_NULL_RESULTS_V2.md +162 -0
  269. rna_structure_audit-0.1.0/docs/batch2_results_writeup.md +216 -0
  270. rna_structure_audit-0.1.0/docs/factorization_whitepaper_v1.md +269 -0
  271. rna_structure_audit-0.1.0/docs/factorization_whitepaper_v2.md +334 -0
  272. rna_structure_audit-0.1.0/docs/frozen_prereg_weight_geom/freeze_manifest.json +52 -0
  273. rna_structure_audit-0.1.0/docs/frozen_prereg_weight_geom/prereg_sha256.txt +1 -0
  274. rna_structure_audit-0.1.0/experiment_plan.md +173 -0
  275. rna_structure_audit-0.1.0/lib/__init__.py +0 -0
  276. rna_structure_audit-0.1.0/lib/distillation.py +249 -0
  277. rna_structure_audit-0.1.0/lib/factorized_model.py +841 -0
  278. rna_structure_audit-0.1.0/lib/factorized_rnafm.py +136 -0
  279. rna_structure_audit-0.1.0/lib/rnafm_weights.py +90 -0
  280. rna_structure_audit-0.1.0/multi_model_audit.py +1005 -0
  281. rna_structure_audit-0.1.0/notebooks/bring_your_own_model.ipynb +303 -0
  282. rna_structure_audit-0.1.0/notebooks/quickstart.ipynb +203 -0
  283. rna_structure_audit-0.1.0/paper/cross_architecture_v11.pdf +0 -0
  284. rna_structure_audit-0.1.0/paper/cross_architecture_v11.tex +977 -0
  285. rna_structure_audit-0.1.0/paper/cross_architecture_v13.tex +1220 -0
  286. rna_structure_audit-0.1.0/paper/main_v1.tex +494 -0
  287. rna_structure_audit-0.1.0/paper/main_v2.pdf +0 -0
  288. rna_structure_audit-0.1.0/paper/main_v2.tex +621 -0
  289. rna_structure_audit-0.1.0/paper/main_v4.tex +1175 -0
  290. rna_structure_audit-0.1.0/preregistration/PREREGISTRATION_PHASE6_UNTRAINED_RINALMO.md +65 -0
  291. rna_structure_audit-0.1.0/pyproject.toml +57 -0
  292. rna_structure_audit-0.1.0/results/audit/phase6_ernierna_20260714_060520/ernierna_phase6_ps.json +1566 -0
  293. rna_structure_audit-0.1.0/results/audit/phase6_ernierna_untrained_20260714_172412/ernierna_untrained_phase6_ps.json +1586 -0
  294. rna_structure_audit-0.1.0/results/audit/phase6_evo_20260715_073218/evo_phase6_ps.json +2225 -0
  295. rna_structure_audit-0.1.0/results/audit/phase6_hyenadna_20260714_060542/hyenadna_phase6_ps.json +1263 -0
  296. rna_structure_audit-0.1.0/results/audit/phase6_nt_20260714_082334/nt_phase6_ps.json +452 -0
  297. rna_structure_audit-0.1.0/results/audit/phase6_rnafm_20260714_065238/rnafm_phase6_ps.json +1586 -0
  298. rna_structure_audit-0.1.0/results/audit/phase6_splicebert_20260714_060520/splicebert_phase6_ps.json +1369 -0
  299. rna_structure_audit-0.1.0/results/audit/phase6_synthetic_ernierna_20260715_003418/ernierna_synthetic_covariation.json +9157 -0
  300. rna_structure_audit-0.1.0/results/audit/phase6_synthetic_rinalmo_20260715_002812/rinalmo_synthetic_covariation.json +13568 -0
  301. rna_structure_audit-0.1.0/results/audit/phase6_synthetic_rinalmo_20260715_073328/rinalmo_synthetic_covariation.json +13568 -0
  302. rna_structure_audit-0.1.0/results/audit/phase6_utrlm_20260714_060516/utrlm_phase6_ps.json +1376 -0
  303. rna_structure_audit-0.1.0/results/bootstrap_cis.json +433 -0
  304. rna_structure_audit-0.1.0/results/dnabert2_phases15_dinuc.json +725 -0
  305. rna_structure_audit-0.1.0/results/ernierna_ablation/ernierna_no_attn_bias_20260717_104015/ernierna_no_attn_bias_phases_1_to_5.json +784 -0
  306. rna_structure_audit-0.1.0/results/ernierna_phases15_dinuc.json +779 -0
  307. rna_structure_audit-0.1.0/results/ernierna_untrained_phases15.json +725 -0
  308. rna_structure_audit-0.1.0/results/htt/htt_caduceus_20260717_104356/caduceus_htt_distances.json +4 -0
  309. rna_structure_audit-0.1.0/results/htt/htt_dnabert2_20260717_104349/dnabert2_htt_distances.json +55 -0
  310. rna_structure_audit-0.1.0/results/htt/htt_ernierna_20260717_104348/ernierna_htt_distances.json +222 -0
  311. rna_structure_audit-0.1.0/results/htt/htt_evo_20260717_104349/evo_htt_distances.json +4 -0
  312. rna_structure_audit-0.1.0/results/htt/htt_hyenadna_20260717_104349/hyenadna_htt_distances.json +96 -0
  313. rna_structure_audit-0.1.0/results/htt/htt_nt_20260717_104348/nt_htt_distances.json +4 -0
  314. rna_structure_audit-0.1.0/results/htt/htt_rinalmo_20260717_104404/rinalmo_htt_distances.json +516 -0
  315. rna_structure_audit-0.1.0/results/htt/htt_splicebert_20260717_104348/splicebert_htt_distances.json +138 -0
  316. rna_structure_audit-0.1.0/results/htt/htt_utrlm_20260717_104405/utrlm_htt_distances.json +138 -0
  317. rna_structure_audit-0.1.0/results/htt/htt_viennarna_20260717_104345/viennarna_mfe.json +62 -0
  318. rna_structure_audit-0.1.0/results/mi_baseline.json +1338 -0
  319. rna_structure_audit-0.1.0/results/multi_sequence/ernierna_multiseq_20260717_104022/ernierna_multiseq.json +1134 -0
  320. rna_structure_audit-0.1.0/results/phase6_all/phase6_dnabert2_20260715_131122 +496 -0
  321. rna_structure_audit-0.1.0/results/phase6_all/phase6_evo_20260715_073218 +2225 -0
  322. rna_structure_audit-0.1.0/results/phase6_all/phase6_rinalmo_20260715_083207 +2276 -0
  323. rna_structure_audit-0.1.0/results/phase6_all/phase6_synthetic_dnabert2_20260715_131418 +2422 -0
  324. rna_structure_audit-0.1.0/results/phase6_all/phase6_synthetic_ernierna_20260715_003418 +9157 -0
  325. rna_structure_audit-0.1.0/results/phase6_all/phase6_synthetic_evo_20260715_073305 +13288 -0
  326. rna_structure_audit-0.1.0/results/phase6_all/phase6_synthetic_hyenadna_20260715_052703 +7369 -0
  327. rna_structure_audit-0.1.0/results/phase6_all/phase6_synthetic_rinalmo_20260715_002812 +13568 -0
  328. rna_structure_audit-0.1.0/results/phase6_all/phase6_synthetic_rinalmo_20260715_073328 +13568 -0
  329. rna_structure_audit-0.1.0/results/phase6_all/phase6_synthetic_rnafm_20260715_062750 +9317 -0
  330. rna_structure_audit-0.1.0/results/phase6_all/phase6_synthetic_splicebert_20260715_003436 +7962 -0
  331. rna_structure_audit-0.1.0/results/phase6_all/phase6_synthetic_utrlm_20260715_002839 +7979 -0
  332. rna_structure_audit-0.1.0/results/phase6_dnabert2_natural.json +496 -0
  333. rna_structure_audit-0.1.0/results/phase6_dnabert2_synthetic.json +2422 -0
  334. rna_structure_audit-0.1.0/results/rinalmo_multiseq +1135 -0
  335. rna_structure_audit-0.1.0/results/rinalmo_phase6_ps.json +2276 -0
  336. rna_structure_audit-0.1.0/results/rinalmo_phases_1_to_5.json +877 -0
  337. rna_structure_audit-0.1.0/results/splicebert_phases15_dinuc.json +689 -0
  338. rna_structure_audit-0.1.0/results/transversion/dnabert2_transversion_20260717_103948/dnabert2_transversion.json +438 -0
  339. rna_structure_audit-0.1.0/results/transversion/ernierna_transversion_20260717_103946/ernierna_transversion.json +490 -0
  340. rna_structure_audit-0.1.0/results/transversion/hyenadna_transversion_20260717_103948/hyenadna_transversion.json +446 -0
  341. rna_structure_audit-0.1.0/results/transversion/rinalmo_transversion_20260717_103949/rinalmo_transversion.json +464 -0
  342. rna_structure_audit-0.1.0/results/transversion/splicebert_transversion_20260717_103948/splicebert_transversion.json +432 -0
  343. rna_structure_audit-0.1.0/results/transversion/utrlm_transversion_20260717_104006/utrlm_transversion.json +436 -0
  344. rna_structure_audit-0.1.0/results/transversion_evo_a100 +446 -0
  345. rna_structure_audit-0.1.0/results/transversion_nt_evo/nt +458 -0
  346. rna_structure_audit-0.1.0/results/transversion_remaining3/caduceus +446 -0
  347. rna_structure_audit-0.1.0/results/transversion_remaining4 +434 -0
  348. rna_structure_audit-0.1.0/scripts/analyze_factorization.py +387 -0
  349. rna_structure_audit-0.1.0/scripts/analyze_phase6_results.py +244 -0
  350. rna_structure_audit-0.1.0/scripts/compute_bootstrap_cis.py +309 -0
  351. rna_structure_audit-0.1.0/scripts/compute_mi_baseline.py +465 -0
  352. rna_structure_audit-0.1.0/scripts/download_missing_phases15.py +85 -0
  353. rna_structure_audit-0.1.0/scripts/download_rfam_seeds.py +221 -0
  354. rna_structure_audit-0.1.0/scripts/eap_ig_ablation.py +474 -0
  355. rna_structure_audit-0.1.0/scripts/freeze_prereg_weight_geometry.py +118 -0
  356. rna_structure_audit-0.1.0/scripts/modal_all_phases.py +225 -0
  357. rna_structure_audit-0.1.0/scripts/modal_benchmark_test.py +200 -0
  358. rna_structure_audit-0.1.0/scripts/modal_caduceus_phases.py +174 -0
  359. rna_structure_audit-0.1.0/scripts/modal_ernierna_ablation.py +178 -0
  360. rna_structure_audit-0.1.0/scripts/modal_htt_all_models.py +504 -0
  361. rna_structure_audit-0.1.0/scripts/modal_missing_phases15.py +198 -0
  362. rna_structure_audit-0.1.0/scripts/modal_multi_sequence.py +263 -0
  363. rna_structure_audit-0.1.0/scripts/modal_multiseq_rinalmo.py +204 -0
  364. rna_structure_audit-0.1.0/scripts/modal_phase6.py +180 -0
  365. rna_structure_audit-0.1.0/scripts/modal_phase6_caduceus.py +115 -0
  366. rna_structure_audit-0.1.0/scripts/modal_phase6_compat.py +151 -0
  367. rna_structure_audit-0.1.0/scripts/modal_phase6_dnabert2.py +165 -0
  368. rna_structure_audit-0.1.0/scripts/modal_phase6_flashattn_models.py +172 -0
  369. rna_structure_audit-0.1.0/scripts/modal_phase6_synthetic_covariation.py +199 -0
  370. rna_structure_audit-0.1.0/scripts/modal_phase6_untrained_ernierna.py +131 -0
  371. rna_structure_audit-0.1.0/scripts/modal_phase6_untrained_rinalmo.py +128 -0
  372. rna_structure_audit-0.1.0/scripts/modal_rerun_phases15_dinuc.py +387 -0
  373. rna_structure_audit-0.1.0/scripts/modal_rinalmo_phases15.py +131 -0
  374. rna_structure_audit-0.1.0/scripts/modal_train.py +184 -0
  375. rna_structure_audit-0.1.0/scripts/modal_transversion_control.py +398 -0
  376. rna_structure_audit-0.1.0/scripts/modal_transversion_evo_a100.py +152 -0
  377. rna_structure_audit-0.1.0/scripts/modal_transversion_nt_evo.py +194 -0
  378. rna_structure_audit-0.1.0/scripts/modal_transversion_remaining3.py +205 -0
  379. rna_structure_audit-0.1.0/scripts/modal_transversion_remaining4.py +208 -0
  380. rna_structure_audit-0.1.0/scripts/patch_dnabert2_flash_attn.py +72 -0
  381. rna_structure_audit-0.1.0/scripts/patch_dnabert2_triton.py +40 -0
  382. rna_structure_audit-0.1.0/scripts/phase6_compensatory_mutation.py +648 -0
  383. rna_structure_audit-0.1.0/scripts/phase6_compensatory_mutation_v1.py +403 -0
  384. rna_structure_audit-0.1.0/scripts/phase6_compensatory_mutation_v2_preflight.py +594 -0
  385. rna_structure_audit-0.1.0/scripts/phases_1_to_5.py +502 -0
  386. rna_structure_audit-0.1.0/scripts/prepare_rfam_families.py +371 -0
  387. rna_structure_audit-0.1.0/scripts/run_hdas6.py +178 -0
  388. rna_structure_audit-0.1.0/scripts/weight_geometry_analysis.py +635 -0
  389. rna_structure_audit-0.1.0/src/rna_structure_audit/__init__.py +3 -0
  390. rna_structure_audit-0.1.0/src/rna_structure_audit/adapter.py +47 -0
  391. rna_structure_audit-0.1.0/src/rna_structure_audit/adapters/__init__.py +43 -0
  392. rna_structure_audit-0.1.0/src/rna_structure_audit/adapters/caduceus.py +40 -0
  393. rna_structure_audit-0.1.0/src/rna_structure_audit/adapters/dnabert2.py +43 -0
  394. rna_structure_audit-0.1.0/src/rna_structure_audit/adapters/ernierna.py +33 -0
  395. rna_structure_audit-0.1.0/src/rna_structure_audit/adapters/evo.py +53 -0
  396. rna_structure_audit-0.1.0/src/rna_structure_audit/adapters/hyenadna.py +40 -0
  397. rna_structure_audit-0.1.0/src/rna_structure_audit/adapters/nt.py +42 -0
  398. rna_structure_audit-0.1.0/src/rna_structure_audit/adapters/rinalmo.py +33 -0
  399. rna_structure_audit-0.1.0/src/rna_structure_audit/adapters/rnafm.py +59 -0
  400. rna_structure_audit-0.1.0/src/rna_structure_audit/adapters/splicebert.py +33 -0
  401. rna_structure_audit-0.1.0/src/rna_structure_audit/adapters/utrlm.py +33 -0
  402. rna_structure_audit-0.1.0/src/rna_structure_audit/cli.py +107 -0
  403. rna_structure_audit-0.1.0/src/rna_structure_audit/data/5S_rRNA_ecoli.json +8 -0
  404. rna_structure_audit-0.1.0/src/rna_structure_audit/data/6S_RNA.json +10 -0
  405. rna_structure_audit-0.1.0/src/rna_structure_audit/data/7SK_RNA.json +10 -0
  406. rna_structure_audit-0.1.0/src/rna_structure_audit/data/Bacterial_SRP.json +10 -0
  407. rna_structure_audit-0.1.0/src/rna_structure_audit/data/CRISPR_leader.json +10 -0
  408. rna_structure_audit-0.1.0/src/rna_structure_audit/data/Corona_5UTR.json +10 -0
  409. rna_structure_audit-0.1.0/src/rna_structure_audit/data/Corona_s2m.json +10 -0
  410. rna_structure_audit-0.1.0/src/rna_structure_audit/data/CrPV_IRES.json +10 -0
  411. rna_structure_audit-0.1.0/src/rna_structure_audit/data/FMN_riboswitch.json +10 -0
  412. rna_structure_audit-0.1.0/src/rna_structure_audit/data/HDV_ribozyme.json +8 -0
  413. rna_structure_audit-0.1.0/src/rna_structure_audit/data/Hepatitis_C_IRES_III.json +10 -0
  414. rna_structure_audit-0.1.0/src/rna_structure_audit/data/Histone_3prime.json +10 -0
  415. rna_structure_audit-0.1.0/src/rna_structure_audit/data/IRES_HCV_domainII.json +8 -0
  416. rna_structure_audit-0.1.0/src/rna_structure_audit/data/IRE_stem_loop.json +10 -0
  417. rna_structure_audit-0.1.0/src/rna_structure_audit/data/RNaseP_specificity.json +8 -0
  418. rna_structure_audit-0.1.0/src/rna_structure_audit/data/SAH_riboswitch.json +10 -0
  419. rna_structure_audit-0.1.0/src/rna_structure_audit/data/SAM_riboswitch.json +8 -0
  420. rna_structure_audit-0.1.0/src/rna_structure_audit/data/SECIS_element.json +10 -0
  421. rna_structure_audit-0.1.0/src/rna_structure_audit/data/SRP_RNA_helix8.json +8 -0
  422. rna_structure_audit-0.1.0/src/rna_structure_audit/data/THF_riboswitch.json +10 -0
  423. rna_structure_audit-0.1.0/src/rna_structure_audit/data/TPP_riboswitch.json +8 -0
  424. rna_structure_audit-0.1.0/src/rna_structure_audit/data/T_box_leader.json +10 -0
  425. rna_structure_audit-0.1.0/src/rna_structure_audit/data/U1_snRNA.json +10 -0
  426. rna_structure_audit-0.1.0/src/rna_structure_audit/data/U2_snRNA_stem.json +8 -0
  427. rna_structure_audit-0.1.0/src/rna_structure_audit/data/U4_snRNA.json +10 -0
  428. rna_structure_audit-0.1.0/src/rna_structure_audit/data/U5_snRNA.json +10 -0
  429. rna_structure_audit-0.1.0/src/rna_structure_audit/data/U6_snRNA.json +10 -0
  430. rna_structure_audit-0.1.0/src/rna_structure_audit/data/Vault_RNA.json +10 -0
  431. rna_structure_audit-0.1.0/src/rna_structure_audit/data/Y_RNA.json +10 -0
  432. rna_structure_audit-0.1.0/src/rna_structure_audit/data/ZMP_riboswitch.json +10 -0
  433. rna_structure_audit-0.1.0/src/rna_structure_audit/data/__init__.py +18 -0
  434. rna_structure_audit-0.1.0/src/rna_structure_audit/data/c_di_GMP_riboswitch.json +10 -0
  435. rna_structure_audit-0.1.0/src/rna_structure_audit/data/cobalamin_riboswitch.json +10 -0
  436. rna_structure_audit-0.1.0/src/rna_structure_audit/data/fluoride_riboswitch.json +10 -0
  437. rna_structure_audit-0.1.0/src/rna_structure_audit/data/glmS_ribozyme.json +10 -0
  438. rna_structure_audit-0.1.0/src/rna_structure_audit/data/glycine_riboswitch.json +10 -0
  439. rna_structure_audit-0.1.0/src/rna_structure_audit/data/group_II_intron_D5.json +10 -0
  440. rna_structure_audit-0.1.0/src/rna_structure_audit/data/group_I_intron_P4P6.json +10 -0
  441. rna_structure_audit-0.1.0/src/rna_structure_audit/data/hammerhead_ribozyme.json +8 -0
  442. rna_structure_audit-0.1.0/src/rna_structure_audit/data/hatchet_ribozyme.json +10 -0
  443. rna_structure_audit-0.1.0/src/rna_structure_audit/data/lysine_riboswitch.json +10 -0
  444. rna_structure_audit-0.1.0/src/rna_structure_audit/data/manganese_riboswitch.json +10 -0
  445. rna_structure_audit-0.1.0/src/rna_structure_audit/data/mir_122_precursor.json +10 -0
  446. rna_structure_audit-0.1.0/src/rna_structure_audit/data/mir_155_precursor.json +10 -0
  447. rna_structure_audit-0.1.0/src/rna_structure_audit/data/mir_21_precursor.json +8 -0
  448. rna_structure_audit-0.1.0/src/rna_structure_audit/data/mir_let7_precursor.json +10 -0
  449. rna_structure_audit-0.1.0/src/rna_structure_audit/data/pistol_ribozyme.json +10 -0
  450. rna_structure_audit-0.1.0/src/rna_structure_audit/data/preQ1_riboswitch.json +10 -0
  451. rna_structure_audit-0.1.0/src/rna_structure_audit/data/purine_riboswitch.json +10 -0
  452. rna_structure_audit-0.1.0/src/rna_structure_audit/data/tRNA_Ala_human.json +8 -0
  453. rna_structure_audit-0.1.0/src/rna_structure_audit/data/tRNA_Phe_yeast.json +8 -0
  454. rna_structure_audit-0.1.0/src/rna_structure_audit/data/tmRNA.json +10 -0
  455. rna_structure_audit-0.1.0/src/rna_structure_audit/data/twister_ribozyme.json +10 -0
  456. rna_structure_audit-0.1.0/src/rna_structure_audit/evaluate.py +96 -0
  457. rna_structure_audit-0.1.0/src/rna_structure_audit/rungs/__init__.py +7 -0
  458. rna_structure_audit-0.1.0/src/rna_structure_audit/rungs/rung1.py +152 -0
  459. rna_structure_audit-0.1.0/src/rna_structure_audit/rungs/rung2.py +128 -0
  460. rna_structure_audit-0.1.0/src/rna_structure_audit/rungs/rung3.py +231 -0
  461. rna_structure_audit-0.1.0/tests/__init__.py +0 -0
  462. rna_structure_audit-0.1.0/tests/conftest.py +1 -0
  463. rna_structure_audit-0.1.0/tests/test_benchmark.py +312 -0
  464. rna_structure_audit-0.1.0/tests/test_rnafm.py +491 -0
@@ -0,0 +1,21 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ publish:
9
+ runs-on: ubuntu-latest
10
+ environment: pypi
11
+ permissions:
12
+ id-token: write
13
+ contents: read
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - uses: actions/setup-python@v5
17
+ with:
18
+ python-version: "3.11"
19
+ - run: pip install hatchling
20
+ - run: python -m hatchling build
21
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,15 @@
1
+ .venv/
2
+ pretrained/
3
+ __pycache__/
4
+ *.pyc
5
+ .DS_Store
6
+ data/*.pt
7
+ data/*.json
8
+ data/factorization/
9
+ figures/
10
+ uv.lock
11
+ *.aux
12
+ *.log
13
+ *.out
14
+ *.synctex.gz
15
+ .pytest_cache/
@@ -0,0 +1,83 @@
1
+ # Factorization Spec for RNA-FM
2
+
3
+ **For:** The other Claude session on factorization-circuits repo
4
+ **Goal:** Factorize RNA-FM (BERT-style, 12 layers, 640-dim, 20 heads) using the existing factorization pipeline
5
+
6
+ ## Context
7
+
8
+ RNA-FM is a 99M param BERT model for RNA sequences. We already ran SVD on its weight matrices and confirmed low-rank structure:
9
+ - W_Q effective rank: 265 (L0) → 86 (L11) — 3x compression
10
+ - W_K: 254 → 89
11
+ - W_Q–W_K subspace overlap: 0.81 in layer 3, 0.77 in layer 4
12
+ - W_V stays high-rank (~370) throughout
13
+ - This mirrors the GPT-2 pattern exactly
14
+
15
+ The SVD results are at: `/Users/elliottower/Documents/GitHub/causal-rna/data/analysis_results_latest.json`
16
+ The RNA-FM weights are at: `/Users/elliottower/Documents/GitHub/causal-rna/pretrained/pytorch_model.bin`
17
+
18
+ ## Architecture Details
19
+
20
+ RNA-FM is a standard BERT encoder:
21
+ - vocab_size=28 (A=5, C=6, G=7, U=8, CLS=2, EOS=3)
22
+ - hidden_size=640
23
+ - num_hidden_layers=12
24
+ - num_attention_heads=20 (d_head = 32)
25
+ - intermediate_size=5120
26
+ - max_position_embeddings=1026
27
+
28
+ The HuggingFace weights (pytorch_model.bin, 398MB) have keys like:
29
+ - `model.embeddings.word_embeddings.weight`
30
+ - `model.encoder.layer.0.attention.self.query.weight`
31
+ - `model.encoder.layer.0.attention.self.key.weight`
32
+ - `model.encoder.layer.0.attention.self.value.weight`
33
+ - `model.encoder.layer.0.attention.output.dense.weight` (this is W_O)
34
+ - `model.encoder.layer.0.intermediate.dense.weight` (this is W_in)
35
+ - `model.encoder.layer.0.output.dense.weight` (this is W_out)
36
+ - `model.encoder.layer.0.attention.layer_norm.weight` (attention LN)
37
+ - `model.encoder.layer.0.layer_norm.weight` (output LN)
38
+
39
+ ## What To Do
40
+
41
+ ### Option A: Minimal — Weight-space factorization only (no TransformerLens)
42
+
43
+ Skip HookedEncoder entirely. Directly decompose the weight matrices:
44
+
45
+ 1. Load the state dict from `pretrained/pytorch_model.bin`
46
+ 2. For each layer, extract W_Q, W_K, W_V, W_O, W_in, W_out
47
+ 3. Fit a shared factor bank F (n_factors × 640) using joint SVD or NMF across all projections
48
+ 4. Compute per-projection selector matrices S such that W_proj ≈ S @ F
49
+ 5. Report reconstruction error, sparsity of S, factor interpretability
50
+
51
+ This is the fastest path and gives the paper everything it needs.
52
+
53
+ ### Option B: Full — Adapt FactorizedHookedTransformer for BERT
54
+
55
+ TransformerLens has `HookedEncoder` for BERT models. The factorization code needs:
56
+ 1. A `FactorizedHookedEncoder` class that wraps HookedEncoder the same way FactorizedHookedTransformer wraps HookedTransformer
57
+ 2. The same `__getattr__` trick to replace W_Q/W_K/W_V/W_O/W_in/W_out with FactorizedLinear properties
58
+ 3. Distillation against the pretrained RNA-FM (MSE on QK.AB, OV.AB, W_in, W_out)
59
+ 4. This requires GPU training
60
+
61
+ Option B is the "real" factorization but is GPU work. Option A gives us the paper results.
62
+
63
+ ### Suggested Factor Counts
64
+
65
+ Based on the SVD effective ranks:
66
+ - Start with n_factors = 100 (captures ~95% of late-layer QK)
67
+ - Also try 150 and 200 for comparison
68
+ - For the factor bank, initialize with top-k right singular vectors of the concatenated [W_Q; W_K] matrices
69
+
70
+ ### What To Save
71
+
72
+ Save to `/Users/elliottower/Documents/GitHub/causal-rna/data/factorization/`:
73
+ - `factor_bank_{n_factors}.pt` — the shared factors F
74
+ - `selectors_{n_factors}.pt` — per-layer, per-projection selector matrices S
75
+ - `reconstruction_errors_{n_factors}.json` — per-layer, per-projection MSE
76
+ - `factor_analysis_{n_factors}.json` — per-factor statistics (which layers/projections use it, sparsity)
77
+
78
+ ### HTT-Specific Analysis
79
+
80
+ After factorization, run the factor bank through HTT mRNA:
81
+ 1. Compute factor activations h = x @ F.T for the CAG repeat region
82
+ 2. Identify which factors are selectively active on CAG vs flanking sequence
83
+ 3. Check if CAG-selective factors correspond to the intensive dimensions identified by bracket norm (dims 548, 527, 401, 590, 511, 1, 505, 287, 442, 124)
@@ -0,0 +1,137 @@
1
+ Metadata-Version: 2.4
2
+ Name: rna-structure-audit
3
+ Version: 0.1.0
4
+ Summary: Three-rung benchmark for evaluating whether RNA/DNA foundation models encode genuine secondary structure or composition shortcuts.
5
+ Project-URL: Homepage, https://github.com/elliottower/rna-structure-audit
6
+ Author-email: Elliot Tower <elliot@elliottower.ai>
7
+ License-Expression: MIT
8
+ Keywords: RNA,benchmark,bioinformatics,foundation-models,secondary-structure
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Science/Research
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
14
+ Requires-Python: >=3.10
15
+ Requires-Dist: numpy>=1.24.0
16
+ Requires-Dist: scikit-learn>=1.2.0
17
+ Requires-Dist: scipy>=1.10.0
18
+ Requires-Dist: torch>=2.0.0
19
+ Requires-Dist: tqdm>=4.60.0
20
+ Provides-Extra: all-models
21
+ Requires-Dist: einops>=0.6.0; extra == 'all-models'
22
+ Requires-Dist: multimolecule>=0.2.0; extra == 'all-models'
23
+ Requires-Dist: transformers>=4.30.0; extra == 'all-models'
24
+ Provides-Extra: experiments
25
+ Requires-Dist: biopython; extra == 'experiments'
26
+ Requires-Dist: matplotlib; extra == 'experiments'
27
+ Requires-Dist: multimolecule>=0.2.0; extra == 'experiments'
28
+ Requires-Dist: rna-fm; extra == 'experiments'
29
+ Requires-Dist: tensorly>=0.9.0; extra == 'experiments'
30
+ Requires-Dist: transformers<5; extra == 'experiments'
31
+ Description-Content-Type: text/markdown
32
+
33
+ # rna-structure-audit
34
+
35
+ Three-rung benchmark for evaluating whether RNA/DNA foundation models encode genuine secondary structure or composition shortcuts.
36
+
37
+ [![Open Quickstart in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/elliottower/rna-structure-audit/blob/main/notebooks/quickstart.ipynb) [![Open BYOM Tutorial in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/elliottower/rna-structure-audit/blob/main/notebooks/bring_your_own_model.ipynb)
38
+
39
+ ## Install
40
+
41
+ ```bash
42
+ pip install rna-structure-audit
43
+ ```
44
+
45
+ For pre-built adapters (ERNIE-RNA, RiNALMo, RNA-FM, and 7 more):
46
+
47
+ ```bash
48
+ pip install rna-structure-audit[all-models]
49
+ ```
50
+
51
+ ## Quick start
52
+
53
+ ```python
54
+ from rna_structure_audit.adapters import ERNIERNAAdapter
55
+ from rna_structure_audit.evaluate import evaluate
56
+
57
+ results = evaluate(ERNIERNAAdapter(), device="cuda")
58
+ print(results["report"]["grade"]) # A
59
+ ```
60
+
61
+ ## Pre-built adapters
62
+
63
+ | Adapter | Model | Params | Grade |
64
+ |---------|-------|--------|-------|
65
+ | `ERNIERNAAdapter` | ERNIE-RNA | 86M | A |
66
+ | `RiNALMoAdapter` | RiNALMo | 650M | A |
67
+ | `SpliceBERTAdapter` | SpliceBERT | 19M | D |
68
+ | `UTRLMAdapter` | UTR-LM | 1.2M | D |
69
+ | `RNAFMAdapter` | RNA-FM | 99M | D |
70
+ | `NTAdapter` | Nucleotide Transformer v2 | 56M | D |
71
+ | `HyenaDNAAdapter` | HyenaDNA | 5.4M | D |
72
+ | `CaduceusAdapter` | Caduceus | 14M | D |
73
+ | `EvoAdapter` | Evo | 7B | D |
74
+ | `DNABERT2Adapter` | DNABERT-2 | 117M | D |
75
+
76
+ ## Bring your own model
77
+
78
+ Write an adapter for your model:
79
+
80
+ ```python
81
+ from rna_structure_audit.adapter import ModelAdapter
82
+ import torch
83
+
84
+ class MyModelAdapter(ModelAdapter):
85
+ name = "my-model"
86
+ d_model = 640
87
+ n_layers = 12
88
+
89
+ def load(self):
90
+ # Load your model
91
+ ...
92
+
93
+ def tokenize(self, sequence: str) -> torch.Tensor:
94
+ # Return input_ids tensor
95
+ ...
96
+
97
+ def get_all_layer_embeddings(self, tokens: torch.Tensor) -> list[torch.Tensor]:
98
+ # Return list of (seq_len, d_model) tensors, one per layer
99
+ ...
100
+ ```
101
+
102
+ Then run from the command line:
103
+
104
+ ```bash
105
+ rna-structure-audit --adapter my_adapter.py --device cuda -o results.json
106
+ ```
107
+
108
+ Or from Python:
109
+
110
+ ```python
111
+ from rna_structure_audit.evaluate import evaluate
112
+
113
+ adapter = MyModelAdapter()
114
+ results = evaluate(adapter, device="cuda")
115
+ print(results["report"]["grade"]) # A, B, C, or D
116
+ ```
117
+
118
+ See the [Bring Your Own Model tutorial](notebooks/bring_your_own_model.ipynb) for a full walkthrough.
119
+
120
+ ## Grading
121
+
122
+ | Grade | Meaning |
123
+ |-------|---------|
124
+ | A | Partner-specific: encodes which position pairs with which |
125
+ | B | Structure-aware beyond composition: survives dinucleotide controls |
126
+ | C | Composition-sensitive: stem/loop signal absorbed by nucleotide null |
127
+ | D | No detectable structure signal |
128
+
129
+ ## The three rungs
130
+
131
+ 1. **Mutation sensitivity** — Do stems respond differently than loops to complement mutations? Controlled by nucleotide-stratified permutation null.
132
+ 2. **Dinucleotide null** — Of families passing Rung 1, how many survive when the null is stratified by dinucleotide context?
133
+ 3. **Partner specificity** — When position i is mutated, is perturbation at its base-pairing partner j greater than at j's stem-adjacent neighbors? Controlled by within-stem derangement null.
134
+
135
+ ## Citation
136
+
137
+ Tower, E. (2026). A Three-Rung Evaluation of RNA Structure Awareness in Foundation Models.
@@ -0,0 +1,367 @@
1
+ # Frozen Analysis Protocol: Direction Instability and Cross-View Validation of RNA-FM on HTT mRNA
2
+
3
+ **Title:** Direction instability of RNA foundation model embeddings across CAG repeat variants, with thermodynamic cross-view validation
4
+
5
+ **Authors:** Elliot Tower
6
+
7
+ **Date:** 2026-07-11 (pre SHA freeze)
8
+
9
+ **Commit SHA:** 5427db9
10
+
11
+ **Epistemic status:** This is a **frozen analysis protocol**, not a pre-registration
12
+ in the strict sense. The hypotheses below are informed by results from a prior
13
+ analysis (the causal geometry audit of RNA-FM, reported separately). We observed
14
+ a categorical transportability collapse (geodesic distance ~3.7 for any non-WT
15
+ repeat count) and extreme late-layer rank-1 compression before formulating these
16
+ hypotheses. The SHA freeze guarantees the **scorer code and decision criteria**
17
+ were fixed before the direction instability and cross-view experiments ran, but
18
+ the hypotheses themselves encode expectations formed after seeing the geometry.
19
+ We state this openly rather than overclaiming pre-registration status.
20
+
21
+ ---
22
+
23
+ ## Prior results (already observed, motivate this protocol)
24
+
25
+ The following results from the initial audit are known and inform the design below:
26
+
27
+ - Grassmannian transportability collapses categorically: geodesic distance
28
+ ~3.7 for ANY non-WT repeat count, including normal-range r=27.
29
+ The collapse is binary (0.14 same / ~3.7 different), not gradual.
30
+ - Layer-wise effective dimensionality: 51 → 1 across layers 0–12.
31
+ Layers 9–12 have effective dim = 1 (97.9% variance in PC1).
32
+ - W_Q effective rank: 265 → 86 across layers (3x compression).
33
+ - Per-position embedding norms are constant at 28.667 (LayerNorm effect).
34
+
35
+ ---
36
+
37
+ ## Experiment 1: Direction Instability Across CAG Repeat Variants
38
+
39
+ ### Background
40
+
41
+ The transportability analysis found that PCA subspaces rotate near-completely
42
+ for any repeat-count change. This binary behavior could arise from two sources:
43
+ (a) the PCA subspace is dominated by length-dependent structure (different numbers
44
+ of positions create different principal components), or (b) RNA-FM genuinely
45
+ represents different repeat counts as categorically different structures.
46
+
47
+ Direction instability (DI) — computed as a per-variant scalar metric against
48
+ the WT reference — provides a complementary test. Unlike Grassmannian distance,
49
+ DI operates on aligned individual positions rather than global subspaces, so it
50
+ can detect gradual per-position changes that the subspace metric averages away.
51
+
52
+ **Critical design note:** Because Paper 1 already showed the subspace metric
53
+ is binary, we specifically test whether DI *also* shows binary behavior (H1a)
54
+ or smooth monotonic behavior (H1b). Pre-committing to both possibilities avoids
55
+ designing H1 to fail.
56
+
57
+ ### Hypotheses
58
+
59
+ #### Confirmatory hypotheses (Bonferroni-corrected, α = 0.05/4 = 0.0125)
60
+
61
+ **H1: DI is structured with respect to repeat-count deviation.**
62
+ For each CAG variant r, compute the mean cosine distance of its aligned
63
+ embedding (at layer 6) against the WT (r=21) embedding. Test whether
64
+ these per-variant DI values correlate with |r − 21|.
65
+
66
+ - **H1a (smooth):** Spearman ρ > 0.5 with p < 0.0125.
67
+ - **H1b (binary, matching Paper 1):** DI is bimodal — WT cluster
68
+ (r ∈ {21}) vs all others — with Mann-Whitney U p < 0.0125
69
+ separating the two groups.
70
+ - **Decision:** Report which pattern obtains. If both pass, smooth
71
+ subsumes binary. If neither passes, the metric does not capture
72
+ repeat-count variation at this layer.
73
+ - **Power note:** With n=12 variants and only 1 WT observation, the
74
+ Spearman test has limited power. We report the effect size regardless
75
+ of significance.
76
+
77
+ **H2: CAG-region DI exceeds flanking-region DI.**
78
+ The 50-nt flanking regions (conserved across variants) will show lower DI
79
+ than the CAG repeat region. Because mean-pooling the CAG to a single
80
+ position (as used for H1) would leave n=1 in the CAG group — insufficient
81
+ for a group comparison — H2 uses **per-codon alignment**: each CAG codon
82
+ (3 nt) is mean-pooled to one vector, and the first 10 codons (the minimum
83
+ repeat count in the variant set) are retained. This gives 10 CAG positions
84
+ vs 100 flank positions for the Mann-Whitney test.
85
+
86
+ - **Decision criterion:** Cohen's d > 0.5 and Mann-Whitney U p < 0.0125.
87
+ - **Null baseline:** Shuffled-sequence DI. For each variant, shuffle the
88
+ nucleotide order of the full sequence (preserving composition), extract
89
+ embeddings with the same per-codon alignment, compute DI. Repeat 50
90
+ times. H2 passes only if real CAG DI exceeds the 95th percentile of
91
+ shuffled CAG DI.
92
+
93
+ **H5: ViennaRNA base-pair probabilities correlate with RNA-FM embedding structure.**
94
+ Per-nucleotide base-pair probability from ViennaRNA partition function will
95
+ correlate with the projection onto PC1 of middle-layer (layer 6) RNA-FM
96
+ embeddings on the WT HTT CAG + flanking region.
97
+
98
+ - **Decision criterion:** Pearson |r| > 0.3 with p < 0.0125.
99
+
100
+ **H6: Cross-view subspace overlap exceeds chance.**
101
+ The Grassmannian distance between the PCA **score** subspaces (k=2) of
102
+ RNA-FM layer-6 embeddings and ViennaRNA structural features (BP probability,
103
+ loop type) will be smaller than the null distribution from 100
104
+ composition-matched shuffled sequences. Both PCA score matrices are
105
+ (n_positions, k), living in the shared position-space R^n_positions, so
106
+ `subspace_angles` is well-defined. Loadings live in incompatible feature
107
+ spaces (R^640 vs R^2) and cannot be compared directly.
108
+
109
+ - **Decision criterion:** Real geodesic distance < 5th percentile of
110
+ shuffled-sequence geodesic distances.
111
+
112
+ #### Exploratory analyses (effect sizes reported, no p-threshold)
113
+
114
+ **H3: DI informativeness is layer-dependent.**
115
+ Compute H1's per-variant DI metric at all 13 layers (0–12). Report which
116
+ layer yields the strongest effect. Prediction (from Paper 1's layer-wise
117
+ compression): middle layers (4–8) will be most informative.
118
+
119
+ - **Report:** |Spearman ρ| per layer, best layer index. No statistical
120
+ test — this is a descriptive exploration of layer sensitivity.
121
+
122
+ **H4: DI dissociates from magnitude instability.**
123
+ Some CAG variants may show high direction instability but low magnitude
124
+ instability (embedding norm CV), confirming DI captures structural change
125
+ rather than scale change.
126
+
127
+ - **Report:** Spearman ρ between per-variant DI and per-variant magnitude
128
+ CV. Dissociation indicated if |ρ| < 0.7.
129
+
130
+ **H7: ViennaRNA transportability compared to RNA-FM transportability.**
131
+ Compute within-modality geodesic distances: for each CAG variant, fit
132
+ PCA on its (n_positions, n_features) matrix, QR-orthonormalize the score
133
+ matrix, then measure subspace_angles between the variant's orthonormalized
134
+ scores and WT's scores in position-space. Both modalities use k=2 so
135
+ geodesic magnitudes are on the same scale (ViennaRNA has effective rank 2,
136
+ so k=2 is the maximum; RNA-FM uses the same k for comparability).
137
+ Compare geodesic distances to WT across the two modalities.
138
+
139
+ - **Decision:** Report Spearman ρ between ViennaRNA and RNA-FM geodesic
140
+ distances across variants.
141
+ - ρ > 0.7: The collapse is a genuine property of HTT CAG structure.
142
+ - ρ < 0.3: The collapse is architectural (RNA-FM-specific).
143
+ - 0.3 ≤ ρ ≤ 0.7: Partial concordance — both structural and
144
+ architectural factors contribute. Report both distances and note
145
+ which variants diverge.
146
+ - **Dimensionality caveat:** ViennaRNA geodesics are computed on a 2D
147
+ feature space ([bp_prob, loop_type]) and are therefore a coarse
148
+ comparator. A weak ρ may reflect ViennaRNA's low feature dimensionality
149
+ rather than genuine architectural divergence between the two views.
150
+
151
+ ---
152
+
153
+ ## Scorer Functions (frozen)
154
+
155
+ ### Per-variant DI against WT (for H1, H3, H4)
156
+
157
+ ```python
158
+ def di_vs_wt(embeddings_dict, wt_key=21):
159
+ """
160
+ embeddings_dict: {repeat_count: (n_aligned, d_model) tensor}
161
+ All tensors must be position-aligned (same n_aligned).
162
+ Returns: {repeat_count: scalar DI} — mean cosine distance to WT.
163
+ """
164
+ wt = embeddings_dict[wt_key]
165
+ wt_normed = wt / (wt.norm(dim=-1, keepdim=True) + 1e-8)
166
+ result = {}
167
+ for r, emb in embeddings_dict.items():
168
+ emb_normed = emb / (emb.norm(dim=-1, keepdim=True) + 1e-8)
169
+ cos = (wt_normed * emb_normed).sum(dim=-1) # (n_aligned,)
170
+ result[r] = float(1 - cos.mean())
171
+ return result
172
+ ```
173
+
174
+ ### Per-position DI across all variants (for H2)
175
+
176
+ ```python
177
+ def direction_instability_profile(embeddings_list):
178
+ """
179
+ embeddings_list: list of (n_aligned, d_model) tensors.
180
+ Returns: per-position DI (n_aligned,) — 1 minus mean pairwise cosine.
181
+ """
182
+ n = len(embeddings_list)
183
+ normed = [e / (e.norm(dim=-1, keepdim=True) + 1e-8) for e in embeddings_list]
184
+ cos_sum = np.zeros(normed[0].shape[0])
185
+ count = 0
186
+ for i in range(n):
187
+ for j in range(i + 1, n):
188
+ cos_sum += (normed[i] * normed[j]).sum(dim=-1).numpy()
189
+ count += 1
190
+ return 1 - (cos_sum / count)
191
+ ```
192
+
193
+ ### Magnitude instability (for H4)
194
+
195
+ ```python
196
+ def magnitude_instability(embeddings_dict, wt_key=21):
197
+ """CV of embedding norms for each variant relative to WT."""
198
+ result = {}
199
+ wt_norms = embeddings_dict[wt_key].norm(dim=-1).numpy()
200
+ for r, emb in embeddings_dict.items():
201
+ norms = emb.norm(dim=-1).numpy()
202
+ result[r] = float(np.std(norms - wt_norms) / (np.mean(np.abs(wt_norms)) + 1e-8))
203
+ return result
204
+ ```
205
+
206
+ ---
207
+
208
+ ## Position Alignment Strategy
209
+
210
+ Because different CAG repeat counts produce different numbers of nucleotides,
211
+ direct positional alignment in the repeat region is not possible. Two alignment
212
+ modes are used, depending on the hypothesis:
213
+
214
+ ### Mode A: Mean-pool alignment (H1, H3, H4, H5, H6, H7)
215
+
216
+ 1. **Left flank:** Positions −50 to −1 relative to CAG start. Always 50 positions,
217
+ identical sequence across all variants. Directly aligned.
218
+
219
+ 2. **Right flank:** Positions +1 to +50 relative to CAG end. Always 50 positions,
220
+ identical sequence across all variants. Directly aligned.
221
+
222
+ 3. **CAG region:** Mean-pool all CAG nucleotide embeddings into a single
223
+ (1, d_model) vector per variant. This avoids the per-codon alignment problem
224
+ (codon 5 of an 80-mer is in a different structural context than codon 5 of
225
+ a 21-mer). The mean-pooled vector summarizes the aggregate representation of
226
+ the repeat region regardless of length.
227
+
228
+ 4. **Full aligned representation:** Concatenate [left_flank (50,d), cag_mean (1,d),
229
+ right_flank (50,d)] → (101, d_model) per variant.
230
+
231
+ **Worked example for r=40:**
232
+ - Input sequence: `[50nt flank_L] [CAG×40 = 120nt] [50nt flank_R]` = 220 nt
233
+ - RNA-FM embeddings: (220, 640) after stripping CLS/EOS
234
+ - Left flank: positions 0–49 → (50, 640)
235
+ - CAG mean: mean(positions 50–169) → (1, 640)
236
+ - Right flank: positions 170–219 → (50, 640)
237
+ - Aligned: (101, 640)
238
+
239
+ ### Mode B: Per-codon alignment (H2 only)
240
+
241
+ H2 compares the DI *distribution* at CAG positions against flank positions,
242
+ so it requires multiple CAG positions (not a single mean-pooled vector).
243
+ Each CAG codon (3 nucleotides) is mean-pooled to one (1, d_model) vector.
244
+ The first 10 codons (= minimum repeat count in the variant set) are retained,
245
+ giving a fixed-size CAG representation across all variants.
246
+
247
+ **Full aligned representation:** Concatenate [left_flank (50,d), cag_codons (10,d),
248
+ right_flank (50,d)] → (110, d_model) per variant.
249
+
250
+ This provides n=10 CAG DI values vs n=100 flank DI values for the
251
+ Mann-Whitney test, avoiding the n=1 problem that mean-pool alignment
252
+ would create.
253
+
254
+ **CLS/EOS handling:** Special tokens (CLS at position 0, EOS at final position)
255
+ are stripped before alignment. All indices above refer to post-stripping positions.
256
+
257
+ ---
258
+
259
+ ## Null Model (for H2, H6)
260
+
261
+ Null sequences are generated by **full-sequence shuffle**: the entire variant
262
+ sequence (flanks + CAG region) is randomly permuted, preserving nucleotide
263
+ composition and length but destroying all local structure including the
264
+ CAG/flank boundary. Embeddings and ViennaRNA features are then extracted
265
+ from the shuffled sequence and sliced at the **same positional indices** as
266
+ the real sequence (i.e., positions 0–49 as "left flank," the middle region
267
+ as "CAG," and the final 50 as "right flank"). After shuffling, these
268
+ indices no longer correspond to flanks or CAG repeats — they are arbitrary
269
+ positions in a random sequence. This is the intended null: it tests whether
270
+ the observed DI or cross-view alignment reflects genuine structural
271
+ sensitivity or is an artifact of embedding geometry that would arise for
272
+ any composition-matched sequence.
273
+
274
+ - **H2 null:** 50 shuffles per variant, per-codon alignment (Mode B).
275
+ H2 passes only if real CAG DI exceeds the 95th percentile of shuffled
276
+ CAG-index DI.
277
+ - **H6 null:** 100 shuffles of the WT sequence, mean-pool alignment
278
+ (Mode A). H6 passes only if real cross-view geodesic < 5th percentile
279
+ of shuffled geodesics.
280
+
281
+ ---
282
+
283
+ ## Thermodynamic Features (frozen)
284
+
285
+ ### Primary tool: ViennaRNA
286
+
287
+ ViennaRNA (installed, verified via `RNA.fold()`) provides the baseline
288
+ physics-based view using Turner 2004 thermodynamic parameters.
289
+
290
+ For each HTT variant sequence, compute:
291
+
292
+ 1. `bp_prob[i]`: Sum of base-pair probabilities involving position i.
293
+ **Ensemble quantity** — computed from the full partition function
294
+ via `RNA.fold_compound(seq).pf()` then `fc.bpp()`. Sum upper triangle
295
+ entries for each position i.
296
+ 2. `loop_type[i]`: Binary indicator — 1 if position i is unpaired in the
297
+ **MFE structure only** (from `RNA.fold(seq)`), 0 if base-paired.
298
+ **This is NOT an ensemble quantity.** It is a single-structure property
299
+ from the minimum free energy fold. We use MFE because ViennaRNA does
300
+ not provide per-position loop-type probabilities from the partition
301
+ function. This limitation is stated explicitly.
302
+
303
+ Stack [bp_prob, loop_type] as a (n_positions, 2) feature matrix.
304
+ Accessibility (1 − bp_prob) is omitted because it is linearly dependent
305
+ on bp_prob and would create a rank-deficient feature matrix. PCA on
306
+ ViennaRNA features uses k=2 throughout (H6, H7).
307
+
308
+ Use the same position-alignment strategy as Experiment 1 (mean-pool the CAG
309
+ region, keep flanks aligned).
310
+
311
+ ### Future extension: EternaFold
312
+
313
+ EternaFold (learned parameters from Eterna crowdsourced + experimental probing
314
+ data) produces base-pair probabilities that agree better with experimental
315
+ chemical probing than ViennaRNA's Turner parameters. EternaFold is not
316
+ pip-installable (requires C++ compilation from source) and was not available
317
+ in this session. It is deferred to a follow-up analysis.
318
+
319
+ When EternaFold is added, the same two-feature stack (bp_prob, loop_type)
320
+ will be computed from both tools, and an additional hypothesis (H8) will
321
+ test cross-tool agreement:
322
+ ViennaRNA and EternaFold BP-probability profiles should correlate at Pearson
323
+ r > 0.7 on the WT sequence, establishing baseline agreement before interpreting
324
+ disagreements on variant sequences. If RNA-FM tracks EternaFold but not ViennaRNA,
325
+ this would suggest RNA-FM learned probing-consistent structure beyond Turner
326
+ thermodynamics.
327
+
328
+ ---
329
+
330
+ ## Frozen sequence data
331
+
332
+ All variant sequences are constructed from the HTT mRNA reference NM_002111.7
333
+ (13,669 nt, downloaded from NCBI, stored at `data/HTT_NM_002111.7.fasta`).
334
+ The native CAG repeat region is at positions 148–211 (21 repeats, identified
335
+ by regex `(CAG){5,}`). Flanking sequences are the 50 nt immediately upstream
336
+ (positions 98–147) and downstream (positions 212–261) of the native repeat.
337
+
338
+ Variant set: r ∈ {10, 15, 18, 21, 24, 27, 30, 36, 40, 50, 60, 80}.
339
+
340
+ ---
341
+
342
+ ## Statistical corrections
343
+
344
+ Confirmatory hypotheses {H1, H2, H5, H6} use Bonferroni correction
345
+ (α = 0.05/4 = 0.0125). Exploratory analyses {H3, H4, H7} report effect
346
+ sizes without p-value thresholds.
347
+
348
+ All results are reported regardless of significance. Effect sizes (ρ, d, r)
349
+ are primary; p-values are secondary.
350
+
351
+ ---
352
+
353
+ ## Reproducibility
354
+
355
+ Random seed `SEED = 20260711` is set via `np.random.seed()` and
356
+ `torch.manual_seed()` before any stochastic operations (null model shuffles).
357
+ Re-running the frozen scorer with the same seed produces identical null
358
+ distributions and therefore identical p-values and pass/fail decisions.
359
+
360
+ ---
361
+
362
+ ## Data and code availability
363
+
364
+ All scorer code, analysis scripts, raw sequences, and results will be committed
365
+ to the causal-rna repository. The commit SHA of this document proves that the
366
+ scorer and decision criteria were frozen before the direction instability and
367
+ ViennaRNA experiments were run.