Sequence Comparison Using Python/Biopython
2
0
Entering edit mode
13.2 years ago
Barby ▴ 20

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

biopython fasta sequence • 8.7k views
ADD COMMENT
1
Entering edit mode

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?

ADD REPLY
3
Entering edit mode
13.2 years ago
Eric Fournier ★ 1.4k

You should not be writing any script to compare two fasta sequences. There are tons of alignment software out there, a list of which can be found here. Look under the "pairwise comparison" category.

There are also online tools that you can use, such as bl2seq or CLUSTALW.

ADD COMMENT
1
Entering edit mode
13.2 years ago

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
ADD COMMENT

Login before adding your answer.

Traffic: 3103 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6