This is a test version of Biostars. For the public version, visit https://www.biostars.org.
5 FAsta file input and showing result using nested loop

a. Read five different protein sequences from any public repository and store them in five different files in your hard drive.

b. Using nested loop, read each file with following combination and apply global pairwise alignment on sequences. For scoring, use BLOSUM100, BLOSUM62 and BLOSUM45 scoring matrix:

like: file1- file2, file1-3, file1- file4, file1- file5, file2- file3, file2- file4, file2- file5, file3-file4, file3- file5, file4- file5

c. Show histogram of all above scores for each BLOSUM matrix.

sequencing alignment r fasta databanks

This looks a lot like an assignment, and you will learn nothing if someone else solves it for you.

It's our past paper. Just trying to solve it for exam prepration

library("gdata")
library("csv")
library(seqinr)
library("Biostrings")
library(msa)
library(ape)

choosebank("genbank")
a1 <- read.GenBank("JF806202", as.character = TRUE)
a1
write.fasta(sequences = a1, names = names(a1), nbchar = 80, file.out = "a.fasta")
a2 <- read.GenBank("JF806212", as.character = TRUE)
a2
write.fasta(sequences = a2, names = names(a2), nbchar = 80, file.out = "b.fasta")
a3 <- read.GenBank("JF806213", as.character = TRUE)
a3
write.fasta(sequences = a3, names = names(a3), nbchar = 80, file.out = "c.fasta")
a4 <- read.GenBank("JF806214", as.character = TRUE)
a4
write.fasta(sequences = a4, names = names(a4), nbchar = 80, file.out = "d.fasta")
a5 <- read.GenBank("JF806215", as.character = TRUE)
a5
write.fasta(sequences = a5, names = names(a5), nbchar = 80, file.out = "e.fasta")
a1=read.fasta(file = "a.fasta")
a2=read.fasta(file = "b.fasta")
a3=read.fasta(file = "c.fasta")
a4=read.fasta(file = "d.fasta")
a5=read.fasta(file = "e.fasta")
a1 <- as.character(a1[[1]])
a2 <- as.character(a2[[1]])
a3 <- as.character(a3[[1]])
a4 <- as.character(a4[[1]])
a5 <- as.character(a5[[1]])
q<-c2s(a1)
q1<-c2s(a2)
q2<-c2s(a3)
q3<-c2s(a5)
q4<-c2s(a5)
q<-toupper(q)
q1<-toupper(q1)
q2<-toupper(q2)
q3<-toupper(q3)
q4<-toupper(q4)

r<- matrix(c(q,q, 1, 1), nrow=1)  
r1<- matrix(c(q1,q1, 1, 1), nrow=1)
r2<- matrix(c(q2,q2, 1, 1), nrow=1)
r3<- matrix(c(q3,q3, 1, 1), nrow=1)
r4<- matrix(c(q4,q4, 1, 1), nrow=1)
data("BLOSUM62")
for (a in r) {

   a<-matrix(score(pairwiseAlignment(r, r1,substitutionMatrix = "BLOSUM62")))
}

This sounds like someone's homework assignment.

0 answers

No answers yet.

Log in to answer this question.