{"id":22174566,"url":"https://github.com/dwinter/pafr","last_synced_at":"2025-07-26T15:32:06.991Z","repository":{"id":56935399,"uuid":"202606130","full_name":"dwinter/pafr","owner":"dwinter","description":"Read, manipulate and visualize 'Pairwise mApping Format' data in R","archived":false,"fork":false,"pushed_at":"2021-04-30T04:32:47.000Z","size":6190,"stargazers_count":62,"open_issues_count":25,"forks_count":8,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-07-11T20:32:54.434Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dwinter.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-15T20:20:26.000Z","updated_at":"2024-06-04T12:48:22.000Z","dependencies_parsed_at":"2022-08-21T05:50:11.320Z","dependency_job_id":null,"html_url":"https://github.com/dwinter/pafr","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dwinter%2Fpafr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dwinter%2Fpafr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dwinter%2Fpafr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dwinter%2Fpafr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dwinter","download_url":"https://codeload.github.com/dwinter/pafr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227692777,"owners_count":17805175,"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","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":[],"created_at":"2024-12-02T07:51:26.015Z","updated_at":"2024-12-02T07:51:26.709Z","avatar_url":"https://github.com/dwinter.png","language":"R","funding_links":[],"categories":["Comparative"],"sub_categories":[],"readme":"---\noutput:\n  md_document:\n    variant: markdown_github\n---\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n[![Travis-CI Build Status](https://travis-ci.org/dwinter/pafr.svg?branch=master)](https://travis-ci.org/dwinter/pafr)\n[![Coverage Status](https://img.shields.io/codecov/c/github/dwinter/pafr/master.svg)](https://codecov.io/github/dwinter/pafr?branch=master)\n\n```{r, echo = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\"\n)\n```\n\n# pafr\n\nRead, manipulate and visualize 'Pairwise mApping Format' data in R\n\n## Install\n\nThe package is not yet available on CRAN, but we will keep the master branch of\nthis repository stable. You can install using devtools\n\n```r\n#install.packages(devtools)\ndevtools::install_github(\"dwinter/pafr\")\n```\n\n## Read in a .paf file and check it out \n\nHaving installed the package, making a whole-genome dotplot is as simple as \nreading in an alignment and calling `dotplot`:\n\n```{r, dotplot}\nlibrary(pafr, quietly=TRUE)\ntest_alignment \u003c- system.file(\"extdata\", \"fungi.paf\", package=\"pafr\")\nali \u003c- read_paf(test_alignment)\ndotplot(ali)\n```\n\n## A paf file in R\n\n`read_paf` takes alignments in a .paf file and represents them in table that \nbehaves very much like a standard R `data.frame`. The table \nhas columns for each of the 12 standard columns in the .paf format as well\ncolumns for any any tags represented in the file. Printing the tables shows a \nsummary of the contents and lists the the available tags.\n \n```{r, ali}\nali\n```\nBecause the table behaves as a `data.frame`, it integrates with existing R functions. \nFor example, We can find the mean length of alignments in this file using the `alen`\ncolumn.\n\n```{r, mean_alen}\nmean(ali$alen)\n```\n\nLikewise, we can produce a ggplot histogram of the distribution of alignment-lengths \nin the file.\n\n```{r,len_distr}\nggplot(ali, aes(alen)) + \n    geom_histogram(colour=\"black\", fill=\"steelblue\", bins=20) + \n    theme_bw(base_size=16) + \n    ggtitle(\"Distribution of alignment lengths\") +\n    scale_x_log10(\"Alignment-length\")\n```\n\nIf we decide we don't like those shorter alignments, we can remove them with\n`subset` or `filter` from dplyr.\n\n```{r, subset}\nlong_ali \u003c- subset(ali, alen \u003e 1e4)\nlong_ali\n```\n\n## Plots\n\nIn addition to the dotplot demonstrated above, the package implements two\nother classes of genomic visualization\n\n### Synteny plot\n\nThe synteny plot displays alignments between one query and one target sequence\nin a given paf file. Using the alignment above, we first filter short alignments \nthen plot regions that align between query chromosome \"Q_chr3\" and target \n\"T_chr4\":\n\n```{r, synteny}\nlong_ali \u003c- subset(ali, alen \u003e 1e4)\nplot_synteny(long_ali, q_chrom=\"Q_chr3\", t_chrom=\"T_chr4\", centre=TRUE)\n```\n\n### Coverage plot\n\nThe coverage plot displays all sequences in either the query or target genome,\nshading those regions of each sequence that are covered by at least one\nalignment. This can be a useful in identifying how alternative genome assemblies \ndiffer from each other, or visualizing differences between related genomes.\n\nIn this example we visualize the sequences in the target genome, shading each\naligned-region according to query-sequence aligning to that region.\n\n```{r, coverage}\nplot_coverage(long_ali, fill='qname') +\n   scale_fill_brewer(palette=\"Set1\")\n```\n## Bugs/Issues\n\nPlease use the issue tracker on this repo to let us know about any bugs or\nissues that arise as you use this package.\n\n  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdwinter%2Fpafr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdwinter%2Fpafr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdwinter%2Fpafr/lists"}