Using regular expression as global constant and have to check the regular expression regCheck in processloop fucntion also converting if -else statement with any loops( by removing "elif" since changed by loop)
`````````````````regex``````````````
regSingle = r'[ACGU]\d+[ACGU]&[ACGU]-?\d+[ACGU]'
regMulti = 'regSingle(|regSingle)*'
regAlt = 'regMulti(,regMulti)*'
regCheck = '^\s* regAlt \s*$'
````````````````````````
```````````````````conversion of ifelse into loop``````````````
def processLoop():
for index, record in enumerate(sRNAGene):
mutation = sRNAGene[record].get("mutation")
if ("|" in mutation):
print("\n\n Multiple Evaluations using : \t", mutation)
multiEval = mutation.split("|")
for index , element in enumerate(multiEval):
part_1, part_2, = element.split('&', 1)
boolsRNA(part_1, sRNAGene[record].get("fasta") ,sRNAGene[record].get("name"))
boolsGene(part_2, sRNAGene[record].get("gene").get("Sequence") ,sRNAGene[record].get("gene").get("name"))
sys.exit()
complementBase(part_2, part_1)
elif ("," in mutation):
print("\n\n Mutation with Bar ',' : \t", mutation)
else:
part_1, part_2 = mutation.split('&', 1)
boolsRNA(part_1, sRNAGene[record].get("fasta") ,sRNAGene[record].get("name"))
boolsGene(part_2, sRNAGene[record].get("gene").get("Sequence") ,sRNAGene[record].get("gene").get("name"))
sys.exit()
complementBase(part_2, part_1)
Aucun commentaire:
Enregistrer un commentaire