orfdata 0.13.0__tar.gz → 0.14.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 (149) hide show
  1. {orfdata-0.13.0/orfdata.egg-info → orfdata-0.14.0}/PKG-INFO +1 -1
  2. {orfdata-0.13.0 → orfdata-0.14.0}/docs/measurements.md +10 -2
  3. {orfdata-0.13.0 → orfdata-0.14.0}/orfdata/reference.py +6 -2
  4. orfdata-0.14.0/orfdata/version.py +1 -0
  5. {orfdata-0.13.0 → orfdata-0.14.0/orfdata.egg-info}/PKG-INFO +1 -1
  6. {orfdata-0.13.0 → orfdata-0.14.0}/orfdata.egg-info/SOURCES.txt +3 -0
  7. orfdata-0.14.0/tests/data/regions/NOTICE.md +1 -0
  8. orfdata-0.14.0/tests/data/regions/ingolia.json +110 -0
  9. orfdata-0.14.0/tests/test_region_targets.py +104 -0
  10. orfdata-0.13.0/orfdata/version.py +0 -1
  11. {orfdata-0.13.0 → orfdata-0.14.0}/LICENSE +0 -0
  12. {orfdata-0.13.0 → orfdata-0.14.0}/MANIFEST.in +0 -0
  13. {orfdata-0.13.0 → orfdata-0.14.0}/README.md +0 -0
  14. {orfdata-0.13.0 → orfdata-0.14.0}/deploy.sh +0 -0
  15. {orfdata-0.13.0 → orfdata-0.14.0}/docs/copy-yeast.md +0 -0
  16. {orfdata-0.13.0 → orfdata-0.14.0}/docs/coverage.md +0 -0
  17. {orfdata-0.13.0 → orfdata-0.14.0}/docs/design.md +0 -0
  18. {orfdata-0.13.0 → orfdata-0.14.0}/docs/human-tissue.md +0 -0
  19. {orfdata-0.13.0 → orfdata-0.14.0}/docs/pairing.md +0 -0
  20. {orfdata-0.13.0 → orfdata-0.14.0}/docs/pfizer-protein.md +0 -0
  21. {orfdata-0.13.0 → orfdata-0.14.0}/docs/pfizer-rna.md +0 -0
  22. {orfdata-0.13.0 → orfdata-0.14.0}/docs/reference.md +0 -0
  23. {orfdata-0.13.0 → orfdata-0.14.0}/docs/search-references.md +0 -0
  24. {orfdata-0.13.0 → orfdata-0.14.0}/docs/source-references.md +0 -0
  25. {orfdata-0.13.0 → orfdata-0.14.0}/docs/species.md +0 -0
  26. {orfdata-0.13.0 → orfdata-0.14.0}/docs/storage.md +0 -0
  27. {orfdata-0.13.0 → orfdata-0.14.0}/lint.sh +0 -0
  28. {orfdata-0.13.0 → orfdata-0.14.0}/orfdata/__init__.py +0 -0
  29. {orfdata-0.13.0 → orfdata-0.14.0}/orfdata/build.py +0 -0
  30. {orfdata-0.13.0 → orfdata-0.14.0}/orfdata/catalog.py +0 -0
  31. {orfdata-0.13.0 → orfdata-0.14.0}/orfdata/cli.py +0 -0
  32. {orfdata-0.13.0 → orfdata-0.14.0}/orfdata/data/datasets.json +0 -0
  33. {orfdata-0.13.0 → orfdata-0.14.0}/orfdata/data/orf-evidence/AUTHOR-LICENSE.txt +0 -0
  34. {orfdata-0.13.0 → orfdata-0.14.0}/orfdata/data/orf-evidence/NOTICE.txt +0 -0
  35. {orfdata-0.13.0 → orfdata-0.14.0}/orfdata/data/orf-evidence/catalog.json.gz +0 -0
  36. {orfdata-0.13.0 → orfdata-0.14.0}/orfdata/data/orf-evidence/manifest.json +0 -0
  37. {orfdata-0.13.0 → orfdata-0.14.0}/orfdata/data/uorf-evidence/AUTHOR-LICENSE.txt +0 -0
  38. {orfdata-0.13.0 → orfdata-0.14.0}/orfdata/data/uorf-evidence/NOTICE.txt +0 -0
  39. {orfdata-0.13.0 → orfdata-0.14.0}/orfdata/data/uorf-evidence/catalog.json.gz +0 -0
  40. {orfdata-0.13.0 → orfdata-0.14.0}/orfdata/data/uorf-evidence/manifest.json +0 -0
  41. {orfdata-0.13.0 → orfdata-0.14.0}/orfdata/dataset.py +0 -0
  42. {orfdata-0.13.0 → orfdata-0.14.0}/orfdata/dataset_cli.py +0 -0
  43. {orfdata-0.13.0 → orfdata-0.14.0}/orfdata/datasets.py +0 -0
  44. {orfdata-0.13.0 → orfdata-0.14.0}/orfdata/initiation_context.py +0 -0
  45. {orfdata-0.13.0 → orfdata-0.14.0}/orfdata/measurements.py +0 -0
  46. {orfdata-0.13.0 → orfdata-0.14.0}/orfdata/model.py +0 -0
  47. {orfdata-0.13.0 → orfdata-0.14.0}/orfdata/pairing.py +0 -0
  48. {orfdata-0.13.0 → orfdata-0.14.0}/orfdata/reference_mapping.py +0 -0
  49. {orfdata-0.13.0 → orfdata-0.14.0}/orfdata/search_reference.py +0 -0
  50. {orfdata-0.13.0 → orfdata-0.14.0}/orfdata/sequence.py +0 -0
  51. {orfdata-0.13.0 → orfdata-0.14.0}/orfdata/sources/__init__.py +0 -0
  52. {orfdata-0.13.0 → orfdata-0.14.0}/orfdata/sources/copy.py +0 -0
  53. {orfdata-0.13.0 → orfdata-0.14.0}/orfdata/sources/pfizer.py +0 -0
  54. {orfdata-0.13.0 → orfdata-0.14.0}/orfdata/sources/pfizer_rna.py +0 -0
  55. {orfdata-0.13.0 → orfdata-0.14.0}/orfdata/sources/wang.py +0 -0
  56. {orfdata-0.13.0 → orfdata-0.14.0}/orfdata.egg-info/dependency_links.txt +0 -0
  57. {orfdata-0.13.0 → orfdata-0.14.0}/orfdata.egg-info/entry_points.txt +0 -0
  58. {orfdata-0.13.0 → orfdata-0.14.0}/orfdata.egg-info/requires.txt +0 -0
  59. {orfdata-0.13.0 → orfdata-0.14.0}/orfdata.egg-info/top_level.txt +0 -0
  60. {orfdata-0.13.0 → orfdata-0.14.0}/pyproject.toml +0 -0
  61. {orfdata-0.13.0 → orfdata-0.14.0}/setup.cfg +0 -0
  62. {orfdata-0.13.0 → orfdata-0.14.0}/test.sh +0 -0
  63. {orfdata-0.13.0 → orfdata-0.14.0}/tests/conftest.py +0 -0
  64. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/copy/GSM1905474.soft +0 -0
  65. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/copy/GSM1905474_KL9_fpkm.txt.gz +0 -0
  66. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/copy/GSM1905476.soft +0 -0
  67. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/copy/GSM1905476_KL10_fpkm.txt.gz +0 -0
  68. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/copy/GSM1905478.soft +0 -0
  69. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/copy/GSM1905478_KL11_fpkm.txt.gz +0 -0
  70. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/copy/GSM1905479.soft +0 -0
  71. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/copy/GSM1905479_KL12_fpkm.txt.gz +0 -0
  72. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/copy/NOTICE.md +0 -0
  73. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/copy/expected.json +0 -0
  74. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/copy/geo-series.soft +0 -0
  75. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/copy/manifest.json +0 -0
  76. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/copy/methods.pdf +0 -0
  77. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/copy/paper.xml +0 -0
  78. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/copy/pmc-metadata.json +0 -0
  79. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/copy/qconcat.fasta +0 -0
  80. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/copy/workbook.xlsx +0 -0
  81. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/pfizer/NOTICE.md +0 -0
  82. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/pfizer/dog/expected.json +0 -0
  83. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/pfizer/dog/manifest.json +0 -0
  84. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/pfizer/dog/protein.tsv +0 -0
  85. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/pfizer/dog/search.fasta +0 -0
  86. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/pfizer/human/expected.json +0 -0
  87. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/pfizer/human/manifest.json +0 -0
  88. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/pfizer/human/protein.tsv +0 -0
  89. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/pfizer/human/search.fasta +0 -0
  90. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/pfizer/mouse/expected.json +0 -0
  91. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/pfizer/mouse/manifest.json +0 -0
  92. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/pfizer/mouse/protein.tsv +0 -0
  93. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/pfizer/mouse/search.fasta +0 -0
  94. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/pfizer_rna/GSE325522_family.soft.gz +0 -0
  95. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/pfizer_rna/GSE325523_family.soft.gz +0 -0
  96. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/pfizer_rna/GSE325525_family.soft.gz +0 -0
  97. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/pfizer_rna/NOTICE.md +0 -0
  98. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/pfizer_rna/counts.csv.gz +0 -0
  99. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/pfizer_rna/dog-annotation.gtf.gz +0 -0
  100. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/pfizer_rna/dog-expected.json +0 -0
  101. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/pfizer_rna/dog-manifest.json +0 -0
  102. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/pfizer_rna/mouse-annotation.gtf.gz +0 -0
  103. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/pfizer_rna/mouse-expected.json +0 -0
  104. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/pfizer_rna/mouse-manifest.json +0 -0
  105. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/pfizer_rna/samples.xlsx +0 -0
  106. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/references/README.md +0 -0
  107. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/references/canis_lupus_familiaris.json +0 -0
  108. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/references/context-keys-v0.4.json +0 -0
  109. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/references/homo_sapiens.json +0 -0
  110. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/references/mus_musculus.json +0 -0
  111. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/references/saccharomyces_cerevisiae.json +0 -0
  112. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/search_reference/NOTICE.md +0 -0
  113. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/search_reference/dog.fasta +0 -0
  114. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/search_reference/ensembl83-expected.json +0 -0
  115. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/search_reference/ensembl83-human.fasta.gz +0 -0
  116. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/search_reference/expected.json +0 -0
  117. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/storage/README.md +0 -0
  118. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/storage/generate.py +0 -0
  119. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/storage/v1.json +0 -0
  120. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/storage/v1.sqlite +0 -0
  121. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/storage/v2.json +0 -0
  122. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/storage/v2.sqlite +0 -0
  123. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/storage/v3.json +0 -0
  124. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/storage/v3.sqlite +0 -0
  125. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/wang/NOTICE.md +0 -0
  126. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/wang/annotation.gtf.gz +0 -0
  127. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/wang/copies.zip +0 -0
  128. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/wang/expected.json +0 -0
  129. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/wang/manifest.json +0 -0
  130. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/wang/protein.zip +0 -0
  131. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/wang/rna.zip +0 -0
  132. {orfdata-0.13.0 → orfdata-0.14.0}/tests/data/wang/search.fasta.gz +0 -0
  133. {orfdata-0.13.0 → orfdata-0.14.0}/tests/test_copy.py +0 -0
  134. {orfdata-0.13.0 → orfdata-0.14.0}/tests/test_cross_reference_pairing.py +0 -0
  135. {orfdata-0.13.0 → orfdata-0.14.0}/tests/test_ensembl_search_reference.py +0 -0
  136. {orfdata-0.13.0 → orfdata-0.14.0}/tests/test_initiation_context.py +0 -0
  137. {orfdata-0.13.0 → orfdata-0.14.0}/tests/test_local_build_queries.py +0 -0
  138. {orfdata-0.13.0 → orfdata-0.14.0}/tests/test_measurements.py +0 -0
  139. {orfdata-0.13.0 → orfdata-0.14.0}/tests/test_pairing.py +0 -0
  140. {orfdata-0.13.0 → orfdata-0.14.0}/tests/test_pfizer.py +0 -0
  141. {orfdata-0.13.0 → orfdata-0.14.0}/tests/test_pfizer_rna.py +0 -0
  142. {orfdata-0.13.0 → orfdata-0.14.0}/tests/test_reference_context.py +0 -0
  143. {orfdata-0.13.0 → orfdata-0.14.0}/tests/test_reference_mapping.py +0 -0
  144. {orfdata-0.13.0 → orfdata-0.14.0}/tests/test_reference_orf.py +0 -0
  145. {orfdata-0.13.0 → orfdata-0.14.0}/tests/test_search_reference.py +0 -0
  146. {orfdata-0.13.0 → orfdata-0.14.0}/tests/test_selectors.py +0 -0
  147. {orfdata-0.13.0 → orfdata-0.14.0}/tests/test_storage.py +0 -0
  148. {orfdata-0.13.0 → orfdata-0.14.0}/tests/test_uorf_catalog.py +0 -0
  149. {orfdata-0.13.0 → orfdata-0.14.0}/tests/test_wang.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orfdata
3
- Version: 0.13.0
3
+ Version: 0.14.0
4
4
  Summary: Reference open reading frames and experimental translation evidence on annotated transcripts
5
5
  Author: OpenVax
6
6
  License-Expression: Apache-2.0
@@ -2,8 +2,8 @@
2
2
 
3
3
  ORFdata adds evidence to PyEnsembl's reference transcripts and proteins. Its
4
4
  quantitative layer stores measurements of genes, transcripts, reference ORFs,
5
- proteins, protein groups and peptides. A measurement stays at the resolution
6
- the experiment supports. Parent-gene RNA abundance is useful context for an ORF;
5
+ proteins, protein groups, peptides and source-defined regions. A measurement stays
6
+ at the resolution the experiment supports. Parent-gene RNA abundance is useful context for an ORF;
7
7
  it is not a separate measurement of each ORF in that gene.
8
8
 
9
9
  Install `orfdata[data]` to manage datasets. The registry includes downloadable
@@ -50,6 +50,14 @@ mapping table. The default PyEnsembl target uses its unversioned `id`; request
50
50
  mapping across annotation releases, gene isoforms, ORFs or species. A variant or
51
51
  fusion product does not inherit a native reference protein measurement.
52
52
 
53
+ Use `ScopedTarget(reference, "region", source_id, source_namespace)` for a
54
+ quantified UTR, intron or other source-defined window. Keep its native feature
55
+ type and target length in measurement provenance. A region ID does not assert
56
+ known genomic coordinates or a translated ORF. RNA and Ribo measurements of the
57
+ same region can be compared through an explicit `same_target` relationship;
58
+ such a density ratio describes that region, not a particular uORF inside it.
59
+ Regions do not automatically bind to PyEnsembl or participate in gene/ORF orthology.
60
+
53
61
  For native sources with unreported genomic metadata, use explicit
54
62
  [source references and mapping views](source-references.md) to retain the original
55
63
  observation alongside its mapping to a PyEnsembl target.
@@ -210,7 +210,11 @@ class ReferenceContext:
210
210
 
211
211
  @dataclass(frozen=True)
212
212
  class ScopedTarget:
213
- """A source identifier whose reference, kind and dataset cannot be discarded."""
213
+ """A source identifier whose reference, kind and dataset cannot be discarded.
214
+
215
+ ``region`` names a source-defined quantification window (for example a UTR
216
+ or intron). It does not assert resolved coordinates or a complete ORF.
217
+ """
214
218
 
215
219
  reference: ReferenceContext
216
220
  kind: str
@@ -220,7 +224,7 @@ class ScopedTarget:
220
224
  def __post_init__(self):
221
225
  if not isinstance(self.reference, ReferenceContext):
222
226
  raise TypeError("Target requires a ReferenceContext")
223
- if self.kind not in ("gene", "transcript", "orf", "protein", "protein_group", "peptide"):
227
+ if self.kind not in ("gene", "transcript", "orf", "protein", "protein_group", "peptide", "region"):
224
228
  raise ValueError("Unknown target kind")
225
229
  if not all(isinstance(x, str) and x.strip() for x in (self.identifier, self.namespace)):
226
230
  raise ValueError("Target identifier and source namespace are required")
@@ -0,0 +1 @@
1
+ __version__ = "0.14.0"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orfdata
3
- Version: 0.13.0
3
+ Version: 0.14.0
4
4
  Summary: Reference open reading frames and experimental translation evidence on annotated transcripts
5
5
  Author: OpenVax
6
6
  License-Expression: Apache-2.0
@@ -67,6 +67,7 @@ tests/test_pfizer_rna.py
67
67
  tests/test_reference_context.py
68
68
  tests/test_reference_mapping.py
69
69
  tests/test_reference_orf.py
70
+ tests/test_region_targets.py
70
71
  tests/test_search_reference.py
71
72
  tests/test_selectors.py
72
73
  tests/test_storage.py
@@ -120,6 +121,8 @@ tests/data/references/context-keys-v0.4.json
120
121
  tests/data/references/homo_sapiens.json
121
122
  tests/data/references/mus_musculus.json
122
123
  tests/data/references/saccharomyces_cerevisiae.json
124
+ tests/data/regions/NOTICE.md
125
+ tests/data/regions/ingolia.json
123
126
  tests/data/search_reference/NOTICE.md
124
127
  tests/data/search_reference/dog.fasta
125
128
  tests/data/search_reference/ensembl83-expected.json
@@ -0,0 +1 @@
1
+ Small factual slices of Ingolia et al. (2009), DOI10.1126/science.1168978, GSE13750. Native columns and original line numbers are preserved; full-source URLs, SHA-256 and sizes are recorded in ingolia.json. GEO unrestricted reuse with attribution. This fixture validates source-defined region targets only, not full reference/ORF mapping or a production source importer.
@@ -0,0 +1,110 @@
1
+ [
2
+ {
3
+ "sample": "GSM346111",
4
+ "source": {
5
+ "url": "https://ftp.ncbi.nlm.nih.gov/geo/samples/GSM346nnn/GSM346111/suppl/GSM346111_fp_rich1_quant.txt.gz",
6
+ "size": 131843,
7
+ "sha256": "492f3a630d662de165309628b37ec5c89862f86b80c66391f7421e0f633efe76"
8
+ },
9
+ "rows": [
10
+ {
11
+ "line": 25,
12
+ "native": {
13
+ "yorf": "YAL001C",
14
+ "norm": "7.306",
15
+ "dens": "12.406",
16
+ "count": "43",
17
+ "len": "3466",
18
+ "total": "1698134"
19
+ }
20
+ },
21
+ {
22
+ "line": 26,
23
+ "native": {
24
+ "yorf": "YAL001C_3'utr",
25
+ "norm": "0.000",
26
+ "dens": "0.000",
27
+ "count": "0",
28
+ "len": "50",
29
+ "total": "1698134"
30
+ }
31
+ },
32
+ {
33
+ "line": 27,
34
+ "native": {
35
+ "yorf": "YAL001C_intron",
36
+ "norm": "0.000",
37
+ "dens": "0.000",
38
+ "count": "0",
39
+ "len": "82",
40
+ "total": "1698134"
41
+ }
42
+ },
43
+ {
44
+ "line": 32,
45
+ "native": {
46
+ "yorf": "YAL005C_5'utr",
47
+ "norm": "134.952",
48
+ "dens": "229.167",
49
+ "count": "11",
50
+ "len": "48",
51
+ "total": "1698134"
52
+ }
53
+ }
54
+ ]
55
+ },
56
+ {
57
+ "sample": "GSM346117",
58
+ "source": {
59
+ "url": "https://ftp.ncbi.nlm.nih.gov/geo/samples/GSM346nnn/GSM346117/suppl/GSM346117_mrna_rich1_quant.txt.gz",
60
+ "size": 175847,
61
+ "sha256": "907ddaf47268ea6f36e2363c74a8c001ba48d1dc34617c1461ad5923e57def5b"
62
+ },
63
+ "rows": [
64
+ {
65
+ "line": 25,
66
+ "native": {
67
+ "yorf": "YAL001C",
68
+ "norm": "33.798",
69
+ "dens": "49.048",
70
+ "count": "170",
71
+ "len": "3466",
72
+ "total": "1451219"
73
+ }
74
+ },
75
+ {
76
+ "line": 26,
77
+ "native": {
78
+ "yorf": "YAL001C_3'utr",
79
+ "norm": "55.126",
80
+ "dens": "80.000",
81
+ "count": "4",
82
+ "len": "50",
83
+ "total": "1451219"
84
+ }
85
+ },
86
+ {
87
+ "line": 27,
88
+ "native": {
89
+ "yorf": "YAL001C_intron",
90
+ "norm": "0.000",
91
+ "dens": "0.000",
92
+ "count": "0",
93
+ "len": "82",
94
+ "total": "1451219"
95
+ }
96
+ },
97
+ {
98
+ "line": 32,
99
+ "native": {
100
+ "yorf": "YAL005C_5'utr",
101
+ "norm": "229.692",
102
+ "dens": "333.333",
103
+ "count": "16",
104
+ "len": "48",
105
+ "total": "1451219"
106
+ }
107
+ }
108
+ ]
109
+ }
110
+ ]
@@ -0,0 +1,104 @@
1
+ """Source windows stay distinct from complete ORFs across storage and queries."""
2
+
3
+ import hashlib
4
+ import json
5
+ from dataclasses import replace
6
+ from pathlib import Path
7
+
8
+ import pytest
9
+ from test_measurements import definition, write_dataset
10
+
11
+ from orfdata import (
12
+ Assay,
13
+ DatasetManifest,
14
+ Measurement,
15
+ OrthologyMapping,
16
+ QuantitativeDataset,
17
+ ReferenceContext,
18
+ Sample,
19
+ ScopedTarget,
20
+ SourceAsset,
21
+ )
22
+ from orfdata.cli import run
23
+ from orfdata.pairing import AssayPair, MatchedMeasurements, TargetRelation
24
+
25
+
26
+ def test_native_regions_roundtrip_and_cli(tmp_path, capsys):
27
+ path = Path(__file__).parent / "data/regions/ingolia.json"
28
+ source = json.loads(path.read_text())
29
+ sha = hashlib.sha256(path.read_bytes()).hexdigest()
30
+ reference = ReferenceContext(4932, "yeast", None, "SGD", "2008-06-22",
31
+ source_sha256=sha)
32
+ manifest = DatasetManifest(
33
+ "regions", "fixture", "Native Ingolia quantification slices", (reference,),
34
+ (SourceAsset("slice.json", path.as_uri(), sha, path.stat().st_size,
35
+ "GEO factual source slice; Ingolia et al. 2009", redistributable=True),),
36
+ ("https://doi.org/10.1126/science.1168978",), ("rna_seq", "ribo_seq"),
37
+ dict(source_features=4, source_assays=2, genomic_mapping="unresolved"),
38
+ dict(scope="native source-region round-trip; not a full source importer"))
39
+ samples, assays, values = [], [], []
40
+ for entry in source:
41
+ sid = entry["sample"]
42
+ rna = sid == "GSM346117"
43
+ samples.append(Sample(sid, reference, attributes=dict(strain="BY4741")))
44
+ assays.append(Assay(sid, sid, "rna_seq" if rna else "ribo_seq", reference))
45
+ for record in entry["rows"]:
46
+ row = record["native"]
47
+ target = ScopedTarget(reference, "region", row["yorf"], "Ingolia2009:feature")
48
+ for column, unit in (("count", "counts"), ("norm", "RPKM"), ("dens", "reads/kb")):
49
+ values.append(Measurement(
50
+ f"{sid}:{record['line']}:{column}", target, sid, sid,
51
+ "rna_abundance" if rna else "ribosome_occupancy", float(row[column]),
52
+ unit, manifest.dataset_id, manifest.version,
53
+ provenance=dict(source_asset="slice.json", upstream=entry["source"],
54
+ row=record["line"], column=column, native_value=row[column],
55
+ feature_length_nt=int(row["len"]), total_cds_reads=int(row["total"]))))
56
+ dataset = QuantitativeDataset.create(tmp_path / "source.sqlite", manifest,
57
+ samples=samples, assays=assays, measurements=values)
58
+ assert dataset.counts["measurement"] == 24 and dataset.counts["target"] == 4
59
+ assert {m.measurement_id: m for m in dataset.measurements()} == {m.measurement_id: m for m in values}
60
+ target = ScopedTarget(reference, "region", "YAL005C_5'utr", "Ingolia2009:feature")
61
+ expected = list(dataset.measurements(target=target, unit="RPKM"))
62
+ assert len(expected) == 2 and {m.quantity for m in expected} == {"rna_abundance", "ribosome_occupancy"}
63
+ assert not list(dataset.measurements(target=replace(target, kind="orf")))
64
+ assert all(Measurement.from_dict(m.to_dict()) == m for m in expected)
65
+ registry = tmp_path / "registry.json"
66
+ registry.write_text(json.dumps(definition(dataset)))
67
+ args = ["datasets", "--registry", str(registry), "--cache-root", str(tmp_path / "cache")]
68
+ run(args + ["download", "regions", "--quiet"])
69
+ capsys.readouterr()
70
+ run(args + ["query", "regions", "--reference", reference.key, "--kind", "region",
71
+ "--namespace", target.namespace, "--target", target.identifier, "--unit", "RPKM"])
72
+ assert [Measurement.from_dict(json.loads(line)) for line in capsys.readouterr().out.splitlines()] == expected
73
+
74
+
75
+ def test_region_ids_do_not_cross_species_or_reference(tmp_path, experiment):
76
+ observations = tuple(replace(m, target=replace(m.target, kind="region")) for m in experiment[3])
77
+ dataset = write_dataset(tmp_path / "regions.sqlite", experiment, measurements=observations)
78
+ for value in observations:
79
+ assert list(dataset.measurements(target=value.target)) == [value]
80
+ wrong = replace(value.target, reference=replace(value.target.reference, annotation_version="111"))
81
+ with pytest.raises(ValueError, match="not present"):
82
+ list(dataset.measurements(target=wrong))
83
+
84
+
85
+ def test_same_region_ratio_does_not_become_an_orf_estimate(experiment):
86
+ rna = experiment[3][-1]
87
+ rna = replace(rna, target=replace(rna.target, kind="region"), value=2, unit="RPKM")
88
+ rpf = replace(rna, measurement_id="rpf", assay_id="rpf", quantity="ribosome_occupancy", value=6)
89
+ reference = rna.target.reference
90
+ pair = AssayPair("pair", reference, "fixture", "1", "rna", "rpf", "same_material",
91
+ dict(scope="synthetic assay pairing"))
92
+ relation = TargetRelation("region", "fixture", "1", rna.target, rpf.target, "same_target",
93
+ "one_to_one", dict(scope="same synthetic region"))
94
+ ratio = MatchedMeasurements(pair, relation, (rna,), (rpf,)).ratio(
95
+ rpf, rna, measurement_id="ratio", method="explicit source-window density ratio",
96
+ normalization=dict(scope="same synthetic quantification window"))
97
+ assert ratio.value == 3 and ratio.target.kind == "region"
98
+ assert ratio.quantity == "translation_efficiency" and ratio.origin == "derived"
99
+ with pytest.raises(ValueError, match="gene or transcript"):
100
+ ScopedTarget.from_pyensembl(object(), kind="region", namespace="test")
101
+ with pytest.raises(ValueError, match="canonical genes or independently supported ORFs"):
102
+ OrthologyMapping("regions", rna.target,
103
+ replace(rna.target, reference=experiment[0].references[0]),
104
+ experiment[0].sources[0], "test", "one_to_one", {"score": 1}, {"source": "synthetic"})
@@ -1 +0,0 @@
1
- __version__ = "0.13.0"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes