FASTA Imports

Read the FASTA file into R

myFASTA <- read.FASTA('MT103168.fasta')

Preview the first few lines of the file to determine data content

head(myFASTA)
## 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)

Visualize structure of the list

str(myFASTA)
## List of 1
##  $ MT103168.1 Bifidobacterium longum strain BB536 cell division protein FtsW (rodA) gene, complete cds: raw [1:1560] 88 18 48 88 ...
##  - attr(*, "class")= chr "DNAbin"

FASTQ Imports

Read the FASTQ file into R

myFASTQ <- read.fastq('ERR1072710.fastq')

Preview the first few lines of the file to determine data content

head(myFASTQ)
## 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)

Visualize structure of the list

str(myFASTQ)
## List of 3
##  $ ERR1072710.1 10317.000001315_0 length=151: raw [1:146] 18 18 88 88 ...
##  $ ERR1072710.2 10317.000001315_1 length=116: raw [1:259] 18 28 18 28 ...
##  $ ERR1072710.4 10317.000001315_3 length=151: raw [1:146] 28 28 88 28 ...
##  - attr(*, "class")= chr "DNAbin"
##  - attr(*, "QUAL")=List of 7
##   ..$ ERR1072710.1 10317.000001315_0 length=151: num [1:11] 32 38 51 34 32 34 32 34 32 38 ...
##   ..$ ERR1072710.2 10317.000001315_1 length=116: num [1:11] 30 30 30 30 30 30 30 30 30 30 ...
##   ..$ ERR1072710.4 10317.000001315_3 length=151: num [1:42] 10 36 49 49 16 15 22 17 22 16 ...
##   ..$ NA                                       : num [1:70] 51 32 34 38 38 32 38 38 38 51 ...
##   ..$ NA                                       : num [1:67] 30 30 30 30 30 30 30 30 30 30 ...
##   ..$ NA                                       : num [1:11] 32 51 51 32 38 32 38 34 34 51 ...
##   ..$ NA                                       : num [1:11] 30 30 30 30 30 30 30 30 30 30 ...

vcf Imports

Read in the vcf file using vcfR so it inherently recognizes file type

myVCF <- read.vcfR('TwoVariants.vcf')
## Scanning file to determine attributes.
## File attributes:
##   meta lines: 12
##   header_line: 13
##   variant count: 2
##   column count: 10
## Meta line 12 read in.
## All meta lines processed.
## gt matrix initialized.
## Character matrix gt created.
##   Character matrix gt rows: 2
##   Character matrix gt cols: 10
##   skip: 0
##   nrows: 2
##   row_num: 0
## Processed variant: 2
## All variants processed

Extract column headers and data without metadeta

myVCF_fix <- as.data.frame(getFIX(myVCF))

Preview the first few lines of the file to determine data content

head(myVCF_fix)
##               CHROM POS   ID REF ALT QUAL FILTER
## 1 NZ_BCYL01000006.1  29 <NA>   A   G <NA>   <NA>
## 2 NZ_BCYL01000006.1 145 <NA>   A   G <NA>   <NA>

Visualize structure of the data frame

str(myVCF_fix)
## 'data.frame':    2 obs. of  7 variables:
##  $ CHROM : chr  "NZ_BCYL01000006.1" "NZ_BCYL01000006.1"
##  $ POS   : chr  "29" "145"
##  $ ID    : chr  NA NA
##  $ REF   : chr  "A" "A"
##  $ ALT   : chr  "G" "G"
##  $ QUAL  : chr  NA NA
##  $ FILTER: chr  NA NA