Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

0.2 version bump, update README

  • Loading branch information...
commit 5f9abe53f25b9191aeb40c1a7319f4edeac96d53 1 parent 6fd024d
James Casbon authored
Showing with 32 additions and 1 deletion.
  1. +30 −0 README.rst
  2. +1 −1  setup.py
  3. +1 −0  vcf_filter.py
30 README.rst
View
@@ -57,6 +57,18 @@ a ``True`` value. Integers and floats are handled exactly as you'd expect::
>>> print record.INFO['AF']
[0.5]
+There are a number of convienience functions for each ``Record`` allowing you to
+examine properties of interest::
+
+ >>> print record.num_called, record.call_rate, record.num_unknown
+ 3 1.0 0
+ >>> print record.num_hom_ref, record.num_het, record.num_hom_alt
+ 1 1 1
+ >>> print record.nucl_diversity, record.aaf
+ 0.6 0.5
+ >>> print record.get_hets()
+ [Call(sample=NA00002, GT=1|0)]
+
``record.FORMAT`` will be a string specifying the format of the genotype
fields. In case the FORMAT column does not exist, ``record.FORMAT`` is
``None``. Finally, ``record.samples`` is a list of dictionaries containing the
@@ -72,6 +84,24 @@ by sample name::
>>> print record.genotype('NA00001')['GT']
0|0
+The genotypes are represented by ``Call`` objects, which have three attributes: the
+corresponding Record ``site``, the sample name in ``sample`` and a dictionary of
+call data in ``data``::
+
+ >>> call = record.genotype('NA00001')
+ >>> print call.site
+ Record(CHROM=20, POS=17330, REF=T, ALT=['A'])
+ >>> print call.sample
+ NA00001
+ >>> print call.data
+ {'GT': '0|0', 'HQ': [58, 50], 'DP': [3], 'GQ': [49]}
+
+There are also a number of methods::
+
+ >>> print call.called, call.gt_type, call.gt_bases, call.phased
+ True 0 T|T True
+
+
Metadata regarding the VCF file itself can be investigated through the
following attributes:
2  setup.py
View
@@ -24,5 +24,5 @@
]
},
url='https://github.com/jamescasbon/PyVCF',
- version='0.1'
+ version='0.2'
)
1  vcf_filter.py
View
@@ -67,6 +67,7 @@ def __call__(self, record):
# TODO: flag that writes filter output into INFO column
# TODO: argument use implies filter use
# TODO: parallelize
+ # TODO: prevent plugins raising an exception from crashing the script
# dynamically build the list of available filters
Please sign in to comment.
Something went wrong with that request. Please try again.