|
3 | 3 |
|
4 | 4 | # A directory for handling the AlphaMap (no typo!) data, analogous to the Mac installer, is added via the .inno file |
5 | 5 |
|
| 6 | +# Download AlphaMap data files (FASTA and CSV files) |
| 7 | + Write-Host "Starting downloads of FASTA and CSV files..." |
| 8 | + |
| 9 | + # Create directory for AlphaMap data |
| 10 | + $alphaMapDataDir = ".\dist_pyinstaller\alphaquant_gui\_internal\alphamap\data" |
| 11 | + New-Item -ItemType Directory -Force -Path $alphaMapDataDir | Out-Null |
| 12 | + |
| 13 | + # Get file list from GitHub |
| 14 | + try { |
| 15 | + $downloadList = Invoke-RestMethod -Uri "https://api.github.com/repos/MannLabs/alphamap/contents/alphamap/data?ref=main" |
| 16 | + } catch { |
| 17 | + Write-Host "Error: Failed to fetch file list from GitHub API" |
| 18 | + exit 1 |
| 19 | + } |
| 20 | + |
| 21 | + # Download FASTA and CSV files |
| 22 | + $fileCount = 0 |
| 23 | + foreach ($file in $downloadList) { |
| 24 | + if ($file.name -match "\.(fasta|csv)$") { |
| 25 | + $url = $file.download_url |
| 26 | + $filename = $file.name |
| 27 | + Write-Host "Downloading $filename..." |
| 28 | + |
| 29 | + try { |
| 30 | + Invoke-WebRequest -Uri $url -OutFile "$alphaMapDataDir\$filename" |
| 31 | + Write-Host "Successfully downloaded $filename" |
| 32 | + $fileCount++ |
| 33 | + } catch { |
| 34 | + Write-Host "Error: Failed to download $filename" |
| 35 | + exit 1 |
| 36 | + } |
| 37 | + } |
| 38 | + } |
| 39 | + |
| 40 | + # Verify downloads |
| 41 | + Write-Host "Downloaded $fileCount files" |
| 42 | + if ($fileCount -eq 0) { |
| 43 | + Write-Host "Error: No files were downloaded" |
| 44 | + exit 1 |
| 45 | + } |
| 46 | + |
| 47 | +# Download and extract AlphaQuant resources from datashare |
| 48 | +Write-Host "Creating resources directory..." |
| 49 | +$resourcesDir = ".\dist_pyinstaller\alphaquant_gui\_internal\alphaquant\resources" |
| 50 | +New-Item -ItemType Directory -Force -Path $resourcesDir | Out-Null |
| 51 | + |
| 52 | +# Download and extract the first zip file |
| 53 | +Write-Host "Downloading and extracting first resource from datashare..." |
| 54 | +$tempZip1 = [System.IO.Path]::GetTempFileName() |
| 55 | +try { |
| 56 | + Invoke-WebRequest -Uri "https://datashare.biochem.mpg.de/s/ezPzeqStEgDD8gg/download" -OutFile $tempZip1 |
| 57 | + Write-Host "Successfully downloaded first resource, now extracting..." |
| 58 | + Expand-Archive -Path $tempZip1 -DestinationPath $resourcesDir -Force |
| 59 | + Remove-Item -Path $tempZip1 |
| 60 | +} catch { |
| 61 | + Write-Host "Error: Failed to download or extract first resource from datashare" |
| 62 | + exit 1 |
| 63 | +} |
| 64 | + |
| 65 | +# Download and extract the second zip file |
| 66 | +Write-Host "Downloading and extracting second resource from datashare..." |
| 67 | +$tempZip2 = [System.IO.Path]::GetTempFileName() |
| 68 | +try { |
| 69 | + Invoke-WebRequest -Uri "https://datashare.biochem.mpg.de/s/stH9pmNe6O9CRHG/download" -OutFile $tempZip2 |
| 70 | + Write-Host "Successfully downloaded second resource, now extracting..." |
| 71 | + Expand-Archive -Path $tempZip2 -DestinationPath $resourcesDir -Force |
| 72 | + Remove-Item -Path $tempZip2 |
| 73 | +} catch { |
| 74 | + Write-Host "Error: Failed to download or extract second resource from datashare" |
| 75 | + exit 1 |
| 76 | +} |
| 77 | + |
| 78 | +# Verify the downloads and extraction |
| 79 | +Write-Host "Verifying extracted resources..." |
| 80 | +if (-not (Test-Path -Path $resourcesDir)) { |
| 81 | + Write-Host "Error: Resources directory not found after extraction" |
| 82 | + exit 1 |
| 83 | +} |
| 84 | + |
| 85 | +# Verify that specific database subdirectories exist |
| 86 | +$referenceDbDir = Join-Path $resourcesDir "reference_databases" |
| 87 | +$phosphopredDbDir = Join-Path $resourcesDir "phosphopred_databases" |
| 88 | + |
| 89 | +Write-Host "Checking for reference_databases directory..." |
| 90 | +if (-not (Test-Path -Path $referenceDbDir)) { |
| 91 | + Write-Host "Error: reference_databases directory not found at $referenceDbDir" |
| 92 | + exit 1 |
| 93 | +} |
| 94 | + |
| 95 | +Write-Host "Checking for phosphopred_databases directory..." |
| 96 | +if (-not (Test-Path -Path $phosphopredDbDir)) { |
| 97 | + Write-Host "Error: phosphopred_databases directory not found at $phosphopredDbDir" |
| 98 | + exit 1 |
| 99 | +} |
| 100 | + |
| 101 | +# Verify that the phosphopred database contains the expected file |
| 102 | +$humanPhosphoFile = Join-Path $phosphopredDbDir "human_uniprot_reviewed_phos_prob.tsv" |
| 103 | +if (-not (Test-Path -Path $humanPhosphoFile)) { |
| 104 | + Write-Host "Error: Expected phosphopred database file not found at $humanPhosphoFile" |
| 105 | + Write-Host "Contents of phosphopred_databases directory:" |
| 106 | + Get-ChildItem -Path $phosphopredDbDir -Recurse | Format-Table Name, FullName |
| 107 | + exit 1 |
| 108 | +} |
| 109 | + |
| 110 | +Write-Host "Resources successfully downloaded and extracted" |
| 111 | +Write-Host " - reference_databases: OK" |
| 112 | +Write-Host " - phosphopred_databases: OK" |
| 113 | +Write-Host " - human_uniprot_reviewed_phos_prob.tsv: OK" |
| 114 | + |
6 | 115 | # Wrapping the pyinstaller folder in a .exe package |
7 | 116 | & "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" .\release\windows\alphaquant_innoinstaller.iss |
0 commit comments