Compare commits

...

6 Commits

Author SHA1 Message Date
chaopower bba0aec2f4 bug 2024-06-15 12:12:49 +08:00
chaopower 86cfb0e582 超过2000G的提醒处理 2024-04-28 17:36:30 +08:00
chaopower b7c62dcf7f 华大的版本回归 2024-04-18 09:58:42 +08:00
chaopower 72acc6898a 华大的取消少于50G 不上机 2024-04-08 17:48:40 +08:00
chaopower 62a2093a8d priority bug 2024-03-30 21:54:42 +08:00
chaopower c2d5fc7030 微调 2024-03-22 15:51:10 +08:00
3 changed files with 36 additions and 34 deletions

Binary file not shown.

Binary file not shown.

View File

@ -186,6 +186,12 @@ class AutoLayout:
self.return_log.append(f'芯片{chipname}有碱基不平衡:\n{desc}')
print(f'芯片{chipname}有碱基不平衡:\n{desc}')
def dec_lib_data_scatter(self, data):
"""
"""
pass
@staticmethod
def level(row):
@ -194,19 +200,19 @@ class AutoLayout:
if 'nextera' in row['classification'].lower():
return 1000
if '华大' in row['classification']:
if '华大' in row['classification'] and 'NN' in row['i5']:
return 1100
if '超加急' in row['priority']:
if '超加急' in str(row['priority']):
return 1500
if row['拆分方式'] == '极致周期' or '极致' in row['拆分方式']:
return 2000
if '加急' in row['priority']:
if '加急' in str(row['priority']):
return 3000
if '补测' in row['priority']:
if '补测' in str(row['priority']):
return 4000
mytime = row['time']
@ -221,21 +227,6 @@ class AutoLayout:
"""
barcode 有重复的极致样本 进行排列组合汇集成新的可能性
"""
# 筛选有重复的行
# same_barcode_data = [data for data in self.ori_lib_data if data['level'] == 1900]
# same_barcode_sorted = sorted(same_barcode_data, key=lambda x: (-x['size']))
#
# same_barcode_dict = dict()
# for index, data in enumerate(same_barcode_sorted):
# same_barcode_dict[data['library']] = data['level'] + index + 1
# correct_data = list()
# for data in self.ori_lib_data:
# if data in same_barcode_sorted:
# data['level'] = same_barcode_dict[data['library']]
# correct_data.append(data)
# self.ori_lib_data = correct_data
same_barcode_df = pd.DataFrame(
[spdata for data in self.ori_lib_data if data['level'] == 1900 for spdata in data['data']])
@ -323,13 +314,17 @@ class AutoLayout:
# print(library_data['data'][0]['barcode'])
self.chip_size_N[chipname] += library_data['size']
def use_rule(self, chipname, classfication):
def use_rule_exclusive_classfication(self, chipname, classfication):
"""
文库不能排在一起
"""
may_classfic = set(self.rule[self.rule['c1'] == classfication]['c2'])
if self.chip_customer[chipname].intersection(may_classfic):
return True
return False
def use_rule_exclusive_customer(self, chipname, customer):
"""文库不能排在一起"""
may_classfic = set(
self.rule_exclusive_customer[self.rule_exclusive_customer['customer1'] == customer]['customer2'])
if self.chip_customer[chipname].intersection(may_classfic):
@ -347,7 +342,7 @@ class AutoLayout:
classification = library_data['classification']
customer = library_data['customer']
is_balance_lib = library_data['is_balance_lib']
library = library_data['library']
# library = library_data['library']
# 芯片大小不能超过设定限制
sizelimit = True
@ -367,7 +362,7 @@ class AutoLayout:
# 互斥的文库
exclusive_classific = True
if self.use_rule(chipname, classification):
if self.use_rule_exclusive_classfication(chipname, classification):
exclusive_classific = False
# print(chipname, library, '互斥的文库')
@ -500,7 +495,6 @@ class AutoLayout:
self.loc_chip_num += 1
def assign_samples(self):
# ori_library_data = list()
if '未测' not in self.ori_data.keys():
raise UserWarning('提供excel没有 未测 sheet ,请核查!')
@ -512,7 +506,7 @@ class AutoLayout:
if unhave_col:
unhave_from = '; '.join(unhave_col)
raise UserWarning(f'未测表里没有{unhave_from} 表头,请核查!')
raise UserWarning(f'未测表里没有 {unhave_from} 表头,请核查!')
# 数据标准格式
numeric_mask = pd.to_numeric(ori_library_df['data_needed'], errors='coerce').notna()
@ -532,20 +526,25 @@ class AutoLayout:
no_ori_data = ori_library_df[~(numeric_mask & time_mask) | status_mask | barcode_mask]
# 某个客户的检测的数据超过1个T就单独处理
summary = ori_library_df.groupby('customer').agg({'data_needed': 'sum'})
summary_dict = summary['data_needed'].to_dict()
for customer_sum, data_needed_sum in summary_dict.items():
if not data_needed_sum:
continue
if float(data_needed_sum) > 2000 :
self.return_log.append(f'客户 {customer_sum} 本次排样超过 2000G 建议包lane 处理')
self.no_assign_data.extend(no_ori_data.to_dict('records'))
# 使用布尔索引筛选出不是数字和非日期的行,并且不是暂不排样的行
# 使用布尔索引筛选出不是数字和非日期的行,并且不是暂不排样的行, 以及非16位置barcode
ori_library_df = ori_library_df[(numeric_mask & time_mask) & ~status_mask & ~barcode_mask]
# 某个客户的检测的数据超过1个T就单独处理
# summary = ori_library_df.groupby('customer').agg({'data_needed': 'sum'})
# print(summary)
# 时间格式化
ori_library_df['time'] = pd.to_datetime(ori_library_df['time'], errors='coerce')
ori_library_df['level'] = ori_library_df.apply(self.level, axis=1)
# 极致客户有重复的把等级调到19,防止放到了最后,到了未测里
# 极致客户有重复的把等级调到1900,防止放到了最后,到了未测里
must_lib_df = ori_library_df[ori_library_df['level'] == 2000]
must_lib = set(must_lib_df[must_lib_df.duplicated(subset='barcode', keep=False)]['#library'].to_list())
ori_library_df.loc[ori_library_df['#library'].isin(must_lib), 'level'] = 1900
@ -586,7 +585,7 @@ class AutoLayout:
continue
# 拆分处理 分为了2个大文库
if size > (self.data_limit) / 2:
if size > self.data_limit / 2:
library_df['data_needed'] = library_df['data_needed'] / 2
self.return_log.append(f'文库{library} 已做拆分处理, 请注意!!! ')
self.ori_lib_data.append(dict(
@ -685,7 +684,7 @@ class AutoLayout:
self.loc_chip_num = 100
while ori_lib_data:
library_data = ori_lib_data[0]
chipname = f'chipB{self.loc_chip_num}_{max_barcode}' if max_barcode != 'all' else f'chipB{self.loc_chip_num}'
chipname = f'chip{self.loc_chip_num}_{max_barcode}' if max_barcode != 'all' else f'chip{self.loc_chip_num}'
# 空白芯片直接添加
if chipname not in self.index_assignments:
@ -720,7 +719,6 @@ class AutoLayout:
self.assign_again_size()
# self.assign_again_size(max_barcode='i7')
# self.assign_again_size(max_barcode='i5')
# self.assign_again_size()
except Exception as e:
self.return_log.append(f'T7排样出错 请联系!{e}')
self.index_assignments = {}
@ -740,6 +738,7 @@ class AutoLayout:
addname = 'X'
else:
addname = ''
other_name = ''
# if 'chipB' in chip_idx and df['barcode'].duplicated().any():
# other_name = '_i7'
@ -772,7 +771,10 @@ class AutoLayout:
no_assign_df = pd.DataFrame(self.no_assign_data)
no_assign_df = no_assign_df.applymap(lambda x: format_date(x) if isinstance(x, pd.Timestamp) else x)
if not no_assign_df.empty:
no_assign_df_not_balance = ','.join(set([lib for lib in no_assign_df['#library'] if lib in self.split_lib]))
else:
no_assign_df_not_balance = ''
if no_assign_df_not_balance:
self.return_log.append(f'文库{no_assign_df_not_balance}有做不平衡文库拆分处理,并且没有排完,请核查!')
if not no_assign_df.empty: