I have this script that contains four different function. Function 2-4 have a common path, the for loop. I would like to get some help so I can sort that 'for loop' making it into one but depending on the function to get the data from the right file, fastqs, faster or xml.
> def One(): #gene extraction
#do something
One()
def Two(path_to_folder_H*,something_else): # de novo assembly
#do something with files
folders=glob.glob(path_to_folder_H*)
for folder in folders:
my_file=glob.glob(file.fastqs)
if folder exit:
#do something
elif:
# do something else
Two(path_to_folder_H*,something_else)
def Third(path_to_folder_H*, someting_else_2): #database+blast
#do something
folders=glob.glob(path_to_folder_H*)
for folder in folders:
my_file=glob.glob(file.fa)
Third(path_to_folder_H*,something_else_2)
def Fouth(path_to_folder_H*,something_else_3): #parsing file
#do someething
count=0
dict={}
folders=glob.glob(path_to_folder_H*)
for folder in folders:
my_file=glob.glob(file.xml)
if something:
#do something
elif:
#something else
Fourth(path_to_folder_H*,something_else_3)
This code is about 200 line long, and I just put a synopsis to abbreviate. The first function extract data from a file. The second function does the novo assembly with the fastqs file, and give a confing.fa. The third function uses the cotings.fa and a file obtained with the first function to do a database, and blast, giving an xml file. The fourth function parse the xml obtained with the third funcion.