Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not handle missing genotype in VCF file #166

Open
whtop opened this issue Feb 27, 2023 · 1 comment
Open

Can not handle missing genotype in VCF file #166

whtop opened this issue Feb 27, 2023 · 1 comment

Comments

@whtop
Copy link

whtop commented Feb 27, 2023

When there is missing genotype ("./.") in SNV VCF:

TypeError                                 Traceback (most recent call last)
<ipython-input-136-616bc7531471> in <module>
----> 1 app.vcf(["chr17.ALL.vcf.gz], use_index=True, chroms=['chr17'], sample="sample")

~/anaconda3/lib/python3.9/site-packages/CNVpytor-1.2.1-py3.9.egg/cnvpytor/root.py in vcf(self, vcf_files, chroms, sample, no_counts, ad_tag, gt_tag, filter, callset, use_index)
    347         """
    348         for vcf_file in vcf_files:
--> 349             self._read_vcf(vcf_file, chroms, sample, no_counts=no_counts, ad_tag=ad_tag, gt_tag=gt_tag, filter=filter,
    350                            callset=callset, use_index=use_index)
    351             self.io.add_meta_attribute("VCF", vcf_file)

~/anaconda3/lib/python3.9/site-packages/CNVpytor-1.2.1-py3.9.egg/cnvpytor/root.py in _read_vcf(self, vcf_file, chroms, sample, use_index, no_counts, ad_tag, gt_tag, filter, callset)
    272                     nref, nalt = np.zeros_like(pos), np.zeros_like(pos)
    273                 else:
--> 274                     pos, ref, alt, nref, nalt, gt, flag, qual = vcff.read_chromosome_snp(c, sample, ad_tag=ad_tag,
    275                                                                                          gt_tag=gt_tag, filter=filter)
    276

~/anaconda3/lib/python3.9/site-packages/CNVpytor-1.2.1-py3.9.egg/cnvpytor/vcf.py in read_chromosome_snp(self, chr_name, sample, ad_tag, gt_tag, filter)
    159                             gt.append(gt_from_str(rec.samples[sample][gt_tag]))
    160                         else:
--> 161                             gt.append(gt_from_list(rec.samples[sample][gt_tag], rec.samples[sample].phased))
    162         except ValueError:
    163             _logger.error("Variant file reading problem. Probably index file is missing or corrupted.")

~/anaconda3/lib/python3.9/site-packages/CNVpytor-1.2.1-py3.9.egg/cnvpytor/utils.py in gt_from_list(l, phased)
   1049
   1050 def gt_from_list(l, phased):
-> 1051     haps = list(map(int1, l))
   1052     ones, n = sum(haps), len(haps)
   1053     x = int(phased) * 4

~/anaconda3/lib/python3.9/site-packages/CNVpytor-1.2.1-py3.9.egg/cnvpytor/utils.py in int1(x)
   1032
   1033     """
-> 1034     return int(int(x) == 1)
   1035
   1036

TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType' 
@arpanda
Copy link
Member

arpanda commented Feb 27, 2023

Could you please share the command you used.

-Arijit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants