unifier.py

Reads groups files, rename and join them into a main fasta file

Usage

You can run this script from command line passing args or using a configuration file

Command line

You can read help message running unifier.py -h:

usage: unifier.py [-h] [--taxon TAXON] [--ids_file IDS_FILE]
                  [--discriminate_groups {yes,no,both}] [--log LOG]
                  [--output_dir OUTPUT_DIR] [--conf CONF]

Unifier - unify files into main organism FASTA file and rename it

optional arguments:
  -h, --help            show this help message and exit
  --taxon TAXON         taxonomic ID
  --ids_file IDS_FILE   Groups descendants from taxon parameter to be
                        considered
  --discriminate_groups {yes,no,both}
                        Output filepath
  --log LOG             Log output
  --output_dir OUTPUT_DIR
                        Output dir
  --conf CONF           Configuration file

Read groups files, rename them and join into a main fasta file

An command example:

unifier.py --taxon txid1980416 --ids_file ids_file.txt --discriminate_groups both --output_dir output

Config file

You can use a configuration file with this content:

[Unifier]
log = unifier.log
taxon = 1980416
ids_file = ids.txt
discriminate_groups = both

In first line, you're setting between "[]" the section, organism script use "Unifier" section to get parameters. After that, everything is parameter = value (until it finds another section), they're the same parameters from help message without "--" before the keys.
Run script using:

organism.py --conf example.conf

Functions

This script have the following functions

add_prefix()

Return fasta content with headers prefixed

Parameters Type Description
fasta str FASTA content
prefix str Prefix to be added

get_name_from_taxon()

Return name based on taxon ID

Parameters Type Description
taxon str Taxon ID or Organism name