How to use Blastp one sequence vs fasta file and get most similar sequence?
1
1
Entering edit mode
11 months ago

Hello,

I have a protein sequence with format

record = SeqRecord(Seq(sequence), id=Protein_id, description=Protein_id, name=Protein_id)

And a .fasta file with different proteins and sequences (Bacteria.fasta)

I want to apply blastp record vs all the sequences in fasta and retrieve the most similiar sequence? (It is a local blastp against this local database)

How can I do this in python?

Best Regards and Thank you.

Python Protein fasta Blastp • 1.1k views
ADD COMMENT
0
Entering edit mode

Why do you want to do it in python?

ADD REPLY
0
Entering edit mode

can be in shell commands too. I said python but not mandatory to be on python

ADD REPLY
0
Entering edit mode

Write the sequence you have in memory to a file (unless you read it from a file, in which case just use that file) and run blastp on the command line, with makeblastdb if required.

ADD REPLY
0
Entering edit mode

Thank you and sorry but could you detail more? I understand i build a local database makeblastdb -in {bacteria_clusters} -dbtype prot -out Bacteria_db then how can I run blastp with my file vs Bacteria_db and get the most similiar

ADD REPLY
0
Entering edit mode

Please read the blast manual. You're already halfway there, I'm confident you can figure this out yourself.

ADD REPLY
1
Entering edit mode
11 months ago

okay here is the solution. Thank you for your help Ram .

blastp -outfmt 7 \
-db database \
 -query file \
  > table.tsv
ADD COMMENT
1
Entering edit mode

Use -out filename instead of using >.

ADD REPLY
0
Entering edit mode

Please accept your own answer to provide closure to the post.

ADD REPLY

Login before adding your answer.

Traffic: 2450 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