Repository: biopython/biopython

Issue:
ScanProsite no longer working
### Setup

I am reporting a problem with Biopython version, Python version, and operating
system as follows:

```python
import sys; print(sys.version)
import platform; print(platform.python_implementation()); print(platform.platform())
import Bio; print(Bio.__version__)
```

(*Please copy and run the above in your Python, and copy-and-paste the output*)
3.7.16 (default, Mar 10 2023, 03:25:26) 
[GCC 7.3.1 20180712 (Red Hat 7.3.1-15)]
CPython
Linux-5.10.177-158.645.amzn2.x86_64-x86_64-with-glibc2.2.5
1.81

### Expected behaviour

Hi, I have been recently having difficulty with the ScanProsite module.  I am wondering if the ScanProsite mirror needs to updated.  Thank you in advance.

### Actual behaviour

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.7/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib64/python3.7/urllib/request.py", line 531, in open
    response = meth(req, response)
  File "/usr/lib64/python3.7/urllib/request.py", line 641, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib64/python3.7/urllib/request.py", line 569, in error
    return self._call_chain(*args)
  File "/usr/lib64/python3.7/urllib/request.py", line 503, in _call_chain
    result = func(*args)
  File "/usr/lib64/python3.7/urllib/request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 308: Permanent Redirect

### Steps to reproduce

    from Bio import ExPASy
    from Bio.ExPASy import ScanProsite
    import pandas as pd
    # Run input sequence through ScanProsite
    handle = ScanProsite.scan(sig = sequence, output = 'xml', lineage='Homo sapiens', mirror = 'https://prosite.expasy.org/cgi-bin/prosite/scanprosite/PSScan.cgi')
    result = ScanProsite.read(handle)
    df = pd.DataFrame(handle)



Discussion:
Your mirror value looks wrong.

Does the default mirror value of "https://prosite.expasy.org" work? If I am reading the code correctly it would build a URL of https://prosite.expasy.org/cgi-bin/prosite/PSScan.cgi from that (different to yours).
> Your mirror value looks wrong.
> 
> Does the default mirror value of "https://prosite.expasy.org" work? If I am reading the code correctly it would build a URL of https://prosite.expasy.org/cgi-bin/prosite/PSScan.cgi from that (different to yours).

Hi there, I can confirm that using the default mirror you've provided there doesn't work - I get the same error as above, with a 308 permanent redirect :(
After a bit of work, I've realised that the scanprosite `scan` command has an incorrect, presumably outdated url, on line 62:
Old:
`url = f"{mirror}/cgi-bin/prosite/PSScan.cgi?{command}"`
Working:
`url = f"{mirror}/cgi-bin/prosite/scanprosite/PSScan.cgi?{command}"`

So if anyone else has had this issue, I'd recommend changing the scan command :)
@BairdMcI can you turn that suggestion into a pull request? GitHub makes this very easy by editing https://github.com/biopython/biopython/blob/master/Bio/ExPASy/ScanProsite.py in the browser.
Oh sweet ok, was thinking I'd need to make a whole new branch etc just to change one line but will look into it, thanks a lot!
Well, the web-interface will make a fork (if you don't have one already) and a branch, but it is very easy.

Resolving patch:
diff --git a/Bio/ExPASy/ScanProsite.py b/Bio/ExPASy/ScanProsite.py
--- a/Bio/ExPASy/ScanProsite.py
+++ b/Bio/ExPASy/ScanProsite.py
@@ -59,7 +59,7 @@ def scan(seq="", mirror="https://prosite.expasy.org", output="xml", **keywords):
         if value is not None:
             parameters[key] = value
     command = urlencode(parameters)
-    url = f"{mirror}/cgi-bin/prosite/PSScan.cgi?{command}"
+    url = f"{mirror}/cgi-bin/prosite/scanprosite/PSScan.cgi?{command}"
     handle = urlopen(url)
     return handle
 


Test patch: