색인 1의 아미노산 서열을 가지고있는 Excel 파일에 제가 작업하고있는 데이터가 있습니다. 다른 속성을 계산하려고합니다. BioPython을 사용하여 시퀀스를 기반으로합니다. 지금 가지고있는 코드는 다음과 같습니다.BioPython : 아미노산 서열에 'J'가 들어있어 분자량을 계산할 수 없습니다.
import xlrd
import sys
from Bio.SeqUtils.ProtParam import ProteinAnalysis
print '~~~~~~~~~~~~~~~ EXCEL PARSER FOR PVA/NON-PVA DATA ~~~~~~~~~~~~~~~'
print 'Path to Excel file:', str(sys.argv[1])
fname = sys.argv[1]
workbook = xlrd.open_workbook(fname, 'rU')
print ''
print 'The sheet names that have been found in the Excel file: '
sheet_names = workbook.sheet_names()
number_of_sheet = 1
for sheet_name in sheet_names:
print '*', number_of_sheet, ': ', sheet_name
number_of_sheet += 1
with open("thefile.txt","w") as f:
lines = []
f.write('LENGTH.SEQUENCE,SEQUENCE,MOLECULAR.WEIGHT\n')
for sheet_name in sheet_names:
worksheet = workbook.sheet_by_name(sheet_name)
print 'opened: ', sheet_name
for i in range(1, worksheet.nrows):
row = worksheet.row_values(i)
analysed_seq = ProteinAnalysis(row[1].encode('utf-8'))
weight = analysed_seq.molecular_weight()
lines.append('{},{},{}\n'.format(row[2], row[1].encode('utf-8'), weight))
f.writelines(lines)
분자량 계산을 추가 할 때까지 작업하고있었습니다.
Traceback (most recent call last):
File "Excel_PVAdata_Parser.py", line 28, in <module>
weight = analysed_seq.molecular_weight()
File "/usr/lib/python2.7/dist-packages/Bio/SeqUtils/ProtParam.py", line 114, in molecular_weight
total_weight += aa_weights[aa]
KeyError: 'J'
내가 Excel 데이터 파일에보고하고이 아미노산 서열은 J. 누군가가 '알 수없는 아미노산을'잡는다 바이오 파이썬의 패키지를 알거나 있습니까 포함 않음을 보여줍니다이는 다음과 같은 오류를 보여 주었다 또 다른 제안? 이 알 수없는 경우에는
이 문제는 매우 특정 패키지 것, 그리고이 모든 파이썬 표준 모듈이 아닙니다. 특정 포럼이나 프로젝트의 github 페이지를 살펴 보는 것이 좋습니다. – Raf