1
1
pandas-charm
2
2
============
3
3
4
- .. image :: https://travis-ci.org/jmenglund/pandas-charm.svg?branch=master
5
- :target: https://travis-ci.org/jmenglund/pandas-charm
4
+ |Build-Status | |Coverage-Status | |PyPI-Status | |License | |DOI-URI |
6
5
7
- .. image :: https://codecov.io/gh/jmenglund/pandas-charm/branch/master/graph/badge.svg
8
- :target: https://codecov.io/gh/jmenglund/pandas-charm
9
-
10
- .. image :: https://img.shields.io/badge/license-MIT-blue.svg
11
- :target: https://opensource.org/licenses/MIT
12
-
13
- .. image :: https://zenodo.org/badge/23107/jmenglund/pandas-charm.svg
14
- :target: https://zenodo.org/badge/latestdoi/23107/jmenglund/pandas-charm
15
-
16
- |
17
-
18
- pandas-charm is a small Python package (or library) for getting character
6
+ ``pandas-charm `` is a small Python package for getting character
19
7
matrices (alignments) into and out of `pandas <http://pandas.pydata.org >`_.
20
- The intention of the package is to make pandas interoperable with
21
- other scientific packages that can be used for working with character
22
- matrices, like for example `BioPython <http://biopython.org >`_ and
23
- `Dendropy <http://dendropy.org >`_.
8
+ Its purpose is to make pandas interoperable with other scientific
9
+ packages that can be used for dealing with character matrices, like for example
10
+ `BioPython <http://biopython.org >`_ and `Dendropy <http://dendropy.org >`_.
24
11
25
- With pandas-charm, it is currently possible to convert between the
12
+ With `` pandas-charm `` , it is currently possible to convert between the
26
13
following objects:
27
14
28
15
* BioPython MultipleSeqAlignment <-> pandas DataFrame
29
16
* DendroPy CharacterMatrix <-> pandas DataFrame
30
17
31
- Source repository: `< https://github.com/jmenglund/pandas-charm >`_
18
+ The code has been tested with Python 2.7, 3.3, 3.4 and 3.5.
32
19
20
+ Source repository: `<https://github.com/jmenglund/pandas-charm >`_
33
21
34
- The name
35
- --------
22
+ ------------------------------------------
36
23
37
- pandas-charm got its name from the pandas library plus an acronym for
38
- CHARacter Matrix.
24
+ .. contents :: Table of contents
25
+ :backlinks: top
26
+ :local:
39
27
40
28
41
29
Installation
@@ -49,7 +37,7 @@ hosted on `PyPI <https://pypi.python.org/>`_:
49
37
$ pip install pandas-charm
50
38
51
39
The project is hosted at https://github.com/jmenglund/pandas-charm and
52
- can be installed using git:
40
+ can also be installed using git:
53
41
54
42
.. code-block ::
55
43
@@ -58,25 +46,30 @@ can be installed using git:
58
46
$ python setup.py install
59
47
60
48
49
+ You may consider installing ``pandas-charm `` and its required Python packages
50
+ within a virtual environment in order to avoid cluttering your system's
51
+ Python path. See for example the environment management system
52
+ `conda <http://conda.pydata.org >`_ or the package
53
+ `virtualenv <https://virtualenv.pypa.io/en/latest/ >`_.
54
+
55
+
61
56
Running tests
62
57
-------------
63
58
64
- After installing the pandas-charm, you may want to check that everything
65
- works as expected. Below is an example of how to run the tests with pytest.
66
- The packages BioPython, DendroPy, pytest, coverage, and pytest-cov need
67
- to be installed.
59
+ Testing is carried out with `pytest <http://pytest.org >`_. Here is an
60
+ example on how to run the test suite and generating a coverage report:
68
61
69
62
.. code-block ::
70
63
71
- $ cd pandas-charm
72
- $ py.test -v --cov-report term-missing --cov pandascharm.py
64
+ $ pip install pytest pytest-cov pytest-pep8 dendropy biopython
65
+ $ py.test -v --cov-report term-missing --cov pandascharm.py --pep8
73
66
74
67
75
68
Usage
76
69
-----
77
70
78
71
Below are a few examples on how to use pandas-charm. The examples are
79
- written with Python 3 code, but pandas-charm should work also with
72
+ written with Python 3 code, but `` pandas-charm `` should work also with
80
73
Python 2.7. You need to install BioPython and/or DendroPy manually
81
74
before you start:
82
75
@@ -86,8 +79,8 @@ before you start:
86
79
$ pip install dendropy
87
80
88
81
89
- Converting a DendroPy CharacterMatrix to a pandas DataFrame
90
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
82
+ DendroPy CharacterMatrix to pandas DataFrame
83
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
91
84
92
85
.. code-block :: pycon
93
86
@@ -112,9 +105,9 @@ Converting a DendroPy CharacterMatrix to a pandas DataFrame
112
105
3 A A A
113
106
4 A A A
114
107
115
- As seen above , characters are stored as rows and sequences as
116
- columns in the DataFrame. If you want rows to hold sequences,
117
- it is easy to transpose the matrix in pandas:
108
+ By default , characters are stored as rows and sequences as columns
109
+ in the DataFrame. If you want rows to hold sequences, just transpose
110
+ the matrix in pandas:
118
111
119
112
.. code-block :: pycon
120
113
@@ -125,8 +118,8 @@ it is easy to transpose the matrix in pandas:
125
118
t3 T G - A A
126
119
127
120
128
- Converting a pandas DataFrame to a Dendropy CharacterMatrix
129
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
121
+ pandas DataFrame to Dendropy CharacterMatrix
122
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
130
123
131
124
.. code-block :: pycon
132
125
@@ -145,16 +138,16 @@ Converting a pandas DataFrame to a Dendropy CharacterMatrix
145
138
3 A A A
146
139
4 A A A
147
140
148
- >>> matrix = pc.to_charmatrix(df, type ='dna')
141
+ >>> matrix = pc.to_charmatrix(df, data_type ='dna')
149
142
>>> print(matrix.as_string('phylip'))
150
143
3 5
151
144
t1 TCCAA
152
145
t2 TGCAA
153
146
t3 TG-AA
154
147
155
148
156
- Converting a BioPython MultipleSeqAlignment to a pandas DataFrame
157
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
149
+ BioPython MultipleSeqAlignment to pandas DataFrame
150
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
158
151
159
152
.. code-block :: pycon
160
153
@@ -180,8 +173,8 @@ Converting a BioPython MultipleSeqAlignment to a pandas DataFrame
180
173
4 A A A
181
174
182
175
183
- Converting a pandas DataFrame to a BioPython MultipleSeqAlignment
184
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
176
+ pandas DataFrame to BioPython MultipleSeqAlignment
177
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
185
178
186
179
.. code-block :: pycon
187
180
@@ -208,11 +201,19 @@ Converting a pandas DataFrame to a BioPython MultipleSeqAlignment
208
201
TG-AA t3
209
202
210
203
204
+
205
+ The name
206
+ --------
207
+
208
+ ``pandas-charm `` got its name from the pandas library plus an acronym for
209
+ CHARacter Matrix.
210
+
211
+
211
212
License
212
213
-------
213
214
214
- pandas-charm is distributed under
215
- `the MIT license <https://opensource.org/licenses/MIT >`_.
215
+ `` pandas-charm `` is distributed under the
216
+ `MIT license <https://opensource.org/licenses/MIT >`_.
216
217
217
218
218
219
Citing
@@ -222,8 +223,24 @@ If you use results produced with this package in a scientific
222
223
publication, please just mention the package name in the text and
223
224
cite the Zenodo DOI of this project:
224
225
225
- .. image :: https://zenodo.org/badge/23107/jmenglund/pandas-charm.svg
226
- :target: https://zenodo.org/badge/latestdoi/23107/jmenglund/pandas-charm
226
+ |DOI-URI |
227
227
228
228
You can select a citation style from the dropdown menu in the
229
- *"Cite as" * section on the Zenodo page.
229
+ "Cite as" section on the Zenodo page.
230
+
231
+
232
+ Author
233
+ ------
234
+
235
+ Markus Englund, `orcid.org/0000-0003-1688-7112 <http://orcid.org/0000-0003-1688-7112 >`_
236
+
237
+ .. |Build-Status | image :: https://travis-ci.org/jmenglund/pandas-charm.svg?branch=master
238
+ :target: https://travis-ci.org/jmenglund/pandas-charm
239
+ .. |Coverage-Status | image :: https://codecov.io/gh/jmenglund/pandas-charm/branch/master/graph/badge.svg
240
+ :target: https://codecov.io/gh/jmenglund/pandas-charm
241
+ .. |PyPI-Status | image :: https://img.shields.io/pypi/v/pandas-charm.svg
242
+ :target: https://pypi.python.org/pypi/pandas-charm
243
+ .. |License | image :: https://img.shields.io/pypi/l/pandas-charm.svg
244
+ :target: https://raw.githubusercontent.com/jmenglund/pandas-charm/master/LICENSE.txt
245
+ .. |DOI-URI | image :: https://zenodo.org/badge/23107/jmenglund/pandas-charm.svg
246
+ :target: https://zenodo.org/badge/latestdoi/23107/jmenglund/pandas-charm
0 commit comments