# What do negative dN or dS mean in cal_dn_ds in Biopython?

I'm noobie in bioinformatics. I use cal_dn_ds from Bio.codonalign.codonseq with method 'NG86'. Sometimes I get dS=-1. What does it mean? How can number of substitutions be negative? Does it mean that something is wrong with my data?

Upd. 1) Chris_Rands pointed to sources, I read them already, but the question remain. What is that ps variable, and why if it's greater than 3/4, dS = -1?

2) Some more details. cal_dn_ds requires sequences from CodonAlignment object, which is created by function Bio.codonalign.build that requires (quote from docs) protein alignment and corresponding nucleotides. I have nucleotide sequences from NCBI at the beginning. So I trim non-coding regions from nucleotide sequences, translate all trimmed sequences, write them to a file, perform multiple alignment of the protein sequences, and then pass the list of aligned protein sequences and the list of nucleotide sequences to the build function. I analize protein DKK1, and example sequences that get negatives are Empidonax traillii XM_027898752.1 and Physeter catodon XM_007110600.1. But I just want to understand general idea behind dS = -1, what can it mean it different cases.

3) Michael G. gave an interesting suggestion that it means zero, but it's strange because the function returns dN and dS separately, so Biopython might as well return zero, so the user would handle those cases himself. And for some sequences Biopython actually returns normal positive dS and dN = 0 at the same time. If it's an error, what are the possible causes? And why in those error cases Biopython can calculate dN, but dS is -1?

• Please edit your question and give us some more details. What kind of input do you have? What are you passing as input to cal_dn_ds? If you are using some sort of alignment, what species are involved? The more details you give us, the better your chances of getting a useful answer. May 13 '19 at 14:12
• github.com/biopython/biopython/blob/master/Bio/codonalign/… May 13 '19 at 14:59
• terdon, Chirs_Rands, thank you for replies, I updated my question with more details. May 14 '19 at 8:04

dS = -1 .. there are two suggestions

1. I suggest its an error, possibly based on nucleotide calls within the S, check for anomylous nucleotides, particularly over a non-synonymous codon

2. It might mean their are no synonymous mutations. It is not the best idea to assign this a value of 0 in a ratio because it will cause the ratio to fall over when in fact their could be strong selection pressure, ie non-synon mutations. Having an incrementally small value is problematic because dN if positive could anything up to infinity, so -1 might flag this problem.

Okay I now know why... You are correct to be concerned with the result because its serious.

My sincere advice to you is do not use any dN/dS ratio where -1 is occurring under any circumstances. On this occasion I'm not going to explain why for two reasons:

1. First and foremost, as a phylogeneticist you should know why, it relates to the fundamentals of the discipline.
2. (Hint) The answer is in my past posts on this forum.

To conclude, I'm pretty nuanced in statistical dogma, you can check my record, IMO most dogma is tribalism because every calculation has weaknesses. HERE HOWEVER, there is a real problem and again I urge you to ditch any data set where -1 is occurring and everything associated with it. That is a fairly dire warning should give you a clue about whats wrong. If you are not prepared to do this, then you must report the result and the situations where it is arising (don't hide it).

• Thank you for your reply, I provided some more details for you at Upd 3. I checked my nucleotide sequences, and they do not have anything except ATGC, if that's what you meant by 1. May 14 '19 at 8:16