I was wondering whether I can avoid using the same arguments when using a function within another one. I will give you a chunk of code to make it clear:
def calculateQC(self,dic_symbols:dict) -> float:
str_quality = self.quality
length_seq = len(str_quality)
num_qc = 0
for symbol in str_quality:
num_value = dic_symbols[symbol]
num_qc += num_value
mean_qc = num_qc/length_seq
return(mean_qc)
def FastqtoFasta(self,min_qual:int,dic_symbols:dict) -> FastaFile:
header,sequence,qualc = self.info,self.seq,self.quality
qualc = self.calculateQC(dic_symbols)
if qualc >= min_qual:
print(">%s\n%s" %(header,sequence))
As you can see, the function FastqtoFasta includes another function called calculateQC, which requires a dictionary as an argument. As a consequence, I must also provide the FastqtoFasta with the dictionary in order to work it out or otherwise I would not be able to use calculateQC (error).
Is there a more straightforward solution to this or is this just the only way?
Thanks.