Skip to content

Commit

Permalink
Adding a script aiming to help alex on his work
Browse files Browse the repository at this point in the history
  • Loading branch information
Mxrcon committed Oct 20, 2021
1 parent 1d966c4 commit 54fd56d
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions ab1_to_blast.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env python3

from Bio import SeqIO
from Bio.Blast import NCBIWWW
import sys

input_file = sys.argv[1]
input_name = input_file.split(".")[0]

records = SeqIO.parse(input_file,"abi")
count = SeqIO.write(records, input_name+".fastq", "fastq")
print("Converted %i records" % count)
input_name = "teste"
# h37rv 16s portion
# fasta_string = "ggaattcctggtgtagcggtggaatgcgcagatatcaggaggaacaccggtggcgaaggcgggtctctgggcagtaactgacgctgaggagcgaaagcgtggggagcgaacaggattagataccctggtagtccacgccgtaaacggtgggtactaggtgtgggtttccttccttgggat"
fasta_string = open(input_name+".fasta").read()
result_handle = NCBIWWW.qblast("blastn", "nt", fasta_string, format_type="Text")

with open(input_name+"_blast_result.txt", "w") as out_handle:
out_handle.write(result_handle.read())
result_handle.close()

0 comments on commit 54fd56d

Please sign in to comment.