Skip to content

Commit

Permalink
+ document how to run bcftools commands from pysam
Browse files Browse the repository at this point in the history
  - this wasn't explicitly stated in the documentation.  I was
    using the notes described in [github issue 958][0] as a guide.

[0]: pysam-developers#958
  • Loading branch information
indraniel committed Mar 31, 2024
1 parent cdc0ed1 commit 5dc5a4c
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions doc/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,25 @@ Note that this means that output from commands which produce output on
stdout will not be available. The only solution is to run samtools
commands through subprocess.

=====================================
Using bcftools commands within python
=====================================

Commands available in `bcftools`_ are also available as simple
function calls, but they are invoked slightly differently from `samtools`_.
Command line options are also provided as arguments. For
example::

import pysam.bcftools as bcftools
bcftools.reheader("-s", "samples.txt", "-o", "out.vcf.gz", "in.vcf.gz", catch_stdout=False)

corresponds to the command line::

bcftools reheader -s samples.txt -o out.vcf.gz in.vcf.gz

If the `catch_stdout=False`_ option is not specified, then the output of the
`bcftools`_ command will be returned as a variable

================================
Working with tabix-indexed files
================================
Expand Down

0 comments on commit 5dc5a4c

Please sign in to comment.