Mercurial > repos > greg > draw_amr_matrix
comparison draw_amr_matrix.py @ 12:aa2b737102dc draft
Uploaded
author | greg |
---|---|
date | Mon, 27 Mar 2023 22:14:56 +0000 |
parents | da1c9c1be421 |
children | b1a7e04e6371 |
comparison
equal
deleted
inserted
replaced
11:da1c9c1be421 | 12:aa2b737102dc |
---|---|
190 for deletion_idx, deleted_gene in amr_deletions.iterrows(): | 190 for deletion_idx, deleted_gene in amr_deletions.iterrows(): |
191 amr_to_draw = amr_to_draw.append(pandas.Series(['\u0394' + deleted_gene[3], deleted_gene[5]], name=amr_to_draw.shape[0], index=amr_to_draw.columns)) | 191 amr_to_draw = amr_to_draw.append(pandas.Series(['\u0394' + deleted_gene[3], deleted_gene[5]], name=amr_to_draw.shape[0], index=amr_to_draw.columns)) |
192 ofh.write("\nAfter processing deletions, amr_to_draw: %s\n" % str(amr_to_draw)) | 192 ofh.write("\nAfter processing deletions, amr_to_draw: %s\n" % str(amr_to_draw)) |
193 | 193 |
194 ofh.write("\namr_to_draw.shape[0]: %s\n" % str(amr_to_draw.shape[0])) | 194 ofh.write("\namr_to_draw.shape[0]: %s\n" % str(amr_to_draw.shape[0])) |
195 if amr_to_draw.shape[0] > 0: | 195 if amr_to_draw.shape[0] > 1: |
196 ofh.write("\nDrawing AMR matrix...\n") | 196 ofh.write("\nDrawing AMR matrix...\n") |
197 present_genes = amr_to_draw['gene'].unique() | 197 present_genes = amr_to_draw['gene'].unique() |
198 present_drugs = amr_to_draw['drug'].unique() | 198 present_drugs = amr_to_draw['drug'].unique() |
199 amr_matrix = pandas.DataFrame(0, index=present_genes, columns=present_drugs) | 199 amr_matrix = pandas.DataFrame(0, index=present_genes, columns=present_drugs) |
200 for hit_idx, hit in amr_to_draw.iterrows(): | 200 for hit_idx, hit in amr_to_draw.iterrows(): |