# New Python features; print\_schema and show\_globals removed

**URL:** <https://discuss.hail.is/t/new-python-features-print-schema-and-show-globals-removed/109>\
**Category:** Updates\
**Created:** [January 28, 2017, 4:58pm UTC](https://discuss.hail.is/t/new-python-features-print-schema-and-show-globals-removed/109 "2017-01-28T16:58:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hail-team](https://avatars.discourse-cdn.com/v4/letter/h/ad7895/32.png) [@hail-team](https://discuss.hail.is/u/hail-team)\
**Post date:** [January 28, 2017, 4:58pm UTC](https://discuss.hail.is/t/new-python-features-print-schema-and-show-globals-removed/109/1 "2017-01-28T16:58:35Z")

</div>

# Lots of changes

Time to start rewriting your pipelines! We’ve rolled out a big set of changes to the Hail Python API which make it much more user-friendly and powerful. We have built a connector that translates annotations to Python, which you’ll see used in the examples in this post. We also now have first-class Python objects for genetics concepts like Variant, Genotype, and Interval. We’ll be building out new features using these constructs in the coming weeks.

### No more print\_schema

This was a useful function! But what’s even more useful? Being able to print and manipulate the schemata directly:

```auto
>>> vds = vds.split_multi().sample_qc().variant_qc()

>>> print(vds.sample_schema)
>>> print(vds.variant_schema)

```

### No more annotate\_global\_expr\_by\_\* methods: use query\_variants and query\_samples

This functionality has been replaced by a much more useable interface. We’ve added two commands, [`query_samples`](https://hail.is/hail/hail.VariantDataset.html#hail.VariantDataset.query_samples) and [`query_variants`](https://hail.is/hail/hail.VariantDataset.html#hail.VariantDataset.query_variants) that let you aggregate on samples and variants and see those results without going through the awkward intermediate of global annotations.

Here are some toy examples:

```auto
>>> vds = vds.split_multi().sample_qc().variant_qc()

>>> low_callrate_variants = vds.query_variants(
>>> 'variants.filter(v => va.qc.callRate < 0.90).collect()')[0]

>>> print(low_callrate_variants[:3])
[Variant(22, 16050036, A, [AltAllele(A, C)]), 
  Variant(22, 16050115, G, [AltAllele(G, A)]), 
  Variant(22, 16050159, C, [AltAllele(C, T)])]

```

These results are returned as directly manipulable Python objects. Did you actually want to have them in global annotations to use later, though? We can do that too with the new method [`annotate_global_py`](https://hail.is/hail/hail.VariantDataset.html#hail.VariantDataset.annotate_global_py).

```auto
>>> from hail.type import *
>>> vds = vds.annotate_global_py(
>>> 'global.badVariants', 
>>> low_callrate_variants, 
>>> TArray(TVariant()))

```

### No more show\_globals: use .globals instead

We don’t have show\_globals anymore, but we _can_ easily get the values back out:

```auto
>>> vds.globals.badVariants

```

```auto
>>> vds.globals.badVariants == low_callrate_variants
True

```

Some of the `VariantDataset` methods have become attributes. See the API in our [Python docs](https://hail.is/hail/hail.VariantDataset.html). Notice that you can also get out a Python dict of sample annotations with `vds.sample_annotations`!

### Be ready for a complete removal of the command line module in the next few days! As always, feel free to stop by to chat on Gitter if you have questions!
