Esempio n. 1
0
def run(parser, args):
    args = parser.parse_args()
    # args = check_args(args)
    if args.quiet:
        logger.setLevel(logging.ERROR)
    else:
        logger.setLevel(logging.INFO)
    DBNAME = 'atlas-%s' % (args.db_name)
    db = client[DBNAME]
    connect(DBNAME)
    logger.debug("Using DB %s" % DBNAME)
    reference_set_name = ".".join(
        os.path.basename(args.reference_set).split(".")[:-1])
    try:
        reference_set = ReferenceSet.objects.get(name=reference_set_name)
    except DoesNotExist:
        reference_set = ReferenceSet.create_and_save(name=reference_set_name)
        # Hack
    try:
        reference = Reference.create_and_save(name=reference_set_name,
                                              reference_sets=[reference_set],
                                              md5checksum="NA")
    except:
        pass
    vcf = VCF(args.vcf, reference_set.id, method=args.method, force=args.force)
    vcf.add_to_database()
 def setup(self):
     DB.drop_database("mykrobe-test")
     self.reference_set = ReferenceSet().create_and_save(name="ref_set")
     self.reference = Reference().create_and_save(
         name="NC_000962.3",
         md5checksum="sre",
         reference_sets=[self.reference_set])
Esempio n. 3
0
def run(parser, args):
    args = parser.parse_args()
    # args = check_args(args)
    if args.quiet:
        logger.setLevel(logging.ERROR)
    else:
        logger.setLevel(logging.INFO)
    DBNAME = "%s-%s" % (DB_PREFIX, args.db_name)
    connect(DBNAME, host=args.db_uri)
    logger.debug("Using DB %s" % DBNAME)

    with open(args.reference_set) as fp:
        reference_set_name = get_first_chrom_name(fp)

    try:
        reference_set = ReferenceSet.objects.get(name=reference_set_name)
    except DoesNotExist:
        reference_set = ReferenceSet.create_and_save(name=reference_set_name)

    try:
        reference = Reference.create_and_save(name=reference_set_name,
                                              reference_sets=[reference_set],
                                              md5checksum="NA")
    except:
        pass
    vcf = VCF(args.vcf, reference_set.id, method=args.method, force=args.force)
    vcf.add_to_database()
Esempio n. 4
0
    def setup(self):
        DB.drop_database('mykrobe-test')

        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)
Esempio n. 5
0
 def setup(self):
     DB.drop_database('mykrobe-test')
     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])
Esempio n. 6
0
 def setup(self):
     DB.drop_database('mykrobe-test')
     self.pg = AlleleGenerator(
         reference_filepath="src/mykrobe/data/BX571856.1.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])
Esempio n. 7
0
 def setup(self):
     DB.drop_database("mykrobe-test")
     self.pg = AlleleGenerator(
         reference_filepath=f"{DATA_DIR}/NC_000962.3.fasta", kmer=31)
     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('mykrobe-test')
     self.reference_set = ReferenceSet().create_and_save(name="ref_set")
     self.reference = Reference().create_and_save(
         name="NC_000962.3",
         md5checksum="sre",
         reference_sets=[self.reference_set])
     vcf = VCF(f="tests/vcf_tests/test.vcf",
               reference_set_id=self.reference_set.id,
               method="CORTEX")
     vcf.add_to_database()
Esempio n. 9
0
    def setup(self):
        DB.drop_database('mykrobe-test')
        with open("src/mykrobe/data/NC_000962.3.fasta", 'r') as infile:
            self.reference_seq = list(SeqIO.parse(infile, "fasta"))[0].seq

        self.gm = GeneAminoAcidChangeToDNAVariants(
            reference="src/mykrobe/data/NC_000962.3.fasta",
            genbank="src/mykrobe/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])
Esempio n. 10
0
def run_make_probes_from_vcf_file(args):
    # Make VariantSet from vcf
    reference = os.path.basename(args.reference_filepath).split(".fa")[0]
    try:
        reference_set = ReferenceSet.objects.get(name=reference)
    except DoesNotExist:
        reference_set = ReferenceSet.create_and_save(name=reference)
        # Hack
    try:
        reference = Reference.create_and_save(
            name=reference,
            reference_sets=[reference_set],
            md5checksum=reference)
    except NotUniqueError:
        pass
    vcf = VCF(
        args.vcf,
        reference_set.id,
        method="tmp",
        force=True,
        append_to_global_variant_set=False)
    vcf.add_to_database()