# HG changeset patch # User greg # Date 1496940949 14400 # Node ID c5846258c458919a75b228393b8a744dfd13b7fe Uploaded diff -r 000000000000 -r c5846258c458 .shed.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.shed.yml Thu Jun 08 12:55:49 2017 -0400 @@ -0,0 +1,11 @@ +name: plant_tribes_ks_distribution +owner: greg +description: | + Contains a tool that plots the distribution of synonymous substitution (Ks) rates and fits significant component(s). +homepage_url: https://github.com/dePamphilis/PlantTribes +long_description: | + Contains a tool that plots the distribution of synonymous substitution (Ks) rates and fits significant component(s). +remote_repository_url: https://github.com/gregvonkuster/galaxy_tools/tree/master/tools/plant_tribes/ks_distribution +type: unrestricted +categories: +- Phylogenetics diff -r 000000000000 -r c5846258c458 components.tabular --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/components.tabular Thu Jun 08 12:55:49 2017 -0400 @@ -0,0 +1,2 @@ +species n number_comp lnL AIC BIC mean variance porportion +species1 3 1 -3.4750 6.95 6.95 3.1183 5.7732 1.00 diff -r 000000000000 -r c5846258c458 kaks_input1.tabular --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kaks_input1.tabular Thu Jun 08 12:55:49 2017 -0400 @@ -0,0 +1,4 @@ +SEQ1 SEQ2 Ka Ks Ka\Ks +contig_241; contig_241 1.5312 7.1619 0.2138 +contig_300 contig_300; 0.8653 3.7872 0.2285 +contig_586 contig_586; 1.7791 1.1181 1.5912 diff -r 000000000000 -r c5846258c458 ks_distribution.R --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ks_distribution.R Thu Jun 08 12:55:49 2017 -0400 @@ -0,0 +1,163 @@ +#!/usr/bin/env Rscript + +suppressPackageStartupMessages(library("optparse")) + +option_list <- list( + make_option(c("-c", "--components_input"), action="store", dest="components_input", help="Ks significant components input dataset"), + make_option(c("-k", "--kaks_input"), action="store", dest="kaks_input", help="KaKs analysis input dataset"), + make_option(c("-o", "--output"), action="store", dest="output", help="Output dataset") +) + +parser <- OptionParser(usage="%prog [options] file", option_list=option_list) +args <- parse_args(parser, positional_arguments=TRUE) +opt <- args$options + + +get_num_components = function(components_data) +{ + # Get the max of the number_comp column. + number_comp = components_data[, 3] + num_components <- max(number_comp, na.rm=TRUE) + return(num_components) +} + +get_pi_mu_var = function(components_data, num_components) +{ + # FixMe: enhance this to generically handle any integer value for num_components. + if (num_components == 1) + { + pi <- c(components_data[1, 9]) + mu <- c(components_data[1, 7]) + var <- c(components_data[1, 8]) + } + else if (num_components == 2) + { + pi <- c(components_data[2, 9], components_data[3, 9]) + mu <- c(components_data[2, 7], components_data[3, 7]) + var <- c(components_data[2, 8], components_data[3, 8]) + } + else if (num_components == 3) + { + pi <- c(components_data[4, 9], components_data[5, 9], components_data[6, 9]) + mu <- c(components_data[4, 7], components_data[5, 7], components_data[6, 7]) + var <- c(components_data[4, 8], components_data[5, 8], components_data[6, 8]) + } + else if (num_components == 4) + { + pi <- c(components_data[7, 9], components_data[8, 9], components_data[9, 9], components_data[10, 9]) + mu <- c(components_data[7, 7], components_data[8, 7], components_data[9, 7], components_data[10, 7]) + var <- c(components_data[7, 8], components_data[8, 8], components_data[9, 8], components_data[10, 8]) + } + else if (num_components == 5) + { + pi <- c(components_data[11, 9], components_data[12, 9], components_data[13, 9], components_data[14, 9], components_data[15, 9]) + mu <- c(components_data[11, 7], components_data[12, 7], components_data[13, 7], components_data[14, 7], components_data[15, 7]) + var <- c(components_data[11, 8], components_data[12, 8], components_data[13, 8], components_data[14, 8], components_data[15, 8]) + } + else if (num_components == 6) + { + pi <- c(components_data[16, 9], components_data[17, 9], components_data[18, 9], components_data[19, 9], components_data[20, 9], components_data[21, 9]) + mu <- c(components_data[16, 7], components_data[17, 7], components_data[18, 7], components_data[19, 7], components_data[20, 7], components_data[21, 7]) + var <- c(components_data[16, 8], components_data[17, 8], components_data[18, 8], components_data[19, 8], components_data[20, 8], components_data[21, 8]) + } + results = c(pi, mu, var) + return(results) +} + +plot_ks<-function(kaks_input, output, pi, mu, var) +{ + # Start PDF device driver to save charts to output. + pdf(file=output, bg="white") + kaks <- read.table(file=kaks_input, header=T) + max_ks <- max(kaks$Ks, na.rm=TRUE) + # Change bin width + max_bin_range <- as.integer(max_ks / 0.05) + bin <- 0.05 * seq(0, (max_bin_range + 1 )) + kaks <- kaks[kaks$Ks + plots the distribution of synonymous substitution (Ks) rates and fits significant component(s) + + macros.xml + + + + + + + + + + + + + + + + + + +**What it does** + +This tool is one of the PlantTribes collection of automated modular analysis pipelines for comparative and evolutionary analyses of +genome-scale gene families and transcriptomes. This tool uses the analysis results produced by the KaKsAnalysis tool to plot the +distribution of synonymous substitution (Ks) rates and fit the estimated significant normal mixtures component(s) onto the distribution. + +----- + +**Options** + + * **Synonymous substitution rates** - estimated synonymous substitution (Ks) rates output file produced by the KaKsAnalysis tool selected from your history. + * **Synonymous components** - estimated significant component(s) output file produced by the KaKsAnalysis tool selected from your history. + + + + + @article{Wall2008, + journal = {Nucleic Acids Research}, + author = {2. Wall PK, Leebens-Mack J, Muller KF, Field D, Altman NS}, + title = {PlantTribes: a gene and gene family resource for comparative genomics in plants}, + year = {2008}, + volume = {36}, + number = {suppl 1}, + pages = {D970-D976},} + + + @article{Altschul1990, + journal = {Journal of molecular biology} + author = {3. Altschul SF, Gish W, Miller W, Myers EW, Lipman DJ}, + title = {Basic local alignment search tool}, + year = {1990}, + volume = {215}, + number = {3}, + pages = {403-410},} + + + @article{Katoh2013, + journal = {Molecular biology and evolution}, + author = {4. Katoh K, Standley DM}, + title = {MAFFT multiple sequence alignment software version 7: improvements in performance and usability}, + year = {2013}, + volume = {30}, + number = {4}, + pages = {772-780},} + + + @article{Yang2007, + journal = {Molecular biology and evolution}, + author = {5. Yang Z}, + title = {PAML 4: phylogenetic analysis by maximum likelihood}, + year = {2007}, + volume = {24}, + number = {8}, + pages = {1586-1591},} + + + @article{Cui2006, + journal = {Genome Research}, + author = {6. Cui L, Wall PK, Leebens-Mack JH, Lindsay BG, Soltis DE, Doyle JJ, Soltis PS, Carlson JE, Arumuganathan K, Barakat A, Albert VA}, + title = {Widespread genome duplications throughout the history of flowering plants}, + year = {2006}, + volume = {16}, + number = {6}, + pages = {738-749},} + + + @article{McLachlan1999, + journal = {Journal of Statistical Software}, + author = {7. McLachlan GJ, Peel D, Basford KE, Adams P}, + title = {The EMMIX software for the fitting of mixtures of normal and t-components}, + year = {1999}, + volume = {4}, + number = {2}, + pages = {1-14},} + + + + diff -r 000000000000 -r c5846258c458 macros.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/macros.xml Thu Jun 08 12:55:49 2017 -0400 @@ -0,0 +1,130 @@ + + + 1.0 + + + plant_tribes_assembly_post_processor + + + + + plant_tribes_gene_family_aligner + + + + + plant_tribes_gene_family_classifier + + + + + plant_tribes_gene_family_integrator + + + + + plant_tribes_kaks_analysis + + + + + r-optparse + + + + + plant_tribes_gene_family_phylogeny_builder + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @misc{None, + journal = {None}, + author = {1. Wafula EK}, + title = {Manuscript in preparation}, + year = {None}, + url = {https://github.com/dePamphilis/PlantTribes},} + + + diff -r 000000000000 -r c5846258c458 output.pdf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/output.pdf Thu Jun 08 12:55:49 2017 -0400 @@ -0,0 +1,52 @@ +1 0 obj +<< +/Title (R Graphics Output) +/Creator (R) +>> +endobj +2 0 obj +<< /Type /Catalog /Pages 3 0 R >> +endobj +7 0 obj +<< /Type /Page /Parent 3 0 R /Contents 8 0 R /Resources 4 0 R >> +endobj +8 0 obj +<< +>> +stream +endobj +3 0 obj +<< /Type /Pages /Kids [ 7 0 R ] /Count 1 /MediaBox [0 0 504 504] >> +endobj +4 0 obj +<< +/ProcSet [/PDF /Text] +/Font <> +/ExtGState << >> +/ColorSpace << /sRGB 5 0 R >> +>> +endobj +5 0 obj +[/ICCBased 6 0 R] +endobj +6 0 obj +<< /Alternate /DeviceRGB /N 3 /Length 2596 /Filter /FlateDecode >> +stream +9 0 obj +<< +/Type /Encoding /BaseEncoding /WinAnsiEncoding +/Differences [ 45/minus 96/quoteleft +144/dotlessi /grave /acute /circumflex /tilde /macron /breve /dotaccent +/dieresis /.notdef /ring /cedilla /.notdef /hungarumlaut /ogonek /caron /space] +>> +endobj +10 0 obj +<< /Type /Font /Subtype /Type1 /Name /F2 /BaseFont /Helvetica +/Encoding 9 0 R >> +endobj +xref +0 11 +trailer +<< /Size 11 /Info 1 0 R /Root 2 0 R >> +startxref +%%EOF