def test_compound_non_commutative(self): """The goal is to test the non-cummutativity of applying compound het then some other filter, or the contrary. Not certain about the final number, but at least it should go without an error.""" variants = variants_collection_factory(db='test') ss = samples_selection_factory(db='test', groups={ 'affected': ['09818', '09819'], 'not_affected': ['09960', '09961'] }) filter_coll = variant_filters_collection_factory([ ('filter', '=', 'PASS'), ('aaf_1kg_all', '<=', '0.01'), ('genotype', '=', 'compound_het'), ], ss) var = filter_coll.apply(variants).variants self.assertEqual(len(var), 13) filter_coll = variant_filters_collection_factory([ ('genotype', '=', 'compound_het'), ('filter', '=', 'PASS'), ('aaf_1kg_all', '<=', '0.01'), ], ss) var = filter_coll.apply(variants).variants self.assertEqual(len(var), 0)
def setUp(self): self.varCol = variants_collection_factory('test') self.simpleVariants = VariantsCollection([ Variant(ref=x[0], quality=x[1], chrom=x[2], start=x[3]) for x in ([ ('A', 100.3, 'chr1', 100), ('B', 10.4, 'chr1', 99), ('C', 9.2, 'chr2', 20), ('D', 200, 'chr12', 1000), ('E', 1, 'chr1', 2000), ]) ])
def test_compound_Lucie_FNDC1(self): """These 2(3) variants are annotated on different transcripts of the same gene, and because of the group_by(transcript_id), the compound was not found. Check here that it is fixed. """ ss = samples_selection_factory(db='test', groups = {'affected': ['101563','101591'], 'not_affected':['101564','101565']}) variants = variants_collection_factory(db='test', qs=Variant.objects.using('test').filter(gene_symbol='FNDC1')) ## To select them directly: #variants = variants_collection_factory( # Variants.objects.using('test').filter(start__in=['159653504','159653634']), db='test') var = GenotypesFilterCompoundHeterozygous(ss).apply(variants).variants self.assertEqual(len(var), 3)
def test_Xlinked_Norine_BMX(self): """This gene has no X-linked variant""" db = 'lgueneau' ss = samples_selection_factory(db=db, groups = {'affected': ['09818','09819'], 'not_affected':['09960','09961']}) qs = Variant.objects.using(db).filter(gene_symbol__in=['BMX'], chrom='chrX') # Using GenotypesFilterXLinked.apply() variants = variants_collection_factory(db=db, qs=qs) var = GenotypesFilterXLinked(ss).apply(variants).variants self.assertEqual(len(var), 0) # Using FilterCollection.apply() fc = FiltersCollection([GenotypesFilterXLinked(ss)]) var = fc.apply(initqs=qs, db=db).variants self.assertEqual(len(var), 0)
def test_Xlinked_Lucie_ASMTL(self): """This gene has 2 X-linked variants""" db = 'lgueneau' ss = samples_selection_factory(db=db, groups = {'affected': ['09818','09819'], 'not_affected':['09960','09961']}) qs = Variant.objects.using(db).filter(gene_symbol__in=['ASMTL','CSF2RA','PPP2R3B','TM4SF2'], chrom='chrX') # Using GenotypesFilterXLinked.apply() variants = variants_collection_factory(db=db, qs=qs) print(GenotypesFilterXLinked(ss).conditions_vector) var = GenotypesFilterXLinked(ss).apply(variants).variants self.assertEqual(len(var), 5) # Using FilterCollection.apply() fc = FiltersCollection([GenotypesFilterXLinked(ss)]) var = fc.apply(initqs=qs, db=db).variants self.assertEqual(len(var), 5)
def test_Xlinked_Norine_BMX(self): """This gene has no X-linked variant""" db = 'lgueneau' ss = samples_selection_factory(db=db, groups={ 'affected': ['09818', '09819'], 'not_affected': ['09960', '09961'] }) qs = Variant.objects.using(db).filter(gene_symbol__in=['BMX'], chrom='chrX') # Using GenotypesFilterXLinked.apply() variants = variants_collection_factory(db=db, qs=qs) var = GenotypesFilterXLinked(ss).apply(variants).variants self.assertEqual(len(var), 0) # Using FilterCollection.apply() fc = FiltersCollection([GenotypesFilterXLinked(ss)]) var = fc.apply(initqs=qs, db=db).variants self.assertEqual(len(var), 0)
def test_compound_Lucie_FNDC1(self): """These 2(3) variants are annotated on different transcripts of the same gene, and because of the group_by(transcript_id), the compound was not found. Check here that it is fixed. """ ss = samples_selection_factory(db='test', groups={ 'affected': ['101563', '101591'], 'not_affected': ['101564', '101565'] }) variants = variants_collection_factory( db='test', qs=Variant.objects.using('test').filter(gene_symbol='FNDC1')) ## To select them directly: #variants = variants_collection_factory( # Variants.objects.using('test').filter(start__in=['159653504','159653634']), db='test') var = GenotypesFilterCompoundHeterozygous(ss).apply(variants).variants self.assertEqual(len(var), 3)
def test_Xlinked_Lucie_ASMTL(self): """This gene has 2 X-linked variants""" db = 'lgueneau' ss = samples_selection_factory(db=db, groups={ 'affected': ['09818', '09819'], 'not_affected': ['09960', '09961'] }) qs = Variant.objects.using(db).filter( gene_symbol__in=['ASMTL', 'CSF2RA', 'PPP2R3B', 'TM4SF2'], chrom='chrX') # Using GenotypesFilterXLinked.apply() variants = variants_collection_factory(db=db, qs=qs) print(GenotypesFilterXLinked(ss).conditions_vector) var = GenotypesFilterXLinked(ss).apply(variants).variants self.assertEqual(len(var), 5) # Using FilterCollection.apply() fc = FiltersCollection([GenotypesFilterXLinked(ss)]) var = fc.apply(initqs=qs, db=db).variants self.assertEqual(len(var), 5)
def test_compound_non_commutative(self): """The goal is to test the non-cummutativity of applying compound het then some other filter, or the contrary. Not certain about the final number, but at least it should go without an error.""" variants = variants_collection_factory(db='test') ss = samples_selection_factory(db='test', groups = {'affected': ['09818','09819'], 'not_affected':['09960','09961']}) filter_coll = variant_filters_collection_factory([ ('filter', '=', 'PASS'), ('aaf_1kg_all', '<=', '0.01'), ('genotype', '=', 'compound_het'), ], ss) var = filter_coll.apply(variants).variants self.assertEqual(len(var), 13) filter_coll = variant_filters_collection_factory([ ('genotype', '=', 'compound_het'), ('filter', '=', 'PASS'), ('aaf_1kg_all', '<=', '0.01'), ], ss) var = filter_coll.apply(variants).variants self.assertEqual(len(var), 0)
def setUp(self): self.ss = samples_selection_factory(TESTDB, groups='ped') self.variants = variants_collection_factory(TESTDB) self.N = len(self.variants)
def setUp(self): self.variants = variants_collection_factory(db='test') self.genotypes = genotypes_service(db='test').genotypes
def setUp(self): self.variants = variants_collection_factory(db='test')
def test_sort_all(self): """Just check that it does not raise an error.""" var = variants_collection_factory(db='test') for field in VARIANT_FIELDS: Sort(field, False).sort(var)
def setUp(self): self.rf = RequestFactory() self.variants_django = Variants.objects.using('test').all() self.variants = variants_collection_factory(db='test')
def setUp(self): self.testdb = 'test' self.variants = variants_collection_factory(self.testdb) self.N = len(self.variants)
def setUp(self): self.variants = variants_collection_factory('test') self.v1 = self.variants[0] self.v8 = self.variants[8]
def setUp(self): self.qs = Variant.objects.using('test') self.variants = variants_collection_factory(db='test') self.N = len(self.variants)
def setUp(self): self.variants = variants_collection_factory('test') self.N = len(self.variants)
def setUp(self): self.var = variants_collection_factory(db='test') self.ss = samples_selection_factory(db='test')