1. Setup Install R, if it is not already installed. NOTE: PAST is written in R and, therefore, requires that its users have R installed. At the time of this writing, installing PAST directly from Bioconductor requires R4.0. Older versions of PAST can be installed from Bioconductor for R3.6, and PAST can be installed from Github for users with R3.5. R installation instructions can be downloaded from the following link: https://www.r-project.org/. Install the latest version of RStudio Desktop or update RStudio (optional). NOTE: RStudio is a helpful environment for working with the R language. Its installation is recommended, especially for those who choose to run PAST in the command line rather than through the Shiny GUI application. RStudio and its installation instructions can be found at the following link: https://rstudio.com/products/rstudio/. Install PAST from Bioconductor11 by following the instructions on Bioconductor. NOTE: Installation through Bioconductor should handle the installation of PAST's dependencies. Additionally, PAST can be installed from Github12, but installing from Github will not install dependencies automatically. Install PAST Shiny (optional). Download the file "app.R" from the Releases page of the Github repository: https://github.com/IGBB/PAST/releases/, and remember where the downloaded file is located. NOTE: PAST can be used by calling its methods directly with R, but users who are less familiar with R can run the PAST Shiny application, which provides a guided user interface. PAST Shiny is an R script available in the shiny_app branch of the PAST Github repository. PAST Shiny will attempt to install its dependencies during the first run. Begin analysis by starting the application in one of the three ways described below. PAST Shiny with RStudio Using RStudio, create a new project in the folder where app.R is located. Click File | New Project and select that folder. Once a new project has been created, open the app.R file downloaded earlier. RStudio recognizes that app.R is a Shiny app and creates a Run App button on the bar above the displayed source code. Click Run App. RStudio will then launch a window that displays the PAST Shiny application. PAST Shiny with R Console Launch R and run the following code to start the PAST Shiny application: shiny::runApp('path/to/folder/with/shiny/app.R'. Replace the text in quotes with the folder to which app.R was downloaded, and keep the quotes. PAST without R Shiny Run library(PAST) in an R Console to load PAST. 2. Customize Shiny analysis (optional) Change the analysis title from "New Analysis" to something that better reflects the type of analysis being run which helps to keep track of multiple analyses (see Figure 1). Figure 1. Please click here to view a larger version of this figure. Modify the number of cores and the mode. Set the number of cores to any number between 1 and the total number on the machine but be aware that devoting more resources to PAST may slow down other operations on the machine. Set the mode based on the description in section 6. 3. Load GWAS data NOTE: Verify that the GWAS data is tab delimited. Ensure that the association file contains the following columns: trait, marker name, locus or chromosome, position on the chromosome, p-value, and R2 value for the marker. Ensure that the effects file contains the following columns: trait, marker name, locus or chromosome, position on the chromosome, and effect. The order of these columns is not important, as the user can specify the names of the columns when loading the data. Any additional columns are ignored. TASSEL13 can be used to produce these files. Load GWAS data with PAST Shiny. Select an association file and an effects file by using the Association File and Effects File selection boxes. Change the column names in the Association Column Name and Effects Columns Name input boxes below the file selection boxes to reflect the column names in the data. Figure 2. Please click here to view a larger version of this figure. Load GWAS data with PAST in the R Console. Modify and run the following code: gwas_data = load_GWAS_data("path/to/association_file.tsv", "path/to/effects_file.tsv", association_columns = c("Trait", "Marker", "Locus", "Site", "p", "marker_R2"), effects_columns = c("Trait", "Marker", "Locus", "Site", "Effect") NOTE: Change the paths to the actual location of the GWAS files. The values provided for association_columns and effects_columns are the default values. If the names do not match the default values, specify the column names. Otherwise, these can be omitted. 4. Load linkage disequilibrium (LD) data NOTE: Verify that the linkage disequilibrium (LD) data is tab delimited and contains the following types of data: Locus, Position1, Site1, Position2, Site2, Distance in base pairs between Position1 and Position2, and R2 value. Load LD data with PAST Shiny. Select the file containing LD data. Change the column names in the LD Column Names input boxes below the file selection box to match the column names in the LD data if necessary. Figure 3. Please click here to view a larger version of this figure. Load LD Data with PAST in the R Console. Modify and run the following code to load LD data: LD = load_LD("path/to/LD.tsv", LD_columns = c("Locus1", "Position1", "Site1", "Position2", "Site2", "Dist_bp", "R.2") NOTE: Change the path to the actual location of the LD file. The values provided for LD_columns are the default values. If the names do not match these defaults, specify the correct names of the columns; otherwise, these can be omitted. 5. Assign SNPs to genes NOTE: Download or otherwise locate annotations in GFF format. These annotations can often be found in online databases for specific organisms. Be cautious about low quality annotations, as the quality of the annotations data will affect the quality of the pathway analysis. Confirm that the first column of these annotations (the chromosome) matches the format of the locus/chromosome in the association, effects, and LD data. For example, the annotations should not call the first chromosome "chr1" if the GWAS and LD data files call the first chromosome "1". Assign SNPs to genes with PAST Shiny. NOTE: More information about determining an appropriate R2 cutoff can be found in Tang et al.6, in the section called "SNP to gene algorithm for the pathway analysis". Select the file containing GFF annotations. Consider what window size and R2 cutoff are most suitable for the species being considered and modify if the defaults do not suit the uploaded data. NOTE: Default values in PAST primarily reflect values appropriate for maize. The number of cores set at the beginning of the PAST Shiny analysis (Step 2.2) is used in this step. Figure 4. Please click here to view a larger version of this figure. Assign SNPs to genes with PAST in the R Console. Modify and run the following code to assign SNPs to genes: genes = assign_SNPs_to_genes(gwas_data, LD, "path/to/annotations.gff", c("gene"), 1000, 0.8, 2) NOTE: In this sample code, several default suggestions are provided: 1000 is the size of the window around the SNP to search for genes; 0.8 is the cutoff value for R2; 2 is the number of cores used for parallel processing. The path to the annotations should also be changed to the actual location of the annotations file. 6. Discover significant pathways NOTE: Verify that the pathways file contains the following data in tab delimited format, with one line for every gene in each pathway: pathway ID – an identifier such as "PWY-6475-1"; pathway description – a lengthier description of what the pathways do such as "trans-lycopene biosynthesis"; gene – a gene in the pathway, which should match the names provided in the annotations. Pathway information can likely be found in online databases for specific organisms, such as MaizeGDB. The second user-specified option is the mode. "Increasing" refers to phenotypes that reflect when an increasing value of the measured trait is desirable, such as yield, while "decreasing" refers to a trait where a decrease in the measured values is beneficial, such as insect damage ratings. The significance of pathways is tested using previously described methods4,6,14. Discover significant pathways with PAST Shiny. Select the file containing pathways data and be sure that the mode is selected in the analysis options. If necessary, change the number of genes that must be in a pathway to retain it for the analysis and the number of permutations used to create the null distribution to test significance of effect. Figure 5. Please click here to view a larger version of this figure. NOTE: The number of cores and the mode set at the beginning of the PAST Shiny analysis (Step 2.2) is used in this step. The default number of genes is currently set at 5 genes, so pathways with fewer known genes will be removed. The user can lower this value to 4 or 3, to include shorter pathways, but doing so will risk false positive results. Increasing this value can increase the power of the analysis but will remove more pathways from the analysis. Changing the number of permutations used increases and decreases the power of the test. Discover significant pathways with PAST in the R Console. Modify and run the following code to discover significant pathways: rugplots_data <- find_pathway_significance(genes, "path/to/pathways.tsv", 5, "increasing", 1000, 2) NOTE: In this sample code, several suggested defaults are provided. 5 is the minimum number of genes that must be in a pathway in order to keep the pathway in the analysis, increasing refers to an increasing amount of the measured trait (it is recommended that the user run both increasing and decreasing, regardless of trait; data interpretation will differ for the two, however), 1000 is the number of times to sample the effects to determine the null distribution, and 2 is the number of cores used for parallel processing. Change the path to the actual location of the pathways file. 7. View Rugplots View Rugplots with PAST Shiny. Once all inputs are uploaded and set, click Begin Analysis. A progress bar will appear and indicate which step of the analysis was last completed. When the analysis completes, PAST Shiny will switch to the Results tab. A table of results will be displayed in the left column (labeled "pathways") and the Rugplots will be displayed in the right column (labeled "plots"). Use the slider to control the filtering parameters. When the filtering level is satisfactory, click the Download Results button at the bottom left to download all images and tables individually to a ZIP file that is named with the analysis title. This ZIP file contains the filtered table, the unfiltered table, and one image per pathway in the filtered table. Figure 6. Please click here to view a larger version of this figure. Figure 7. Please click here to view a larger version of this figure. View Rugplots with PAST in the R Console Modify and run the following code to save the results: plot_pathways(rugplots_data, "pvalue", 0.02, "increasing", "output_folder") NOTE: In this sample code, several suggested defaults are provided. pvalue provides the data that can be used for filtering insignificant pathways after a significance threshold is chosen by the user; 0.02 is the default value used in filtering, and increasing refers to an increasing amount of the measured trait (it is recommended that the user run both increasing and decreasing, regardless of trait; data interpretation will differ for the two, however); output_folder is the folder where the images and tables will be written (this folder must exist prior to running the function). A table of filtered results, the unfiltered results, and individual images for every pathway in the filtered results are written to this folder.