Esempio n. 1
0
def annotate_and_output_results(g_patient, g_reference, output_results):
	import forannotation as ANNO
	annotated_alterations = ANNO.alteration_list_to_transcrit_mutation(g_patient, g_reference)
	# add experiment arguments
	PROGRAMEND = time.time()
	experiment_description = {}
	this_timestamp = get_timestamp()
	experiment_description['timestamp'] = this_timestamp
	experiment_description['exec_time'] = PROGRAMEND - PROGRAMSTART
	experiment_description['parameters'] = vars(args)
	experiment_description['n_reads'] = g_patient.n_reads
	experiment_description['git_revision_hash'] = get_git_revision_hash()

	experiment_description['significant_alterations'] = annotated_alterations
	experiment_description['graphs'] = {
		"coverage_total": g_patient.coverage['total'],
		"before_cleaning": len(g_patient.dbg),
		"after_clearning": len(g_patient.dbgclean)
	}
	experiment_description['all_alterations'] = []
	for x in g_patient.alteration_list:
		alteration_description = x.__dict__
		del alteration_description['reference_path']
		del alteration_description['alternative_path']
		del alteration_description['random_alternative_count_list']
		del alteration_description['random_reference_count_list']
		del alteration_description['random_ratio_list']
		alteration_description['edit_operations'] = find_edit_operations(x.reference_sequence, x.alternative_sequence)
		alteration_description['alignment'] = pairwise2.align.globalms(x.reference_sequence, x.alternative_sequence, 2, -3, -5, -2)[0]
		experiment_description['all_alterations'].append(alteration_description)
	print json.dumps(experiment_description)
	if output_results:
		with open(output_results, "w") as f:
			json.dump(experiment_description, f)
Esempio n. 2
0
def annotate_and_output_results(g_patient, g_reference, output_results):
    import forannotation as ANNO
    annotated_alterations = ANNO.alteration_list_to_transcrit_mutation(
        g_patient, g_reference)
    # add experiment arguments
    PROGRAMEND = time.time()
    experiment_description = {}
    this_timestamp = get_timestamp()
    experiment_description['timestamp'] = this_timestamp
    experiment_description['exec_time'] = PROGRAMEND - PROGRAMSTART
    experiment_description['parameters'] = vars(args)
    experiment_description['n_reads'] = g_patient.n_reads
    experiment_description['git_revision_hash'] = get_git_revision_hash()
    # experiment_description['memory_usage'] = process.memory_info().rss

    experiment_description['significant_alterations'] = annotated_alterations
    experiment_description['graphs'] = {
        "coverage_total": g_patient.coverage['total'],
        "before_cleaning": len(g_patient.dbg),
        "after_clearning": len(g_patient.dbgclean)
    }
    experiment_description['all_alterations'] = []
    for x in g_patient.alteration_list:
        alteration_description = x.__dict__
        del alteration_description['reference_path']
        del alteration_description['alternative_path']
        del alteration_description['random_alternative_count_list']
        del alteration_description['random_reference_count_list']
        del alteration_description['random_ratio_list']
        alteration_description['edit_operations'] = find_edit_operations(
            x.reference_sequence, x.alternative_sequence)
        alteration_description['alignment'] = pairwise2.align.globalms(
            x.reference_sequence, x.alternative_sequence, 2, -3, -5, -2)[0]
        experiment_description['all_alterations'].append(
            alteration_description)
    # print json.dumps(experiment_description)
    if output_results:
        with open(output_results, "w") as f:
            json.dump(experiment_description, f)
Esempio n. 3
0
	def test_find_edit_operations(self):
		ref="CTGGGAGAGACCGGCGCACAGAGGAAGAGAATCTCCGCAAGAAAGGGGAGCCTCAC"
		alt="CTGGGAGAGACCGGCGCACAccGAGGAAGAGAATCTCcGCAAGAAAGGGGAGCCTCAC"
		print find_edit_operations(ref,alt)