12
12
from pymongo .errors import BulkWriteError , DuplicateKeyError
13
13
14
14
from scout .build import build_variant
15
- from scout .constants import CHROMOSOMES , ORDERED_FILE_TYPE_MAP
15
+ from scout .constants import CHROMOSOMES , INVALID_SAMPLE_TYPES , ORDERED_FILE_TYPE_MAP
16
16
from scout .exceptions import IntegrityError
17
17
from scout .parse .variant import parse_variant
18
18
from scout .parse .variant .clnsig import is_pathogenic
@@ -621,16 +621,16 @@ def _has_variants_in_file(self, variant_file: str) -> bool:
621
621
622
622
def load_variants (
623
623
self ,
624
- case_obj ,
625
- variant_type = "clinical" ,
626
- category = "snv" ,
627
- rank_threshold = None ,
628
- chrom = None ,
629
- start = None ,
630
- end = None ,
631
- gene_obj = None ,
632
- custom_images = None ,
633
- build = "37" ,
624
+ case_obj : dict ,
625
+ variant_type : str = "clinical" ,
626
+ category : str = "snv" ,
627
+ rank_threshold : float = None ,
628
+ chrom : str = None ,
629
+ start : int = None ,
630
+ end : int = None ,
631
+ gene_obj : dict = None ,
632
+ custom_images : list = None ,
633
+ build : str = "37" ,
634
634
):
635
635
"""Load variants for a case into scout.
636
636
@@ -675,7 +675,7 @@ def load_variants(
675
675
)
676
676
677
677
gene_to_panels = self .gene_to_panels (case_obj )
678
- genes = [ gene_obj for gene_obj in self .all_genes (build = build )]
678
+ genes = list ( self .all_genes (build = build ))
679
679
hgncid_to_gene = self .hgncid_to_gene (genes = genes , build = build )
680
680
genomic_intervals = self .get_coding_intervals (genes = genes , build = build )
681
681
@@ -695,7 +695,11 @@ def load_variants(
695
695
LOG .debug ("Found VEP header %s" , "|" .join (vep_header ))
696
696
697
697
# This is a dictionary to tell where ind are in vcf
698
- individual_positions = {ind : i for i , ind in enumerate (vcf_obj .samples )}
698
+ individual_positions = {
699
+ ind : i
700
+ for i , ind in enumerate (vcf_obj .samples )
701
+ if vcf_obj .samples [i ].analysis_type not in INVALID_SAMPLE_TYPES [category ]
702
+ }
699
703
700
704
# Dictionary for cancer analysis
701
705
sample_info = {}
0 commit comments