开放数据上线下限
parent
6225342e33
commit
5f1d326bb1
35
T7_client.py
35
T7_client.py
|
|
@ -22,7 +22,7 @@ def recvdata(conn, filepath):
|
||||||
recv_len += len(correntrecv)
|
recv_len += len(correntrecv)
|
||||||
|
|
||||||
|
|
||||||
def senddata(conn, path, librarynum, is_use_balance, is_use_max):
|
def senddata(conn, path, librarynum, is_use_balance, is_use_max, datalimit, datalower):
|
||||||
name = os.path.basename(os.path.realpath(path))
|
name = os.path.basename(os.path.realpath(path))
|
||||||
try:
|
try:
|
||||||
with open(path, 'rb') as file:
|
with open(path, 'rb') as file:
|
||||||
|
|
@ -32,7 +32,9 @@ def senddata(conn, path, librarynum, is_use_balance, is_use_max):
|
||||||
contentname=name,
|
contentname=name,
|
||||||
librarynum=librarynum,
|
librarynum=librarynum,
|
||||||
is_use_balance=is_use_balance,
|
is_use_balance=is_use_balance,
|
||||||
is_use_max=is_use_max
|
is_use_max=is_use_max,
|
||||||
|
datalimit=datalimit,
|
||||||
|
datalower=datalower
|
||||||
)
|
)
|
||||||
headerjson = json.dumps(headerdic)
|
headerjson = json.dumps(headerdic)
|
||||||
headerbytes = headerjson.encode('utf-8')
|
headerbytes = headerjson.encode('utf-8')
|
||||||
|
|
@ -52,9 +54,9 @@ def connect():
|
||||||
return client
|
return client
|
||||||
|
|
||||||
|
|
||||||
def transclient(sendfile, resfile, librarynum, is_use_balance, is_use_max):
|
def transclient(sendfile, resfile, librarynum, is_use_balance, is_use_max, datalimit, datalower):
|
||||||
conn = connect()
|
conn = connect()
|
||||||
senddata(conn, sendfile, librarynum, is_use_balance, is_use_max)
|
senddata(conn, sendfile, librarynum, is_use_balance, is_use_max, datalimit, datalower)
|
||||||
recvdata(conn, resfile)
|
recvdata(conn, resfile)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -62,14 +64,17 @@ def make_gui():
|
||||||
sg.theme('DarkBlack1')
|
sg.theme('DarkBlack1')
|
||||||
|
|
||||||
layout = [
|
layout = [
|
||||||
[sg.Text('排样管数'), sg.Spin([i for i in range(150)], initial_value=130, size=(3, 1), key='_LIBRARYNUM_')],
|
[sg.Text('排样管数'), sg.Spin([i for i in range(150)], initial_value=130, size=(3, 1), key='_LIBRARYNUM_'),
|
||||||
|
sg.Text('单芯片量上限'), sg.Spin([i for i in range(2000)], initial_value=1750, size=(4, 1), key='_DATALIMIT_'),
|
||||||
|
sg.Text('单芯片量下限'), sg.Spin([i for i in range(2000)], initial_value=1700, size=(4, 1), key='_DATALOWER_')
|
||||||
|
],
|
||||||
[sg.Text()],
|
[sg.Text()],
|
||||||
|
|
||||||
[sg.Text('使用平衡文库'), sg.Radio("是", "is_use_balance", key='is_use_balance', default=True),
|
[sg.Text('使用平衡文库'), sg.Radio("是", "is_use_balance", key='is_use_balance_key', default=True),
|
||||||
sg.Radio("否", "is_use_balance", key='is_not_use_balance')],
|
sg.Radio("否", "is_use_balance", key='is_not_use_balance_key')],
|
||||||
|
|
||||||
[sg.Text('使用扩容平衡性'), sg.Radio("是", "is_use_max", key='is_use_max'),
|
[sg.Text('使用扩容平衡性'), sg.Radio("是", "is_use_max", key='is_use_max_key'),
|
||||||
sg.Radio("否", "is_use_max", key='is_not_use_max', default=True)],
|
sg.Radio("否", "is_use_max", key='is_not_use_max_key', default=True)],
|
||||||
[sg.Text()],
|
[sg.Text()],
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
@ -86,18 +91,20 @@ def make_gui():
|
||||||
sg.OK('生成'), sg.Cancel('取消')]]
|
sg.OK('生成'), sg.Cancel('取消')]]
|
||||||
# iconpath = os.path.join(os.path.abspath(sys.path[0]), 'other', 'icon.ico')
|
# iconpath = os.path.join(os.path.abspath(sys.path[0]), 'other', 'icon.ico')
|
||||||
window = sg.Window('解码排样T7程序', layout, font='Helvetica 11', icon=r'D:\project\autulayout\other\icon.ico')
|
window = sg.Window('解码排样T7程序', layout, font='Helvetica 11', icon=r'D:\project\autulayout\other\icon.ico')
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
event, values = window.read()
|
event, values = window.read()
|
||||||
is_use_balance = 1 if values['is_use_balance'] else 0
|
if event == sg.WINDOW_CLOSED:
|
||||||
is_use_max = 1 if values['is_use_max'] else 0
|
# 用户关闭了窗口,终止循环
|
||||||
|
break
|
||||||
|
is_use_balance = 1 if values['is_use_balance_key'] else 0
|
||||||
|
is_use_max = 1 if values['is_use_max_key'] else 0
|
||||||
|
print(is_use_balance, is_use_max)
|
||||||
if event == '生成':
|
if event == '生成':
|
||||||
if not values['_FILE1_'] or not values['_FILE2_']:
|
if not values['_FILE1_'] or not values['_FILE2_']:
|
||||||
sg.popup_non_blocking('请正确提供参数')
|
sg.popup_non_blocking('请正确提供参数')
|
||||||
else:
|
else:
|
||||||
transclient(values['_FILE1_'], os.path.join(values['_FILE2_']), values['_LIBRARYNUM_'],
|
transclient(values['_FILE1_'], os.path.join(values['_FILE2_']), values['_LIBRARYNUM_'],
|
||||||
is_use_balance, is_use_max)
|
is_use_balance, is_use_max, values['_DATALIMIT_'], values['_DATALOWER_'])
|
||||||
sg.Popup('排样成功!')
|
sg.Popup('排样成功!')
|
||||||
window.Close()
|
window.Close()
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
19
T7_server.py
19
T7_server.py
|
|
@ -25,6 +25,8 @@ def recvdata(conn, path):
|
||||||
librarynum = header_dic['librarynum']
|
librarynum = header_dic['librarynum']
|
||||||
is_use_balance = header_dic['is_use_balance']
|
is_use_balance = header_dic['is_use_balance']
|
||||||
is_use_max = header_dic['is_use_max']
|
is_use_max = header_dic['is_use_max']
|
||||||
|
datalimit = header_dic['datalimit']
|
||||||
|
datalower = header_dic['datalower']
|
||||||
recv_len = 0
|
recv_len = 0
|
||||||
fielpath = os.path.join(path, '%s_%s' % (datetime.now().strftime("%m%d%H%M"), content_name))
|
fielpath = os.path.join(path, '%s_%s' % (datetime.now().strftime("%m%d%H%M"), content_name))
|
||||||
file = open(fielpath, 'wb')
|
file = open(fielpath, 'wb')
|
||||||
|
|
@ -33,7 +35,7 @@ def recvdata(conn, path):
|
||||||
file.write(correntrecv)
|
file.write(correntrecv)
|
||||||
recv_len += len(correntrecv)
|
recv_len += len(correntrecv)
|
||||||
file.close()
|
file.close()
|
||||||
return fielpath, librarynum, is_use_balance, is_use_max
|
return fielpath, librarynum, is_use_balance, is_use_max, datalimit, datalower
|
||||||
|
|
||||||
|
|
||||||
def senddata(conn, path, message=None):
|
def senddata(conn, path, message=None):
|
||||||
|
|
@ -70,18 +72,15 @@ def server():
|
||||||
myserver.bind(adrss)
|
myserver.bind(adrss)
|
||||||
myserver.listen(5)
|
myserver.listen(5)
|
||||||
|
|
||||||
# myclient, adddr = myserver.accept()
|
|
||||||
# recv_content, chipnum = recvdata(myclient, os.path.join(basedir, 'example'))
|
|
||||||
# layout = T7(recv_content, chipnum)
|
|
||||||
# outputpath = layout.run()
|
|
||||||
# senddata(myclient, outputpath)
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
myclient, adddr = myserver.accept()
|
myclient, adddr = myserver.accept()
|
||||||
recv_content, librarynum, is_use_balance, is_use_max = recvdata(myclient, os.path.join(basedir, 'example'))
|
recv_content, librarynum, is_use_balance, is_use_max, datalimit, datalower = recvdata(myclient,
|
||||||
print(recv_content, librarynum, is_use_balance, is_use_max)
|
os.path.join(basedir,
|
||||||
layout = T7(recv_content, librarynum, is_use_balance, is_use_max)
|
'example'))
|
||||||
|
print(recv_content, librarynum, is_use_balance, is_use_max, datalimit, datalower)
|
||||||
|
layout = T7(recv_content, librarynum, is_use_balance, is_use_max, data_limit=datalimit,
|
||||||
|
data_lower=datalower)
|
||||||
outputpath = layout.run()
|
outputpath = layout.run()
|
||||||
senddata(myclient, outputpath)
|
senddata(myclient, outputpath)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
||||||
12
tools/t7.py
12
tools/t7.py
|
|
@ -19,11 +19,13 @@ class AutoLayout:
|
||||||
自动化派样
|
自动化派样
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, path, librarynum, is_use_balance=1, is_use_max=0, output=basedir, data_limit=1750):
|
def __init__(self, path, librarynum, is_use_balance=1, is_use_max=0, output=basedir, data_limit=1750,
|
||||||
|
data_lower=1700):
|
||||||
self.path = path
|
self.path = path
|
||||||
self.output = output
|
self.output = output
|
||||||
self.librarynum = int(librarynum)
|
self.librarynum = int(librarynum)
|
||||||
self.data_limit = data_limit
|
self.data_limit = data_limit
|
||||||
|
self.data_lower = data_lower
|
||||||
|
|
||||||
# 芯片原始数据读取
|
# 芯片原始数据读取
|
||||||
self.ori_data = self.read_excel()
|
self.ori_data = self.read_excel()
|
||||||
|
|
@ -358,7 +360,7 @@ class AutoLayout:
|
||||||
if is_balance_lib == '甲基化' and self.chip_methylib_size[chipname] + size > 100:
|
if is_balance_lib == '甲基化' and self.chip_methylib_size[chipname] + size > 100:
|
||||||
spmethylibrary = False
|
spmethylibrary = False
|
||||||
|
|
||||||
# 不使用平衡文库
|
# 不使用不平衡文库的判断
|
||||||
if not self.is_use_balance:
|
if not self.is_use_balance:
|
||||||
splibrary = True
|
splibrary = True
|
||||||
spmethylibrary = True
|
spmethylibrary = True
|
||||||
|
|
@ -603,7 +605,7 @@ class AutoLayout:
|
||||||
if not chip_assignments:
|
if not chip_assignments:
|
||||||
continue
|
continue
|
||||||
df = pd.DataFrame(chip_assignments)
|
df = pd.DataFrame(chip_assignments)
|
||||||
if df['data_needed'].sum() < 1700:
|
if df['data_needed'].sum() < self.data_lower:
|
||||||
left_data.extend(chip_assignments)
|
left_data.extend(chip_assignments)
|
||||||
no_need_chipname.append(chip_idx)
|
no_need_chipname.append(chip_idx)
|
||||||
for chip_idx in no_need_chipname:
|
for chip_idx in no_need_chipname:
|
||||||
|
|
@ -692,8 +694,8 @@ class AutoLayout:
|
||||||
# if 'chipB' in chip_idx and df['barcode'].duplicated().any():
|
# if 'chipB' in chip_idx and df['barcode'].duplicated().any():
|
||||||
# other_name = '_i7'
|
# other_name = '_i7'
|
||||||
|
|
||||||
if df['data_needed'].sum() < 1600 and not addname:
|
if df['data_needed'].sum() < (self.data_lower - 50) and not addname:
|
||||||
df['note'] = '排样数据量不足1600G'
|
df['note'] = f'排样数据量不足{self.data_lower - 50}G'
|
||||||
self.no_assign_data.extend(df.to_dict('records'))
|
self.no_assign_data.extend(df.to_dict('records'))
|
||||||
continue
|
continue
|
||||||
if librarynum > self.librarynum:
|
if librarynum > self.librarynum:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue