# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# +
# author=cxf
# date=2020-8-8
# file for take a look

# subplot1 RNCU distribution
import numpy as np
import matplotlib.gridspec as mg
import matplotlib.pyplot as mp


# import warnings filter
from warnings import simplefilter
mp.switch_backend('TkAgg')
# ignore all future warnings
simplefilter(action='ignore')

###########################################################################
data1 = []
name = []
RNCU_value=[]
# Read RNCU index
with open('machine_X_index.txt', 'r') as fx1:
    for line in fx1.readlines():
        each_sample = np.array(line[0:-1].split(','))[1:].astype('int32')
        data1.append(each_sample)
        name.append(np.array(line[0:-1].split(','))[0])
x1 = np.array(data1)
# Read RNCU value
with open('machine_X_values.txt', 'r') as fy1:
    for line in fy1.readlines():
        each_sample = np.array(line[0:-1].split(','))[1:].astype('int32')
        RNCU_value.append(each_sample)
y1 = np.array(RNCU_value)

# subplot2 error rate at different cutoff
data2 = []
with open('error.txt', 'r') as fx2:
    for line in fx2.readlines():
        each_sample = np.array(line[0:-1].split(','))[1:].astype('f8')
        data2.append(each_sample)
x2 = np.array(data2)

# subplot2 number of sites which could be genotypes with 90% homozygotes
data3 = []
with open('a90.txt', 'r') as fx3:
    for line in fx3.readlines():
        each_sample = np.array(line[0:-1].split(','))[1:].astype('int32')
        data3.append(each_sample)
x3 = np.array(data3)

# subplot3 number of sites which could be genotypes with 95% homozygotes
data4 = []
with open('a95.txt', 'r') as fx4:
    for line in fx4.readlines():
        each_sample = np.array(line[0:-1].split(','))[1:].astype('int32')
        data4.append(each_sample)
        #print(each_sample)
x4 = np.array(data4)

# subplot4 number of sites which could be genotypes with 99% homozygotes
data5 = []
with open('a99.txt', 'r') as fx5:
    for line in fx5.readlines():
        each_sample = np.array(line[0:-1].split(','))[1:].astype('int32')
        data5.append(each_sample)
x5 = np.array(data5)
# -

# draw pictures
gs = mg.GridSpec(3, 2)
for i in range(1, 192):
    # 1
    mp.figure(figsize=(10,5))
    mp.subplot(gs[0, :2])
    mp.grid(ls=':')
    mp.title(f'{name[i]}')
    mp.plot(x1[i][:40],y1[i][:40], label='RNCU')
    ax = mp.gca()
    ax.xaxis.set_major_locator(mp.MultipleLocator(1))
    mp.legend()
    # 3
    mp.subplot(gs[1, 0])
    mp.grid(ls=':')
    mp.plot(np.arange(0, 11), x2[i], label='Error_rate')
    ax = mp.gca()
    ax.xaxis.set_major_locator(mp.MultipleLocator(1))
    mp.legend()
    # 4
    mp.subplot(gs[1, 1])
    mp.grid(ls=':')
    mp.plot(np.arange(0, 11), x3[i], label='90% sites')
    ax = mp.gca()
    ax.xaxis.set_major_locator(mp.MultipleLocator(1))
    mp.legend()
    # 5
    mp.subplot(gs[2, 0])
    mp.grid(ls=':')
    mp.plot(np.arange(0, 11), x4[i], label='95% sites')
    ax = mp.gca()
    ax.xaxis.set_major_locator(mp.MultipleLocator(1))
    mp.legend()
    # 6
    mp.subplot(gs[2, 1])
    mp.grid(ls=':')
    mp.plot(np.arange(0, 11), x5[i], label='99% sites')
    ax = mp.gca()
    ax.xaxis.set_major_locator(mp.MultipleLocator(1))
    mp.legend()
    mp.show()

StarcoderdataJupyterScriptsDedupFiltered