qmarcou / IGoR

IGoR is a C++ software designed to infer V(D)J recombination related processes from sequencing data. Find full documentation at:
https://qmarcou.github.io/IGoR/
GNU General Public License v3.0
47 stars 25 forks source link

NaN values for (alpha) chain recombination probabilities! #28

Open JonasMir opened 5 years ago

JonasMir commented 5 years ago

Hi Quentin,

I noticed that for calculating alpha chain probabilities I have the problem of almost always getting nan-values in the output. I looked at the sequences but I do not see a pattern. At the same time nan-values are an exception for my beta-chains. Do you have an idea about what is going wrong there?

Best, Jonas

qmarcou commented 5 years ago

Hi Jonas, Thanks for posting your question here.

For your alpha chains: in general the most problematic step is to get correct gene alignments in the pre processing step, after that the inference/evaluation is pretty smooth. What I would encourage you to do is :

As I mentioned the best results are obtained by constraining the offsets as much as you can provided the sequencing mechanism (having a primer in the V makes you sure of the V offset for instance, as for CDR3s the gene anchors position automatically gives you an offset) and incorrect parameters there may bias your results. I know setting them correctly may seem tedious, but I know by experience that making blind alignments does not work well especially on short sequences (such as CDR3s)

JonasMir commented 5 years ago

Hi Quentin,

thanks for your detailed answer! Indeed the inference_logs.txt file showed the problem having zeroes. In my case already resetting the threshold for the alignment solved the problem.

Cheers, Jonas

spritelysauropods commented 5 years ago

Hello, I am adding to this question because I think the problems I am encountering are related, but I am not sure what additional steps to try to resolve nan generation probability for ~10% of mouse CDR3beta sequences (60 bp-long reads) using the built-in models.

For a handful of sequences in the Pgen_counts.csv that had nan for Pgen_estimate, I tried the following:

I have not tried using the --ntCDR3 flag in the alignment step because it seems like the alignment step is successful. Should I try using the --ntCDR3 flag? We have indices of V and J positions in the read but it may just take me some thinking to match that to offsets.

Thank you! I've attached a extract of the inference_logs.txt for 4 sequences that had nan Pgen_estimate with the default P_ratio_thresh and with P_ratio_thresh set to 0.0. inference_logs_example.txt

qmarcou commented 4 years ago

Dear @spritelysauropods , Apologies for the late reply. Did you have any luck setting the probability ratio to a low value? Setting to 0 must lead to a division by 0 somewhere in the code, hence the NaNs. I should probably introduce a small fix to replace 0 by the minimum double value.

As for your other questions:

I have not tried using the --ntCDR3 flag in the alignment step because it seems like the alignment step is successful. Should I try using the --ntCDR3 flag? We have indices of V and J positions in the read but it may just take me some thinking to match that to offsets.

In general I would advise you to use your V and J position knowledge, especially since you have such short reads (60bp). Disregarding this information is increasing uncertainty for the algorithm and can only produce worse results. As for CDR3, this would require you to first preprocess your sequences in order to extract their CDR3 sequences. Many tools can perform this operation, although they all rely on some kind of alignment, and because you have very short reads you cannot be guaranteed they will spit out the correct CDR3.