Skip to content

Repository files navigation

STRINGDB analyser

A quick way to analyse gene/protein sets to investigate networks and functional enrichment.

It comes in two different flavors:

  • string_api_net_enrich.py: This scripts inputs a list of genes from E. coli or humans in txt format (each gene or protein in a new line), and outputs a network image in svg, a summary of the categories from the different enrichments, and an excel file with all the enrichment information. It will also create radar plots for the most common words for each enrichment category (if any). The file example.txt has a list of genes that can be used to test the script.
  • string_api_MULTI.py: This scripts inputs a list of genes from E. coli or humans in excel format. This script is intended to use with gene/protein lists that are UP-regulated and DOWN-regulated. Each direction must be in different Excel sheets, with a sheet name finised in _UP' or _DOWN'. For example, sample1_UP and sample1_DOWN. More than one sample can be included in the same Excel file, the script will save each sample in separate subfolders with specific names. The list of genes/proteins MUST have a header named genes. The file multi_test serves as an example for this script. The script will analyse these samples and directions in a very similar way as the simple script, but creating subfolders for each sample within the Excel file.

Requirements

This script runs in Python >3.6 and requires the following libraries: pandas, requests, seaborn,numpy, openpyxl and matplotlib.

There are several ways to install these dependencies. You can either use pip

pip install pandas

Or my favourite way to do these things, through a conda env:

conda install pandas

You can install all these libraries at once:

conda install pandas requests seaborn numpy openpyxl matplotlib -y

Example of use

Go to the folder where you should have both the script and the file you want to analyse (for convenience), and type the following:

python string_api_net_enrich.py example.txt out_folder ecoli

And for the other script, the same:

python string_api_MULTI.py multi_test.xlsx out_folder ecoli

Change input and output for your input file, and your desired output filename. Right now it allows to specify either E. coli, Homo sapiens, C. elegans, Mus musculus, D. melanogaster, Dario rerio, Saccharomyces cerevisiae as species (type ecoli or human respectively).

Here is the list of organisms accepted at this moment in the code

Species list code
E. coli ecoli
Homo sapiens human
C. elegans celegans
Mus musculus mouse
D. melanogaster fly
Dario rerio zebrafish
Saccharomyces cerevisiae yeast
Pseudomonas aeruginosa PAO1 PA

This is an example of the radar plots it's able to extract:

alt text

Google colab version

There is a version in Google Colab if you are a bit lazy

Open In Colab

To do

  • generalise funtions into classes
  • include more analyses and plots (heatmaps, semantic space of GO terms...)
  • make word frequency more smart -> concept over words
  • [long term] build all functions in different files, tidy everything

Next action

To adapt the script to two cases (usually up and down regulation)

About

A quick way to analyse gene/protein sets to investigate networks and functional enrichment.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages