- Added optional support for the Numba backend #2483, with Permanova and Mantel currently using it #2488and #2464.
- Introduced transition probability matrix computation (#2496).
- Added inverse robust center log ratio (
rclr_inv) transformation (#2527). TreeNode.pruneandTreeNode.bifurcatenow accept aninplaceparameter (defaultTrue, preserving the previous in-place behavior) and return the resulting tree. This makes them consistent with other whole-tree methods such asshearandroot_at_midpoint. Setinplace=Falseto leave the original tree unchanged and operate on a copy (#2495).
- When using the Numba backend, Permanova is up to 8x faster #2488.
- Improved
TreeNode.copysuch that it can handle node cross-references correctly: If a node attribute refers to another node in the tree, the copied node attribute will be redirected to the corresponding node in the new tree (#2497).
- Fixed a subtle floating-point arithmetic issue in
pair_alignunder a linear gap penalty. Previously it could be less tolerant than expected whenatolwas set smaller than the default (1e-5) and scores involved decimal numbers (#2513). - Fixed a bug in
pair_alignwhich raised aTypeErrorwhen called withatol=None. This should be equivalent toatol=0(#2504). - Patched
rclrsuch that it won't raise a zero division warning (#2526).
- Implemented a global mechanism to document, dispatch and test functions supporting the Python array API standard. The documentation pages of those functions now display a support grid of five array libraries (NumPy, CuPy, PyTorch, JAX and Dask) by two devices (CPU and GPU). An example is
clr. A new developer documentation page (https://scikit.bio/devdoc/array_api.html) was added to introduce this mechanism (#2412 and #2459). - Added
mmvec(Microbe-Metabolite Vectors) toskbio.stats.ordinationfor learning joint embeddings of two feature sets from co-occurrence patterns. Supports L-BFGS and Adam optimizers, cross-validation via Q-squared scores, and prediction of one modality from another (#2360). Interface modernized and computational performance significantly enhanced (#2448). - Added gamma correction support for modeling among-site evolutionary rate heterogeneity in the JC69, F81, K2P, and TN93 models (#2460). Thank @keder for this contribution.
- Added robust center log ratio (
rclr) transformation for performing CLR-like transformation on only observed (non-zero) values, making it suitable for sparse compositional data (#2386). - Added support to
TreeNode.from_taxonomyfor parsing taxonomic lineage strings into trees with an optionalextract_rankparameter (#2406). Thank @r0hansaxena for this and other contributions to this release.
- Reduced
import skbiotime by ~37% by makingrequestsandh5pylazy imports (#2427). Thank @MAUK9086 for contributing this. - Significantly accelerated
gme,bmeandnniof theskbio.treemodule. Of which,bmereceived the most rigorous optimization. Parallelization is now enabled by default for this function (#2404).
- Fixed
nni's parsing of tree with single-child root node by explicitly raising in this situation (#2446). - Fixed
permdispmutating the inputOrdinationResultsobject by adding a"grouping"column to itssamplesDataFrame (#2440). - Fixed
permdispemitting pcoa'sRuntimeWarningon every call with a distance matrix larger than 10 samples (#2456). Thank @jissen706 for this fix and the one below. - Fixed the GenBank/EMBL/GFF3 feature-location parser to accept single-base locations with a fuzzy boundary (e.g.
complement(<23231)as found in the NCBI lambda virus record J02459.1). Previously such locations raisedFileFormatError: Could not parse location string. The corresponding serializer was updated symmetrically to emit<N/>Ninstead of dropping the fuzzy marker (#2473).
- Replaced SciPy sparse matrix constructors with sparse array constructors to align with SciPy's sparse array APIs. This affects
subsample_counts(csr_array) (no public-facing effect) andtree_basis(coo_array) (#2444). - Added a general
_reader_kwargsmechanism for documenting class-specific parameters in auto-generatedread()docstrings. Applied toTabularMSAto document the requiredconstructorparameter (#2421). Thank @LiudengZhang for this addition. beta_diversitynow emits aUserWarningwhenunweighted_unifracorweighted_unifracare passed as a callable, advising users to pass the metric name as a string for the optimized implementation (#2462). Thank @SAY-5 for this patch.- Improved documentation for
pip-based contribution instructions (#2433). Thank @AhmedKhairy22 for this and other contributions.
- Added multiple metrics for calculating the evolutionary distances between aligned sequences: generic:
pdist,logdet,paralin,jc69,f81,k2p,f84,tn93. They are hosted by the submoduleskbio.sequence.distance. Also addedalign_dists, which consumes a multiple sequence alignment and generates a distance matrix using choice of metrics (#2336). mantelandpermanovacan now run directly on condensed formDistanceMatrixobjects (#2322, #2335).- Added new
phylip_dmformat for PHYLIP formatted distance matrices (#2345 and #2352). - Added support for reading relaxed PHYLIP formatted multiple sequence alignments (#2345, #2352, and #2361).
- Added new plotting functionality for
OrdinationResultsobjects, including plotting centroids, confidence ellipses, and 2D plots (#2362)
- Improved
TreeNode.from_linkage_matrix, including efficiency, compatibility (it now accepts array-like objects), and documentation (#2356). - Updated the documentation of
dirmult_ttestto recommend input data supplied as raw counts rather than pre-normalized proportions, as the latter lose magnitude information and can lead to higher statistical uncertainty (#2358).
- Fixed an IO issue in
skbio.Table.writewhere tables containing metadata could not be written (#2338). - Fixed an issue in the
from_iterablemethods of theDistanceMatrix,SymmetricMatrix, andPairwiseMatrixclasses where diagonals were being filled with garbage values (#2347). - Fixed a bug in
TreeNode.root_at_midpointwhich could fail on a tree with no-length branches (#2353). - Fixed an unexpected behavior in several
TreeNodemethods, where tips with.name is Nonewere considered as taxa and included in the calculation. Nameless tips are unusual but not forbidden by the current data model. After fixation, those tips are excluded from the calculation. Affected methods aresubset,subsets,bipart,bipartandcophenet(#2353). - Fixed an integer overflow issue in
_nodes_by_countsthat can occur on 32-bit systems, such as WASM ([#2369]#2369).
- scikit-bio can now be cited by its journal publication in Nature Methods.
TreeNode.shearnow returns the sheared tree even ifinplace=True(#2353).- Added compatibility for pandas 3.0. Most functionality works, but the
INSDC:missingscheme for encoding missing values is not yet supported with pandas 3.0. See issue #2375 for tracking (#2371). - Documentation was improved for the
default_write_formatattributes of supported file types (#2340) - Improved documentation for parallelization techniques across the package (#2343)
- Removed
sokalmichenerfrom the list of supported beta diversity metrics (seeget_beta_diversity_metrics), as this metric was removed in SciPy 1.17.0. SciPy's documentation recommended usingrogerstanimotoinstead (#2367).
- Added support for building scikit-bio python wheels natively on Windows ARM64 (#2309).
- Fixed source distribution packaging for Python 3.14 support.
- Added function
ancombc, a Python implementation of the ANCOM-BC (analysis of compositions of microbiomes with bias correction) method for differential abundance testing. We thank @FrederickHuangLin for advice (#2293, #2305, #2306, #2316). - Added function
struc_zero, a statistical test for structural zeros. This function complementsancombcor can be used alone (#2305). - Enabled inheritance of IO methods (read, write, sniff) on all scikit-bio objects. Subclasses now inherit IO operations, significantly improving custom class creation and extensibility (#2301).
- Added new
PairwiseMatrixandSymmetricMatrixclasses and an updatedDistanceMatrixclass. Underlying data ofSymmetricMatrixandDistanceMatrixclasses can now be stored in condensed form, reducing memory footprint by 50% (#2289).
- Drastically speed up
pcoawith the default eigh method (#2285). - Enriched documentation of
permanova, explaining the underlying mathematics, the usage, and how to calculate R2, a statistic that measures the proportion of data variance explained by the specified variable (#2294, #2294). - Added float32 support for minimum evolution phylogenetic tree building algorithms (
gme,bmeandnni) (#2291). - Added float32 support for reading labeled square matrix (lsmat) file format (
io.format.lsmat) (#2230).
- Fixed an unexpected behavior in the file I/O of
TabularMSAclass thatfastaandfastqformats populate.metadata['id']of each sequence whereasclustal,phylipandstockholmformats populate.indexof the entire alignments. Now all file formats populate both pieces of information (#2320). - Fixed a bug that
pair_alignwithtrim_ends=Trueon completely misaligned sequences would raise an IndexError instead of returning an empty path (#2284). - Fixed IO format
binary_dmimplementation (#2282, #2283). - Fixed a bug in reading binary dissimilarity matrix format (
io.format.binary_dm), that a float32 data file would be unnecessarily casted into float64 (#2230). - Replace "Correspondance Analysis" with "Correspondence Analysis" in creating
OrdinationResultsobjects for the accuracy of terminology. This term has been "Correspondence Analysis" otherwise in the project. - Fixed a runtime error when computing phylogenetic diversity metrics on 32-bit architectures (#2321).
- Renamed
DissimilarityMatrixasPairwiseMatrixto better reflect its nature. The old name is kept as an alias (#2289). - Replace "Correspondance Analysis" with "Correspondence Analysis" in creating
OrdinationResultsobjects for the accuracy of terminology. This term has been "Correspondence Analysis" otherwise in the project (#2318). - Added environment variable
DISABLE_OPENMP, which lets a user optionally disable OpenMP when compiling the Cython code if needed (#2319). - Dropped support for Python 3.9 and added support for Python 3.14 (#2311).
- Dropped support for NumPy versions older than 2.0 (#2314).
- Added a development roadmap for scikit-bio to the website (#2251).
- Added function
dirmult_lme, a differential abundance test for longitudinal data through fitting a Dirichlet-multinomial linear mixed effects model (#2080 and #2250). - Added function
pair_align, a re-designed pairwise sequence alignment engine that is versatile, efficient, and generalizable (#2226 and #2196). It is meant to replace the old slow Python engine and the SSW wrapper. It supports:- Global, local and semi-global alignments (with all four ends customizable).
- Nucleotide, protein, and un-grammared sequences, plain strings (ASCII and Unicode), words/tokens, and numbers.
- Match/mismatch scores or substitution matrix.
- Linear and affine gap penalties.
- Integer, decimal and infinite scores.
- Returning one, multiple or all optimal alignment paths.
- Added wrapper functions
pair_align_protandpair_align_nuclwhich are preloaded with scoring schemes consistent with BLASTP and BLASTN, respectively (#2234). - Added function
align_scoreto calculate the score of a pairwise or multiple sequence alignment (#2201, #2192). - Implemented a dispatch system in scikit-bio to handle a variety of table formats. Currently, it handles arrays, Pandas and Polars dataframes, BIOM tables, and AnnData. Scikit-bio functions can now operate on any of these table formats and outputs an object of the same format, or a format designated by the user (#2187, #2203, #2246, #2258, #2260).
- Added four augmentation methods:
phylomix,compos_cutmix,aitchison_mixupandmixupto enable generation of synthetic samples (#2214, #2190, #2253). - Added support for scikit-bio-binaries, a separate package which currently increases performance of the
pcoaandpermanovafunctions within scikit-bio (#2247). - Added pre-built wheels of scikit-bio to PyPI for easier installation across platforms (#2233, #2232, #2228, #2252).
- Adopting the Python array API standard in scikit-bio to enable GPU support for select functions. Further expansion of GPU support within scikit-bio is expected (#2239 and #2250).
- Added
AlignPath.to_alignedandAlignPath.from_alignedto extract aligned regions of the original sequences, and to reconstruct a path from aligned sequences (#2226). - Added parameter
startstoAlignPath.from_tabularto specify starting positions in the original sequences (#2226).
- Enriched the tutorials of modules
sequence,alignment, andtable(#2263). - Improved the performance of
dirmult_ttest(#2250). - Improved the performance of
ancom. This is primarily due to exploiting vectorization of the statistical testing function (such asf_oneway). As a consequence, a custom testing function now must accept 2-D arrays as input and return 1-D arrays. Function names available underscipy.statsare not impacted (#2250). - Added attributes
rangesandstopstoAlignPath. They facilitate locating the aligned part of each sequence asseq[start:stop](#2226 and #2201). - Improved the performance of
SubstitutionMatrix.identity. - Enhanced
TabularMSA.from_path_seqs. It now can extract the aligned region from the middle of a sequence. Also added docstring and doctests (#2201). - Enhanced and changed the default behavior of
AlignPath.to_bits, which now returns a bit array representing positions instead of segments. This is desired because with the old default behavior,to_bitsandfrom_bitsare not consistent with each other (#2201).
- Fixed a bug that
PairAlignPath.from_cigarwould ignore the first insertion (I) of a CIGAR string (#2236). - Fixed an inaccurate statement that one can specify
gapas np.inf or np.nan inAlignPath.to_indices. These cases are impossible because the output is integer type. - Fixed an inaccurate statement in the documentation of
SubstitutionMatrix.is_ascii. This attribute is True when all characters in the alphabet are ASCII codes (0 to 127), not extended ASCII codes (0 to 255) (#2226). - Fixed a bug that a
SubstitutionMatrixcannot be copied (#2226). - Fixed a bug in
AlignPath.to_indiceswhich would throw an error if the alignment path has only one segment (#2201). - Fixed a bug in the documentation in which the
sourcebutton would link to decorator code, instead of the relevant function (#2184).
- In
TreeNode.root_atandTreeNode.root_at_midpoint, the default value ofbranch_attrswas changed to an empty list; that ofroot_namewas changed to None; that ofresetwas changed to True (#2259). - In
TreeNode.unrooted_copy, the default value ofbranch_attrswas changed to{"length", "support"}. Specifically, "name" was removed from this set, as a node label is often an attribute of the node instead of the branch. The default value ofroot_namewas changed to None (#2259). - In
TreeNode.copy, the default value ofdeepwas set to False. Nowtree.copy()returns a shallow copy instead of a deep copy (#2259). - In
TreeNode.compare_cophenet, the default value ofignore_selfwas set to True. Therefore the estimated cophenetic distance between trees better correlates with their discrepancy (#2259). - Renamed column "Reject null hypothesis" as "Signif" in
ancomanddirmult_ttest's report tables for conciseness (#2250). - Renamed the parameter
significance_testassig_testinancomfor conciseness. The old name is preserved as an alias (#2250). - Set the default data type of
SubstitutionMatrixasnp.float32(previous it wasfloat, which is equivalent tonp.float64). Madedtypean optional parameter infrom_dictandidentitymethods. - Adjusted the
__repr__ofAlignPathandPairAlignPath(#2226 and #2235). - Changed
AlignPath.shape's type from a named tuple to a normal tuple (#2235). Let the values be native Pythonintrather thannp.int64(#2201). - Changed
AlignPath.lengthsandAlignPath.starts's dtype fromint64tointp, as these attributes are to facilitate indexing (#2226). - Changed
Sequence.to_indices's output index array dtype fromuint8tointp, which is the native NumPy indexing type (#2226). - Enriched the documentation of
SubstitutionMatrix(#2226). - Let
AlignPath.statesbe uniformly 2-D, even if there are 8 or less sequences in the alignment (#2201). - Updated documentation to include description of how to stream data through stdin with scikit-bio's
readfunction (#2185). - Improved documentation for the
DistanceMatrixobject (#2204). - Remove autoplotting functionality to enable inplace operations on large in-memory objects, and improve documentation of existing plotting methods (#2216, #2223).
- Initiated efforts to add type annotations to scikit-bio's codebase, starting with the
stats.distancemodule (#2219) - Restored functionality to scikit-bio's benchmarking system and introduced a new repository for storing, running, and hosting benchmarks to prevent performance regression (#2245).
- Renamed the parameter
number_of_dimensionstodimensionsfor thepcoaandpermdispfunctions.number_of_dimensionswill remain a valid alias of the parameter, such that either option may be used. (#2257). - Enriched the tutorial for
skbio.Sequence(#2243). - The
tree.njfunction can now operate onDistanceMatrixobjects containing float32 or float64 values (#2217). - Improved documentation for conversion between scikit-bio sequence alignments and Biopython and Biotite alignments (#2229, #2230).
- Rewrote the
installpage for the website to reflect availability of wheels and to explicitly state scikit-bio's version support windows (#2254). - Renamed the parameter
distance_matrixtodistmatinpcoa,bioenv,anosim,permanova, andpermdisp.distance_matrixwill remain a valid alias of the parameter, such that either option may be used. (#2261)
- Removed
TreeNode.unrooted_deepcopy. UseTreeNode.unrooted_copy(deep=True)instead (#2259). - Removed
TreeNode.deepcopy. UseTreeNode.copy(deep=True)instead (#2259). - Removed
TreeNode.subtree. It was a placehold but never implemented (#2259). - Removed the wrapper for the Striped Smith Waterman (SSW) library (#2240, #2241). Specifically, this removes
local_pairwise_align_ssw,StripedSmithWaterman, andAlignmentStructureunderskbio.alignment. We recommend using the newskbio.alignment.pair_alignfunction for pairwise sequence alignment, or other packages that provide production-ready alignment algorithms. See #1814 for discussions. - Removed
skbio.alignment.make_identity_substitution_matrix. This has been replaced withskbio.sequence.SubstitutionMatrix.identity.
- Python 3.13+ is now supported (#2146).
- Added Balanced Minimum Evolution (BME) function for phylogenetic reconstruction and
balancedoption for NNI (#2105 and #2169). - Added functions
rf_dists,wrf_distsandpath_distsunderskbio.treeto calculate multiple pariwise distance metrics among an arbitrary number of trees. They correspond toTreeNodemethodscompare_rfd,compare_wrfdandcompare_cophenetfor two trees (#2166). - Added
heightanddepthmethods underTreeNodeto calculate the height and depth of a given node. - Added
TreeNode.compare_wrfdto calculate the weighted Robinson-Foulds distance or its variants between two trees (#2144). - Wrapped UPGMA and WPGMA from SciPy's linkage method (#2094).
- Added
TreeNodemethods:bipart,bipartsandcompare_bipartsto encode and compare bipartitions in a tree (#2144). - Added
TreeNode.has_cachesto check if a tree has caches (#2103). - Added
TreeNode.is_bifurcatingto check if a tree is bifurcating (i.e., binary) (#2117). - Added support for Python's
pathlibmodule in the IO system (#2119). - Added
TreeNode.pathto return a list of nodes representing the path from one node to another (#2131). - Exposed
vectorize_counts_and_treefunction from thediversitymodule to allow use for improving ML accuracy in downstream pipelines (#2173)
- Significantly improved the performance of the neighbor joining (NJ) algorithm (
nj) (#2147) and the greedy minimum evolution (GME) algorithm (gme) for phylogenetic reconstruction, and the NNI algorithm for tree rearrangement (#2169). - Significantly improved the performance of
TreeNode.cophenet(renamed fromtip_tip_distances) for computing a patristic distance matrix among all or selected tips of a tree (#2152). - Supported Robinson-Foulds distance calculation (
TreeNode.compare_rfd) based on bipartitions (equivalent tocompare_biparts). This is automatically enabled when the input tree is unrooted. Otherwise the calculation is still based on subsets (equivalent tocompare_subsets). The user can override this behavior using therootedparameter (#2144). - Re-wrote the underlying algorithm of
TreeNode.compare_subsetsbecause it is equivalent to the Robinson-Foulds distance on rooted trees. Added parameterproportion. Renamed parameterexclude_absent_taxaasshared_only(#2144). - Added parameter
include_selftoTreeNode.subset. Added parameterswithin,include_fullandinclude_tipstoTreeNode.subsets(#2144). - Improved the performance and customizability of
TreeNode.total_length(renamed fromdescending_branch_length). Added parametersinclude_stemandinclude_self. - Improved the performance of
TreeNode.lca(#2132). - Improved the performance of
TreeNodemethods:ancestors,siblings, andneighbors(#2133, #2135). - Improved the performance of tree traversal algorithms (#2093).
- Improved the performance of tree copying (#2103).
- Further improved the caching mechanism of
TreeNode. Specifically: 1. Node attribute caches are only registered at the root node, which improves memory efficiency. 2. Methodclear_cachescan be customized to clear node attribute and/or lookup caches, or specified attribute caches (#2099). 3. Added parameteruncacheto multiple methods that involves tree manipulation. Default is True. When one knows that caches are not present or relevant, one may set this parameter as False to skip cache clearing to significantly improve performance (#2103). - Expanded the functionality of
TreeNode.cache_attr. It can now take a custom function to combine children and self attributes. This makes it possible to cache multiple useful clade properties such as node count and total branch length. Also enriched the method's docstring to provide multiple examples of caching clade properties (#2099). - Added parameter
inplaceto methodsshear,root_at,root_at_midpointandroot_by_outgroupofTreeNodeto enable manipulating the tree in place (True), which is more efficient that making a manipulated copy of the tree (False, default) (#2103). TreeNode.extendcan accept any iterable type of nodes as input (#2103).- Added parameter
stricttoTreeNode.shear(#2103). - Added parameter
exclude_attrstoTreeNode.unrooted_copy(#2103). - Added support for legacy random generator to
get_rng, such that outputs of scikit-bio functions become reproducible with code that starts withnp.random.seedor usesRandomState(#2130). - Allowed
shuffleandcompare_cophenet(renamed fromcompare_tip_distances) ofTreeNodeto accept a random seed or random generator to generate the shuffling function, which ensures output reproducibility (#2118). - Replaced
accumulate_to_ancestorwithdepthunderTreeNode. The latter has expanded functionality which covers the default behavior of the former. - Added beta diversity metric
jensenshannon, which calculates Jensen-Shannon distance. Thank @quliping for suggesting this in #2125. - Added parameter
include_selftoTreeNode.ancestorsto optionally include the initial node in the path (default: False) (#2135). - Added parameter
seedto functionspcoa,anosim,permanova,permdisp,randdm,lladser_pe,lladser_ci,isubsample,subsample_power,subsample_paired_power,paired_subsamplesandhommola_cospeciationto accept a random seed or random generator to ensure output reproducibility (#2120 and #2129). - Made the
IORegistrysniffer only attempt file formats which are logical given a specific object, thus improving reading efficiency. - Allowed the
number_of_dimensionsparameter in the functionpcoato accept float values between 0 and 1 to capture fractional cumulative variance.
- Fixed a bug in
TreeNode.findwhich returns the input node object even if it's not in the current tree (#2153). - Fixed a bug in
TreeNode.get_max_distancewhich returns tip names instead of tip instances when there are single-child nodes in the tree (#2144). - Fixed an issue in
subsetsandcophenet(renamed fromtip_tip_distances) ofTreeNodewhich leaves remnant attributes at each node after execution (#2144). - Fixed a bug in
TreeNode.compare_rfdwhich raises an error if taxa of the two trees are not subsets of each other (#2144). - Fixed a bug in
TreeNode.compare_subsetswhich includes the full set (not a subset) of shared taxa between two trees if a basal clade of either tree consists of entirely unshared taxa (#2144). - Fixed a bug in
TreeNode.lcawhich returns the parent of input node X instead of X itself if X is ancestral to other input nodes (#2132). - Fixed a bug in
TreeNode.find_allwhich does not look for other nodes with the same name if aTreeNodeinstance is provided, as in contrast to what the documentation claims (#2099). - Fixed a bug in
skbio.io.format.embedwhich was not correctly updating the idptr sizing. (#2100). - Fixed a bug in
TreeNode.unrooted_movewhich does not respect specified branch attributes (#2103). - Fixed a bug in
skbio.diversity.get_beta_diversity_metricswhich does not display metrics other than UniFrac (#2126). - Raises an error when beta diversity metric
mahalanobisis called but sample number is smaller than or equal to feature number in the data. Thank @quliping for noting this in #2125. - Fixed a bug in
io.format.fastathat improperly handled sequences containing spaces. (#2156)
- Added a parameter
warn_neg_eigvaltopcoaandpermdispto control when to raise a warning when negative eigenvalues are encountered. The default setting is more relaxed than the previous behavior, therefore warnings will not be raised when the negative eigenvalues are small in magnitude, which is the case in many real-world scenarios #2154. - Refactored
dirmult_ttestto use a separate function for fitting data to Dirichlet-multinomial distribution (#2113) - Remodeled documentation. Special methods (previously referred to as built-in methods) and inherited methods of a class no longer have separate stub pages. This significantly reduced the total number of webpages in the documentation (#2110).
- Renamed
invalidate_cachesasclear_cachesunderTreeNode, because the caches are indeed deleted rather than marked as obsolete. The old name is preserved as an alias (#2099). - Renamed
remove_deletedasremove_by_funcunderTreeNode. The old name is preserved as an alias (#2103). - Renamed
descending_branch_lengthastotal_lengthunderTreeNode. The old name is preserved as an alias. - Under
TreeNode, renamedget_max_distanceasmaxdist. Renamedtip_tip_distancesascophenet. Renamedcompare_tip_distancesascompare_cophenet. The new names are consistent with SciPy's relevant functions and the main body of the literature. The old names are preserved as aliases.
- Method
TreeNode.subtreeis deprecated. It will become a private member in version 0.7.0 (#2103).
- Dropped support for Python 3.8 as it has reached end-of-life (EOL). scikit-bio may still be installed under Python 3.8 and will likely work, but the development team no longer guarantee that all functionality will work as intended.
- Removed
skbio.util.SkbioWarning. Now there are no specific warnings to scikit-bio. - Removed
skbio.util.EfficiencyWarning. Previously it was only used in the Python implementations of pairwise sequence alignment algorithms. The new code replaced it withPendingDeprecationWarning. - Removed
skbio.util.RepresentationWarning. Previously it was only used inTreeNode.tip_tip_distanceswhen a node has no branch length. The new code removed this behavior (#2152).
- Added Greedy Minimum Evolution (GME) function for phylogenetic reconstruction (#2087).
- Added support for Microsoft Windows operating system. (#2071, #2068, #2067, #2061, #2046, #2040, #2036, #2034, #2032, #2005)
- Added alpha diversity metrics: Hill number (
hill), Renyi entropy (renyi) and Tsallis entropy (tsallis) (#2074). - Added
renamemethod forOrdinationResultsandDissimilarityMatrixclasses (#2027, #2085). - Added
nnifunction for phylogenetic tree rearrangement using nearest neighbor interchange (NNI) (#2050). - Added method
TreeNode.unrooted_move, which resemblesTreeNode.unrooted_copybut rearranges the tree in place, thus avoid making copies of the nodes (#2073). - Added method
TreeNode.root_by_outgroup, which reroots a tree according to a given outgroup (#2073). - Added method
TreeNode.unroot, which converts a rooted tree into unrooted by trifucating its root (#2073). - Added method
TreeNode.insert, which inserts a node into the branch connecting self and its parent (#2073).
- The time and memory efficiency of
TreeNodehas been significantly improved by making its caching mechanism lazy (#2082). Treenode.copyandTreeNode.unrooted_copycan now perform shallow copy of a tree in addition to deep copy.TreeNode.unrooted_copycan now copy all attributes of the nodes, in addition to name and length (#2073).- Paremter
abovewas added toTreeNode.root_at, such that the user can root the tree within the branch connecting the given node and its parent, thereby creating a rooted tree (#2073). - Parameter
branch_attrswas added to theunrooted_copy,root_at, androot_at_midpointmethods ofTreeNode, such that the user can customize which node attributes should be considered as branch attributes and treated accordingly during the rerooting operation. The default behavior is preserved but is subject ot change in version 0.7.0 (#2073). - Parameter
root_namewas added to theunrooted_copy,root_at, androot_at_midpointmethods ofTreeNode, such that the user can customize (or omit) the name to be given to the root node. The default behavior is preserved but is subject ot change in version 0.7.0 (#2073).
- Cleared the internal node references after performing midpoint rooting (
TreeNode.root_at_midpoint), such that a deep copy of the resulting tree will not result in infinite recursion (#2073). - Fixed the Zenodo link in the README to always point to the most recent version (#2078).
- Added statsmodels as a dependency of scikit-bio. It replaces some of the from-scratch statistical analyses in scikit-bio, including Welch's t-test (with confidence intervals), Benjamini-Hochberg FDR correction, and Holm-Bonferroni FDR correction (#2049, (#2063)).
- Methods
deepcopyandunrooted_deepcopyofTreenodeare deprecated. Usecopyandunrooted_copyinstead.
- NumPy 2.0 is now supported (#2051). We thank @rgommers 's advice on this (#1964).
- Added module
skbio.embeddingto provide support for storing and manipulating embeddings for biological objects, such as protein embeddings outputted from protein language models (#2008). - Added an efficient sequence alignment path data structure
AlignPathand its derivativePairAlignPathto provide a uniform interface for various multiple and pariwise alignment formats (#2011). - Added
simpson_das an alias fordominance(Simpson's dominance index, a.k.a. Simpson's D) (#2024). - Added
inv_simpson(inverse Simpson index), which is equivalent toenspie(#2024). - Added parameter
exptoshannonto calculate the exponential of Shannon index (i.e., perplexity, or effective number of species) (#2024). - Added parameter
finiteto Simpson's D (dominance) and derived metrics (simpson,simpson_eandinv_simpson) to correct for finite samples (#2024). - Added support for dictionary and pandas DataFrame as input for
TreeNode.from_taxonomy(#2042).
subsample_countsnow uses an optimized method frombiom-format(#2016).- Improved efficiency of counts matrix and vector validation prior to calculating community diversity metrics (#2024).
- Default logarithm base of Shannon index (
shannon) was changed from 2 to e. This is to ensure consistency with other Shannon-based metrics (pielou_e), and with literature and implementations in the field. Meanwhile, parameterbasewas added topielou_esuch that the user can control this behavior (#2024). See discussions in 1884 and 2014. - Improved treatment of empty communities (i.e., all taxa have zero counts, or there is no taxon) when calculating alpha diversity metrics. Most metrics will return
np.nanand do not raise a warning due to zero division. Exceptions are metrics that describe observed counts, includngsobs,singles,doublesandosd, which return zero (#2024). See discussions in #2014. - Return values of
pielou_eandheip_ewere set to 1.0 for one-taxon communities, such that NaN is avoided, while honoring the definition (evenness of taxon abundance(s)) and the rationale (ratio between observed and maximum) (#2024). - Removed hdmedians as a dependency by porting its
geomedianfunction (geometric median) into scikit-bio (#2003). - Removed 98% warnings issued during the test process (#2045 and #2037).
- Launched the new scikit-bio website: https://scikit.bio. The previous domain names scikit-bio.org and skbio.org continue to work and redirect to the new website.
- Migrated the scikit-bio website repo from the
gh-pagesbranch of thescikit-biorepo to a standalone repo:scikit-bio.github.io. - Replaced the Bootstrap theme with the PyData theme for building documentation using Sphinx. Extended this theme to the website. Customized design elements (#1934).
- Improved the calculation of Fisher's alpha diversity index (
fisher_alpha). It is now compatible with optimizers in SciPy 1.11+. Edge cases such as all singletons can be handled correctly. Handling of errors and warnings was improved. Documentation was enriched (#1890). - Allowed
delimiter=Nonewhich represents whitespace of arbitrary length in reading lsmat format matrices (#1912).
- Added biom-format Table import and updated corresponding requirement files (#1907).
- Added biom-format 2.1.0 IO support (#1984).
- Added
Tablesupport toalpha_diversityandbeta_diversitydrivers (#1984). - Implemented a mechanism to automatically build documentation and/or homepage and deploy them to the website (#1934).
- Added the Benjamini-Hochberg method as an option for FDR correction (in addition to the existing Holm-Bonferroni method) for
ancomanddirmult_ttest(#1988). - Added function
dirmult_ttest, which performs differential abundance test using a Dirichilet multinomial distribution. This function mirrors the method provided by ALDEx2 (#1956). - Added method
Sequence.to_indicesto convert a sequence into a vector of indices of characters in an alphabet (can be from a substitution matrix) or unique characters observed in the sequence. Supports gap masking and wildcard substitution (#1917). - Added class
SubstitutionMatrixto support substitution matrices for nucleotides, amino acids are more general cases (#1913). - Added alpha diversity metric
sobs, which is the observed species richness (S_{obs}) of a sample.sobswill replaceobserved_otus, which uses the historical term "OTU". Also added metricobserved_featuresto be compatible with the QIIME 2 terminology. All three metrics are equivalent (#1902). beta_diversitynow supports use of Pandas aDataFrameindex, issue #1808.- Added alpha diversity metric
phydiv, which is a generalized phylogenetic diversity (PD) framework permitting unrooted or rooted tree, unweighted or weighted by abundance, and an exponent parameter of the weight term (#1893). - Adopted NumPy's new random generator
np.random.Generator(see NEP 19) (#1889). - SciPy 1.11+ is now supported (#1887).
- Removed IPython as a dependency. Scikit-bio continues to support displaying plots in IPython, but it no longer requires importing IPython functionality (#1901).
- Made Matplotlib an optional dependency. Scikit-bio no longer requires Matplotlib except for plotting, during which it attempts to import Matplotlib if it is present in the system, and raises an error if not (#1901).
- Ported the QIIME 2 metadata object into skbio. (#1929)
- Python 3.12+ is now supported, thank you @actapia (#1930)
- Introduced native character conversion ([#1971])(#1971)
- Beta diversity metric
kulsinskiwas removed. This was motivated by that SciPy replaced this distance metric withkulczynski1in version 1.11 (see SciPy issue #2009), and that both metrics do not return 0 on two identical vectors (#1887).
- Fixed documentation interface of
vlrand relevant functions (#1934). - Fixed broken link in documentation of Simpson's evenness index. See issue #1923.
- Safely handle
Sequence.iter_kmerswherekis greater than the sequence length (#1723) - Re-enabled OpenMP support, which has been mistakenly disabled in 0.5.8 (#1874)
permanovaandpermdistoperate on aDistanceMatrixand a grouping object. Element IDs must be synchronized to compare correct sets of pairwise distances. This failed in case the grouping was provided as apandas.Series, because it was interpreted as an orderedlistand indices were ignored (see issue #1877 for an example). Note:pandas.DataFramewas handled correctly. This behavior has been fixed with PR #1879- Fixed slicing for
TabularMSALocon Python 3.12. See issue #1926.
- Replaced the historical term "OTU" with the more generic term "taxon" (plural: "taxa"). As a consequence, the parameter "otu_ids" in phylogenetic alpha and beta diversity metrics was replaced by "taxa". Meanwhile, the old parameter "otu_ids" is still kept as an alias of "taxa" for backward compatibility. However it will be removed in a future release.
- Revised contributor's guidelines.
- Renamed function
multiplicative_replacementasmulti_replacefor conciseness (#1988). - Renamed parameter
multiple_comparisons_correctionasp_adjustof functionancomfor conciseness (#1988). - Enabled code coverage reporting via Codecov. See #1954.
- Renamed the default branch from "master" to "main". See #1953.
- Enabled subclassing of DNA, RNA and Protein classes to allow secondary development.
- Dropped support for NumPy < 1.17.0 in order to utilize the new random generator.
- Use CYTHON by default during build (#1874)
- Implemented augmented assignments proposed in issue #1789
- Incorporated Ruff's formatting and linting via pre-commit hooks and GitHub Actions. See PR #1924.
- Improved docstrings for functions accross the entire codebase. See #1933 and #1940
- Removed API lifecycle decorators in favor of deprecation warnings. See #1916
- Adding Variance log ratio estimators in
skbio.stats.composition.vlrandskbio.stats.composition.pairwise_vlr(#1803) - Added
skbio.stats.composition.tree_basisto construct ILR bases fromTreeNodeobjects. (#1862) IntervalMetadata.querynow defaults to obtaining all results, see #1817.
- With the introduction of the
tree_basisobject, the ILR bases are now represented in log-odds coordinates rather than in probabilities to minimize issues with numerical stability. Furthermore, theilrandilr_invfunctions now takes thebasisinput parameter in terms of log-odds coordinates. This affects theskbio.stats.composition.sbp_basisas well. (#1862)
- Complex multiple axis indexing operations with
TabularMSAhave been removed from testing due to incompatibilities with modern versions of Pandas. (#1851) - Pinning
scipy <= 1.10.1(#1851)
- Fixed a bug that caused build failure on the ARM64 microarchitecture due to floating-point number handling. (#1859)
- Never let the Gini index go below 0.0, see #1844.
- Fixed bug #1847 in which the edge from the root was inadvertantly included in the calculation for
descending_branch_length
- Replaced dependencies
CacheControlandlockfilewithrequeststo avoid a dependency inconsistency issue of the former. (See #1863, merged in #1859) - Updated installation instructions for developers in
CONTRIBUTING.md(#1860)
- Added NCBI taxonomy database dump format (
taxdump) (#1810). - Added
TreeNode.from_taxdumpfor converting taxdump into a tree (#1810). - scikit-learn has been removed as a dependency. This was a fairly heavy-weight dependency that was providing minor functionality to scikit-bio. The critical components have been implemented in scikit-bio directly, and the non-criticial components are listed under "Backward-incompatible changes [experimental]".
- Python 3.11 is now supported.
-
With the removal of the scikit-learn dependency, three beta diversity metric names can no longer be specified. These are
wminkowski,nan_euclidean, andhaversine. On testing,wminkowskiandhaversinedid not work throughskbio.diversity.beta_diversity(orsklearn.metrics.pairwise_distances). The former was deprecated in favor of callingminkowskiwith a vector of weights provided as kwargw(example below), and the latter does not work with data of this shape.nan_euclideancan still be accessed fron scikit-learn directly if needed, if a user installs scikit-learn in their environment (example below).counts = [[23, 64, 14, 0, 0, 3, 1], [0, 3, 35, 42, 0, 12, 1], [0, 5, 5, 0, 40, 40, 0], [44, 35, 9, 0, 1, 0, 0], [0, 2, 8, 0, 35, 45, 1], [0, 0, 25, 35, 0, 19, 0], [88, 31, 0, 5, 5, 5, 5], [44, 39, 0, 0, 0, 0, 0]] # new mechanism of accessing wminkowski from skbio.diversity import beta_diversity beta_diversity("minkowski", counts, w=[1,1,1,1,1,1,2]) # accessing nan_euclidean through scikit-learn directly import skbio from sklearn.metrics import pairwise_distances sklearn_dm = pairwise_distances(counts, metric="nan_euclidean") skbio_dm = skbio.DistanceMatrix(sklearn_dm)
skbio.alignment.local_pairwise_align_sswhas been deprecated (#1814) and will be removed or replaced in scikit-bio 0.6.0.
- Use
oldest-supported-numpyas build dependency. This fixes problems with environments that use an older version of numpy than the one used to build scikit-bio (#1813).
- Introduce support for Python 3.10 (#1801).
- Tentative support for Apple M1 (#1709).
- Added support for reading and writing a binary distance matrix object format. (#1716)
- Added support for
np.float32withDissimilarityMatrixobjects. - Added support for method and number_of_dimensions to permdisp reducing the runtime by 100x at 4000 samples, issue #1769.
- OrdinationResults object is now accepted as input for permdisp.
- Avoid an implicit data copy on construction of
DissimilarityMatrixobjects. - Avoid validation on copy of
DissimilarityMatrixandDistanceMatrixobjects, see PR #1747 - Use an optimized version of symmetry check in DistanceMatrix, see PR #1747
- Avoid performing filtering when ids are identical, see PR #1752
- center_distance_matrix has been re-implemented in cython for both speed and memory use. Indirectly speeds up pcoa PR #1749
- Use a memory-optimized version of permute in DistanceMatrix, see PR #1756.
- Refactor pearson and spearman skbio.stats.distance.mantel implementations to drastically improve memory locality. Also cache intermediate results that are invariant across permutations, see PR #1756.
- Refactor permanova to remove intermediate buffers and cythonize the internals, see PR #1768.
- Fix windows and 32bit incompatibility in
unweighted_unifrac.
- Python 3.6 has been removed from our testing matrix.
- Specify build dependencies in pyproject.toml. This allows the package to be installed without having to first manually install numpy.
- Update hdmedians package to a version which doesn't require an initial manual numpy install.
- Now buildable on non-x86 platforms due to use of the SIMD Everywhere library.
- Regenerate Cython wrapper by default to avoid incompatibilities with installed CPython.
- Update documentation for the
skbio.stats.composition.ancomfunction. (#1741)
-
Added option to return a capture group compiled regex pattern to any class inheriting
GrammaredSequencethrough theto_regexmethod. (#1431) -
Added
Dissimilarity.withinand.betweento obtain the respective distances and express them as aDataFrame. (#1662) -
Added Kendall Tau as possible correlation method in the
skbio.stats.distance.mantelfunction (#1675). -
Added support for IUPAC amino acid codes U (selenocysteine), O (pyrrolysine), and J (leucine or isoleucine). (#1576
- Changed
skbio.tree.TreeNode.supportfrom a method to a property. - Added
assign_supportsmethod toskbio.tree.TreeNodeto extract branch support values from node labels. - Modified the way a node's label is printed:
support:nameif both exist, orsupportornameif either exists.
-
Require
Sphinx <= 3.0. Newer Sphinx versions caused build errors. #1719 -
skbio.stats.ordinationtests have been relaxed. (#1713)
-
Fixes build errors for newer versions of NumPy, Pandas, and SciPy.
-
Corrected a criticial bug in
skbio.alignment.StripedSmithWaterman/skbio.alignment.local_pairwise_align_sswwhich would cause the formatting of the aligned sequences to misplace gap characters by the number of gap characters present in the opposing aligned sequence up to that point. This was caused by a faulty implementation of CIGAR string parsing, see #1679 for full details. -
Fixes build errors for newer versions of NumPy, Pandas, and SciPy.
-
Corrected a criticial bug in
skbio.alignment.StripedSmithWaterman/skbio.alignment.local_pairwise_align_sswwhich would cause the formatting of the aligned sequences to misplace gap characters by the number of gap characters present in the opposing aligned sequence up to that point. This was caused by a faulty implementation of CIGAR string parsing, see #1679 for full details.
-
skbio.diversity.beta_diversitynow accepts a pandas DataFrame as input. -
Avoid pandas 1.0.0 import warning (#1688)
-
Added support for Python 3.8 and dropped support for Python 3.5.
-
This version now depends on
scipy >= 1.3andpandas >= 1.0.
skbio.stats.compositionnow has methods to compute additive log-ratio transformation and inverse additive log-ratio transformation (alr,alr_inv) as well as a method to build a basis from a sequential binary partition (sbp_basis).
-
Python 3.6 and 3.7 compatibility is now supported
-
A pytest runner is shipped with every installation (#1633)
-
The nosetest framework has been replaced in favor of pytest (#1624)
-
This version is now compatible with numpy >= 1.17.0 and Pandas >= 0.23. (#1627)
- Added
FSVD, an alternative fast heuristic method to perform Principal Coordinates Analysis, toskbio.stats.ordination.pcoa.
- Added optimized utility methods
f_matrix_inplaceande_matrix_inplacewhich performf_matrixande_matrixcomputations in-place and are used by the newcenter_distance_matrixmethod inskbio.stats.ordination.
-
Added
unpackandunpack_by_funcmethods toskbio.tree.TreeNodeto unpack one or multiple internal nodes. Theunpackoperation removes an internal node and regrafts its children to its parent while retaining the overall length. (#1572) -
Added
supporttoskbio.tree.TreeNodeto return the support value of a node. -
Added
permdisptoskbio.stats.distanceto test for the homogeniety of groups. (#1228). -
Added
pcoa_biplottoskbio.stats.ordinationto project descriptors into a PCoA plot. -
Fixed pandas to 0.22.0 due to this: pandas-dev/pandas#20527
- Relaxing type checking in diversity calculations. (#1583).
-
Added
skbio.io.format.emblfor reading and writing EMBL files forDNA,RNAandSequenceclasses. -
Removing ValueError check in
skbio.stats._subsample.subsample_countswhenreplace=Trueandnis greater than the number of items in counts. #1527 -
Added
skbio.io.format.gff3for reading and writing GFF3 files forDNA,Sequence, andIntervalMetadataclasses. (#1450) -
skbio.metadata.IntervalMetadataconstructor has a new keyword argument,copy_from, for creating anIntervalMetadataobject from an existingIntervalMetadataobject with specifiedupper_bound. -
skbio.metadata.IntervalMetadataconstructor allowsNoneas a valid value forupper_bound. Anupper_boundofNonemeans that theIntervalMetadataobject has no upper bound. -
skbio.metadata.IntervalMetadata.drophas a new boolean parameternegateto indicate whether to drop or keep the specifiedIntervalobjects.
skbio.tree.njwall-clock runtime was decreased by 99% for a 500x500 distance matrix and 93% for a 100x100 distance matrix. (#1512, #1513)
-
The
include_selfparameter was not being honored inskbio.TreeNode.tips. The scope of this bug was that ifTreeNode.tipswas called on a tip, it would always result in an emptylistwhen unrolled. -
In
skbio.stats.ordination.ca,proportion_explainedwas missing in the returnedOrdinationResultsobject. (#1345) -
skbio.diversity.beta_diversitynow handles qualitative metrics as expected such thatbeta_diversity('jaccard', mat) == beta_diversity('jaccard', mat > 0). Please see #1549 for further detail. -
skbio.stats.ordination.rdaThe occasional column mismatch in outputbiplot_scoresis fixed (#1519).
- scikit-bio now depends on pandas >= 0.19.2, and is compatible with newer pandas versions (e.g. 0.20.3) that were previously incompatible.
- scikit-bio now depends on
numpy >= 1.17.0, < 1.14.0for compatibility with Python 3.4, 3.5, and 3.6 and the available numpy conda packages indefaultsandconda-forgechannels. - added support for running tests from
setup.py. Bothpython setup.py nosetestsandpython setup.py testare now supported, howeverpython setup.py testwill only run a subset of the full test suite. (#1341)
- Added
IntervalMetadataandIntervalclasses inskbio.metadatato store, query, and manipulate information of a sub-region of a sequence. (#1414) Sequenceand its child classes (includingGrammaredSequence,RNA,DNA,Protein) now acceptIntervalMetadatain their constructor API. Some of their relevant methods are also updated accordingly. (#1430)- GenBank parser now reads and writes
Sequenceor its subclass objects withIntervalMetadata. (#1440) DissimilarityMatrixnow has a new constructor method calledfrom_iterable. (#1343).DissimilarityMatrixnow allows non-hollow matrices. (#1343).DistanceMatrix.from_iterablenow accepts avalidate=Trueparameter. (#1343).DistanceMatrixnow has a new method calledto_seriesto create apandas.Seriesfrom aDistanceMatrix(#1397).- Added parallel beta diversity calculation support via
skbio.diversity.block_beta_diversity. The issue and idea is discussed in (#1181, while the actual code changes are in #1352).
-
The constructor API for
Sequenceand its child classes (includingGrammaredSequence,RNA,DNA,Protein) are changed from(sequence, metadata=None, positional_metadata=None, lowercase=False)to(sequence, metadata=None, positional_metadata=None, interval_metadata=None, lowercase=False)The changes are made to allow these classes to adopt
IntervalMetadataobject for interval features on the sequence. Theinterval_metadataparameter is added imediately afterpositional_metadatainstead of appended to the end, because it is more natural and logical and, more importantly, because it is unlikely in practice to break user code. A user's code would break only if they had suppliedmetadata,postional_metadata, andlowercaseparameters positionally. In the unlikely event that this happens, users will get an error telling them a bool isn't a validIntervalMetadatatype, so it won't silently produce buggy behavior.
- Modifying basis handling in
skbio.stats.composition.ilr_invprior to checking for orthogonality. Now the basis is strictly assumed to be in the Aitchison simplex. DistanceMatrix.from_iterabledefault behavior is now to validate matrix by computing all pairwise distances. Passvalidate=Falseto get the previous behavior (no validation, but faster execution).(#1343).- GenBank I/O now parses sequence features into the attribute of
interval_metadatainstead ofpositiona_metadata. And the key ofFEATURESis removed frommetadataattribute.
TreeNode.shearwas rewritten for approximately a 25% performance increase. (#1399)- The
IntervalMetadataallows dramatic decrease in memory usage in reading GenBank files of feature rich sequences. (#1159)
skbio.tree.TreeNode.pruneand implicitlyskbio.tree.TreeNode.shearwere not handling a situation in which a parent was validly removed during pruning operations as may happen if the resulting subtree does not include the root. Previously, anAttributeErrorwould raise asparentwould beNonein this situation.- numpy linking was fixed for installation under El Capitan.
- A bug was introduced in #1398 into
TreeNode.pruneand fixed in #1416 in which, under the special case of a single descendent existing from the root, the resulting children parent references were not updated. The cause of the bug was a call made toself.children.extendas opposed toself.extendwhere the former is alist.extendwithout knowledge of the tree, while the latter isTreeNode.extendwhich is able to adjust references toself.parent.
- Removed deprecated functions from
skbio.util:is_casava_v180_or_later,remove_files, andcreate_dir. - Removed deprecated
skbio.Sequence.copymethod.
IMPORTANT: scikit-bio is no longer compatible with Python 2. scikit-bio is compatible with Python 3.4 and later.
- Added more descriptive error message to
skbio.io.registrywhen attempting to read without specifyingintoand when there is no generator reader. (#1326) - Added support for reference tags to
skbio.io.format.stockholmreader and writer. (#1348) - Expanded error message in
skbio.io.format.stockholmreader whenconstructoris not passed, in order to provide better explanation to user. (#1327) - Added
skbio.sequence.distance.kmer_distancefor computing the kmer distance between two sequences. (#913) - Added
skbio.sequence.Sequence.replacefor assigning a character to positions in aSequence. (#1222) - Added support for
pandas.RangeIndex, lowering the memory footprint of default integer index objects.Sequence.positional_metadataandTabularMSA.positional_metadatanow usepd.RangeIndexas the positional metadata index.TabularMSAnow usespd.RangeIndexas the default index. Usage ofpd.RangeIndexover the previouspd.Int64Indexshould be transparent, so these changes should be non-breaking to users. scikit-bio now depends on pandas >= 0.18.0 (#1308) - Added
reset_index=Falseparameter toTabularMSA.appendandTabularMSA.extendfor resetting the MSA's index to the default index after appending/extending. - Added support for partial pairwise calculations via
skbio.diversity.partial_beta_diversity. (#1221, #1337). This function is immediately deprecated as its return type will change in the future and should be used with caution in its present form (see the function's documentation for details). TemporaryFileandNamedTemporaryFileare now supported IO sources forskbio.ioand related functionality. (#1291)- Added
tree_node_class=TreeNodeparameter toskbio.tree.majority_ruleto support returning consensus trees of typeTreeNode(the default) or a type that has the same interface asTreeNode(e.g.TreeNodesubclasses) (#1193) TreeNode.from_linkage_matrixandTreeNode.from_taxonomynow support constructingTreeNodesubclasses.TreeNode.bifurcatenow supportsTreeNodesubclasses (#1193)- The
ignore_metadatakeyword has been added toTabularMSA.iter_positionsto improve performance when metadata is not necessary. - Pairwise aligners in
skbio.alignmentnow propagate per-sequencemetadataobjects (this does not includepositional_metadata).
TabularMSA.appendandTabularMSA.extendnow require one ofminter,index, orreset_indexto be provided when incorporating new sequences into an MSA. Previous behavior was to auto-increment the index labels ifminterandindexweren't provided and the MSA had a default integer index, otherwise error. Usereset_index=Trueto obtain the previous behavior in a more explicit way.skbio.stats.composition.ancomnow returns twopd.DataFrameobjects, where it previously returned one. The first contains the ANCOM test results, as before, and the second contains percentile abundances of each feature in each group. The specific percentiles that are computed and returned is controlled by the newpercentilesparameter toskbio.stats.composition.ancom. In the future, this secondpd.DataFramewill not be returned by this function, but will be available through the contingency table API. (#1293)skbio.stats.composition.ancomnow performs multiple comparisons correction by default. The previous behavior of not performing multiple comparisons correction can be achieved by passingmultiple_comparisons_correction=None.- The
rejectcolumn in the firstpd.DataFramereturned fromskbio.stats.composition.ancomhas been renamedReject null hypothesisfor clarity. (#1375)
- Fixed row and column names to
biplot_scoresin theOrdinationResultsobject fromskbio.stats.ordination. This fix affect theccaandrdamethods. (#1322) - Fixed bug when using
skbio.io.format.stockholmreader on file with multi-line tree with no id. Previously this raised anAttributeError, now it correctly handles this type of tree. (#1334) - Fixed bug when reading Stockholm files with GF or GS features split over multiple lines. Previously, the feature text was simply concatenated because it was assumed to have trailing whitespace. There are examples of Stockholm files with and without trailing whitespace for multi-line features, so the
skbio.io.format.stockholmreader now adds a single space when concatenating feature text without trailing whitespace to avoid joining words together. Multi-line trees stored as GF metadata are concatenated as they appear in the file; a space is not added when concatenating. (#1328) - Fixed bug when using
Sequence.iter_kmerson emptySequenceobject. Previously this raised aValueError, now it returns an empty generator. - Fixed minor bug where adding sequences to an empty
TabularMSAwith MSA-widepositional_metadatawould result in aTabularMSAobject in an inconsistent state. This could happen usingTabularMSA.appendorTabularMSA.extend. This bug only affects aTabularMSAobject without sequences that has MSA-widepositional_metadata(for example,TabularMSA([], positional_metadata={'column': []})). TreeNode.distancenow handles the situation in whichselforotherare ancestors. Previosly, a node further up the tree was used resulting in inflated distances. (#807)TreeNode.prunecan now handle a root with a single descendent. Previously, the root was ignored from possibly having a single descendent. (#1247)- Providing the
formatkeyword toskbio.io.readwhen creating a generator with an empty file will now return an empty generator instead of raisingStopIteration. (#1313) OrdinationResultsis now importable fromskbioandskbio.stats.ordinationand correctly linked from the documentation (#1205)- Fixed performance bug in pairwise aligners resulting in 100x worse performance than in 0.2.4.
- Deprecated use of the term "non-degenerate", in favor of "definite".
GrammaredSequence.nondegenerate_chars,GrammaredSequence.nondegenerates, andGrammaredSequence.has_nondegenerateshave been renamed toGrammaredSequence.definite_chars,GrammaredSequence.definites, andGrammaredSequence.has_definites, respectively. The old names will be removed in scikit-bio 0.5.2. Relevant affected public classes includeGrammaredSequence,DNA,RNA, andProtein.
- Deprecated function
skbio.util.create_dir. This function will be removed in scikit-bio 0.5.1. Please use the Python standard library functionality described here. (#833) - Deprecated function
skbio.util.remove_files. This function will be removed in scikit-bio 0.5.1. Please use the Python standard library functionality described here. (#833) - Deprecated function
skbio.util.is_casava_v180_or_later. This function will be removed in 0.5.1. Functionality moved to FASTQ sniffer. (#833)
- When installing scikit-bio via
pip, numpy must now be installed first (#1296)
Minor maintenance release. This is the last Python 2.7 compatible release. Future scikit-bio releases will only support Python 3.
- Added
skbio.tree.TreeNode.bifurcatefor converting multifurcating trees into bifurcating trees. (#896) - Added
skbio.io.format.stockholmfor reading Stockholm files into aTabularMSAand writing from aTabularMSA. (#967) - scikit-bio
Sequenceobjects have better compatibility with numpy. For example, callingnp.asarray(sequence)now converts the sequence to a numpy array of characters (the same as callingsequence.values). - Added
skbio.sequence.distancesubpackage for computing distances between scikit-bioSequenceobjects (#913) - Added
skbio.sequence.GrammaredSequence, which can be inherited from to create grammared sequences with custom alphabets (e.g., for use with TabularMSA) (#1175) - Added
skbio.util.classpropertydecorator
- When sniffing or reading a file (
skbio.io.sniff,skbio.io.read, or the object-oriented.read()interface), passingnewlineas a keyword argument toskbio.io.opennow raises aTypeError. This backward-incompatible change to a stable API is necessary because it fixes a bug (more details in bug fix section below). - When reading a FASTQ or QSEQ file and passing
variant='solexa',ValueErroris now raised instead ofNotImplementedError. This backward-incompatible change to a stable API is necessary to avoid creating a spin-locked process due to a bug in Python. See #1256 for details. This change is temporary and will be reverted toNotImplementedErrorwhen the bug is fixed in Python.
skbio.io.format.genbank: When reading GenBank files, the date field of the LOCUS line is no longer parsed into adatetime.datetimeobject and is left as a string. When writing GenBank files, the locus date metadata is expected to be a string instead of adatetime.datetimeobject (#1153)Sequence.distancenow converts the input sequence (other) to its type before passing both sequences tometric. Previous behavior was to always convert toSequence.
- Fixed bug when using
Sequence.distanceorDistanceMatrix.from_iterableto compute distances betweenSequenceobjects with differingmetadata/positional_metadataand passingmetric=scipy.spatial.distance.hamming(#1254) - Fixed performance bug when computing Hamming distances between
Sequenceobjects inDistanceMatrix.from_iterable(#1250) - Changed
skbio.stats.composition.multiplicative_replacementto raise an error whenever a large value ofdeltais chosen (#1241) - When sniffing or reading a file (
skbio.io.sniff,skbio.io.read, or the object-oriented.read()interface), passingnewlineas a keyword argument toskbio.io.opennow raises aTypeError. The file format'snewlinecharacter will be used when opening the file. Previous behavior allowed overriding the format'snewlinecharacter but this could cause issues with readers that assume newline characters are those defined by the file format (which is an entirely reasonable assumption). This bug is very unlikely to have surfaced in practice as the defaultnewlinebehavior is universal newlines mode. - DNA, RNA, and Protein are no longer inheritable because they assume an IUPAC alphabet.
DistanceMatrixconstructor provides more informative error message when data contains NaNs (#1276)
- Warnings raised by scikit-bio now share a common subclass
skbio.util.SkbioWarning.
- The
TabularMSAobject was added to represent and operate on tabular multiple sequence alignments. This satisfies RFC 1. See theTabularMSAdocs for full details. - Added phylogenetic diversity metrics, including weighted UniFrac, unweighted UniFrac, and Faith's Phylogenetic Diversity. These are accessible as
skbio.diversity.beta.unweighted_unifrac,skbio.diversity.beta.weighted_unifrac, andskbio.diversity.alpha.faith_pd, respectively. - Addition of the function
skbio.diversity.alpha_diversityto support applying an alpha diversity metric to multiple samples in one call. - Addition of the functions
skbio.diversity.get_alpha_diversity_metricsandskbio.diversity.get_beta_diversity_metricsto support discovery of the alpha and beta diversity metrics implemented in scikit-bio. - Added
skbio.stats.composition.ancomfunction, a test for OTU differential abundance across sample categories. (#1054) - Added
skbio.io.format.blast7for reading BLAST+ output format 7 or BLAST output format 9 files into apd.DataFrame. (#1110) - Added
skbio.DissimilarityMatrix.to_data_framemethod for creating apandas.DataFramefrom aDissimilarityMatrixorDistanceMatrix. (#757) - Added support for one-dimensional vector of dissimilarities in
skbio.stats.distance.DissimilarityMatrixconstructor. (#6240) - Added
skbio.io.format.blast6for reading BLAST+ output format 6 or BLAST output format 8 files into apd.DataFrame. (#1110) - Added
inner,ilr,ilr_invandclr_inv,skbio.stats.composition, which enables linear transformations on compositions (#892 - Added
skbio.diversity.alpha.pielou_efunction as an evenness metric of alpha diversity. (#1068) - Added
to_regexmethod toskbio.sequence._iupac_sequenceABC - it returns a regex object that matches all non-degenerate versions of the sequence. - Added
skbio.util.assert_ordination_results_equalfunction for comparingOrdinationResultsobjects in unit tests. - Added
skbio.io.format.genbankfor reading and writing GenBank/GenPept forDNA,RNA,ProteinandSequenceclasses. - Added
skbio.util.RepresentationWarningfor warning about substitutions, assumptions, or particular alterations that were made for the successful completion of a process. TreeNode.tip_tip_distancesnow supports nodes without an associated length. In this case, a length of 0.0 is assumed and anskbio.util.RepresentationWarningis raised. Previous behavior was to raise aNoLengthError. (#791)DistanceMatrixnow has a new constructor method calledfrom_iterable.Sequencenow acceptslowercasekeyword likeDNAand others. Updatedfasta,fastq, andqseqreaders/writers forSequenceto reflect this.- The
lowercasemethod has been moved up toSequencemeaning all sequence objects now have alowercasemethod. - Added
reverse_transcribeclass method toRNA. - Added
Sequence.observed_charsproperty for obtaining the set of observed characters in a sequence. (#1075) - Added
Sequence.frequenciesmethod for computing character frequencies in a sequence. (#1074) - Added experimental class-method
Sequence.concatwhich will produce a new sequence from an iterable of existing sequences. Parameters control how positional metadata is propagated during a concatenation. TreeNode.to_arraynow supports replacingnanbranch lengths in the resulting branch length vector with the value provided asnan_length_value.skbio.io.format.phylipnow supports sniffing and reading strict, sequential PHYLIP-formatted files intoskbio.Alignmentobjects. (#1006)- Added
default_gap_charclass property toDNA,RNA, andProteinfor representing gap characters in a new sequence.
-
Sequence.kmer_frequenciesnow returns adict. Previous behavior was to return acollections.Counterifrelative=Falsewas passed, and acollections.defaultdictifrelative=Truewas passed. In the case of a missing key, theCounterwould return 0 and thedefaultdictwould return 0.0. Because the return type is now always adict, attempting to access a missing key will raise aKeyError. This change may break backwards-compatibility depending on how theCounter/defaultdictis being used. We hope that in most cases this change will not break backwards-compatibility because bothCounteranddefaultdictaredictsubclasses.If the previous behavior is desired, convert the
dictinto aCounter/defaultdict:import collections from skbio import Sequence seq = Sequence('ACCGAGTTTAACCGAATA') # Counter freqs_dict = seq.kmer_frequencies(k=8) freqs_counter = collections.Counter(freqs_dict) # defaultdict freqs_dict = seq.kmer_frequencies(k=8, relative=True) freqs_default_dict = collections.defaultdict(float, freqs_dict)
Rationale: We believe it is safer to return
dictinstead ofCounter/defaultdictas this may prevent error-prone usage of the return value. Previous behavior allowed accessing missing kmers, returning 0 or 0.0 depending on therelativeparameter. This is convenient in many cases but also potentially misleading. For example, consider the following code:from skbio import Sequence seq = Sequence('ACCGAGTTTAACCGAATA') freqs = seq.kmer_frequencies(k=8) freqs['ACCGA']
Previous behavior would return 0 because the kmer
'ACCGA'is not present in theCounter. In one respect this is the correct answer because we asked for kmers of length 8;'ACCGA'is a different length so it is not included in the results. However, we believe it is safer to avoid this implicit behavior in case the user assumes there are no'ACCGA'kmers in the sequence (which there are!). AKeyErrorin this case is more explicit and forces the user to consider their query. Returning adictwill also be consistent withSequence.frequencies.
- Replaced
PCoA,CCA,CAandRDAinskbio.stats.ordinationwith equivalent functionspcoa,cca,caandrda. These functions now takepd.DataFrameobjects. - Change
OrdinationResultsto have its attributes based onpd.DataFrameandpd.Seriesobjects, instead of pairs of identifiers and values. The changes are as follows:speciesandspecies_idshave been replaced by apd.DataFramenamedfeatures.siteandsite_idshave been replaced by apd.DataFramenamedsamples.eigvalsis now apd.Seriesobject.proportion_explainedis now apd.Seriesobject.biplotis now apd.DataFrameobject namedbiplot_scores.site_constraintsis now apd.DataFrameobject namedsample_constraints.
short_method_nameandlong_method_nameare now required arguments of theOrdinationResultsobject.- Removed
skbio.diversity.alpha.equitability. Please useskbio.diversity.alpha.pielou_e, which is more accurately named and better documented. Note thatequitabilityby default used logarithm base 2 whilepielou_euses logarithm baseeas described in Heip 1974. skbio.diversity.beta.pw_distancesis now calledskbio.diversity.beta_diversity. This function no longer defines a default metric, andmetricis now the first argument to this function. This function can also now take a pairwise distances function aspairwise_func.- Deprecated function
skbio.diversity.beta.pw_distances_from_tablehas been removed from scikit-bio as scheduled. Code that used this should be adapted to useskbio.diversity.beta_diversity. TreeNode.index_treenow returns a 2-D numpy array as its second return value (the child node index) instead of a 1-D numpy array.- Deprecated functions
skbio.draw.boxplotsandskbio.draw.grouped_distributionshave been removed from scikit-bio as scheduled. These functions generated plots that were not specific to bioinformatics. These types of plots can be generated with seaborn or another general-purpose plotting package. - Deprecated function
skbio.stats.power.bootstrap_power_curvehas been removed from scikit-bio as scheduled. Useskbio.stats.power.subsample_powerorskbio.stats.power.subsample_paired_powerfollowed byskbio.stats.power.confidence_bound. - Deprecated function
skbio.stats.spatial.procrusteshas been removed from scikit-bio as scheduled in favor ofscipy.spatial.procrustes. - Deprecated class
skbio.tree.CompressedTrieand functionskbio.tree.fasta_to_pairlisthave been removed from scikit-bio as scheduled in favor of existing general-purpose Python trie packages. - Deprecated function
skbio.util.flattenhas been removed from scikit-bio as scheduled in favor of solutions available in the Python standard library (see here and here for examples). - Pairwise alignment functions in
skbio.alignmentnow return a tuple containing theTabularMSAalignment, alignment score, and start/end positions. The returnedTabularMSA'sindexis always the default integer index; sequence IDs are no longer propagated to the MSA. Additionally, the pairwise alignment functions now accept the following input types to align:local_pairwise_align_nucleotide:DNAorRNAlocal_pairwise_align_protein:Proteinlocal_pairwise_align:IUPACSequenceglobal_pairwise_align_nucleotide:DNA,RNA, orTabularMSA[DNA|RNA]global_pairwise_align_protein:ProteinorTabularMSA[Protein]global_pairwise_align:IUPACSequenceorTabularMSAlocal_pairwise_align_ssw:DNA,RNA, orProtein. Additionally, this function now overrides theproteinkwarg based on input type.constructorparameter was removed because the function now determines the return type based on input type.
- Removed
skbio.alignment.SequenceCollectionin favor of using a list or other standard library containers to store scikit-bio sequence objects (mostSequenceCollectionoperations were simple list comprehensions). UseDistanceMatrix.from_iterableinstead ofSequenceCollection.distances(passkey="id"to exactly match original behavior). - Removed
skbio.alignment.Alignmentin favor ofskbio.alignment.TabularMSA. - Removed
skbio.alignment.SequenceCollectionErrorandskbio.alignment.AlignmentErrorexceptions as their corresponding classes no longer exist.
Sequenceobjects now handle slicing of empty positional metadata correctly. Any metadata that is empty will no longer be propagated by the internal_toconstructor. (#1133)DissimilarityMatrix.plot()no longer leaves a white border around the heatmap it plots (PR #1070).- TreeNode.root_at_midpoint`` no longer fails when a node with two equal length child branches exists in the tree. (#1077)
TreeNode._set_max_distance, as called throughTreeNode.get_max_distanceorTreeNode.root_at_midpointwould store distance information aslists in the attributeMaxDistTipson each node in the tree, however, these distances were only valid for the node in which the call to_set_max_distancewas made. The values contained inMaxDistTipsare now correct across the tree following a call toget_max_distance. The scope of impact of this bug is limited to users that were interacting directly withMaxDistTipson descendant nodes; this bug does not impact any known method within scikit-bio. (#1223)- Added missing
nosedependency to setup.py'sinstall_requires. (#1214) - Fixed issue that resulted in legends of
OrdinationResultplots sometimes being truncated. (#1210)
skbio.Sequence.copyhas been deprecated in favor ofcopy.copy(seq)andcopy.deepcopy(seq).
- Doctests are now written in Python 3.
make testnow validates MANIFEST.in using check-manifest. (#461)- Many new alpha diversity equations added to
skbio.diversity.alphadocumentation. (#321) - Order of
lowercaseandvalidatekeywords swapped inDNA,RNA, andProtein.
Initial beta release. In addition to the changes detailed below, the following subpackages have been mostly or entirely rewritten and most of their APIs are substantially different (and improved!):
skbio.sequenceskbio.io
The APIs of these subpackages are now stable, and all others are experimental. See the API stability docs for more details, including what we mean by stable and experimental in this context. We recognize that this is a lot of backward-incompatible changes. To avoid these types of changes being a surprise to our users, our public APIs are now decorated to make it clear to developers when an API can be relied upon (stable) and when it may be subject to change (experimental).
- Added
skbio.stats.compositionfor analyzing data made up of proportions - Added new
skbio.stats.evolvesubpackage for evolutionary statistics. Currently contains a single function,hommola_cospeciation, which implements a permutation-based test of correlation between two distance matrices. - Added support for
skbio.io.util.open_fileandskbio.io.util.open_filesto pull files from HTTP and HTTPS URLs. This behavior propagates to the I/O registry. - FASTA/QUAL (
skbio.io.format.fasta) and FASTQ (skbio.io.format.fastq) readers now allow blank or whitespace-only lines at the beginning of the file, between records, or at the end of the file. A blank or whitespace-only line in any other location will continue to raise an error #781. - scikit-bio now ignores leading and trailing whitespace characters on each line while reading FASTA/QUAL and FASTQ files.
- Added
ratioparameter toskbio.stats.power.subsample_power. This allows the user to calculate power on groups for uneven size (For example, draw twice as many samples from Group B than Group A). Ifratiois not set, group sizes will remain equal across all groups. - Power calculations (
skbio.stats.power.subsample_powerandskbio.stats.power.subsample_paired_power) can use test functions that return multiple p values, like some multivariate linear regression models. Previously, the power calculations required the test to return a single p value. - Added
skbio.util.assert_data_frame_almost_equalfunction for comparingpd.DataFrameobjects in unit tests.
- The speed of quality score decoding has been significantly improved (~2x) when reading
fastqfiles. - The speed of
NucleotideSequence.reverse_complementhas been improved (~6x).
- Changed
Sequence.distanceto raise an error any time two sequences are passed of different lengths regardless of thedistance_fnbeing passed. (#514) - Fixed issue with
TreeNode.extendwhere if given the children of anotherTreeNodeobject (tree.children), both trees would be left in an incorrect and unpredictable state. (#889) - Changed the way power was calculated in
subsample_paired_powerto move the subsample selection before the test is performed. This increases the number of Monte Carlo simulations performed during power estimation, and improves the accuracy of the returned estimate. Previous power estimates fromsubsample_paired_powershould be disregarded and re-calculated. (#910) - Fixed issue where
randdmwas attempting to create asymmetric distance matrices.This was causing an error to be raised by theDistanceMatrixconstructor inside of theranddmfunction, so thatranddmwould fail when attempting to create large distance matrices. (#943)
- Deprecated
skbio.util.flatten. This function will be removed in scikit-bio 0.3.1. Please use standard python library functionality described here Making a flat list out of lists of lists, Flattening a shallow list (#833) - Deprecated
skbio.stats.power.bootstrap_power_curvewill be removed in scikit-bio 0.4.1. It is deprecated in favor of usingsubsample_powerorsample_paired_powerto calculate a power matrix, and then the use ofconfidence_boundsto calculate the average and confidence intervals.
- Removed the following deprecated functionality:
skbio.parsesubpackage, includingSequenceIterator,FastaIterator,FastqIterator,load,parse_fasta,parse_fastq,parse_qual,write_clustal,parse_clustal, andFastqParseError; please useskbio.ioinstead.skbio.formatsubpackage, includingfasta_from_sequence,fasta_from_alignment, andformat_fastq_record; please useskbio.ioinstead.skbio.alignment.SequenceCollection.int_map; please useSequenceCollection.update_idsinstead.skbio.alignment.SequenceCollectionmethodsto_fastaandtoFasta; please useSequenceCollection.writeinstead.constructorparameter inskbio.alignment.Alignment.majority_consensus; please convert returned biological sequence object manually as desired (e.g.,str(seq)).skbio.alignment.Alignment.to_phylip; please useAlignment.writeinstead.skbio.sequence.BiologicalSequence.to_fasta; please useBiologicalSequence.writeinstead.skbio.tree.TreeNodemethodsfrom_newick,from_file, andto_newick; please useTreeNode.readandTreeNode.writeinstead.skbio.stats.distance.DissimilarityMatrixmethodsfrom_fileandto_file; please useDissimilarityMatrix.readandDissimilarityMatrix.writeinstead.skbio.stats.ordination.OrdinationResultsmethodsfrom_fileandto_file; please useOrdinationResults.readandOrdinationResults.writeinstead.skbio.stats.p_value_to_str; there is no replacement.skbio.stats.subsample; please useskbio.stats.subsample_countsinstead.skbio.stats.distance.ANOSIM; please useskbio.stats.distance.anosiminstead.skbio.stats.distance.PERMANOVA; please useskbio.stats.distance.permanovainstead.skbio.stats.distance.CategoricalStatsResults; there is no replacement, please useskbio.stats.distance.anosimorskbio.stats.distance.permanova, which will return apandas.Seriesobject.
skbio.alignment.Alignment.majority_consensusnow returnsBiologicalSequence('')if the alignment is empty. Previously,''was returned.min_observationswas removed fromskbio.stats.power.subsample_powerandskbio.stats.power.subsample_paired_power. The minimum number of samples for subsampling depends on the data set and statistical tests. Having a default parameter to set unnecessary limitations on the technique.
- Changed testing procedures
- Developers should now use
make test - Users can use
python -m skbio.test - Added
skbio.util._testing.TestRunner(available throughskbio.util.TestRunner). Used to provide atestmethod for each module init file. This class represents a unified testing path which wraps allskbiotesting functionality. - Autodetect Python version and disable doctests for Python 3.
- Developers should now use
numpyis no longer required to be installed before installing scikit-bio!- Upgraded checklist.py to check source files non-conforming to new header style. (#855)
- Updated to use
natsort>= 4.0.0. - The method of subsampling was changed for
skbio.stats.power.subsample_paired_power. Rather than drawing a paired sample for the run and then subsampling for each count, the subsample is now drawn for each sample and each run. In test data, this did not significantly alter the power results. - checklist.py now enforces
__future__imports in .py files.
- Modified
skbio.stats.distance.pwmantelto accept a list of filepaths. This is useful as it allows for a smaller amount of memory consumption as it only loads two matrices at a time as opposed to requiring that all distance matrices are loaded into memory. - Added
skbio.util.find_duplicatesfor finding duplicate elements in an iterable.
- Fixed floating point precision bugs in
Alignment.position_frequencies,Alignment.position_entropies,Alignment.omit_gap_positions,Alignment.omit_gap_sequences,BiologicalSequence.k_word_frequencies, andSequenceCollection.k_word_frequencies(#801).
- Removed
feature_typesattribute fromBiologicalSequenceand all subclasses (#797). - Removed
find_featuresmethod fromBiologicalSequenceandProteinSequence(#797). BiologicalSequence.k_word_frequenciesnow returns acollections.defaultdictof typefloatinstead of typeint. This only affects the "default" case, when a key isn't present in the dictionary. Previous behavior would return0as anint, while the new behavior is to return0.0as afloat. This change also affects thedefaultdicts that are returned bySequenceCollection.k_word_frequencies.
DissimilarityMatrixandDistanceMatrixnow report duplicate IDs in theDissimilarityMatrixErrormessage that can be raised during validation.
- Added
plotmethod toskbio.stats.distance.DissimilarityMatrixfor creating basic heatmaps of a dissimilarity/distance matrix (see #684). Also added_repr_png_and_repr_svg_methods for automatic display in the IPython Notebook, withpngandsvgproperties for direct access. - Added
__str__method toskbio.stats.ordination.OrdinationResults. - Added
skbio.stats.distance.anosimandskbio.stats.distance.permanovafunctions, which replace theskbio.stats.distance.ANOSIMandskbio.stats.distance.PERMANOVAclasses. These new functions provide simpler procedural interfaces to running these statistical methods. They also provide more convenient access to results by returning apandas.Seriesinstead of aCategoricalStatsResultsobject. These functions have more extensive documentation than their previous versions. If significance tests are suppressed, p-values are returned asnp.naninstead ofNonefor consistency with other statistical methods in scikit-bio. #754 - Added
skbio.stats.powerfor performing empirical power analysis. The module uses existing datasets and iteratively draws samples to estimate the number of samples needed to see a significant difference for a given critical value. - Added
skbio.stats.isubsamplefor subsampling from an unknown number of values. This method supports subsampling from multiple partitions and does not require that all items be stored in memory, requiring approximatelyO(N*M)`` space whereNis the number of partitions andM` is the maximum subsample size. - Added
skbio.stats.subsample_counts, which replacesskbio.stats.subsample. See deprecation section below for more details (#770).
- Fixed issue where SSW wouldn't compile on i686 architectures (#409).
- Deprecated
skbio.stats.p_value_to_str. This function will be removed in scikit-bio 0.3.0. Permutation-based p-values in scikit-bio are calculated as(num_extreme + 1) / (num_permutations + 1), so it is impossible to obtain a p-value of zero. This function historically existed for correcting the number of digits displayed when obtaining a p-value of zero. Since this is no longer possible, this functionality will be removed. - Deprecated
skbio.stats.distance.ANOSIMandskbio.stats.distance.PERMANOVAin favor ofskbio.stats.distance.anosimandskbio.stats.distance.permanova, respectively. - Deprecated
skbio.stats.distance.CategoricalStatsResultsin favor of usingpandas.Seriesto store statistical method results.anosimandpermanovareturnpandas.Seriesinstead ofCategoricalStatsResults. - Deprecated
skbio.stats.subsamplein favor ofskbio.stats.subsample_counts, which provides an identical interface; only the function name has changed.skbio.stats.subsamplewill be removed in scikit-bio 0.3.0.
- Deprecation warnings are now raised using
DeprecationWarninginstead ofUserWarning(#774).
- The
pandas.DataFramereturned byskbio.stats.distance.pwmantelnow stores p-values as floats and does not convert them to strings with a specific number of digits. p-values that were previously stored as "N/A" are now stored asnp.nanfor consistency with other statistical methods in scikit-bio. See note in "Deprecated functionality" above regardingp_value_to_strfor details. - scikit-bio now supports versions of IPython < 2.0.0 (#767).
This is an alpha release of scikit-bio. At this stage, major backwards-incompatible API changes can and will happen. Unified I/O with the scikit-bio I/O registry was the focus of this release.
- Added
strictandlookupoptional parameters toskbio.stats.distance.mantelfor handling reordering and matching of IDs when providedDistanceMatrixinstances as input (these parameters were previously only available inskbio.stats.distance.pwmantel). skbio.stats.distance.pwmantelnow accepts an iterable ofarray_likeobjects. Previously, onlyDistanceMatrixinstances were allowed.- Added
plotmethod toskbio.stats.ordination.OrdinationResultsfor creating basic 3-D matplotlib scatterplots of ordination results, optionally colored by metadata in apandas.DataFrame(see #518). Also added_repr_png_and_repr_svg_methods for automatic display in the IPython Notebook, withpngandsvgproperties for direct access. - Added
skbio.stats.ordination.assert_ordination_results_equalfor comparingOrdinationResultsobjects for equality in unit tests. BiologicalSequence(and its subclasses) now optionally store Phred quality scores. A biological sequence's quality scores are stored as a 1-Dnumpy.ndarrayof nonnegative integers that is the same length as the biological sequence. Quality scores can be provided upon object instantiation via the keyword argumentquality, and can be retrieved via theBiologicalSequence.qualityproperty.BiologicalSequence.has_qualityis also provided for determining whether a biological sequence has quality scores or not. See #616 for more details.- Added
BiologicalSequence.sequenceproperty for retrieving the underlying string representing the sequence characters. This was previously (and still is) accessible viaBiologicalSequence.__str__. It is provided via a property for convenience and explicitness. - Added
BiologicalSequence.equalsfor full control over equality testing of biological sequences. By default, biological sequences must have the same type, underlying sequence of characters, identifier, description, and quality scores to compare equal. These properties can be ignored via the keyword argumentignore. The behavior ofBiologicalSequence.__eq__/__ne__remains unchanged (only type and underlying sequence of characters are compared). - Added
BiologicalSequence.copyfor creating a copy of a biological sequence, optionally with one or more attributes updated. BiologicalSequence.__getitem__now supports specifying a sequence of indices to take from the biological sequence.- Methods to read and write taxonomies are now available under
skbio.tree.TreeNode.from_taxonomyandskbio.tree.TreeNode.to_taxonomyrespectively. - Added
SequenceCollection.update_ids, which provides a flexible way of updating sequence IDs on aSequenceCollectionorAlignment(note that a new object is returned, since instances of these classes are immutable). DeprecatedSequenceCollection.int_mapin favor of this new method; it will be removed in scikit-bio 0.3.0. - Added
skbio.util.cardinal_to_ordinalfor converting a cardinal number to ordinal string (e.g., useful for error messages). - New I/O Registry: supports multiple file formats, automatic file format detection when reading, unified procedural
skbio.io.readandskbio.io.writein addition to OOP interfaces (read/writemethods) on the below objects. Seeskbio.iofor more details.- Added "clustal" format support:
- Has sniffer
- Readers:
Alignment - Writers:
Alignment
- Added "lsmat" format support:
- Has sniffer
- Readers:
DissimilarityMatrix,DistanceMatrix - Writers:
DissimilarityMatrix,DistanceMatrix
- Added "ordination" format support:
- Has sniffer
- Readers:
OrdinationResults - Writers:
OrdinationResults
- Added "newick" format support:
- Has sniffer
- Readers:
TreeNode - Writers:
TreeNode
- Added "phylip" format support:
- No sniffer
- Readers: None
- Writers:
Alignment
- Added "qseq" format support:
- Has sniffer
- Readers: generator of
BiologicalSequenceor its subclasses,SequenceCollection,BiologicalSequence,NucleotideSequence,DNASequence,RNASequence,ProteinSequence - Writers: None
- Added "fasta"/QUAL format support:
- Has sniffer
- Readers: generator of
BiologicalSequenceor its subclasses,SequenceCollection,Alignment,BiologicalSequence,NucleotideSequence,DNASequence,RNASequence,ProteinSequence - Writers: same as readers
- Added "fastq" format support:
- Has sniffer
- Readers: generator of
BiologicalSequenceor its subclasses,SequenceCollection,Alignment,BiologicalSequence,NucleotideSequence,DNASequence,RNASequence,ProteinSequence - Writers: same as readers
- Added "clustal" format support:
- Removed
constructorparameter fromAlignment.k_word_frequencies,BiologicalSequence.k_words,BiologicalSequence.k_word_counts, andBiologicalSequence.k_word_frequenciesas it had no effect (it was never hooked up in the underlying code).BiologicalSequence.k_wordsnow returns a generator ofBiologicalSequenceobjects instead of strings. - Modified the
Alignmentconstructor to verify that all sequences have the same length, if not, raise anAlignmentErrorexception. Updated the methodAlignment.subalignmentto calculate the indices only once now that identical sequence length is guaranteed.
-
Deprecated
constructorparameter inAlignment.majority_consensusin favor of having users callstron the returnedBiologicalSequence. This parameter will be removed in scikit-bio 0.3.0. -
Existing I/O functionality deprecated in favor of I/O registry, old functionality will be removed in scikit-bio 0.3.0. All functionality can be found at
skbio.io.read,skbio.io.write, and the methods listed below:-
Deprecated the following "clustal" readers/writers:
write_clustal->Alignment.writeparse_clustal->Alignment.read
-
Deprecated the following distance matrix format ("lsmat") readers/writers:
DissimilarityMatrix.from_file->DissimilarityMatrix.readDissimilarityMatrix.to_file->DissimilarityMatrix.writeDistanceMatrix.from_file->DistanceMatrix.readDistanceMatrix.to_file->DistanceMatrix.write
-
Deprecated the following ordination format ("ordination") readers/writers:
OrdinationResults.from_file->OrdinationResults.readOrdinationResults.to_file->OrdinationResults.write
-
Deprecated the following "newick" readers/writers:
TreeNode.from_file->TreeNode.readTreeNode.from_newick->TreeNode.readTreeNode.to_newick->TreeNode.write
-
Deprecated the following "phylip" writers:
Alignment.to_phylip->Alignment.write
-
Deprecated the following "fasta"/QUAL readers/writers:
SequenceCollection.from_fasta_records->SequenceCollection.readSequenceCollection.to_fasta->SequenceCollection.writefasta_from_sequences->skbio.io.write(obj, into=<file>, format='fasta')fasta_from_alignment->Alignment.writeparse_fasta->skbio.io.read(<fasta>, format='fasta')parse_qual->skbio.io.read(<fasta>, format='fasta', qual=<file>)BiologicalSequence.to_fasta->BiologicalSequence.write
-
Deprecated the following "fastq" readers/writers:
parse_fastq->skbio.io.read(<fastq>, format='fastq')format_fastq_record->skbio.io.write(<fastq>, format='fastq')
-
skbio.stats.distance.mantelnow returns a 3-element tuple containing correlation coefficient, p-value, and the number of matching rows/cols in the distance matrices (n). The return value was previously a 2-element tuple containing only the correlation coefficient and p-value.skbio.stats.distance.mantelreorders inputDistanceMatrixinstances based on matching IDs (see optional parametersstrictandlookupfor controlling this behavior). In the past,DistanceMatrixinstances were treated the same asarray_likeinput and no reordering took place, regardless of ID (mis)matches.array_likeinput behavior remains the same.- If mismatched types are provided to
skbio.stats.distance.mantel(e.g., aDistanceMatrixandarray_like), aTypeErrorwill be raised.
- Added git timestamp checking to checklist.py, ensuring that when changes are made to Cython (.pyx) files, their corresponding generated C files are also updated.
- Fixed performance bug when instantiating
BiologicalSequenceobjects. The previous runtime scaled linearly with sequence length; it is now constant time when the sequence is already a string. See #623 for details. - IPython and six are now required dependencies.
This is an initial alpha release of scikit-bio. At this stage, major backwards-incompatible API changes can and will happen. Many backwards-incompatible API changes were made since the previous release.
- Added ability to compute distances between sequences in a
SequenceCollectionobject (#509), and expandedAlignment.distanceto allow the user to pass a function for computing distances (the default distance metric is stillscipy.spatial.distance.hamming) (#194). - Added functionality to not penalize terminal gaps in global alignment. This functionality results in more biologically relevant global alignments (see #537 for discussion of the issue) and is now the default behavior for global alignment.
- The python global aligners (
global_pairwise_align,global_pairwise_align_nucleotide, andglobal_pairwise_align_protein) now support aligning pairs of sequences, pairs of alignments, and a sequence and an alignment (see #550). This functionality supports progressive multiple sequence alignment, among other things such as adding a sequence to an existing alignment. - Added
StockholmAlignment.to_filefor writing Stockholm-formatted files. - Added
strict=Trueoptional parameter toDissimilarityMatrix.filter. - Added
TreeNode.find_allfor finding all tree nodes that match a given name.
- Fixed bug that resulted in a
ValueErrorfromlocal_align_pairwise_nucleotide(see #504) under many circumstances. This would not generate incorrect results, but would cause the code to fail.
- Removed
skbio.math, leavingstatsanddiversityto become top level packages. For example, instead offrom skbio.math.stats.ordination import PCoAyou would now importfrom skbio.stats.ordination import PCoA. - The module
skbio.math.gradientas well as the contents ofskbio.math.subsampleandskbio.math.stats.miscare now found inskbio.stats. As an example, to import subsample:from skbio.stats import subsample; to import everything from gradient:from skbio.stats.gradient import *. - The contents of
skbio.math.stats.ordination.utilsare now inskbio.stats.ordination. - Removed
skbio.appsubpackage (i.e., the application controller framework) as this code has been ported to the standalone burrito Python package. This code was not specific to bioinformatics and is useful for wrapping command-line applications in general. - Removed
skbio.core, leavingalignment,genetic_code,sequence,tree, andworkflowto become top level packages. For example, instead offrom skbio.core.sequence import DNAyou would now importfrom skbio.sequence import DNA. - Removed
skbio.util.exceptionandskbio.util.warning(see #577 for the reasoning behind this change). The exceptions/warnings were moved to the following locations:
FileFormatError,RecordError,FieldError, andEfficiencyWarninghave been moved toskbio.utilBiologicalSequenceErrorhas been moved toskbio.sequenceSequenceCollectionErrorandStockholmParseErrorhave been moved toskbio.alignmentDissimilarityMatrixError,DistanceMatrixError,DissimilarityMatrixFormatError, andMissingIDErrorhave been moved toskbio.stats.distanceTreeError,NoLengthError,DuplicateNodeError,MissingNodeError, andNoParentErrorhave been moved toskbio.treeFastqParseErrorhas been moved toskbio.parse.sequencesGeneticCodeError,GeneticCodeInitError, andInvalidCodonErrorhave been moved toskbio.genetic_code
- The contents of
skbio.genetic_codeformerlyskbio.core.genetic_codeare now inskbio.sequence. TheGeneticCodesdictionary is now a functiongenetic_code. The functionality is the same, except that because this is now a function rather than a dict, retrieving a genetic code is done using a function call rather than a lookup (so, for example,GeneticCodes[2]becomesgenetic_code(2). - Many submodules have been made private with the intention of simplifying imports for users. See #562 for discussion of this change. The following list contains the previous module name and where imports from that module should now come from.
skbio.alignment.sswtoskbio.alignmentskbio.alignment.alignmenttoskbio.alignmentskbio.alignment.pairwisetoskbio.alignmentskbio.diversity.alpha.basetoskbio.diversity.alphaskbio.diversity.alpha.ginitoskbio.diversity.alphaskbio.diversity.alpha.lladsertoskbio.diversity.alphaskbio.diversity.beta.basetoskbio.diversity.betaskbio.draw.distributionstoskbio.drawskbio.stats.distance.anosimtoskbio.stats.distanceskbio.stats.distance.basetoskbio.stats.distanceskbio.stats.distance.permanovatoskbio.stats.distanceskbio.distancetoskbio.stats.distanceskbio.stats.ordination.basetoskbio.stats.ordinationskbio.stats.ordination.canonical_correspondence_analysistoskbio.stats.ordinationskbio.stats.ordination.correspondence_analysistoskbio.stats.ordinationskbio.stats.ordination.principal_coordinate_analysistoskbio.stats.ordinationskbio.stats.ordination.redundancy_analysistoskbio.stats.ordinationskbio.tree.treetoskbio.treeskbio.tree.trietoskbio.treeskbio.util.misctoskbio.utilskbio.util.testingtoskbio.utilskbio.util.exceptiontoskbio.utilskbio.util.warningtoskbio.util
- Moved
skbio.distancecontents intoskbio.stats.distance.
- Relaxed requirement in
BiologicalSequence.distancethat sequences being compared are of equal length. This is relevant for Hamming distance, so the check is still performed in that case, but other distance metrics may not have that requirement. See #504). - Renamed
powertrip.pyrepo-checking script tochecklist.pyfor clarity. checklist.pynow ensures that all unit tests import from a minimally deep API. For example, it will produce an error ifskbio.core.distance.DistanceMatrixis used overskbio.DistanceMatrix.- Extra dimension is no longer calculated in
skbio.stats.spatial.procrustes. - Expanded documentation in various subpackages.
- Added new scikit-bio logo. Thanks Alina Prassas!
This is a pre-alpha release. At this stage, major backwards-incompatible API changes can and will happen.
- Added Python implementations of Smith-Waterman and Needleman-Wunsch alignment as
skbio.core.alignment.pairwise.local_pairwise_alignandskbio.core.alignment.pairwise.global_pairwise_align. These are much slower than native C implementations (e.g.,skbio.core.alignment.local_pairwise_align_ssw) and as a result raise anEfficencyWarningwhen called, but are included as they serve as useful educational examples as they’re simple to experiment with. - Added
skbio.core.diversity.beta.pw_distancesandskbio.core.diversity.beta.pw_distances_from_table. These provide convenient access to thescipy.spatial.distance.pdistbeta diversity metrics from within scikit-bio. Theskbio.core.diversity.beta.pw_distances_from_tablefunction will only be available temporarily, until thebiom.table.Tableobject is merged into scikit-bio (see #489), at which pointskbio.core.diversity.beta.pw_distanceswill be updated to use that. - Added
skbio.core.alignment.StockholmAlignment, which provides support for parsing Stockholm-formatted alignment files and working with those alignments in the context RNA secondary structural information. - Added
skbio.core.tree.majority_rulefunction for computing consensus trees from a list of trees.
- Function
skbio.core.alignment.align_striped_smith_watermanrenamed tolocal_pairwise_align_sswand now returns anAlignmentobject instead of anAlignmentStructure - The following keyword-arguments for
StripedSmithWatermanandlocal_pairwise_align_sswhave been renamed:gap_open->gap_open_penaltygap_extend->gap_extend_penaltymatch->match_scoremismatch->mismatch_score
- Removed
skbio.util.sortmodule in favor of natsort package.
- Added powertrip.py script to perform basic sanity-checking of the repo based on recurring issues that weren't being caught until release time; added to Travis build.
- Added RELEASE.md with release instructions.
- Added intersphinx mappings to docs so that "See Also" references to numpy, scipy, matplotlib, and pandas are hyperlinks.
- The following classes are no longer
namedtuplesubclasses (see #359 for the rationale):skbio.math.stats.ordination.OrdinationResultsskbio.math.gradient.GroupResultsskbio.math.gradient.CategoryResultsskbio.math.gradient.GradientANOVAResults
- Added coding guidelines draft.
- Added new alpha diversity formulas to the
skbio.math.diversity.alphadocumentation.
This is a pre-alpha release. At this stage, major backwards-incompatible API changes can and will happen.
- Added
enforce_qual_rangeparameter toparse_fastq(on by default, maintaining backward compatibility). This allows disabling of the quality score range-checking. - Added
skbio.core.tree.nj, which applies neighbor-joining for phylogenetic reconstruction. - Added
bioenv,mantel, andpwmanteldistance-based statistics toskbio.math.stats.distancesubpackage. - Added
skbio.math.stats.miscmodule for miscellaneous stats utility functions. - IDs are now optional when constructing a
DissimilarityMatrixorDistanceMatrix(monotonically-increasing integers cast as strings are automatically used). - Added
DistanceMatrix.permutemethod for randomly permuting rows and columns of a distance matrix. - Added the following methods to
DissimilarityMatrix:filter,index, and__contains__for ID-based filtering, index lookup, and membership testing, respectively. - Added
ignore_commentparameter toparse_fasta(off by default, maintaining backward compatibility). This handles stripping the comment field from the header line (i.e., all characters beginning with the first space) before returning the label. - Added imports of
BiologicalSequence,NucleotideSequence,DNA,DNASequence,RNA,RNASequence,Protein,ProteinSequence,DistanceMatrix,align_striped_smith_waterman,SequenceCollection,Alignment,TreeNode,nj,parse_fasta,parse_fastq,parse_qual,FastaIterator,FastqIterator,SequenceIteratorinskbio/__init__.pyfor convenient importing. For example, it's now possible tofrom skbio import Alignment, rather thanfrom skbio.core.alignment import Alignment.
- Fixed a couple of unit tests that could fail stochastically.
- Added missing
__init__.pyfiles to a couple of test directories so that these tests won't be skipped. parse_fastqnow raises an error on dangling records.- Fixed several warnings that were raised while running the test suite with Python 3.4.
- Functionality imported from
skbio.core.sswmust now be imported fromskbio.core.alignmentinstead.
- Code is now flake8-compliant; added flake8 checking to Travis build.
- Various additions and improvements to documentation (API, installation instructions, developer instructions, etc.).
__future__imports are now standardized across the codebase.- New website front page and styling changes throughout. Moved docs site to its own versioned subdirectories.
- Reorganized alignment data structures and algorithms (e.g., SSW code,
Alignmentclass, etc.) into anskbio.core.alignmentsubpackage.
Fixes to setup.py. This is a pre-alpha release. At this stage, major backwards-incompatible API changes can and will happen.
Initial pre-alpha release. At this stage, major backwards-incompatible API changes can and will happen.