def test_repliseq(update_ffmeta_event_data_repliseq): updater = FourfrontUpdater(**update_ffmeta_event_data_repliseq) updater.update_all_pfs() updater.update_qc() target_accession = updater.accessions('filtered_sorted_deduped_bam')[0] assert target_accession == '4DNFIP2T7ANW' assert updater.post_items assert len(updater.post_items['quality_metric_dedupqc_repliseq']) == 1 uuid = list(updater.post_items['quality_metric_dedupqc_repliseq'].keys())[0] assert 'Proportion of removed duplicates' in updater.post_items['quality_metric_dedupqc_repliseq'][uuid] assert updater.patch_items assert '050c9382-61d7-49e8-8598-1a6734dda5d2' in updater.patch_items bam_patch = updater.patch_items['050c9382-61d7-49e8-8598-1a6734dda5d2'] # filtered bam assert 'md5sum' in bam_patch assert 'file_size' in bam_patch assert 'status' in bam_patch assert bam_patch['md5sum'] == '908488c3d8bea2875551c67c9fd1b3dc' assert bam_patch['file_size'] == 11061946 assert bam_patch['status'] == 'uploaded' assert 'quality_metric' in updater.patch_items['4DNFIP2T7ANW'] # qc_metric is patched by accession assert '4127ad92-16cf-4716-ab68-dc9b352658eb' in updater.patch_items bg_patch = updater.patch_items['4127ad92-16cf-4716-ab68-dc9b352658eb'] # count_bg assert 'extra_files' in bg_patch assert len(bg_patch['extra_files']) == 2 assert bg_patch['extra_files'][1]['file_format'] == 'bw' assert bg_patch['extra_files'][1]['md5sum'] == 'f08575a366c14dbc949d35e415151cfd' assert bg_patch['extra_files'][1]['file_size'] == 3120059 assert bg_patch['extra_files'][1]['status'] == 'uploaded' assert bg_patch['extra_files'][0]['file_format'] == 'bg_px2' assert bg_patch['extra_files'][0]['md5sum'] == 'aa8e2848e1f022b197fe31c804de08bf' assert bg_patch['extra_files'][0]['file_size'] == 991610 assert bg_patch['extra_files'][0]['status'] == 'uploaded'
def test_madqc(update_ffmeta_event_data_madqc): updater = FourfrontUpdater(**update_ffmeta_event_data_madqc) updater.update_qc() target_accessions = updater.accessions('mad_qc.quantfiles') assert len(target_accessions) == 3 assert target_accessions[0] == '4DNFIRV6DRTJ' assert target_accessions[1] == '4DNFILGR8Q3P' assert target_accessions[2] in updater.patch_items assert updater.post_items assert len(updater.post_items['quality_metric_rnaseq_madqc']) == 1 uuid = list(updater.post_items['quality_metric_rnaseq_madqc'].keys())[0] assert len(updater.post_items['quality_metric_rnaseq_madqc'][uuid]['MAD QC']) == 3 first_pair = list(updater.post_items['quality_metric_rnaseq_madqc'][uuid]['MAD QC'].keys())[0] assert len(updater.post_items['quality_metric_rnaseq_madqc'][uuid]['MAD QC'][first_pair]) == 4
def test_chipseq(update_ffmeta_event_data_chipseq): updater = FourfrontUpdater(**update_ffmeta_event_data_chipseq) updater.update_all_pfs() updater.update_qc() target_accession = updater.accessions('chip.first_ta_ctl')[0] assert target_accession == '4DNFI8B19NWU' assert updater.post_items assert len(updater.post_items['quality_metric_chipseq']) == 1 uuid = list(updater.post_items['quality_metric_chipseq'].keys())[0] assert 'ctl_dup_qc' in updater.post_items['quality_metric_chipseq'][uuid] assert updater.patch_items assert 'd3caa9c8-9e67-4d64-81d1-8039569dc6ce' in updater.patch_items bed_patch = updater.patch_items['d3caa9c8-9e67-4d64-81d1-8039569dc6ce'] assert 'status' in bed_patch assert bed_patch['status'] == 'uploaded' assert 'quality_metric' in updater.patch_items[target_accession]
def test_pairsqc(update_ffmeta_event_data_pairsqc): updater = FourfrontUpdater(**update_ffmeta_event_data_pairsqc) fake_unzipped_data = ["Total reads\t651,962\nShort cis reads (<20kb)\t221,017\n" + "Cis reads (>20kb)\t276,411\nTrans reads\t154,534\n" + "Cis/Trans ratio\t67.89\n"] with mock.patch("tibanna_ffcommon.qc.unzip_s3_data", return_value=fake_unzipped_data): with mock.patch("tibanna_ffcommon.qc.unzip_s3_to_s3"): # skip file copying updater.update_qc() target_accession = updater.accessions('input_pairs')[0] assert target_accession == '4DNFI1ZLO9D7' assert updater.post_items assert len(updater.post_items['quality_metric_pairsqc']) == 1 uuid = list(updater.post_items['quality_metric_pairsqc'].keys())[0] assert 'Cis reads (>20kb)' in updater.post_items['quality_metric_pairsqc'][uuid] assert 'Trans reads' in updater.post_items['quality_metric_pairsqc'][uuid] assert 'Cis/Trans ratio' in updater.post_items['quality_metric_pairsqc'][uuid]
def test_imargi(update_ffmeta_event_data_imargi): updater = FourfrontUpdater(**update_ffmeta_event_data_imargi) updater.update_all_pfs() updater.update_qc() target_accession = updater.accessions('out_pairs')[0] assert target_accession == '4DNFI2H7T6NP' assert updater.post_items assert len(updater.post_items['quality_metric_margi']) == 1 uuid = list(updater.post_items['quality_metric_margi'].keys())[0] assert 'total_read_pairs' in updater.post_items['quality_metric_margi'][uuid] assert updater.patch_items assert 'aca7c203-f476-410f-b3bb-4965c9f5e411' in updater.patch_items pairs_patch = updater.patch_items['aca7c203-f476-410f-b3bb-4965c9f5e411'] assert 'md5sum' in pairs_patch assert 'file_size' in pairs_patch assert 'status' in pairs_patch assert pairs_patch['md5sum'] == 'ec98b56a98249b85ee6a99a7f43f2884' assert pairs_patch['file_size'] == 22199565 assert pairs_patch['status'] == 'uploaded' assert 'quality_metric' in updater.patch_items[target_accession]
def test_fastqc(update_ffmeta_event_data_fastqc2): updater = FourfrontUpdater(**update_ffmeta_event_data_fastqc2) # pretend that this is the content of the zipped table file. fake_unzipped_data = ["Per sequence quality scores\t23.45\n" + "Per base sequence content\t12.34\n" + "Per sequence GC content\t45.67"] with mock.patch("tibanna_ffcommon.qc.unzip_s3_data", return_value=fake_unzipped_data): with mock.patch("tibanna_ffcommon.qc.unzip_s3_to_s3"): # skip file copying updater.update_qc() target_accession = updater.accessions('input_fastq')[0] assert target_accession == '4DNFIRSRJH45' assert updater.post_items assert len(updater.post_items['quality_metric_fastqc']) == 1 uuid = list(updater.post_items['quality_metric_fastqc'].keys())[0] print(str(updater.post_items['quality_metric_fastqc'][uuid])) assert 'url' in updater.post_items['quality_metric_fastqc'][uuid] assert 'Per sequence quality scores' in updater.post_items['quality_metric_fastqc'][uuid] assert 'Per base sequence content' in updater.post_items['quality_metric_fastqc'][uuid] assert 'Per sequence GC content' in updater.post_items['quality_metric_fastqc'][uuid] assert 'value_qc' in updater.ff_output_file('report_zip') assert updater.ff_output_file('report_zip')['value_qc'] == uuid