def test_add_new_vcf_variant_set(self): vcf = VCF(f="tests/vcf_tests/test.vcf", reference_set_id=self.reference_set.id, method="CORTEX") vcf.add_to_database() # We create a global variant set as well as one for the individual VCF assert VariantSet.objects().count() == 2 vs = VariantSet.objects()[0] assert len(Variant.objects()[0].variant_sets) == 2 assert vs.name == "test.vcf"
def _create_new_variant_set(self): variant_set_name = os.path.basename(self.f) if VariantSet.objects(name=variant_set_name, reference_set=self.reference_set): if not self.force: raise NotUniqueError( "VariantSet %s already exists. Rerun with -f to recreate." % variant_set_name) else: self._remove_variant_set(variant_set_name) self.vcf_variant_set = VariantSet.create_and_save( name=variant_set_name, reference_set=self.reference_set)
def setUp(self): self.reference_set = ReferenceSet().create_and_save(name="ref_set") self.variant_set = VariantSet.create_and_save( name="this_vcf_file2", reference_set=self.reference_set) self.variant_sets = [self.variant_set] self.reference = Reference().create_and_save( name="ref", md5checksum="sre", reference_sets=[ self.reference_set]) self.call_set = VariantCallSet.create( sample_id="C00123", name="C00123", variant_sets=self.variant_sets) self.variant_snp = Variant.create(variant_sets=self.variant_sets, start=0, end=1, reference_bases="A", alternate_bases=["T"], reference=self.reference) self.variant_snp_mult_alts = Variant.create( variant_sets=self.variant_sets, start=0, end=1, reference_bases="T", alternate_bases=[ "A", "C"], reference=self.reference)
def global_variant_set(self): try: vs = VariantSet.objects.get(name=GLOBAL_VARIANT_SET_NAME) except: vs = VariantSet.create_and_save(name=GLOBAL_VARIANT_SET_NAME, reference_set=self.reference_set) return vs
def test_create_new_variant(self): variant_set = VariantSet.create_and_save( name="this_vcf_file", reference_set=self.reference_set) vs = VariantSet.objects.get(name="this_vcf_file") assert variant_set == vs assert vs.reference_set.name == "ref_set"
def setUp(self): DB.drop_database('ga4ghmongo-test') self.reference_set = ReferenceSet().create_and_save(name="ref_set") self.variant_set = VariantSet.create_and_save( name="this_vcf_file", reference_set=self.reference_set) self.variant_sets = [self.variant_set] self.reference = Reference().create_and_save( name="ref", md5checksum="sre", reference_sets=[self.reference_set])
def setUp(self): DB.drop_database('atlas-test') self.pg = AlleleGenerator( reference_filepath="atlasvar/data/NC_000962.2.fasta") self.reference_set = ReferenceSet().create_and_save(name="ref_set") self.variant_set = VariantSet.create_and_save( name="this_vcf_file", reference_set=self.reference_set) self.variant_sets = [self.variant_set] self.reference = Reference().create_and_save( name="ref", md5checksum="sre", reference_sets=[self.reference_set])
def setUp(self): DB.drop_database('ga4ghmongo-test') self.reference_set = ReferenceSet().create_and_save(name="ref_set") self.variant_set = VariantSet.create_and_save( name="this_vcf_file", reference_set=self.reference_set) self.variant_sets = [self.variant_set] self.reference = Reference().create_and_save( name="ref", md5checksum="sre", reference_sets=[ self.reference_set])
def setUp(self): DB.drop_database('atlas-test') with open("mykatlas/data/NC_000962.3.fasta", 'r') as infile: self.reference_seq = list(SeqIO.parse(infile, "fasta"))[0].seq self.gm = GeneAminoAcidChangeToDNAVariants( reference="mykatlas/data/NC_000962.3.fasta", genbank="mykatlas/data/NC_000962.3.gb") self.reference_set = ReferenceSet().create_and_save(name="ref_set") self.variant_set = VariantSet.create_and_save( name="this_vcf_file", reference_set=self.reference_set) self.variant_sets = [self.variant_set] self.reference_id = Reference().create_and_save( name="ref", md5checksum="sre", reference_sets=[self.reference_set])
def test_add_second_vcf_variant_set(self): # This VCF only has one Variant which is not in the first VCF vcf = VCF(f="tests/vcf_tests/test2.vcf", reference_set_id=self.reference_set.id, method="CORTEX") vcf.add_to_database() assert VariantSet.objects().count() == 3 assert VariantCallSet.objects().count() == 2 assert VariantCall.objects().count() == 42 assert Variant.objects().count() == 22 assert len(Variant.objects()[0].variant_sets) == 3 assert len( Variant.objects.get( names="UNION_BC_k31_var_147").variant_sets) == 3
def test_add_second_vcf_variant_set(self): # This VCF only has one Variant which is not in the first VCF vcf = VCF(f="tests/vcf_tests/test3.vcf", reference_set_id=self.reference_set.id, method="CORTEX") vcf.add_to_database() assert VariantSet.objects().count() == 2 assert VariantCallSet.objects().count() == 1 assert VariantCall.objects().count() == 106 assert Variant.objects().count() == 106 assert Variant.snps().count() == 89 assert Variant.indels().count() == 17 assert Variant.insertions().count() == 8 assert Variant.deletions().count() == 8 assert Variant.ph_snps.count() == 1
def setUp(self): self.reference_set = ReferenceSet().create_and_save(name="ref_set") self.variant_set = VariantSet.create_and_save( name="this_vcf_file", reference_set=self.reference_set) self.variant_sets = [self.variant_set]