GADMA icon indicating copy to clipboard operation
GADMA copied to clipboard

IndexError: string index out of range

Open anubhabkhan opened this issue 3 years ago • 7 comments

Hey,

I am new to GADMA. I have installed GADMA2 and trying to run it on vcf file but I get the error pasted bellow. Could you please help. My parameter file is attached too.

UserWarning: Parameters will be in genetic units (Relative parameters). Engines dadi and moments require mutation rate and sequence length for unit translation (/usr/local/lib/python3.6/site-packages/gadma/cli/settings_storage.py:1352) Data reading False Traceback (most recent call last): File "/usr/local/bin/gadma", line 11, in sys.exit(main()) File "/usr/local/lib/python3.6/site-packages/gadma/core/core.py", line 69, in main settings_storage.read_data() File "/usr/local/lib/python3.6/site-packages/gadma/cli/settings_storage.py", line 891, in read_data engine.data = self.data_holder File "/usr/local/lib/python3.6/site-packages/gadma/engines/engine.py", line 209, in data self.set_data(new_data) File "/usr/local/lib/python3.6/site-packages/gadma/engines/engine.py", line 191, in set_data self.inner_data = self.read_data(data) File "/usr/local/lib/python3.6/site-packages/gadma/engines/engine.py", line 121, in read_data return cls._read_data(data_holder) File "/usr/local/lib/python3.6/site-packages/gadma/engines/dadi_moments_common.py", line 58, in _read_data data = read_vcf_data(cls.base_module, data_holder) File "/usr/local/lib/python3.6/site-packages/gadma/engines/dadi_moments_common.py", line 733, in read_vcf_data flanking_info=[None, None], File "/usr/local/lib64/python3.6/site-packages/moments/Misc.py", line 562, in make_data_dict_vcf g1, g2 = gt[0], gt[2] IndexError: string index out of range GADMA_param_HiC_scaffold_1.txt

anubhabkhan avatar Jun 29 '22 12:06 anubhabkhan

Hi @anubhabkhan ,

Sorry for the late reply. The error occurs during VCF data reading. Moments sometimes failed to read files. Let's find out what is the reason and I think that I will put some warning for the future. I have checked moments code and it looks like you have VCF file with haploid samples. Is that correct? Do you have GT field like ./. or just ., where . is for 0 or 1?

Best regards, Ekaterina

noscode avatar Jul 01 '22 09:07 noscode

Hey,

My populations are diploid. I do have a GT field. I am attaching a sample of my vcf in .txt format here. Could you please take a look. It would be very helpful.

Thank you

pop_order.txt test.vcf.txt .

anubhabkhan avatar Jul 03 '22 19:07 anubhabkhan

Hi @anubhabkhan,

Sorry for slow reply, I have checked VCF file that you have sent and found that in some samples there is haploid information. That is why the error occurs. The GT field is the first field in the sample information and you should check that it is 0/0 or 0/1 or 1/1 thought the file. For example I see 0:4,0:2,0:2,0:4:0:99:3:0,144:0:LowGQX;SiteConflict: as a sample information somewhere in the file and GT field here is 0 which is bad for GADMA. Maybe it is because of SiteConflict as I see several similar info in the file?

Best regards, Ekaterina

noscode avatar Jul 06 '22 13:07 noscode

Hey,

thanks for that. We have removed those loci but now we get a different error and I am unable to solve this one too. Could you please look at the attached files and advice.

Anubhab [GADMA.log](https://github.com/ctlab/GADMA/files/9140418/GADMA.log GADMA_param_no_site_conflict.par.txt )

anubhabkhan avatar Jul 19 '22 11:07 anubhabkhan

Hi Anubhab,

Great! I see that file was successfully read. The error is caused because GADMA tries to build model using moments engine for more than 5 populations. How many population have you specified in popmap file? Usually GADMA supports up to three populations. It could deal with 4 and 5 but it is slow and I recommend to specify simple models (e.g. without migrations).

Best, Ekaterina

noscode avatar Jul 19 '22 12:07 noscode

Thanks so much. I tried with 6 populations and that is probably the reason it failed. I will try again with fewer populations. Thanks

Anubhab

anubhabkhan avatar Jul 19 '22 12:07 anubhabkhan

You are welcome!

noscode avatar Jul 19 '22 15:07 noscode