seashell-cli 0.1.1__tar.gz → 0.1.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: seashell-cli
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Seashell — Genomic data, compressed and queryable
5
5
  License: Proprietary
6
6
  Project-URL: Homepage, https://seashell.bio
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "seashell-cli"
7
- version = "0.1.1"
7
+ version = "0.1.2"
8
8
  description = "Seashell — Genomic data, compressed and queryable"
9
9
  readme = "README.md"
10
10
  license = {text = "Proprietary"}
@@ -0,0 +1 @@
1
+ __version__ = "0.1.2"
@@ -172,13 +172,53 @@ def _print_variants(result, action, latency):
172
172
 
173
173
 
174
174
  def _print_diff(result, latency):
175
- print("\n %s vs %s" % (result.get("patient_a", "?"), result.get("patient_b", "?")))
176
- print(" Only in A: %s variants" % result.get("only_in_a", "?"))
177
- print(" Only in B: %s variants" % result.get("only_in_b", "?"))
178
- print(" Shared: %s variants" % result.get("shared", "?"))
175
+ a = result.get("patient_a", "?")
176
+ b = result.get("patient_b", "?")
177
+ shared_count = result.get("shared_count", 0)
178
+ unique_a_count = result.get("unique_to_a_count", 0)
179
+ unique_b_count = result.get("unique_to_b_count", 0)
180
+ truncated = result.get("truncated", False)
181
+
182
+ print("\n %s vs %s" % (a, b))
183
+ print(" %s %12s variants" % ("Only in " + a + ":", "{:,}".format(unique_a_count)))
184
+ print(" %s %12s variants" % ("Only in " + b + ":", "{:,}".format(unique_b_count)))
185
+ print(" %s %12s variants" % ("Shared:" + " " * (len(a) + len(b) - 1), "{:,}".format(shared_count)))
186
+
187
+ # Show a sample of shared variants if any
188
+ shared_sample = result.get("shared", [])
189
+ if shared_sample:
190
+ shown = len(shared_sample)
191
+ label = "first %d" % shown if truncated else "all %d" % shown
192
+ print("\n Shared variants (%s):" % label)
193
+ header = " %-8s %12s %-6s %-6s" % ("CHROM", "POS", "REF", "ALT")
194
+ has_gene = any("gene" in r for r in shared_sample)
195
+ if has_gene:
196
+ header += " %-12s" % "GENE"
197
+ print(header)
198
+ print(" %s" % ("-" * (len(header) - 2)))
199
+ for r in shared_sample[:25]: # show at most 25 in table
200
+ line = " %-8s %12s %-6s %-6s" % (
201
+ r.get("chrom", ""), r.get("pos", 0),
202
+ _truncate(r.get("ref", ""), 6),
203
+ _truncate(r.get("alt", ""), 6))
204
+ if has_gene:
205
+ line += " %-12s" % r.get("gene", "")
206
+ print(line)
207
+ if shown > 25:
208
+ print(" ... (%d more not shown)" % (shown - 25))
209
+
179
210
  print("\n %s ms" % latency)
180
211
 
181
212
 
213
+ def _truncate(s, n):
214
+ """Truncate a string to n chars with ellipsis."""
215
+ if not isinstance(s, str):
216
+ return str(s)
217
+ if len(s) <= n:
218
+ return s
219
+ return s[:n - 1] + "…"
220
+
221
+
182
222
  def _print_pca(result, latency):
183
223
  components = result.get("components", [])
184
224
  print("\n PCA (%s components, %s patients)\n" % (
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: seashell-cli
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Seashell — Genomic data, compressed and queryable
5
5
  License: Proprietary
6
6
  Project-URL: Homepage, https://seashell.bio
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = seashell-cli
3
- version = 0.1.1
3
+ version = 0.1.2
4
4
  description = Seashell — Genomic data, compressed and queryable
5
5
  long_description = file: README.md
6
6
  long_description_content_type = text/markdown
@@ -1 +0,0 @@
1
- __version__ = "0.1.1"
File without changes