Sequence Comparison Using Python/Biopython
Hi all,
Iam quite new in programming!
I need to make a script in order to compare two fasta sequences. I want to find pattern variation in regard to the nucleotides (codons), their position, and of course the related aa.
Any help in this, please?
thanks
• 9,591 views
•
link
2 answers
Not sure what you really want to do, but here's an example of aligning Amino Acid sequences (in R) taken from Bioconductor's Biostrings library:
R> library(Biostrings)
R> pattern <- AAStringSet(c("HLDNLKGTF", "HVDDMPNAL"))
R> subject <- AAString("SMDDTEKMSMKL")
R> aln <- pairwiseAlignment(pattern, subject, substitutionMatrix="BLOSUM50",
gapOpening=-3, gapExtension=-1)
R> aln[1]
Global PairwiseAlignedFixedSubject (1 of 1)
pattern: [1] HLDN-----LKGTF
subject: [1] SMDDTEKMSMK--L
score: 9
R> aln[2]
Global PairwiseAlignedFixedSubject (1 of 1)
pattern: [1] HVDD---MPNAL
subject: [1] SMDDTEKMSMKL
score: 18
R> as.character(aln)
[1] "HLDN-----LKF" "HVDD---MPNAL"
Biostrings also provides facilities for reading in/out FASTA files. For more information, see:
R> ?pairwiseAlignment
• 1 views
•
link
Log in to answer this question.
Some further information would be great. Are the sequences in the two files ordered in the same way? Do you want pairwise comparison of all sequences in the 2 files (each against each)? Do you have to use Biopyhton or are other languages possible? Have you ever heard somethin about global alignment?