library(Biostrings)
## 载入需要的程辑包:BiocGenerics
## 载入需要的程辑包:parallel
## 
## 载入程辑包:'BiocGenerics'
## The following objects are masked from 'package:parallel':
## 
##     clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
##     clusterExport, clusterMap, parApply, parCapply, parLapply,
##     parLapplyLB, parRapply, parSapply, parSapplyLB
## The following objects are masked from 'package:stats':
## 
##     IQR, mad, sd, var, xtabs
## The following objects are masked from 'package:base':
## 
##     anyDuplicated, append, as.data.frame, basename, cbind, colnames,
##     dirname, do.call, duplicated, eval, evalq, Filter, Find, get, grep,
##     grepl, intersect, is.unsorted, lapply, Map, mapply, match, mget,
##     order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank,
##     rbind, Reduce, rownames, sapply, setdiff, sort, table, tapply,
##     union, unique, unsplit, which.max, which.min
## 载入需要的程辑包:S4Vectors
## 载入需要的程辑包:stats4
## 
## 载入程辑包:'S4Vectors'
## The following objects are masked from 'package:base':
## 
##     expand.grid, I, unname
## 载入需要的程辑包:IRanges
## 
## 载入程辑包:'IRanges'
## The following object is masked from 'package:grDevices':
## 
##     windows
## 载入需要的程辑包:XVector
## 载入需要的程辑包:GenomeInfoDb
## 
## 载入程辑包:'Biostrings'
## The following object is masked from 'package:base':
## 
##     strsplit
a <- readDNAStringSet("A.fasta", format="fasta")
a
## DNAStringSet object of length 1:
##     width seq                                               names               
## [1]     6 AAATTT                                            NC_006307.2 Influ...
b <- readDNAStringSet("B.fasta", format="fasta")
b
## DNAStringSet object of length 1:
##     width seq                                               names               
## [1]     6 GGGCCC                                            NC_006310.2 Influ...
d <- DNAStringSet(paste0(a, b))
d
## DNAStringSet object of length 1:
##     width seq
## [1]    12 AAATTTGGGCCC
DNAStringSet(paste0(b, a))
## DNAStringSet object of length 1:
##     width seq
## [1]    12 GGGCCCAAATTT
names(d) <- "Merge_Genome"
d
## DNAStringSet object of length 1:
##     width seq                                               names               
## [1]    12 AAATTTGGGCCC                                      Merge_Genome
writeXStringSet(d, "Merge_Genome.fasta", format = "fasta")
#########################


#ref https://www.biostars.org/p/365602/
#ref https://uclouvain-cbio.github.io/WSBIM1322/sec-biostrings.html