TITLE: Using polyan: a Python package for modelling polysome profiles from ribosome density data
AUTHORS: Tobias von der Haar

[DESCRIPTION]
<div class = "text-blocks"><div class = "text-block">The assessment of transcriptome-wide ribosome binding to mRNAs is useful for studying the dynamic regulation of protein synthesis in living cells. Two methods frequently applied in eukaryotic cells that operate at different levels of resolution are polysome profiling, which reveals the distribution of ribosome loads across the transcriptome, and ribosome footprinting (also termed ribosome profiling or Ribo-Seq), which when combined with appropriate data on mRNA expression levels can reveal ribosome densities on individual transcripts. we have provided Python functions for relating the information content of these two methods to one another, by reconstructing theoretical polysome profiles from ribosome footprinting data. Modelled polysomes are useful for assessing dataset quality in a simple, visual approach that is useful for validating and analysing ribosome footprinting datasets .</div></div>

[STEPS]
?. [General Functionality]
polyan provides Python functions for modelling polysome profiles from input data that specify transcript abundance and ribosome occupancy of transripts for an organism or cell. Typically, such data are intended to be the result of ribosome footprinting experiments, but in principle any experimental or computational technique that yields information on how many ribosomes are bound to the transcripts can be used as input.polyan currently provides three main functions: fp2poly() calculates peak volume information for a modelled polysome profile, based on a single input dataset. plot_poly() generates plotting coordinates for the modelled profile, which can then be plotted using standard Python plotting functions. nrmsd_profile() calculates a numerical value for the similarity between two polysome profiles.A fourth function, compare_profiles(), reads in ribosome density data for two conditions and maps the principal shifts between modelled polysome peaks between these two conditions, thereby providing a coarse road map of translational control under these conditions.
?. [General Functionality]
Example output from polyan is shown below, including a modelled polysome profile calculated from NCBI GEO dataset GSE87614 from Zinshteyn et al. 2017 (left), and the compare_profile() output for two datasets from Nedialkova and Leidel 2015 (right), mapping the major upward and downward movement of mRNAs upon treatment with rapamycin.
?. [Prerequisites]
polyan has been tested on Windows and Linux systems running Python 3.7.6, which was installed as part of the Anaconda package. However, polyan should run in all Python 3-based environments.polyan has a number of dependencies on other packages, all of which should be available as part of any standard python installation, including pandas, numpy, pyplot, scipy and json.
?. [Installation]
The polyan package is available from pypi using the pip installer, which is included with most Python distributions. For installation , executeWhere Python was installed as part of Anaconda in windows, this command may need to be executed in an Anaconda prompt window rather than a general command prompt window.
?. [Installation]
Import polyan into your Python environment by executing
?. [Data preparation]
polyan requires the source data to be formatted as a Pandas dataframe, which needs to contain at least two columns for gene names and Ribo-Seq data, and may contain a third column for RNA-Seq data. Where no RNA abundance data are specified, a reference dataset is used for RNA abundances. The dataframe can contain additional columns but this will result in a warning of columns not being used for calculations.Dataset columns must be in the order gene names, Ribo-Seq data, RNA-Seq data. The Seq data must be provided as counts per gene (ie not as RPK or RPKM values which are normalised to gene length). Recommended gene names are systematic gene names for yeast (eg YAL005C), and ENSEMBL gene names for human genes (eg ENSG00000210100). Conventional gene names or systematic transcript names may work as well.An example yeast dataset is attached (  ), which if present in the working directory can be loaded into a dataframe by executing
?. [Data preparation]
At the time of publication, polyan provides support datasets for Saccharomyces cereisiae and for human HEK293 cells. It is possible to use polyan with any other organism, but then support datasets need to be provided by the user including a reference list of gene names with corresponding transcript lengths.
?. [Modelling polysome profiles]
Polysome profiles can be modelled by consecutive execution of the fp2poly() and plot_poly() functions, followed by plotting of the x and y coordinates returned by plot_poly() using general plotting packages such as pyplot. The default settings of fp2poly() work on yeast data including RNA-Seq data as part of the dataset and conforming to the requirements explained in steps 6-8, as is the case for the dataset loaded in step 6. Provided that polyan has been installed and imported correctly, peak volumes for this dataset can be generated by executingand coordinates for the polysome trace can be calculated from peak_vols by executing"trace" is a list containing two vectors corresponding to the x- and y-axis coordinates, respectively.These coordinates can then be plotted  via any suitable plotting package. The example output shown in step 2 can be reproduced using pyplot by executing
?. [Mapping movement between polysome peaks]
Changes in ribosome density between two conditions can be mapped using the compare_profiles() function of polyan. the results are trturned as pyplot fig and ax objects, which can be visualised using the plt.show() function of pyplot. To compare how transcripts shift between modelled polysome peaks eg when comparing  two datasets stored in two dataframes df1 and df2, execute The example output shown in step 2 was generated by comparing datasets  and  , from the data by Nedialkova and Leidel (2015).
?. [Changing parameters for fp2poly()]
Where datasets only contain gene names and Ribo_seq data, the inbuilt reference RNA dataset can be used by setting has_RNA to False.Where multiple dataset are being processed some of which contain RNA data and some of which don't, these can be processed using Python try and except.
?. [Changing parameters for fp2poly()]
fp2_poly currently provides context data (gene lengths and generic RNA abundance data) for S.cerevisiae and for HEK293 cells (the HEK293 parameters will likely work for many cultured human cell types if RNA-Seq data are provided as part of the dataset). Which parameter set to use is specified by the parset parameter, which can either be 'Scer' (default) or 'HEK'. To calculate peak volumes for a HEK293 dataset containing RNA-Seq data, the command isThe order of the column names must always be Gene names, then Ribosome density data, then RNA abundance data (if used).
?. [Calculating nRMSD]
To assess the similarity between two datasets, polyan.nrmsd_profile() can be used on two peak volume arrays calculated with fp2poly.It is also possible to calculate the nRMSD to an inbuilt reference profile, but then the organism must be specified by setting the parset parameter (currently 'Scer' or 'HEK', 'Scer' being default).The nRMSD expresses the similarity relative to the average similarity expected when two random profiles are drawn from the collection of datasets we used in our work. The intended use is for comparing candidate data against a "known good" dataset, in which case nRMSD values below 0.7 indicate that the modelled polysome profile of the candidate dataset is relatively similar to the "known good" reference, whereas values approaching or exceeding 1 indicate that the profiles are not similr and candidate dataset may be problematic. This assessment should be accompanied by a visual inspection of the modeled profiles using polyan.plot_poly() as shown above.