Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Processing a gzip file Now complete the function pull_basic_and_predictor_fields_gzip to repeat the above function but use the gzipped file named: test_4families_annovar.vcf.gz. The file is too

Processing a gzip file Now complete the function pull_basic_and_predictor_fields_gzip to repeat the above function but use the gzipped file named: test_4families_annovar.vcf.gz. The file is too large to unzip and use, so we will use it as is. To read the file one file at a time, use the following code: import gzip with gzip.open(filename,'rt') as fp: for line in fp: pass The output of this function is given in expected_mini_project1_gzip.json. Note that you will have to parse the whole file again, but only pull out the fields used in the pull_basic_and_predictor_fields Save the output as mini_project1_gzip.json -- use indent=2, sort_keys=True

def pull_basic_and_predictor_fields_gzip(filename):

# BEGIN SOLUTION

#YourCodeHere

# END SOLUTION

IT should pass this test:

def test_pull_basic_and_predictor_fields_gzip(self):

import json

filename = 'test_4families_annovar.vcf.gz'

if os.path.exists('mini_project1_gzip.json'):

os.remove('mini_project1_gzip.json')

self.mini_project1.pull_basic_and_predictor_fields_gzip(filename)

expected_result = json.load(open('expected_mini_project1_gzip.json'))

value = json.load(open('mini_project1_gzip.json'))

self.assertEqual(expected_result, value)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Computer Networks

Authors: Andrew S. Tanenbaum, David J. Wetherall

5th edition

132126958, 978-0132126953

More Books

Students also viewed these Computer Network questions

Question

What have you done that shows initiative and willingness to work?

Answered: 1 week ago

Question

Why do you want this job?

Answered: 1 week ago