Question: Blast With Biopython
0
gravatar for neilgupte7
11 days ago by
neilgupte70
neilgupte70 wrote:

i wanted to blast two sequences ,but i need the query to be searched with the complement of my subject strand .and how to display such alignment inside biopython using blast?

EXAMPLE:
 AGTC
 ||||
 AGTC

OUTPUT BECOMES-
--AGTC
--||--
TCAG--

 AGTC
 ||||
 TCAG

Help will be appreciated, THANK YOU

ADD COMMENTlink modified 7 days ago by gb290 • written 11 days ago by neilgupte70

What is the actual question here?

Do you want to know how to 'render' the alignment visually, or how to do the BLAST, or how to reverse complement? All 3?

ADD REPLYlink written 11 days ago by jrj.healey6.0k

rendering part might also help basically i wanted to know,can we do Blast complementary strands inside biopython and visaulise the particular output.?

ADD REPLYlink modified 11 days ago • written 11 days ago by neilgupte70

Don’t type entirely in capitals please.

ADD REPLYlink written 11 days ago by jrj.healey6.0k

sorry ,my bad !did not pay attention towards the case

ADD REPLYlink written 11 days ago by neilgupte70

Standalone blast or online?

ADD REPLYlink written 11 days ago by gb290

standalone BLAST connecting it with a python sript

ADD REPLYlink written 8 days ago by neilgupte70
3
gravatar for gb
7 days ago by
gb290
gb290 wrote:

Something like this:

cline = NcbiblastnCommandline(query="m_cold.fasta", db="nt", strand="plus",evalue=0.001, out="m_cold.xml", outfmt=5)

Or:

cline = NcbiblastnCommandline(query="m_cold.fasta", db="nt", strand="minus",evalue=0.001, out="m_cold.xml", outfmt=5)

With the strand parameter you can change which orientation you want. Probably in your case you need to set it on plus but reverse complement all your input sequences.

For displaying the alignment you can do something like this:

from Bio.Blast import NCBIXML
blast_record = NCBIXML.read(result_handle)
for alignment in blast_record.alignments:
 for hsp in alignment.hsps:
     print("****Alignment****")
     print("sequence:", alignment.title)
     print("length:", alignment.length)
     print("e value:", hsp.expect)
     print(hsp.query[0:75] + "...")
     print(hsp.match[0:75] + "...")
     print(hsp.sbjct[0:75] + "...")

Output will be:

****Alignment****
sequence: >gb|AF283004.1|AF283004 Arabidopsis thaliana cold acclimation protein WCOR413-like protein
 alpha form mRNA, complete cds
length: 783
e value: 0.034
tacttgttgatattggatcgaacaaactggagaaccaacatgctcacgtcacttttagtcccttacatattcctc...
||||||||| | ||||||||||| || ||||  || || |||||||| |||||| |  | |||||||| ||| ||...
tacttgttggtgttggatcgaaccaattggaagacgaatatgctcacatcacttctcattccttacatcttcttc...

I got this code from here:

http://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc98

ADD COMMENTlink written 7 days ago by gb290

I am using Anaconda Spyder to run Biopython but i dont get the output when using NcbiblastnCommandline but when i use NcbiblastpCommandline i get the output ....But the output is in following format

*Alignment* sequence: seq2 seq2 <unknown description=""> length: 149 e value: 0.0138168 CTAGCTCGATCGATCGATGCTAAGCTTACGTAGCT... CTAGCT GATCG C TACGTAGCT... CTAGCT-GATCGTAC-----------TACGTAGCT..

what should i do to get the output as follows

tacttgttgatattggatcgaacaaactggagaaccaacatgctcacgtcacttttagtcccttacatattcctc... ||||||||| | ||||||||||| || |||| || || |||||||| |||||| | | |||||||| ||| ||... tacttgttggtgttggatcgaaccaattggaagacgaatatgctcacatcacttctcattccttacatcttcttc...

ADD REPLYlink written 9 hours ago by neilgupte70

Please use the code formatting button (it has101010 written on it in the bar above) to improve your posts readability.

ADD REPLYlink modified 9 hours ago • written 9 hours ago by jrj.healey6.0k

Not sure if I understand because you comment is hard to read. But when you do a blastp you do a protein alignment. So you have matches and positives. You need to check what's going wrong with blastn, blastn is for nucleotide alignments.

ADD REPLYlink written 9 hours ago by gb290
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1457 users visited in the last hour