Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align pdb #165

Open
wants to merge 41 commits into
base: main
Choose a base branch
from
Open

Align pdb #165

wants to merge 41 commits into from

Conversation

mgiulini
Copy link
Collaborator

@mgiulini mgiulini commented Dec 6, 2022

Closes #124

@mgiulini mgiulini self-assigned this Dec 6, 2022
@mgiulini mgiulini marked this pull request as ready for review April 19, 2024 15:02
input_arg,
input_uniprot,
input_fasta,
input_pdb,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

main takes quite a lot of arguments, it might be time to start considering using a configuration file instead of command line arguments.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but this was probably the last (or second last) big modification to the code, so I would not change the whole input structure for the moment.

Comment on lines 210 to +233
input_files = {}
# retrieve uniprot information
if inp.is_fasta():
input_files["fasta"] = Path(inp.arg)
uniprot_id = run_blast(input_files["fasta"], db)
if inp.is_uniprot():
uniprot_id = inp.arg.upper()
if inp.is_pdb():
input_files["pdb"] = Path(inp.arg)
uniprot_id = None
# fasta input
if is_fasta(input_fasta):
input_files["fasta"] = Path(input_fasta)
if not is_uniprot(input_uniprot):
uniprot_id = run_blast(input_files["fasta"], db)
else:
log.warning("Uniprot ID provided. The fasta file will be ignored.")
# pdb input
if is_pdb(input_pdb):
input_files["pdb"] = Path(input_pdb)
if not interface_file:
fasta_f = to_fasta(input_files["pdb"], temp=False)
uniprot_id = run_blast(fasta_f.name, db)
if not is_uniprot(input_uniprot):
uniprot_id = run_blast(fasta_f.name, db)
# remove fasta_f
input_files["pdb"].with_suffix(".fasta").unlink()
else:
input_files["interface_file"] = Path(interface_file)
uniprot_id = None
# 25/7/2023: if the pdb is provided, the blast uniprot_id can be
# overwritten by specifying the uniprot_id input argument
if is_uniprot(input_uniprot):
uniprot_id = input_uniprot.upper()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you are using only if and not if/elif/else, uniprot_id can be None by the end of the switch. Here you should either re-work this logic and add hierarchy to the parameters (with if/elif/else) or add an extra check that uniprot_id is not None

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but it's fine to have uniprot_id = None at the end of the switch!

input_files["pdb"], uniprot_id
)
else:
pdb_f = input_files["pdb"]
else:
if pdb_data:
pdb_data_path = input_files["pdb_data"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep in mind that here if pdb_data_path is None the get_best_pdb function will raise an IndexError

src/arctic3d/modules/interface_matrix.py Show resolved Hide resolved
Comment on lines +457 to +459
with open(pdb_renum, "w") as wfile:
with open(pdb_torenum) as rfile:
for ln in rfile:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's too much identantion here, see if you can reduce it. You should be able to do things such as: with open(pdb_renum, "w") as wfile, with open(pdb_torenum) as rfile: and instead of doing the if check and going into the block you can do it the other way around and continue if it does not pass the check

src/arctic3d/modules/sequence.py Show resolved Hide resolved
src/arctic3d/modules/sequence.py Show resolved Hide resolved
Copy link
Member

@rvhonorato rvhonorato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some small comments!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

introduce alignment on input pdb
2 participants