Skip to content

Commit 95c907e

Browse files
Misc doc updates
1 parent 24fc5fe commit 95c907e

File tree

6 files changed

+65
-50
lines changed

6 files changed

+65
-50
lines changed

README.rst

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ a ``True`` value. Integers and floats are handled exactly as you'd expect::
5858
>>> print record.INFO['AF']
5959
[0.5]
6060

61-
There are a number of convienience methods and properties for each ``Record`` allowing you to
61+
There are a number of convenience methods and properties for each ``Record`` allowing you to
6262
examine properties of interest::
6363

6464
>>> print record.num_called, record.call_rate, record.num_unknown
@@ -142,19 +142,31 @@ ALT records are actually classes, so that you can interrogate them::
142142
>>> print bnd.withinMainAssembly, bnd.orientation, bnd.remoteOrientation, bnd.connectingSequence
143143
True False True T
144144

145-
Random access is supported for files with tabix indexes. This requires the pysam module as a dependency. Simply call fetch for the region you are interested in::
145+
The Reader supports retrieval of records within designated regions for files
146+
with tabix indexes via the fetch method. This requires the pysam module as a
147+
dependency. Pass in a chromosome, and, optionally, start and end coordinates,
148+
for the regions of interest::
146149

147150
>>> vcf_reader = vcf.Reader(filename='vcf/test/tb.vcf.gz')
148-
>>> for record in vcf_reader.fetch('20', 1110696, 1230237): # doctest: +SKIP
151+
>>> # fetch all records on chromosome 20 from base 1110696 through 1230237
152+
>>> for record in vcf_reader.fetch('20', 1110695, 1230237): # doctest: +SKIP
149153
... print record
150154
Record(CHROM=20, POS=1110696, REF=A, ALT=[G, T])
151155
Record(CHROM=20, POS=1230237, REF=T, ALT=[None])
152156

153-
Or extract a single row::
157+
Note that the start and end coordinates are in the zero-based, half-open
158+
coordinate system, similar to ``_Record.start`` and ``_Record.end``. The very
159+
first base of a chromosome is index 0, and the the region includes bases up
160+
to, but not including the base at the end coordinate. For example::
154161

155-
>>> print vcf_reader.fetch('20', 1110696) # doctest: +SKIP
156-
Record(CHROM=20, POS=1110696, REF=A, ALT=[G, T])
162+
>>> # fetch all records on chromosome 4 from base 11 through 20
163+
>>> vcf_reader.fetch('4', 10, 20) # doctest: +SKIP
157164

165+
would include all records overlapping a 10 base pair region from the 11th base
166+
of through the 20th base (which is at index 19) of chromosome 4. It would not
167+
include the 21st base (at index 20). (See
168+
http://genomewiki.ucsc.edu/index.php/Coordinate_Transforms for more
169+
information on the zero-based, half-open coordinate system.)
158170

159171
The ``Writer`` class provides a way of writing a VCF file. Currently, you must specify a
160172
template ``Reader`` which provides the metadata::
@@ -164,8 +176,6 @@ template ``Reader`` which provides the metadata::
164176
>>> for record in vcf_reader:
165177
... vcf_writer.write_record(record)
166178

167-
168179
An extensible script is available to filter vcf files in vcf_filter.py. VCF filters
169180
declared by other packages will be available for use in this script. Please
170181
see :doc:`FILTERS` for full description.
171-

docs/API.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,43 +14,43 @@ vcf.Writer
1414
:members:
1515

1616
vcf.model._Record
17-
-----------
17+
-----------------
1818

1919
.. autoclass:: vcf.model._Record
2020
:members:
2121

2222
vcf.model._Call
23-
---------
23+
---------------
2424

2525
.. autoclass:: vcf.model._Call
2626
:members:
2727

2828
vcf.model._AltRecord
29-
-----------
29+
--------------------
3030

3131
.. autoclass:: vcf.model._AltRecord
3232
:members:
3333

3434
vcf.model._Substitution
35-
-----------
35+
-----------------------
3636

3737
.. autoclass:: vcf.model._Substitution
3838
:members:
3939

4040
vcf.model._SV
41-
-----------
41+
-------------
4242

4343
.. autoclass:: vcf.model._SV
4444
:members:
4545

4646
vcf.model._SingleBreakend
47-
-----------
47+
-------------------------
4848

4949
.. autoclass:: vcf.model._SingleBreakend
5050
:members:
5151

5252
vcf.model._Breakend
53-
-----------
53+
-------------------
5454

5555
.. autoclass:: vcf.parser._Breakend
5656
:members:

docs/HISTORY.rst

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ Development
22
===========
33

44
Please use the `PyVCF repository <https://github.com/jamescasbon/PyVCF/>`_.
5-
Pull requests gladly accepted.
5+
Pull requests gladly accepted.
66
Issues should be reported at the github issue tracker.
77

88
Running tests
99
-------------
1010

1111
Please check the tests by running them with::
1212

13-
python setup.py test
13+
python setup.py test
1414

1515
New features should have test code sent with them.
1616

@@ -20,7 +20,7 @@ Changes
2020
0.6.7 Release
2121
-------------
2222

23-
* Include missing .pyx files
23+
* Include missing .pyx files
2424

2525
0.6.6 Release
2626
-------------
@@ -56,17 +56,17 @@ Changes
5656
-------------
5757

5858
* cython port of #79
59-
* correct writing of meta lines #84
59+
* correct writing of meta lines #84
6060

6161
0.6.2 Release
6262
-------------
6363

64-
* issues #78, #79 (thanks Sean, Brad)
64+
* issues #78, #79 (thanks Sean, Brad)
6565

6666
0.6.1 Release
6767
-------------
6868

69-
* Add strict whitespace mode for well formed VCFs with spaces
69+
* Add strict whitespace mode for well formed VCFs with spaces
7070
in sample names (thanks Marco)
7171
* Ignore blank lines in files (thanks Martijn)
7272
* Tweaks for handling missing data (thanks Sean)
@@ -76,24 +76,24 @@ Changes
7676
0.6.0 Release
7777
-------------
7878

79-
* Backwards incompatible change: _Call.data is now a
79+
* Backwards incompatible change: _Call.data is now a
8080
namedtuple (previously it was a dict)
81-
* Optional cython version, much improved performance.
81+
* Optional cython version, much improved performance.
8282
* Improvements to writer (thanks @cmclean)
8383
* Improvements to inheritance of classes (thanks @lennax)
8484

8585

8686
0.5.0 Release
8787
-------------
8888

89-
VCF 4.1 support:
90-
* support missing genotype #28 (thanks @martijnvermaat)
91-
* parseALT for svs #42, #48 (thanks @dzerbino)
89+
* VCF 4.1 support:
90+
- support missing genotype #28 (thanks @martijnvermaat)
91+
- parseALT for svs #42, #48 (thanks @dzerbino)
9292
* `trim_common_suffix` method #22 (thanks @martijnvermaat)
9393
* Multiple metadata with the same key is stored (#52)
94-
Writer improvements
95-
* A/G in Number INFO fields #53 (thanks @lennax)
96-
* Better output #55 (thanks @cmclean)
94+
* Writer improvements:
95+
- A/G in Number INFO fields #53 (thanks @lennax)
96+
- Better output #55 (thanks @cmclean)
9797
* Allow malformed INFO fields #49 (thanks @ilyaminkin)
9898
* Added bayes factor error bias VCF filter
9999
* Added docs on vcf_melt
@@ -103,14 +103,14 @@ Writer improvements
103103
0.4.6 Release
104104
-------------
105105

106-
* Performance improvements (#47)
106+
* Performance improvements (#47)
107107
* Preserve order of INFO column (#46)
108108

109109
0.4.5 Release
110110
-------------
111111

112-
* Support exponent syntax qual values (#43, #44) (thanks @martijnvermaat)
113-
* Preserve order of header lines (#45)
112+
* Support exponent syntax qual values (#43, #44) (thanks @martijnvermaat)
113+
* Preserve order of header lines (#45)
114114

115115
0.4.4 Release
116116
-------------
@@ -139,15 +139,15 @@ Writer improvements
139139
0.4.0 Release
140140
-------------
141141

142-
* Package structure
142+
* Package structure
143143
* add ``vcf.utils`` module with ``walk_together`` method
144-
* samtools tests
144+
* samtools tests
145145
* support Freebayes' non standard '.' for no call
146-
* fix vcf_melt
146+
* fix vcf_melt
147147
* support monomorphic sites, add ``is_monomorphic`` method, handle null QUALs
148-
* filter support for files with monomorphic calls
148+
* filter support for files with monomorphic calls
149149
* Values declared as single are no-longer returned in lists
150-
* several performance improvements
150+
* several performance improvements
151151

152152

153153
0.3.0 Release
@@ -170,14 +170,14 @@ Documentation release
170170

171171
* Add shebang to vcf_filter.py
172172

173-
0.2 Release
173+
0.2 Release
174174
-----------
175175

176176
* Replace genotype dictionary with a ``Call`` object
177177
* Methods on ``Record`` and ``Call`` (thanks @arq5x)
178178
* Shortcut parse_sample when genotype is None
179179

180-
0.1 Release
180+
0.1 Release
181181
-----------
182182

183183
* Added test code
@@ -188,7 +188,7 @@ Documentation release
188188
* Allow opening by filename as well as filesocket
189189
* Support fetching rows for tabixed indexed files
190190
* Performance improvements (see ``test/prof.py``)
191-
* Added extensible filter script (see FILTERS.md), vcf_filter.py
191+
* Added extensible filter script (see FILTERS.md), vcf_filter.py
192192

193193
Contributions
194194
=============
@@ -197,4 +197,3 @@ Project started by @jdoughertyii and taken over by @jamescasbon on 12th January
197197
Contributions from @arq5x, @brentp, @martijnvermaat, @ian1roberts, @marcelm.
198198

199199
This project was supported by `Population Genetics <http://www.populationgenetics.com/>`_.
200-

docs/INTRO.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
Introduction
22
============
33

4-
.. automodule:: vcf
5-
4+
.. include:: ../README.rst

vcf/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
#!/usr/bin/env python
2+
"""
3+
A VCFv4.0 and 4.1 parser for Python.
4+
5+
Online version of PyVCF documentation is available at http://pyvcf.rtfd.org/
6+
"""
7+
28

39
from vcf.parser import Reader, Writer
410
from vcf.parser import VCFReader, VCFWriter

vcf/model.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ def nucl_diversity(self):
330330
331331
Derived from:
332332
\"Population Genetics: A Concise Guide, 2nd ed., p.45\"
333-
John Gillespie.
333+
John Gillespie.
334334
"""
335335
# skip if more than one alternate allele. assumes bi-allelic
336336
if len(self.ALT) > 1:
@@ -467,13 +467,14 @@ def var_type(self):
467467
def var_subtype(self):
468468
"""
469469
Return the subtype of variant.
470+
470471
- For SNPs and INDELs, yeild one of: [ts, tv, ins, del]
471-
- For SVs yield either "complex" or the SV type defined
472-
in the ALT fields (removing the brackets).
473-
E.g.:
474-
<DEL> -> DEL
475-
<INS:ME:L1> -> INS:ME:L1
476-
<DUP> -> DUP
472+
- For SVs yield either "complex" or the SV type defined in the ALT
473+
fields (removing the brackets). E.g.::
474+
475+
<DEL> -> DEL
476+
<INS:ME:L1> -> INS:ME:L1
477+
<DUP> -> DUP
477478
478479
The logic is meant to follow the rules outlined in the following
479480
paragraph at:

0 commit comments

Comments
 (0)