增加华大单端文库不超过450

main
chaopower 2024-03-21 10:03:26 +08:00
parent f473efa71b
commit 62ab19ead5
1 changed files with 29 additions and 1 deletions

View File

@ -35,6 +35,8 @@ class AutoLayout:
# 记录每个芯片数量大小 # 记录每个芯片数量大小
self.chip_size = dict() self.chip_size = dict()
# 含N端芯片数量大小
self.chip_size_N = dict()
# 记录芯片barcode, i7, i5 barcode信息 # 记录芯片barcode, i7, i5 barcode信息
self.chip_barcode_recode = defaultdict(set) self.chip_barcode_recode = defaultdict(set)
@ -285,6 +287,10 @@ class AutoLayout:
if newer: if newer:
self.chip_size[chipname] = library_data['size'] self.chip_size[chipname] = library_data['size']
self.chip_size_N[chipname] = 0
if 'N' in library_data['data'][0]['barcode']:
# print(library_data['data'][0]['barcode'])
self.chip_size_N[chipname] = library_data['size']
# if library_data['classification'] in ['扩增子', '不平衡文库', '单细胞文库以及甲基化']: # if library_data['classification'] in ['扩增子', '不平衡文库', '单细胞文库以及甲基化']:
if library_data['is_balance_lib'] == '': if library_data['is_balance_lib'] == '':
self.chip_speciallib_size[chipname] = library_data['size'] self.chip_speciallib_size[chipname] = library_data['size']
@ -313,6 +319,10 @@ class AutoLayout:
if '华大' in library_data['classification']: if '华大' in library_data['classification']:
self.chip_speciallib_huada_size[chipname] += library_data['size'] self.chip_speciallib_huada_size[chipname] += library_data['size']
if 'N' in library_data['data'][0]['barcode']:
# print(library_data['data'][0]['barcode'])
self.chip_size_N[chipname] += library_data['size']
def use_rule(self, chipname, classfication): def use_rule(self, chipname, classfication):
may_classfic = set(self.rule[self.rule['c1'] == classfication]['c2']) may_classfic = set(self.rule[self.rule['c1'] == classfication]['c2'])
if self.chip_customer[chipname].intersection(may_classfic): if self.chip_customer[chipname].intersection(may_classfic):
@ -331,14 +341,19 @@ class AutoLayout:
约束条件 约束条件
""" """
size = library_data['size'] size = library_data['size']
size_N = 0
if 'N' in library_data['data'][0]['barcode']:
size_N = library_data['size']
classification = library_data['classification'] classification = library_data['classification']
customer = library_data['customer'] customer = library_data['customer']
is_balance_lib = library_data['is_balance_lib'] is_balance_lib = library_data['is_balance_lib']
library = library_data['library']
# 芯片大小不能超过设定限制 # 芯片大小不能超过设定限制
sizelimit = True sizelimit = True
if self.chip_size[chipname] + size > self.data_limit: if self.chip_size[chipname] + size > self.data_limit:
sizelimit = False sizelimit = False
# print(chipname, library, '芯片大小不能超过设定限制')
# barcode有重复 # barcode有重复
notrepeatbarcode = True notrepeatbarcode = True
@ -348,27 +363,32 @@ class AutoLayout:
self.chip_barcode_recode[chipname].intersection( self.chip_barcode_recode[chipname].intersection(
{item['i5'] + 'N' * 8 for item in library_data['data']}): {item['i5'] + 'N' * 8 for item in library_data['data']}):
notrepeatbarcode = False notrepeatbarcode = False
# print(chipname, library, 'barcode有重复')
# 互斥的文库 # 互斥的文库
exclusive_classific = True exclusive_classific = True
if self.use_rule(chipname, classification): if self.use_rule(chipname, classification):
exclusive_classific = False exclusive_classific = False
# print(chipname, library, '互斥的文库')
# 互斥的用户 # 互斥的用户
exclusive_customer = True exclusive_customer = True
if self.use_rule_exclusive_customer(chipname, customer): if self.use_rule_exclusive_customer(chipname, customer):
exclusive_customer = False exclusive_customer = False
# print(chipname, library, '互斥的用户')
# 不平衡文库大于250G 不能添加 # 不平衡文库大于250G 不能添加
splibrary = True splibrary = True
if is_balance_lib == '' and self.chip_speciallib_size[chipname] + size > 250: if is_balance_lib == '' and self.chip_speciallib_size[chipname] + size > 250:
splibrary = False splibrary = False
# print(chipname, library, '不平衡文库大于250G')
# 甲基化文库不能大于250G # 甲基化文库不能大于250G
# 甲基化更改成100G # 甲基化更改成100G
spmethylibrary = True spmethylibrary = True
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
# print(chipname, library, '甲基化文库不能大于100G')
# 不使用不平衡文库的判断 # 不使用不平衡文库的判断
if not self.is_use_balance: if not self.is_use_balance:
@ -384,11 +404,18 @@ class AutoLayout:
ratio_sites, is_not_balance_list = self.count_barcode_radio(current_data) ratio_sites, is_not_balance_list = self.count_barcode_radio(current_data)
if is_not_balance_list: if is_not_balance_list:
base_balance = False base_balance = False
# print(chipname, library, '碱基不平衡')
# 含N端的数据量不超过 上面设定碱基不平衡的900G的一半
sizelimit_N = True
if self.chip_size_N[chipname] + size_N > 450:
sizelimit_N = False
# 华大的文库不能超过限制的一半, 华大的数据就不能再加 # 华大的文库不能超过限制的一半, 华大的数据就不能再加
use_huada = True use_huada = True
if (self.chip_speciallib_huada_size[chipname] > self.data_limit / 2) and ('华大' in classification): if (self.chip_speciallib_huada_size[chipname] > self.data_limit / 2) and ('华大' in classification):
use_huada = False use_huada = False
# print(chipname, library, '华大的文库不能超过限制的一半')
# 开启i5或者i7 # 开启i5或者i7
if max_barcode != 'all': if max_barcode != 'all':
@ -425,7 +452,8 @@ class AutoLayout:
base_balance and \ base_balance and \
spmethylibrary and \ spmethylibrary and \
use_huada and \ use_huada and \
notrepeatsublib: notrepeatsublib and \
sizelimit_N:
return True return True
return False return False