Skip to content

Commit 526cc2b

Browse files
authored
Merge pull request #1581 from sschmeier/fix_cnv_plotting
Fixes the python plotting routines.
2 parents fc13b08 + 19efd9a commit 526cc2b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

vcfcnv.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ static void plot_sample(args_t *args, sample_t *smpl)
346346
" chr = row[0]\n"
347347
" if chr[0]=='#': continue\n"
348348
" if chr not in dat: dat[chr] = []\n"
349-
" dat[chr].append([row[1], float(row[2]), float(row[3])])\n"
349+
" dat[chr].append([int(row[1]), float(row[2]), float(row[3])])\n"
350350
"\n"
351351
"cnv = {}\n"
352352
"with open('%s', 'r') as f:\n"
@@ -356,6 +356,7 @@ static void plot_sample(args_t *args, sample_t *smpl)
356356
" if chr[0]=='#': continue\n"
357357
" if chr not in cnv: cnv[chr] = []\n"
358358
" row[2] = int(row[2]) + 0.5\n"
359+
" row[1] = int(row[1])\n"
359360
" cnv[chr].append(row[1:])\n"
360361
"\n"
361362
"for chr in dat:\n"
@@ -372,7 +373,7 @@ static void plot_sample(args_t *args, sample_t *smpl)
372373
" heat[1][x] = cn_dat[x][3]\n"
373374
" heat[2][x] = cn_dat[x][4]\n"
374375
" heat[3][x] = cn_dat[x][5]\n"
375-
" mesh = ax3.pcolormesh(xgrid, ygrid, heat, cmap='bwr_r')\n"
376+
" mesh = ax3.pcolormesh(xgrid, ygrid, heat, cmap='bwr_r', shading='auto', alpha=0)\n"
376377
" mesh.set_clim(vmin=-1,vmax=1)\n"
377378
" ax3.plot([x[0] for x in cn_dat],[x[1] for x in cn_dat],'.-',ms=3,color='black')\n"
378379
" fig.suptitle('%s (chr '+chr+')')\n"
@@ -458,14 +459,15 @@ static void create_plots(args_t *args)
458459
" for row in reader:\n"
459460
" chr = row[0]\n"
460461
" if chr != plot_chr: continue\n"
461-
" dat.append([row[1], float(row[2]), float(row[3])])\n"
462+
" dat.append([int(row[1]), float(row[2]), float(row[3])])\n"
462463
"def read_cnv(file,cnv,plot_chr):\n"
463464
" with open(file, 'r') as f:\n"
464465
" reader = csv.reader(f, 'tab')\n"
465466
" for row in reader:\n"
466467
" chr = row[0]\n"
467468
" if chr != plot_chr: continue\n"
468469
" row[2] = int(row[2]) + 0.5\n"
470+
" row[1] = int(row[1])\n"
469471
" cnv.append(row[1:])\n"
470472
"def find_diffs(a,b):\n"
471473
" out = []\n"
@@ -504,7 +506,7 @@ static void create_plots(args_t *args)
504506
" heat[1][x] = cn_dat[x][3]\n"
505507
" heat[2][x] = cn_dat[x][4]\n"
506508
" heat[3][x] = cn_dat[x][5]\n"
507-
" mesh = ax3.pcolormesh(xgrid, ygrid, heat, cmap='bwr')\n"
509+
" mesh = ax3.pcolormesh(xgrid, ygrid, heat, cmap='bwr', shading='auto', alpha=0)\n"
508510
" mesh.set_clim(vmin=-1,vmax=1)\n"
509511
" ax3.plot([x[0] for x in cn_dat],[x[1] for x in cn_dat],'-',ms=3,color='black',lw=1.7)\n"
510512
"\n"

0 commit comments

Comments
 (0)