From f9be323d15062668caf4c5b57f6b17c67df32240 Mon Sep 17 00:00:00 2001 From: lingyuzeng Date: Thu, 25 Jan 2024 15:43:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E5=A6=82=E6=9E=9C=E4=B8=A4?= =?UTF-8?q?=E7=AB=AF=E9=83=BD=E6=B2=A1=E6=9C=89-=E5=AF=B9=E9=BD=90?= =?UTF-8?q?=E6=97=B6=E5=80=99=E4=BA=A7=E7=94=9F=E7=9A=84=E9=94=99=E8=AF=AF?= =?UTF-8?q?ali=E6=96=87=E4=BB=B6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_modeller.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/build_modeller.py b/build_modeller.py index 0cf7c56..3010a9f 100755 --- a/build_modeller.py +++ b/build_modeller.py @@ -46,7 +46,7 @@ class PDBModeler: trim_index = 1 else: # 如果两条链都不需要裁剪,就直接返回原文件 - return file + return None start, end = PDBModeler.find_non_dash_indices(seqs[trim_index].seq) @@ -92,19 +92,19 @@ class PDBModeler: # save alignment in FASTA format aln.write(file=(self.outdir / 'alignment1.fasta').as_posix(), alignment_format='FASTA') slice_fasta = PDBModeler.align_sequences(self.outdir / 'alignment1.fasta') - slice_ali = self.outdir / 'alignment_slice.ali' - fx = pyfastx.Fasta(slice_fasta.as_posix(), build_index=True) - assert len(fx) == 1, "FASTA file should contain only one sequence" - PDBModeler.write_ali(slice_ali, fx[0].name, fx[0].seq) - - env2 = Environ() - mdl2 = Model(env2, file=self.structure_file.as_posix(), model_segment=(f'FIRST:{self.chain}', f'LAST:{self.chain}')) - aln2 = Alignment(env2) - aln2.append_model(mdl2, align_codes=self.structure, atom_files=self.structure_file.as_posix()) - aln2.append(file=slice_ali.as_posix(), align_codes=self.sequence) - aln2.align2d() - aln2.write(file=(self.outdir / 'alignment2.ali').as_posix(), alignment_format='PIR') - aln2.write(file=(self.outdir / 'alignment2.pap').as_posix(), alignment_format='PAP') + if slice_fasta: + slice_ali = self.outdir / 'alignment_slice.ali' + fx = pyfastx.Fasta(slice_fasta.as_posix(), build_index=True) + assert len(fx) == 1, "FASTA file should contain only one sequence" + PDBModeler.write_ali(slice_ali, fx[0].name, fx[0].seq) + env2 = Environ() + mdl2 = Model(env2, file=self.structure_file.as_posix(), model_segment=(f'FIRST:{self.chain}', f'LAST:{self.chain}')) + aln2 = Alignment(env2) + aln2.append_model(mdl2, align_codes=self.structure, atom_files=self.structure_file.as_posix()) + aln2.append(file=slice_ali.as_posix(), align_codes=self.sequence) + aln2.align2d() + aln2.write(file=(self.outdir / 'alignment2.ali').as_posix(), alignment_format='PIR') + aln2.write(file=(self.outdir / 'alignment2.pap').as_posix(), alignment_format='PAP') log.verbose()