Skip to main content

Typing of Staphylococcus aureus protein A from assemblies

Project description

spaTyper.py: Get spa types

Version: 0.2.1

License: GPLv3

USAGE: python3 spaTyper.py [-h] [-r REPEAT_FILE] [-o REPEAT_ORDER_FILE] [-d FOLDER] [-f FASTA [FASTA ...]] [-g GLOB] [-e] [--version] [--debug]

Prints spa type to stdout - egenomics letter combination and then the ridom spa type.

If multiple pcr products are found will print spa types for each product.

Will download sparepeats.fasta and spatypes.txt from the ridom server to repository directory if files not provided or already in directory.

optional arguments:
  -h, --help            show this help message and exit
  -r REPEAT_FILE, --repeat_file REPEAT_FILE
                        List of spa repeats
                        (http://spa.ridom.de/dynamic/sparepeats.fasta)
  -o REPEAT_ORDER_FILE, --repeat_order_file REPEAT_ORDER_FILE
                        List spa types and order of repeats
                        (http://spa.ridom.de/dynamic/spatypes.txt)
  -d FOLDER, --folder FOLDER
                        Folder to save downloaded files from Ridom/Spa server
  -f FASTA [FASTA ...], --fasta FASTA [FASTA ...]
                        List of one or more fasta files.
  -g GLOB, --glob GLOB  Uses unix style pathname expansion to run spa typing
                        on all files. If your shell autoexpands wildcards use
                        -f.
  -e, --do_enrich       Do PCR product enrichment. [Default: False]
  --version             show program's version number and exit
  --debug               Developer messages

Installation

Clone the repository or download the python script. In a future, pip download will be available.

Requires python 3

How it works

Given a fasta file or multiple fasta files, this script identifies the repeats and the order and generates a spa type.

The repeat sequences and repeat orders found on http://spaserver2.ridom.de/ are used to identify the spa type of each enriched sequence.

Ridom spa type and the egenomics repeat sequence are then reported back to the user.

If enriched option provided, the script searches for 50bp to 5000bp sequences produced by the following primer sets

TAAAGACGATCCTTCGGTGAG, CAGCAGTAGTGCCGTTTGCTT
AGACGATCCTTCGGTGAGC, GCTTTTGCAATGTCATTTACTG
ATAGCGTGATTTTGCGGTT, CTAAATATAAATAATGTTGTCACTTGGA
CAACGCAATGGTTTCATCCA, GCTTTTGCAATGTCATTTACTG

If an enriched sequence is found by a primer set, subsequent primer sets are not used.

Load it as a module

This scripts can be loaded and installed as a python module. Python 3 version only.

import spaTyper

## download file repeats   
repeat_file = spaTyper.utils.download_file_repeats(folder, False)

## download file repeats   
repeat_order_file = spaTyper.utils.download_file_types(folder, False)

## Get the SpaTypes in fasta sequences
seqDict, letDict, typeDict, seqLengths = spaTyper.spa_typing.getSpaTypes(repeat_file, repeat_order_file, False)

## read fasta file
fasta_file = "my_genome.fasta"
qDict = spaTyper.utils.fasta_dict(fasta_file)

## find pattern
for i in qDict.keys():
	pattern = findPattern_sequence(qDict[i], seqDict, seqLengths, debug)
	if pattern:
	    type_return = findPattern_type(pattern, letDict, typeDict, debug)
        splitted = type_return.split('::')
        print("Sequence name: ",j, "Repeats:", splitted[2], "Repeat Type:", splitted[1], '\n')    

Copyright

Original code written by mjsull.

Jose F. Sanchez-Herrero updated the code, change to python3, and set to use it as a module

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spaTyper-0.2.1.tar.gz (6.6 kB view hashes)

Uploaded Source

Built Distribution

spaTyper-0.2.1-py3-none-any.whl (10.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page