gdewael / cpg-transformer

CpG Transformer for imputation of single-cell methylomes
MIT License
37 stars 10 forks source link

Always meet a bug when apply to my dataset #4

Closed ElegantLin closed 2 years ago

ElegantLin commented 2 years ago

Hi, @gdewael ,

Thanks for your great work. I am using the pre-trained model to impute my dataset. However, when I am executing dm.setup(None). I always met a bug that the out-of-range exception in the cuts = torch.tensor([(indices[i],indices[i+self.segment_size-1]) for i in cuts_]) given here and the code would go to the exception branch because my indices cannot cover the whole the chromosome due to the mask. Do you have some suggestions?

Thanks!

gdewael commented 2 years ago

Hi! Thanks for trying our code.

I implemented this exception to catch the case in which a chromosome has fewer CpG sites (computed here) than expected to make a whole segment (a segment is what is input to the model all at once, kind of like how you would cut up sentences to input in NLP). If this exception is triggered, it will just make one segment for the whole chromosome. So in essence, this exception is not an error.

If this doesn't solve your issue, is there a way to generate some toy data to reproduce the issue?

Best, Gaetan

ElegantLin commented 2 years ago

Hi, @gdewael

Thanks for your quick reply. I think I have found the issue, which is from my code rather than your code. I would close this issue after I verify all my chromosomes.

Thanks a lot!