# Input files

Pass a structure or alignment file to a model from the CLI, Python, or HTTP.

## How a model takes a file

A model input whose name ends in `_gcs_uri` or `_uri` takes the address of a file, not the file itself. Phi accepts only an address it issued: a file your organization uploaded to Phi, or a file from one of your organization's runs.

You cannot point Phi at a storage bucket of your own. Upload the file to Phi first, then pass the address it returns. The CLI does this for you.

## From the CLI

Pass the file with `@` and its path. The CLI sends it with the request, so there is nothing to copy between commands.

Put `@` on the file field, such as `target_pdb`, and not on the address field, `target_pdb_gcs_uri`. The CLI sends a small file inside the request and uploads a large one first, and the file field accepts both. To reuse a file that is already on Phi, pass its `gs://` address to the address field instead.

A few fields take only an address, such as an alignment's `msa_uri`. They have no `@` form, so upload the file from Python or over HTTP and pass the address it returns.

```bash
phi jobs submit RFDIFFUSION3 \
  --input target_pdb=@target.pdb \
  --input target_chain_id=A \
  --param hotspots=A150,A154 \
  --wait --out out/
```

## From Python

`phi.files.upload` uploads the file and returns its address as a string. Pass that string to the address field.

If you plan to run the same structure several times, keep the address and reuse it. Uploading the same file again makes a second copy.

```python
from phi import PhiClient

with PhiClient() as phi:
    uri = phi.files.upload(path="target.pdb")
    job = phi.jobs.submit(
        "RFDIFFUSION3",
        inputs={"target_pdb_gcs_uri": uri, "target_chain_id": "A"},
        params={"hotspots": ["A150", "A154"]},
    )
```

## Over HTTP

Uploading takes two requests. First, ask `POST /v1/uploads/url` for a signed URL. The response includes `upload_url`, where you send the file, and `gcs_uri`, the address you submit. Then send the file to `upload_url` with `PUT`, using the same content type you named in the first request.

The signed URL expires, so request it when the file is ready to send.

```bash
curl -X POST https://api.dynophi.com/v1/uploads/url \
  -H "x-api-key: $PHI_KEY" -H "content-type: application/json" \
  -d '{"filename": "target.pdb", "content_type": "chemical/x-pdb"}'
# answers upload_url to write to, gcs_uri to submit with, and how long it lasts

curl -X PUT --upload-file target.pdb \
  -H "content-type: chemical/x-pdb" "$UPLOAD_URL"
```

[Uploads](https://dynophi.com/docs/api/uploads)

## Chains and residues

A structure file often holds more than the model should use. Name the chain in the model's chain field, such as `target_chain_id`, using the chain ID as it appears in the file.

Hotspots use author numbering: the residue numbers written in the file, not positions counted from 1.

[Hotspots and numbering](https://dynophi.com/docs/guides/hotspots-and-numbering)

[Models and their inputs](https://dynophi.com/docs/models)

---
Source: https://dynophi.com/docs/reference/inputs
