Skip to main content

Typing of Staphylococcus aureus protein A from assemblies

Project description

spaTyper.py: Generate spa type identification

DOI

Version: 0.3.3

USAGE: spaTyper [-h] [-r REPEAT_FILE] [-o REPEAT_ORDER_FILE] [-d FOLDER] [-f FASTA [FASTA ...]] [-g GLOB] [--output OUTPUT] [-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. It downloads 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]
--output OUTPUT	Provide an output file or print by default using standard out.
--version             show program's version number and exit
--debug               Developer messages

Installation

It requires python 3. Install it using pip package (https://pypi.org/project/spaTyper/)

pip install spaTyper

or clone the repository and install it using setup.py

git clone https://github.com/JFsanchezherrero/spa_typing.git
cd spa_typing
pip install setup.py

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 = spaTyper.spa_typing.findPattern(qDict[i], seqDict, seqLengths, debug)
		if pattern:
			if j in pattern.keys():
				splitted = pattern[j].split('::')
				print("Sequence name: ",j, "Repeats:", splitted[2], "Repeat Type:", splitted[1], '\n')    

Copyright

Original code written by mjsull (https://github.com/mjsull/spa_typing)

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

DOI

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.3.3.tar.gz (157.7 kB view details)

Uploaded Source

Built Distribution

spaTyper-0.3.3-py3-none-any.whl (165.1 kB view details)

Uploaded Python 3

File details

Details for the file spaTyper-0.3.3.tar.gz.

File metadata

  • Download URL: spaTyper-0.3.3.tar.gz
  • Upload date:
  • Size: 157.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.6

File hashes

Hashes for spaTyper-0.3.3.tar.gz
Algorithm Hash digest
SHA256 885398b7a4044419430ec51464c6fe2267bdb6487c0fc945fde302145e659b0c
MD5 6c03971cde4c944d09cd0a55ab0bd135
BLAKE2b-256 5dabc0c69c52a945f2170e54fa3ad9647352ca53a8519515aa0c355b2ba02171

See more details on using hashes here.

File details

Details for the file spaTyper-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: spaTyper-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 165.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.6

File hashes

Hashes for spaTyper-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 cc990e16205716415797400c86f90c358acaccc311edc854d69acfd8acc27349
MD5 6723116baed284818f4b9a9fd098a894
BLAKE2b-256 8dee86f01f6c2be70aa7b5d5e71dbd4a34f4290808a7eefb1b136bbee76f8c3a

See more details on using hashes here.

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