{"id":18006700,"url":"https://github.com/willgearty/pcmtools","last_synced_at":"2025-10-05T07:49:33.752Z","repository":{"id":71540797,"uuid":"213449197","full_name":"willgearty/pcmtools","owner":"willgearty","description":"Tools for Phylogenetic Comparative Methods","archived":false,"fork":false,"pushed_at":"2019-10-29T22:52:45.000Z","size":36,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-05T07:49:32.822Z","etag":null,"topics":["comparative","methods","phylogenetic"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/willgearty.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-07T17:48:09.000Z","updated_at":"2024-01-25T21:50:04.000Z","dependencies_parsed_at":"2023-04-12T08:33:11.015Z","dependency_job_id":null,"html_url":"https://github.com/willgearty/pcmtools","commit_stats":{"total_commits":14,"total_committers":1,"mean_commits":14.0,"dds":0.0,"last_synced_commit":"14fb49ce08d1c677971a756bb699554070482253"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/willgearty/pcmtools","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willgearty%2Fpcmtools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willgearty%2Fpcmtools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willgearty%2Fpcmtools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willgearty%2Fpcmtools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/willgearty","download_url":"https://codeload.github.com/willgearty/pcmtools/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willgearty%2Fpcmtools/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278425499,"owners_count":25984686,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["comparative","methods","phylogenetic"],"created_at":"2024-10-30T01:09:28.678Z","updated_at":"2025-10-05T07:49:33.710Z","avatar_url":"https://github.com/willgearty.png","language":"R","readme":"[![Build Status](https://travis-ci.com/willgearty/pcmtools.svg?branch=master)](https://travis-ci.com/willgearty/pcmtools)\n[![DOI](https://zenodo.org/badge/213449197.svg)](https://zenodo.org/badge/latestdoi/213449197)\n\n# pcmtools\nVarious tools to help with performing phylogenetic comparative methods and curating/visualizing the results.\n\n## To install\n```r\nlibrary(devtools)\ninstall_github(\"willgearty/pcmtools\")\n```\n\n## To use\n\n### Load package\n```r\nlibrary(pcmtools)\n```\n\n### OUwie Post-Analysis Tools\n```r\nlibrary(OUwie)\ndata(tworegime)\nou.results \u003c- list()\nou.results[[1]] \u003c- OUwie(tree,trait,model=c(\"BM1\"))\nou.results[[2]] \u003c- OUwie(tree,trait,model=c(\"BMS\"), root.station = FALSE)\nou.results[[3]] \u003c- OUwie(tree,trait,model=c(\"OUM\"))\nou.results[[4]] \u003c- OUwie(tree,trait,model=c(\"OUMV\"))\n\n#Both regimes have same parameters for BM1 model. Both regimes have different parameters for other models.\nregime.mat \u003c- data.frame(BM1 = c(1, 1), BMS = c(1,2), OUM = c(1,2), OUMV = c(1,2), row.names = c(1,2))\n\n#Extract and map parameters to regimes\nou.parameters \u003c- OUwieParSumm(ou.results, regime.mat)\n\n#Summarize model fit\nou.aic \u003c- OUwieAICSumm(ou.parameters)\n\n#Model average parameters\nou.avg \u003c- OUwieModelAvg(ou.parameters)\n```\n\n### Rename, merge, or split mapped states\n```r\nlibrary(phytools)\n#Simulate a mapped tree\nset.seed(4)\nQ \u003c- matrix(c(-2,1,1,1,-2,1,1,1,-2),3,3)\nrownames(Q) \u003c- colnames(Q) \u003c- letters[1:3]\ntree \u003c- sim.history(pbtree(n=100,scale=1),Q)\ncols \u003c- setNames(c(\"blue\",\"red\",\"green\",\"orange\"),letters[1:4])\n\n#Plot the mapping\nplot(tree, cols, ftype=\"i\", fsize=0.7)\n\n#Split state c to state d within subclade\ntree2 \u003c- mergeMappedStates2(tree, \"c\", \"d\", 173)\n\n#Plot new mapping\nplot(tree2, cols, ftype=\"i\", fsize=0.7)\n```\n\n### Extract posterior values from densityMaps and contMaps\n```r\nlibrary(phytools)\n#Simulate tree\ntree \u003c- pbtree(n=70,scale=1)\n\n#Simulate discrete trait\nQ \u003c- matrix(c(-1,1,1,-1),2,2)\nrownames(Q) \u003c- colnames(Q)\u003c-c(0,1)\nx1 \u003c- sim.history(tree,Q)$states\n\n#Generate stochastic maps and density map\nmtrees \u003c- make.simmap(tree,x1,nsim=100)\nmap1 \u003c- densityMap(mtrees)\n\n#Simulate continuous trait\nx2 \u003c- fastBM(tree,sig2=0.1)\n\n#Generate cont map\nmap2 \u003c- contMap(tree, x2)\n\n#Extract posterior densities\npp_data \u003c- extractSimmapDensity(map1, map2)\n\n#Plot to see how traits have evolved with respect to one another\nplot(pp_data$map1, pp_data$map2)\n```\n\n### Calculating phenotype statistics through time\n```r\nlibrary(phytools)\n#Simulate tree\ntree \u003c- pbtree(n=70,scale=1)\n\n#Simulate discrete trait\nQ \u003c- matrix(c(-1,1,1,-1),2,2)\nrownames(Q) \u003c- colnames(Q)\u003c-c(0,1)\ntree \u003c- sim.history(tree,Q)\n\n#Simulate continuous trait\nx2 \u003c- fastBM(tree,sig2=0.1)\n\n#Calculate stats through time\ntstt \u003c- traitStatsThroughTime(tree, x2)\ncoords \u003c- tstt$xy\nstats \u003c- tstt$stats\n\n#Plot phenogram\nys \u003c- c(coords$y1, coords$y2)\nplot(NULL, xlim=c(0,1), ylim=c(min(ys), max(ys)), ylab=\"trait\", xlab=\"time\")\nsegments(coords$x1, coords$y1, coords$x2, coords$y2)\n\n#Plot stats\nplot(stats$x, stats$mean)\n```\n\n### Coming Soon...\n- Plotting phenotypes through time\n- Plotting OU models\n- And more!\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillgearty%2Fpcmtools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwillgearty%2Fpcmtools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillgearty%2Fpcmtools/lists"}