Skip to content

Commit 9e19809

Browse files
authored
Merge pull request #91 from MannLabs/add_downloads_to_windows_installer
Add downloads to windows installer
2 parents b62a863 + 3436ad9 commit 9e19809

2 files changed

Lines changed: 140 additions & 1 deletion

File tree

release/macos/build_package_macos.sh

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,41 @@ rm "$TEMP_ZIP2"
9797

9898
# Verify the downloads and extraction
9999
echo "Verifying extracted resources..."
100-
if [ ! -d "${CONTENTS_FOLDER}/MacOS/_internal/alphaquant/resources/" ]; then
100+
RESOURCES_DIR="${CONTENTS_FOLDER}/MacOS/_internal/alphaquant/resources"
101+
if [ ! -d "$RESOURCES_DIR" ]; then
101102
echo "Error: Resources directory not found after extraction"
102103
exit 1
103104
fi
105+
106+
# Verify that specific database subdirectories exist
107+
REFERENCE_DB_DIR="$RESOURCES_DIR/reference_databases"
108+
PHOSPHOPRED_DB_DIR="$RESOURCES_DIR/phosphopred_databases"
109+
110+
echo "Checking for reference_databases directory..."
111+
if [ ! -d "$REFERENCE_DB_DIR" ]; then
112+
echo "Error: reference_databases directory not found at $REFERENCE_DB_DIR"
113+
exit 1
114+
fi
115+
116+
echo "Checking for phosphopred_databases directory..."
117+
if [ ! -d "$PHOSPHOPRED_DB_DIR" ]; then
118+
echo "Error: phosphopred_databases directory not found at $PHOSPHOPRED_DB_DIR"
119+
exit 1
120+
fi
121+
122+
# Verify that the phosphopred database contains the expected file
123+
HUMAN_PHOSPHO_FILE="$PHOSPHOPRED_DB_DIR/human_uniprot_reviewed_phos_prob.tsv"
124+
if [ ! -f "$HUMAN_PHOSPHO_FILE" ]; then
125+
echo "Error: Expected phosphopred database file not found at $HUMAN_PHOSPHO_FILE"
126+
echo "Contents of phosphopred_databases directory:"
127+
ls -la "$PHOSPHOPRED_DB_DIR"
128+
exit 1
129+
fi
130+
104131
echo "Resources successfully downloaded and extracted"
132+
echo " - reference_databases: OK"
133+
echo " - phosphopred_databases: OK"
134+
echo " - human_uniprot_reviewed_phos_prob.tsv: OK"
105135

106136
###Download section complete
107137

release/windows/build_package_windows.ps1

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,114 @@
33

44
# A directory for handling the AlphaMap (no typo!) data, analogous to the Mac installer, is added via the .inno file
55

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+
6115
# Wrapping the pyinstaller folder in a .exe package
7116
& "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" .\release\windows\alphaquant_innoinstaller.iss

0 commit comments

Comments
 (0)