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

Deal with older vcf formats and samples with missing data #147

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions pypgx/api/genotype.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,11 +619,13 @@ def call_genotypes(alleles=None, cnv_calls=None):

if alleles is not None and cnv_calls is not None:
if set(alleles.data.index) != set(cnv_calls.data.index):
raise ValueError('SampleTable[Alleles] and '
'SampleTable[CNVCalls] have different samples')
_diff = set(cnv_calls.data.index)- set(alleles.data.index)
print(_diff)
print("Are missing and will be droped")
if alleles.metadata['Gene'] != cnv_calls.metadata['Gene']:
raise ValueError('Found two different target genes')
df = pd.concat([alleles.data, cnv_calls.data], axis=1)
df = df.dropna()
gene = alleles.metadata['Gene']
assembly = alleles.metadata['Assembly']
elif alleles is not None and cnv_calls is None:
Expand Down
6 changes: 6 additions & 0 deletions pypgx/api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1299,6 +1299,12 @@ def prepare_depth_of_coverage(
exclude=exclude
).to_regions()


regions = [
item for item in regions
if item.split(':')[0].isdigit() or item.split(':')[0] in {'X', 'Y'}
]

cf = pycov.CovFrame.from_bam(bams, regions=regions, zero=True)

if bed:
Expand Down