CAST-genomics / haptools

Ancestry and haplotype aware simulation of genotypes and phenotypes for complex trait analysis
https://haptools.readthedocs.io
MIT License
19 stars 4 forks source link

Error when using centromeres file for karyogram #233

Closed gymreklab closed 10 months ago

gymreklab commented 10 months ago

When running haptools karyogram with the following command:

haptools karyogram \
 --bp ${sample}.bp --sample ${sample} --out ${sample}.png --title ${sample} \
 --centromeres centromeres_hg19.txt \
 --colors 'EUR:blue,AFR:red,EAS:green,SAS:purple,NAT:orange,OCE:cyan,AHG:gray,OCE:brown'

I got the error message below. When removing the --centromeres option I do not get this error. I suspect it is because my data has no chromosome X, whereas the centromeres file does, but am not sure.

Traceback (most recent call last):
  File "/opt/conda/bin/haptools", line 8, in <module>
    sys.exit(main())
  File "/opt/conda/lib/python3.9/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/opt/conda/lib/python3.9/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/opt/conda/lib/python3.9/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/conda/lib/python3.9/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/conda/lib/python3.9/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/opt/conda/lib/python3.9/site-packages/haptools/__main__.py", line 85, in karyogram
    PlotKaryogram(
  File "/opt/conda/lib/python3.9/site-packages/haptools/karyogram.py", line 266, in PlotKaryogram
    clipmask_perchrom = GetCentromereClipMask(centromeres_file, chrom_order)
  File "/opt/conda/lib/python3.9/site-packages/haptools/karyogram.py", line 315, in GetCentromereClipMask
    chrom_ind = chrom_order.index(chrom)
ValueError: 23 is not in list
[    INFO] Generating Karyogram... (__main__.py:84)
[    INFO] Collecting Haplotype Blocks... (karyogram.py:230)
[    INFO] Centromeres present, adding into figure... (karyogram.py:265)
Traceback (most recent call last):
  File "/opt/conda/bin/haptools", line 8, in <module>
    sys.exit(main())
  File "/opt/conda/lib/python3.9/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/opt/conda/lib/python3.9/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/opt/conda/lib/python3.9/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/conda/lib/python3.9/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/conda/lib/python3.9/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/opt/conda/lib/python3.9/site-packages/haptools/__main__.py", line 85, in karyogram
    PlotKaryogram(
  File "/opt/conda/lib/python3.9/site-packages/haptools/karyogram.py", line 266, in PlotKaryogram
    clipmask_perchrom = GetCentromereClipMask(centromeres_file, chrom_order)
  File "/opt/conda/lib/python3.9/site-packages/haptools/karyogram.py", line 315, in GetCentromereClipMask
    chrom_ind = chrom_order.index(chrom)
ValueError: 23 is not in list
[    INFO] Generating Karyogram... (__main__.py:84)
[    INFO] Collecting Haplotype Blocks... (karyogram.py:230)
[    INFO] Centromeres present, adding into figure... (karyogram.py:265)
Traceback (most recent call last):
  File "/opt/conda/bin/haptools", line 8, in <module>
    sys.exit(main())
  File "/opt/conda/lib/python3.9/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/opt/conda/lib/python3.9/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/opt/conda/lib/python3.9/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/conda/lib/python3.9/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/conda/lib/python3.9/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/opt/conda/lib/python3.9/site-packages/haptools/__main__.py", line 85, in karyogram
    PlotKaryogram(
  File "/opt/conda/lib/python3.9/site-packages/haptools/karyogram.py", line 266, in PlotKaryogram
    clipmask_perchrom = GetCentromereClipMask(centromeres_file, chrom_order)
  File "/opt/conda/lib/python3.9/site-packages/haptools/karyogram.py", line 315, in GetCentromereClipMask
    chrom_ind = chrom_order.index(chrom)
ValueError: 23 is not in list