32 lines
1.5 KiB
Python
32 lines
1.5 KiB
Python
from tcr_pmhc_complexes import FastaFile
|
|
from pathlib import Path
|
|
import glob
|
|
|
|
def test_fasta_file(file_path):
|
|
fasta_file = FastaFile(file=Path(file_path))
|
|
|
|
print(f"File: {file_path}")
|
|
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 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"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 if header_info.is_polymeric else 'Unknown'}")
|
|
print(f"Description: {header_info.description}")
|
|
print(f"Sequence: {seq.sequence.sequence[:30]}...")
|
|
print(f"Sequence Length: {len(seq.sequence.sequence)}\n")
|
|
|
|
# Discover all .fasta files within directories matching the pattern
|
|
runner_directories = glob.glob('/mnt/mydrive/analysis_pdb-dev/pdb_test1/runner_*')
|
|
fasta_files = [file for directory in runner_directories for file in Path(directory).glob('*.fasta')]
|
|
|
|
# Add the standard FASTA file to the list of files to be tested
|
|
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
|