<filename>arabidopsis_call_psiblast.py
import os
import re
import subprocess

#
#file_list = [f for f in os.listdir(".") if os.path.isfile(os.path.join(".", f))]
#print "file_list2", file_list2
#fastq_dict = {}
#if len(file_list2) > 0:
#    for e in file_list2:
#        if e[-6:] == ".fastq":
            

genotypes = ["Cvi", "Ler"]
roi = {1:[[174952, 3112850], [23698501, 24905939]]}#, 4:[[11438290, 16924197]]}
# <codecell>
for g in genotypes: # g = geno type

    geno = g 

    geno_path = "./" + geno
    os.chdir(geno_path)
    for ch in roi: # roi is a dictionary, with key = chrom, value = list of positions 
        for reg in roi[ch]:
            print "Begining psi-blast for ", geno, ch, reg
            print reg
            reg_descrip = "Chr_" + str(ch) + "_Reg_" + str(reg[0]) + "_" + str(reg[1])
            reg_dir_name = "./" + reg_descrip
            os.getcwd()
            os.chdir(reg_dir_name)
            file_list = [f for f in os.listdir(".") if os.path.isfile(os.path.join(".", f))]         
            for fl in file_list: #the .fasta (but not psi.fasta) files are individual protein sequences generated by SHM_Arabidopsis_SNPs which are located in a roi and contain a non-synonymous SNP
                if fl[-6:] == ".fasta" and fl[-10:] != "_psi.fasta": #the output of this loop is a fasta file *of* the psiblast hits - we don't want these to *be* blasted in the looping, should only be an issue while testing
                    file_name = fl[:-6]
                    blast_command = "psiblast -query " + fl + " -db plant.all.prot.masked -out " + file_name + "_psi.xml -outfmt 5 -max_target_seqs 100" 
                    subprocess.call(blast_command, shell=True) # submit file to psi-blast
            os.chdir("..")
    os.chdir("..")
    

<filename>arabidopsis_call_psiblast.py
import os
import re
import subprocess

#
#file_list = [f for f in os.listdir(".") if os.path.isfile(os.path.join(".", f))]
#print "file_list2", file_list2
#fastq_dict = {}
#if len(file_list2) > 0:
#    for e in file_list2:
#        if e[-6:] == ".fastq":
            

genotypes = ["Cvi", "Ler"]
roi = {1:[[174952, 3112850], [23698501, 24905939]]}#, 4:[[11438290, 16924197]]}
# <codecell>
for g in genotypes: # g = geno type

    geno = g 

    geno_path = "./" + geno
    os.chdir(geno_path)
    for ch in roi: # roi is a dictionary, with key = chrom, value = list of positions 
        for reg in roi[ch]:
            print "Begining psi-blast for ", geno, ch, reg
            print reg
            reg_descrip = "Chr_" + str(ch) + "_Reg_" + str(reg[0]) + "_" + str(reg[1])
            reg_dir_name = "./" + reg_descrip
            os.getcwd()
            os.chdir(reg_dir_name)
            file_list = [f for f in os.listdir(".") if os.path.isfile(os.path.join(".", f))]         
            for fl in file_list: #the .fasta (but not psi.fasta) files are individual protein sequences generated by SHM_Arabidopsis_SNPs which are located in a roi and contain a non-synonymous SNP
                if fl[-6:] == ".fasta" and fl[-10:] != "_psi.fasta": #the output of this loop is a fasta file *of* the psiblast hits - we don't want these to *be* blasted in the looping, should only be an issue while testing
                    file_name = fl[:-6]
                    blast_command = "psiblast -query " + fl + " -db plant.all.prot.masked -out " + file_name + "_psi.xml -outfmt 5 -max_target_seqs 100" 
                    subprocess.call(blast_command, shell=True) # submit file to psi-blast
            os.chdir("..")
    os.chdir("..")
    

# #file_list = [f for f in os.listdir(".") if os.path.isfile(os.path.join(".", f))] #print "file_list2", file_list2 #fastq_dict = {} #if len(file_list2) > 0: #    for e in file_list2: #        if e[-6:] == ".fastq": #, 4:[[11438290, 16924197]]} # <codecell> # g = geno type # roi is a dictionary, with key = chrom, value = list of positions #the .fasta (but not psi.fasta) files are individual protein sequences generated by SHM_Arabidopsis_SNPs which are located in a roi and contain a non-synonymous SNP #the output of this loop is a fasta file *of* the psiblast hits - we don't want these to *be* blasted in the looping, should only be an issue while testing # submit file to psi-blast