update test file
This commit is contained in:
44
test.py
44
test.py
@@ -1,43 +1,31 @@
|
|||||||
from tcr_pmhc_complexes import FastaFile
|
from tcr_pmhc_complexes import FastaFile
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
import glob
|
||||||
|
|
||||||
def test_fasta_file(file_path):
|
def test_fasta_file(file_path):
|
||||||
fasta_file = FastaFile(file=Path(file_path))
|
fasta_file = FastaFile(file=Path(file_path))
|
||||||
|
|
||||||
print(f"文件:{file_path}")
|
print(f"File: {file_path}")
|
||||||
print(f"序列数量:{fasta_file.sequence_num}\n")
|
print(f"Number of Sequences: {fasta_file.sequence_num}\n")
|
||||||
|
|
||||||
for seq in fasta_file.sequences:
|
|
||||||
header_info = seq.header_info
|
|
||||||
print(f"PDB ID: {header_info.pdb_id}")
|
|
||||||
print(f"Chain IDs: {', '.join(header_info.chain_ids)}")
|
|
||||||
print(f"Author Chain IDs: {', '.join([f'{cid} ({aid})' for cid, aid in header_info.auth_chain_ids.items()])}")
|
|
||||||
print(f"Description: {header_info.description}")
|
|
||||||
print(f"Sequence: {seq.sequence.sequence[:30]}...") # 打印部分序列以简化输出
|
|
||||||
print(f"Sequence Length: {seq.sequence_length}\n") # 新增行来打印序列长度
|
|
||||||
|
|
||||||
def test_fasta_file1(file_path):
|
|
||||||
fasta_file = FastaFile(file=Path(file_path))
|
|
||||||
|
|
||||||
print(f"文件:{file_path}")
|
|
||||||
print(f"序列数量:{fasta_file.sequence_num}\n")
|
|
||||||
|
|
||||||
for seq in fasta_file.sequences:
|
for seq in fasta_file.sequences:
|
||||||
header_info = seq.header_info
|
header_info = seq.header_info
|
||||||
print(f"PDB ID: {header_info.pdb_id if header_info.pdb_id else 'N/A'}")
|
print(f"PDB ID: {header_info.pdb_id if header_info.pdb_id else 'N/A'}")
|
||||||
print(f"Chain IDs: {', '.join(header_info.chain_ids) if header_info.chain_ids else 'N/A'}")
|
print(f"Chain IDs: {', '.join(header_info.chain_ids) if header_info.chain_ids else 'N/A'}")
|
||||||
print(f"Author Chain IDs: {', '.join([f'{cid} ({aid})' for cid, aid in header_info.auth_chain_ids.items()]) if header_info.auth_chain_ids else 'N/A'}")
|
print(f"Author Chain IDs: {', '.join([f'{cid} ({aid})' for cid, aid in header_info.auth_chain_ids.items()]) if header_info.auth_chain_ids else 'N/A'}")
|
||||||
print(f"Is Polymeric: {header_info.is_polymeric}")
|
print(f"Is Polymeric: {header_info.is_polymeric if header_info.is_polymeric else 'Unknown'}")
|
||||||
print(f"Description: {header_info.description}")
|
print(f"Description: {header_info.description}")
|
||||||
print(f"Sequence: {seq.sequence.sequence[:30]}...\n")
|
print(f"Sequence: {seq.sequence.sequence[:30]}...")
|
||||||
|
print(f"Sequence Length: {len(seq.sequence.sequence)}\n")
|
||||||
|
|
||||||
# 测试三个 fasta 文件
|
# Discover all .fasta files within directories matching the pattern
|
||||||
test_fasta_files = [
|
runner_directories = glob.glob('/mnt/mydrive/analysis_pdb-dev/pdb_test1/runner_*')
|
||||||
'/mnt/mydrive/analysis_pdb-dev/pdb_test1/runner_8gvb/8gvb.fasta',
|
fasta_files = [file for directory in runner_directories for file in Path(directory).glob('*.fasta')]
|
||||||
'/mnt/mydrive/analysis_pdb-dev/pdb_test1/runner_8gom/8gom.fasta',
|
|
||||||
'/mnt/mydrive/analysis_pdb-dev/pdb_test1/runner_7n6e/7n6e.fasta',
|
|
||||||
'/mnt/mydrive/analysis_pdb-dev/test.fasta'
|
|
||||||
]
|
|
||||||
|
|
||||||
for file in test_fasta_files:
|
# Add the standard FASTA file to the list of files to be tested
|
||||||
test_fasta_file(file)
|
fasta_files.append(Path('/mnt/mydrive/analysis_pdb-dev/test.fasta'))
|
||||||
|
|
||||||
|
# Test each FASTA file
|
||||||
|
for file_path in fasta_files:
|
||||||
|
test_fasta_file(file_path)
|
||||||
|
# test_fasta_file('/mnt/mydrive/analysis_pdb-dev/test.fasta')exit
|
||||||
|
|||||||
Reference in New Issue
Block a user