add sample material column and rewrite inosticID column
This commit is contained in:
BIN
qubittool/__pycache__/rowmodel.cpython-310.pyc
Normal file
BIN
qubittool/__pycache__/rowmodel.cpython-310.pyc
Normal file
Binary file not shown.
BIN
qubittool/__pycache__/tool.cpython-310.pyc
Normal file
BIN
qubittool/__pycache__/tool.cpython-310.pyc
Normal file
Binary file not shown.
@@ -4,6 +4,7 @@ class RowModel:
|
|||||||
self.coordinate = coordinate
|
self.coordinate = coordinate
|
||||||
self.accessionid = accessionid
|
self.accessionid = accessionid
|
||||||
self.customerid = None
|
self.customerid = None
|
||||||
|
self.materialid = None
|
||||||
self.plasmavolml = float(0.0)
|
self.plasmavolml = float(0.0)
|
||||||
self.qubitrunid = None
|
self.qubitrunid = None
|
||||||
self.qubitassay = None
|
self.qubitassay = None
|
||||||
@@ -39,7 +40,13 @@ class RowModel:
|
|||||||
|
|
||||||
def get_customerid(self):
|
def get_customerid(self):
|
||||||
return self.customerid
|
return self.customerid
|
||||||
|
|
||||||
|
def set_materialid(self, matrlid:str):
|
||||||
|
self.materialid = matrlid
|
||||||
|
|
||||||
|
def get_materialid(self):
|
||||||
|
return self.materialid
|
||||||
|
|
||||||
def set_qubitassay(self, assay:str):
|
def set_qubitassay(self, assay:str):
|
||||||
self.qubitassay = assay
|
self.qubitassay = assay
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,9 @@ from openpyxl.styles import PatternFill, Border, Side, Alignment
|
|||||||
|
|
||||||
from rowmodel import RowModel
|
from rowmodel import RowModel
|
||||||
|
|
||||||
|
codex:dict = {"gDNA from cells":"BM"}
|
||||||
|
codex.update({"gDNA from Buffy Coat":"BC"})
|
||||||
|
|
||||||
def read_qubit_doc_by_accession(keys:dict, path:str):
|
def read_qubit_doc_by_accession(keys:dict, path:str):
|
||||||
# collect values_by_sample_names string ids #
|
# collect values_by_sample_names string ids #
|
||||||
with open(path, 'r', newline='', encoding='utf-8') as csvfile:
|
with open(path, 'r', newline='', encoding='utf-8') as csvfile:
|
||||||
@@ -84,7 +87,8 @@ def write_run_doc(dm:dict, path:str):
|
|||||||
for r in dm:
|
for r in dm:
|
||||||
model:RowModel = dm[r]
|
model:RowModel = dm[r]
|
||||||
ix=ix+1
|
ix=ix+1
|
||||||
ws.append([ix, "", model.get_Id(), model.get_customerid(), model.get_plasmavolml(), model.get_qubitrunid(),
|
fmtId = formatInosticsId( model.get_Id(), model.get_materialid() )
|
||||||
|
ws.append([ix, "", fmtId, model.get_customerid(), model.get_plasmavolml(), model.get_qubitrunid(),
|
||||||
model.get_sampleconc(), convert_to_GE(model.get_sampleconc())])
|
model.get_sampleconc(), convert_to_GE(model.get_sampleconc())])
|
||||||
|
|
||||||
grayFill = PatternFill(start_color='D0CECE', end_color='D0CECE',
|
grayFill = PatternFill(start_color='D0CECE', end_color='D0CECE',
|
||||||
@@ -98,6 +102,20 @@ def write_run_doc(dm:dict, path:str):
|
|||||||
wb.close()
|
wb.close()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
def formatInosticsId(id:str=None, matrl:str=None):
|
||||||
|
iid = id.split("-", 1)[0]
|
||||||
|
ncd:str = ""
|
||||||
|
try:
|
||||||
|
if codex[matrl] is None:
|
||||||
|
ncd = ""
|
||||||
|
else:
|
||||||
|
ncd = codex[matrl]
|
||||||
|
if iid:
|
||||||
|
return iid + ncd
|
||||||
|
except Exception as e:
|
||||||
|
pass
|
||||||
|
return iid
|
||||||
|
|
||||||
def convert_to_numeric(vlu, stndv:float=0.0):
|
def convert_to_numeric(vlu, stndv:float=0.0):
|
||||||
try:
|
try:
|
||||||
return float(vlu)
|
return float(vlu)
|
||||||
@@ -120,6 +138,7 @@ def read_collect_run_doc_name_strids(min_col:int=1, path:str=None):
|
|||||||
InosticsID = None
|
InosticsID = None
|
||||||
CustomerID = None
|
CustomerID = None
|
||||||
PlasmaID = None
|
PlasmaID = None
|
||||||
|
MaterialID = None
|
||||||
InosticsIDKeys = {}
|
InosticsIDKeys = {}
|
||||||
for row in ws.iter_rows(max_row=30, min_col=min_col):
|
for row in ws.iter_rows(max_row=30, min_col=min_col):
|
||||||
for cell in row:
|
for cell in row:
|
||||||
@@ -135,6 +154,10 @@ def read_collect_run_doc_name_strids(min_col:int=1, path:str=None):
|
|||||||
PlasmaID = cell.column
|
PlasmaID = cell.column
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if MaterialID==None and cell.value and isinstance(cell.value, str) and "Sample Material" in cell.value:
|
||||||
|
MaterialID = cell.column
|
||||||
|
continue
|
||||||
|
|
||||||
if cell.value and InosticsID == cell.column:
|
if cell.value and InosticsID == cell.column:
|
||||||
InosticsIDKeys[cell.value] = RowModel(cell.coordinate, cell.value)
|
InosticsIDKeys[cell.value] = RowModel(cell.coordinate, cell.value)
|
||||||
rmv:RowModel = InosticsIDKeys[cell.value]
|
rmv:RowModel = InosticsIDKeys[cell.value]
|
||||||
@@ -159,5 +182,14 @@ def read_collect_run_doc_name_strids(min_col:int=1, path:str=None):
|
|||||||
rmv.set_plasmavolml( convert_to_numeric(cell.value) )
|
rmv.set_plasmavolml( convert_to_numeric(cell.value) )
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
if cell.value and MaterialID == cell.column:
|
||||||
|
print(F"{cell.coordinate}:{cell.row}x{cell.column}={cell.value}")
|
||||||
|
try:
|
||||||
|
if InosticsIDKeys[row[InosticsID-1].value] != None:
|
||||||
|
rmv:RowModel = InosticsIDKeys[row[InosticsID-1].value]
|
||||||
|
rmv.set_materialid( cell.value )
|
||||||
|
except:
|
||||||
|
pass
|
||||||
wb.close()
|
wb.close()
|
||||||
return InosticsIDKeys
|
return InosticsIDKeys
|
||||||
|
|||||||
Reference in New Issue
Block a user