<?xml version='1.0'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:atom="http://www.w3.org/2005/Atom" >
<channel>
	<title><![CDATA[BOL: Python script to finds extact similar sequence between two multi fasta files !]]></title>
	<link>https://bioinformaticsonline.com/snippets/view/44524/python-script-to-finds-extact-similar-sequence-between-two-multi-fasta-files?</link>
	<atom:link href="https://bioinformaticsonline.com/snippets/view/44524/python-script-to-finds-extact-similar-sequence-between-two-multi-fasta-files?" rel="self" type="application/rss+xml" />
	<description><![CDATA[]]></description>
	
	<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/snippets/view/44524/python-script-to-finds-extact-similar-sequence-between-two-multi-fasta-files</guid>
	<pubDate>Thu, 02 May 2024 02:54:56 -0500</pubDate>
	<link>https://bioinformaticsonline.com/snippets/view/44524/python-script-to-finds-extact-similar-sequence-between-two-multi-fasta-files</link>
	<title><![CDATA[Python script to finds extact similar sequence between two multi fasta files !]]></title>
	<description><![CDATA[<code>from Bio.Blast.Applications import NcbiblastnCommandline
import os
import sys

def perform_local_blast(query_file, subject_file, output_file):
    # Set up the BLAST command with format 6 (tab-delimited)
    blastn_cline = NcbiblastnCommandline(query=query_file, subject=subject_file, out=output_file, outfmt=6,
                                          word_size=16, perc_identity=100)
    
    # Run BLAST
    stdout, stderr = blastn_cline()
    
    # Check for errors
    if stderr:
        print(&quot;Error running BLAST:&quot;)
        print(stderr)

def parse_blast_results(output_file):
    # Parse BLAST results
    with open(output_file, &quot;r&quot;) as result_handle:
        for line in result_handle:
            fields = line.strip().split(&#039;\t&#039;)
            qseq = fields[0]  # Extract the aligned query sequence (qseq)
            #print(&quot;Aligned Query Sequence:&quot;, qseq)
            # Print other relevant information if needed

def main():
    if len(sys.argv) != 4:
        print(&quot;Usage: python script.py query.fasta subject.fasta output.txt&quot;)
        sys.exit(1)
    
    query_file = sys.argv[1]
    subject_file = sys.argv[2]
    output_file = sys.argv[3]
    
    # Perform local BLAST
    perform_local_blast(query_file, subject_file, output_file)
    
    # Parse and print BLAST results
    #parse_blast_results(output_file)

if __name__ == &quot;__main__&quot;:
    main()</code>]]></description>
	<dc:creator>LEGE</dc:creator>
</item>

</channel>
</rss>