#Load ape package to import FASTA and FASTQ sequence files.

library(ape)

#Import FASTA File ————————————————————

#Read the FASTA file as a list to store each sequence as an individual item. #Store in a binary format using DNAbin.

fasta <- read.dna(
  file = "MT103168.fasta",
  format = "fasta",
  as.matrix = FALSE
)

#Inspect FASTA data

fasta
## 1 DNA sequence in binary format stored in a list.
## 
## Sequence length: 1560 
## 
## Label:
## MT103168.1 Bifidobacterium longum strain BB536 cell division...
## 
## Base composition:
##     a     c     g     t 
## 0.156 0.319 0.289 0.236 
## (Total: 1.56 kb)

#Import FASTQ File————————————————————-

#Read the FASTQ file as a list to store each sequence as an individual item. #Store in a binary format using DNAbin.

fastq <- read.fastq("ERR1072710.fastq")

#Inspect FASTQ data

fastq
## 3 DNA sequences in binary format stored in a list.
## 
## Mean sequence length: 183.667 
##    Shortest sequence: 146 
##     Longest sequence: 259 
## 
## Labels:
## ERR1072710.1 10317.000001315_0 length=151
## ERR1072710.2 10317.000001315_1 length=116
## ERR1072710.4 10317.000001315_3 length=151
## 
## Base composition:
##     a     c     g     t 
## 0.318 0.208 0.254 0.219 
## (Total: 551 bases)

#Import VCF File—————————————————————

#Read the VCF File as a data frame to organize the data into rows and columns. #Skip the 12 metadata lines with ##

vcf <- read.csv(
  file = "TwoVariants.vcf", 
  header = TRUE, 
  sep = "\t",
  skip = 12,
  check.names = FALSE
)

#Inspect VCF File

vcf
##              #CHROM POS ID REF ALT QUAL FILTER                 INFO
## 1 NZ_BCYL01000006.1  29  .   A   G    .      .  AC=84;AF=1.0;SB=0.0
## 2 NZ_BCYL01000006.1 145  .   A   G    .      . AC=114;AF=1.0;SB=0.0
##           FORMAT                   __NONE__
## 1 GT:AC:AF:SB:NC  1:84:1.0:0.0:+G=37,-G=47,
## 2 GT:AC:AF:SB:NC 1:114:1.0:0.0:+G=42,-G=72,