new
improved
fixed
Client Library
onecodex library v1.0.0
This release contains breaking changes to plotting and classification results functions such as how
SampleCollection
is instantiated and how metric
, diversity_metric
, and rank
are passed to SampleCollection.to_df
and plotting functions.Previously,
metric
and normalize
were determined when a SampleCollection
was instantiated. Now, those parameters are passed to .to_df
and plotting functions separately, allowing users to change metrics at plot time.Example:
##
# in 0.19.x
collection = onecodex.models.SampleCollection(samples, metric='readcount_w_children', normalize=True)
# produce a dataframe using readcount_w_children as the metric
collection.to_df()
# to plot a different metric, create a new SampleCollection
collection = onecodex.models.SampleCollection(samples, metric='abundance_w_children')
collection.plot_bargraph()
##
# in 1.0.0
collection = onecodex.models.SampleCollection(samples)
collection.to_df(metric='normalized_readcount_w_children')
# switch metrics without re-instantiating
collection.plot_bargraph(metric='abundance_w_children')
# for backwards compatibility, the following still works but prints a warning
collection = onecodex.models.SampleCollection(samples, metric='readcount_w_children')
# defaults to the metric provided when the collection was created
collection.to_df()
Added
- metricis now an argument for all plot and stats functions. By default, it isauto, which is determined bySampleCollection.automatic_metricbased on existing logic
- SampleCollection.__repr__has been updated to differentiate it from lists:<SampleCollection[Samples] length=60 : [<Samples 0b2d0b5397324841: "SRR4408293.fastq">, ...
- Added type annotations to onecodex.Api()so that models are now known to static analyzers (e.g.,ocx.Samples)
- SampleCollection.automatic_ranknow returns the best defaultonecodex.enums.Rankto use based on the contained results
- SampleCollection.automatic_metricnow returns the bestonecodex.enums.Metricvalue to use based on the contained results
Changed
- You can change plotting metrics without re-instantiating the SampleCollection
- In alpha- and beta-diversity related functions (e.g., plot_mds), the argument metric was changed to eitherdiversity_metricordistance_metric. Themetricargument in those functions now corresponds to the abundance metric (seeonecodex.enums.Metric)
- onecodex.notebooks.reportfunctions no longer raise aOneCodexExceptionif used outside of IPython.
Removed
- ClassificationDataframe.ocxhas been removed
- SampleCollection()no longer takesmetricornormalizearguments. Those have been merged into a singlemetric=argument that takes a string oronecodex.enums.Metricenum value, which is now passed into dataframe and plotting functions directly
- normalizehas been removed. Normalized metrics are now available as individualMetricenum values
- Removed test-python3-w-simple-jsonfrom CI. It randomly started breaking. We don't think we need it anymore since we've moved away from Potion
Fixed
- readcountbeing used instead of the intended metric when clustering samples for PCA/Heatmap when plotting from aSampleCollection
- Plot title and table export column names have been updated to be more specific and match custom plots