# seqcombo for sequence recombination

#### Guangchuang Yu, The University of Hong Kong

#### 2017-10-30

# Sequence difference plot

Here we use the data published in `Potato Research` 1 as an example.

    fas <- list.files(system.file("examples","GVariation", package="seqcombo"),
                      pattern="fas", full.names=TRUE)
    fas

    ## [1] "C:/Users/biocbuild/bbs-3.6-bioc/tmpdir/RtmpeaRwr3/Rinstb7056f8123a/seqcombo/examples/GVariation/A.Mont.fas"
    ## [2] "C:/Users/biocbuild/bbs-3.6-bioc/tmpdir/RtmpeaRwr3/Rinstb7056f8123a/seqcombo/examples/GVariation/B.Oz.fas"
    ## [3] "C:/Users/biocbuild/bbs-3.6-bioc/tmpdir/RtmpeaRwr3/Rinstb7056f8123a/seqcombo/examples/GVariation/C.Wilga5.fas"

The input fasta file should contains two aligned sequences. User need to specify which sequence (1 or 2, 1 by default) as reference. The `seqdiff` function will parse the fasta file and calculate the nucleotide differences by comparing the non-reference one to reference.

    x1 <- seqdiff(fas[1], reference=1)
    x1

    ## sequence differences of Mont and CF_YL21
    ## 1181 sites differ:
    ##   A   C   G   T
    ## 286 315 301 279

We can visualize the differences by `plot` method:

    plot(x1)

We can parse several files and visualize them simultaneously.

    x <- lapply(fas, seqdiff)
    plts <- lapply(x, plot)
    plot_grid(plotlist=plts, ncol=1, labels=LETTERS[1:3])

# Sequence similarity plot

    fas <- system.file("examples/GVariation/sample_alignment.fa", package="seqcombo")
    simplot(fas, 'CF_YL21')

# Session info

Here is the output of `sessionInfo()` on the system on which this document was compiled:

    ## R version 3.4.2 Patched (2017-10-07 r73498)
    ## Platform: x86_64-w64-mingw32/x64 (64-bit)
    ## Running under: Windows Server 2012 R2 x64 (build 9600)
    ##
    ## Matrix products: default
    ##
    ## locale:
    ## [1] LC_COLLATE=C
    ## [2] LC_CTYPE=English_United States.1252
    ## [3] LC_MONETARY=English_United States.1252
    ## [4] LC_NUMERIC=C
    ## [5] LC_TIME=English_United States.1252
    ##
    ## attached base packages:
    ## [1] stats     graphics  grDevices utils     datasets  methods   base
    ##
    ## other attached packages:
    ## [1] igraph_1.1.2    ggplot2_2.2.1   emojifont_0.5.0 tibble_1.3.4
    ## [5] seqcombo_1.0.0
    ##
    ## loaded via a namespace (and not attached):
    ##  [1] Rcpp_0.12.13        compiler_3.4.2      plyr_1.8.4
    ##  [4] XVector_0.18.0      bindr_0.1           sysfonts_0.7.1
    ##  [7] prettydoc_0.2.0     tools_3.4.2         zlibbioc_1.24.0
    ## [10] digest_0.6.12       evaluate_0.10.1     gtable_0.2.0
    ## [13] pkgconfig_2.0.1     rlang_0.1.2         rvcheck_0.0.9
    ## [16] yaml_2.1.14         parallel_3.4.2      proto_1.0.0
    ## [19] bindrcpp_0.2        showtextdb_2.0      stringr_1.2.0
    ## [22] dplyr_0.7.4         knitr_1.17          Biostrings_2.46.0
    ## [25] S4Vectors_0.16.0    IRanges_2.12.0      stats4_3.4.2
    ## [28] rprojroot_1.2       grid_3.4.2          cowplot_0.8.0
    ## [31] glue_1.2.0          R6_2.2.2            rmarkdown_1.6
    ## [34] magrittr_1.5        backports_1.1.1     scales_0.5.0
    ## [37] htmltools_0.3.6     BiocGenerics_0.24.0 showtext_0.5
    ## [40] assertthat_0.2.0    colorspace_1.3-2    labeling_0.3
    ## [43] stringi_1.1.5       lazyeval_0.2.1      munsell_0.4.3

# References

1. Chang, F. et al. Complete Genome Analysis of a PVYN-Wi Recombinant Isolate from Solanum tuberosum in China. Potato Research 58, 377–389 (2015).