If you multiply an inequality by a negative number you must reverse the direction of the inequality.
For example:
- 1 < x < 6 (1)
- -1 > -x > -10 (2)
if x = 6, it is consistent with equation (1) and (2).
Is there a way to multiply an inequality statement by an integer in a one-liner for Python to reverse the signs?
From the practical point of view, I am trying to extract DNA/protein sequences from TBLASTN results. There are strands +1 and -1 and the operation after that condition statement is the same.
# one-liner statement I would like to implement
if (start_codon <= coord <= stop_codon)*strand:
# do operation
# two-liner statement I know would work
if (start_codon <= coord <= stop_codon) and strand==1:
# do operation
elif (start_codon >= coord >= stop_codon) and strand==-1:
# do operation
Aucun commentaire:
Enregistrer un commentaire