예제 #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 = '%s-%s' % (DB_PREFIX, 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()
예제 #2
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])
예제 #3
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])
예제 #4
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()
예제 #6
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])
예제 #7
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()
예제 #8
0
 def setup(self):
     DB.drop_database('mykrobe-test')
     self.reference_set = ReferenceSet().create_and_save(name="ref_set")