How to use get_test_variants method in avocado

Best Python code snippet using avocado_python

local_test.py

Source:local_test.py Github

copy

Full Screen

...26 args = parser.parse_args()27 test_names = args.systemtest28 tests = []29 for test_name in test_names:30 tests += get_test_variants(test_name)31 tests = filter_tests(tests, args.dockerfile)32 # Checking for older docker containers33 lst2 = docker.get_containers()34 print (lst2)35 if lst2:36 print("Deleting following docker containers:", lst2)37 answer = input("\nOk? (yes/no)\n")38 if answer in ["yes", "y"]:39 for x in lst2:40 ccall("docker container rm -f " + x)41 else:42 print("BE CAREFUL!: Not deleting previous containers can later lead to problems.")43 # Building preCICE44 print("\n\nBuilding preCICE docker image with choosen branch\n\n")...

Full Screen

Full Screen

verify_variants.py

Source:verify_variants.py Github

copy

Full Screen

...11parser.add_argument("-v", "--vcf", help="The vcf file")12args = parser.parse_args()13test_file = args.truth14vcf_file = args.vcf15def get_test_variants():16 """17 This function returns a tuple of a set of tuples of the test variants and the chromosome.18 :return: Set of tuples of (chrom, pos, ref alt, filter) and the chromosome19 :rtype: tuple of set and str20 """21 test_variant_set = set()22 chromosome = ''23 with open(test_file, 'r') as test_obj:24 for line in test_obj:25 if not re.search('^#', line):26 line_items = line.strip().split('\t')27 chrom = line_items[0]28 pos = line_items[1]29 ref = line_items[2]30 alt = line_items[3]31 vcf_filter = line_items[4]32 chromosome = chrom + '\t'33 var = (chrom, pos, ref, alt, vcf_filter)34 test_variant_set.add(var)35 else:36 continue37 return test_variant_set, chromosome38def get_vcf_variants(chromosome):39 """40 This function returns a set of variants with the specified chromosome from the VCF file.41 :param chromosome: The variants' chromosome42 :type chromosome: str43 :return: Set of tuples of (chrom, pos, ref alt, filter)44 :rtype: set45 """46 vcf_variant_set = set()47 with open(vcf_file, 'r') as vcf_obj:48 for line in vcf_obj:49 if re.search('^' + chromosome, line) and not re.search('^#', line):50 line_items = line.strip().split('\t')51 vcf_filter = line_items[6]52 if vcf_filter == 'PASS':53 chrom = line_items[0]54 pos = line_items[1]55 ref = line_items[3]56 alt = line_items[4]57 var = (chrom, pos, ref, alt, vcf_filter)58 vcf_variant_set.add(var)59 else:60 continue61 else:62 continue63 return vcf_variant_set64########################################################################################################################65#66# MAIN67#68########################################################################################################################69def main():70 """71 This is the main function. It prints 'Pass' to the screen if the test variants are found in the VCF variants;72 otherwise, it prints 'Fail'.73 :rtype: void74 """75 test_variant_set, chromosome = get_test_variants()76 vcf_variant_set = get_vcf_variants(chromosome)77 print 'VCF File:', vcf_file.split('/')[-1]78 print 'Truth File:', test_file.split('/')[-1]79 if test_variant_set.issubset(vcf_variant_set):80 print 'Truth Set: ', test_variant_set81 print 'Intersect:', test_variant_set.intersection(vcf_variant_set)82 print 'Pass\n'83 else:84 print 'Truth Set: ', test_variant_set85 print 'Intersect:', test_variant_set.intersection(vcf_variant_set)86 print 'Fail\n'...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run avocado automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful