Skip to main content

Counts file library

This python library cflib provides scripts to convert between fasta, VCF and counts files. Counts files are used by PoMo, an implementation of a polymorphism-aware phylogenetic model. We advice you to use PoMo implemented in IQ-TREE.

For a reference, please see and cite:

Schrempf, D., Minh, B. Q., De Maio, N., von Haeseler, A., &
Kosiol, C. (2016). Reversible Polmorphism-Aware Phylotenetic
Models and their Application to Tree Inference. Journal of
Theoretical Biology, in press.

Requirements

cflib requires python (Version 3.x) to be installed. cflib also uses the following python libraries that will be automatically pulled when installing cflib:

Installation

Install cflib and the conversion scripts with

pip install --user cflib-pomo

Note that the name of cflib on the PyPI repository (which is used by pip) is cflib-pomo, since the name cflib was taken!

If the standard Python version of your operation system is still 2.x (e.g., OSX), make sure that you use, pip3.

The --user flag is optional and tells Python to install cflib and the scripts only for this user but not system wide.

If you want to uninstall cflib,

pip uninstall cflib-pomo

The [conversion scripts](#Conversion scripts) should be directly available if your PATH environment variable is setup correctly. For my Linux installation, the Python path ~/.local/bin had to be included. This may vary for your operating system.

Example

Sample data can be found in examples. Assuming that have installed cflib we will now convert example.fasta to a counts file named example_from_fasta.cf. The script that we will use is called FastaToCounts.py. First, we have a look at the help message:

FastaToCounts.py --help
usage: FastaToCounts.py [-h] [-v] [--iupac] fastaFile output

Convert fasta to counts format.

The (aligned) sequences in the fasta file are read in and the data is
written to a counts format file.

Sequence names are stripped at the first dash.  If the stripped
sequence name coincide, individuals are put into the same population.

E.g., homo_sapiens-XXX and homo_sapiens-YYY will be in the same
population homo_sapiens.

Take care with large files, this uses a lot of memory.

The input as well as the output files can additionally be gzipped
(indicated by a .gz file ending).

If heterozygotes are encoded with IUPAC codes (e.g., 'r' for A or G),
homozygotes need to be counted twice so that the level of polymorphism
stays correct.  This can be done with the `--iupac` flag.

positional arguments:
  fastaFile      path to (gzipped) fasta file
  output         name of (gzipped) outputfile in counts format

optional arguments:
  -h, --help     show this help message and exit
  -v, --verbose  turn on verbosity (-v or -vv)
  --iupac        heteorzygotes are encoded with IUPAC codes

As requested, the sequence names in example.fasta are, e.g., Sheep-1, Sheep-2, and so on. The following code converts the file example.fasta into the counts file example_from_fasta.cf:

FastaToCounts.py example.fasta example_from_fasta.cf

Note on IUPAC codes

IUPAC codes are supported and handled adequately.

In particular,

  • N can be used to denote any base or that the base is unknown; the letter * can also be used in this case, although it is non-standard;

  • - or . denote a gap or a deletion.

Also the other IUPAC codes are supported.

Conversion scripts

  • CountsToFasta.py: Convert a counts file to a fasta file.
  • FastaToCounts.py: Convert a fasta file to counts format.
  • FastaToVCF.py: Convert a fasta file to variant call format.
  • FastaVCFToCounts.py: Convert a fasta reference with VCF files to counts format.
  • FilterMSA.py: Filter a multiple sequence alignment file (apply standard filters; cf. libPoMo).
  • GPToCounts.py: Experimental. Convert gene prediction files with reference to counts format.
  • MSAToCounts.py: Convert multiple sequence alignments with VCF files to counts format.

Each script comes with its own documentation. Please execute, e.g.,

FastaToCounts.py --help

All conversion scripts can be found in the scripts folder.

Documentation

If you are interested in cflib itself, please refer to the cflib reference manual.

Metadata

Release files for cflib-pomo 1.3.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cflib-pomo 1.3.0.0
File Size Uploaded
cflib-pomo-1.3.0.0.tar.gz 680.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cflib-pomo 1.3.0.0
File Interpreter ABI Platform
cflib_pomo-1.3.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 728.5 kB

Release files / cflib-pomo-1.3.0.0.tar.gz

Download URL cflib-pomo-1.3.0.0.tar.gz
Size 680.9 kB
Tags Source
SHA-256 checksum
How to use checksums
da5bf473f56c040c0fd36fb590b5944bfcdbc071c9472ad301a8b2df2c82e700
BLAKE2b-256 checksum
How to use checksums
f348d5042188ec38f299da9b38ef0e9b322c2b799847a0cd1a995ba16df12ad4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.1.post0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.7

Release files / cflib_pomo-1.3.0.0-py3-none-any.whl

Download URL cflib_pomo-1.3.0.0-py3-none-any.whl
Size 47.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a219f4bc73a795824bea25c3d2e9222c8b67319359fe7798ef7b08b62658dd88
BLAKE2b-256 checksum
How to use checksums
0c829a8ef1756667aed6ed6a415c8e7de486ade3e4d4620b183bef622a82756f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.1.post0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.7

Release history Release notifications | RSS feed

This release

1.3.0.0 This release

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2

2 release files

1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page