Download to the Desktop¶
User manual to download data in FEGA.
Data download consists of two parts:
- Apply for data access.
- File download.
Apply for data access¶
- Login into REMS .
- Browse Catalogue for different datasets.
- If you find the desired dataset, press the Add to cart button at the end of the dataset. If you wish, you can add several datasets and request access to several datasets at the same time.
- The cart is shown in the top part of webpage.
- When you have finished adding datasets, press the Apply button in the bottom of the cart.
- The data request form will open. Please review it and if everything appears correct, click Send application.
- Contact Vlad or Tommy, who can review application and approve data access.
Generate a C4GH key pair.¶
- Ensure
crypt4gh
command-line tool has been installed on your computer or install the tool -
Run command to generate the key pair. It's highly recommended to take advantage of the 'add a passphrase' increased security option:
Where:crypt4gh generate -n <c4gh_name>
<c4gh_name>
is the name of your crypt4gh key file.
-
You will be asked to insert a passphrase, it's highly recommended to do so and keep it safe for later use.
- The output is two files
<c4gh_name>.sec.pem
and<c4gh_name>.pub.pem
the crypt4gh private and public key accordingly.
File download¶
Download is possible only, when you have access to at least one dataset, that contains also at least one file.
Get Elixir AAI token¶
Go to https://fega.etais.ee/login to get Elixir AAI token.
You should see the access token with the Copy to clipboard button below (click it).
Make the environment token¶
Copy the token and make it your environment token.
- Open terminal and run command: Where:
export token=<access token>
<access token>
is Elixir AAI token from step 1.
- Open "Command Prompt" and run command: Where:
set token=<access token>
<access token>
is Elixir AAI token from step 1.
Datasets¶
Check for the datasets available to you.
- On the terminal run command:
curl -H "Authorization: Bearer $token" https://download.fega.etais.ee/metadata/datasets
- On the "Command Prompt" run command:
curl -H "Authorization: Bearer %token%" https://download.fega.etais.ee/metadata/datasets
The list of datasets available to you will be displayed.
Example output
[
"EGAD50000000191",
"EGAD50000000199"
]
Important
Access token is valid for 1 hour. If you are granted access to new datasets and you don't see them, then please clear your browser cache and start again from step 1.
Files in the dataset¶
Check the files in the dataset.
- On the terminal run command: Where:
curl -H "Authorization: Bearer $token" https://download.fega.etais.ee/metadata/datasets/<datasetID>/files | jq
<datasetID>
is dataset ID from step 3 (EGAD50000000199
in our example).
- On the terminal run command: Where:
curl -H "Authorization: Bearer $token" https://download.fega.etais.ee/metadata/datasets/<datasetID>/files
<datasetID>
is dataset ID from step 3 (EGAD50000000199
in our example).
- On the "Command Prompt" run command: Where:
curl -H "Authorization: Bearer %token%" https://download.fega.etais.ee/metadata/datasets/<datasetID>/files
<datasetID>
is dataset ID from step 3 (EGAD50000000199
in our example).
Example output
[
{
"fileId":"EGAF50000105398",
"datasetId":"EGAD50000000199",
"displayFileName":"2023-10-24 sample 1.vcf.c4gh",
"filePath":"tommy.tomson_ut.ee/2023-10-24 sample 1.vcf.c4gh",
"fileName":"ef8bf4a3-0cb6-4c96-8083-c3112ee5b994",
"fileSize":18708836,
"decryptedFileSize":18700828,
"decryptedFileChecksum":"37176ae411436fcd6ecb29b35c7070ce073947faaca7a9725a271908dd2f7f78",
"decryptedFileChecksumType":"SHA256",
"fileStatus":"verified",
"createdAt":"2023-10-24T07:17:54.696721Z",
"lastModified":"2023-10-24T07:22:00.811049Z"
},
{
"fileId":"EGAF50000105399",
"datasetId":"EGAD50000000199",
"displayFileName":"2023-10-24 sample 2.vcf.c4gh",
"filePath":"tommy.tomson_ut.ee/2023-10-24 sample 2.vcf.c4gh",
"fileName":"424982b8-ae47-4c20-a667-df760b8613a1",
"fileSize":29248578,
"decryptedFileSize":29236062,
"decryptedFileChecksum":"ee58889e66fa3034f7612d970daae7ac9bc669c97e3d45a0617e54fd63e22cba",
"decryptedFileChecksumType":"SHA256",
"fileStatus":"verified",
"createdAt":"2023-10-24T07:18:57.010961Z",
"lastModified":"2023-10-24T07:22:00.830143Z"
}
]
Encryption¶
Transform crypt4gh public key into your environment variable.
- Encode crypt4gh pubkey into base64 format
cat "-----BEGIN CRYPT4GH PUBLIC KEY----- <crypt4gh public key> -----END CRYPT4GH PUBLIC KEY-----" | base64 | tr -d "\n"
- Open terminal and run command: Where:
export c4ghpubkey=<base64 string c4gh public key>
<c4gh public key>
is the C4GH public key from Generate a c4gh key pair.
- Open "Command Prompt" and run command: Where:
set c4ghpubkey=<c4gh public key>
<c4gh public key>
is the C4GH public key token from Generate a c4gh key pair.
Download¶
Download the selected file.
- On the terminal run command: Where:
curl -H "Authorization: Bearer $token" -H "C4GH-PublicKey: $c4ghpubkey" https://download.fega.etais.ee/files/<fileID> --output <destinationFileName>.c4gh
<fileID>
is file ID from step 4 (EGAF50000105398
in our example).<destinationFileName>
is the downloaded file name in your system. NB! the downloaded file is encrypted, so it needs.c4gh
extension.
- On the "Command Prompt" run command: Where:
curl -H "Authorization: Bearer %token%" -H "C4GH-PublicKey: $c4ghpubkey" https://download.fega.etais.ee/files/<fileID> --output <destinationFileName>.c4gh
<fileID>
is file ID from step 4 (EGAF50000105398
in our example).<destinationFileName>
is the downloaded file name in your system. NB! the downloaded file is encrypted, so it needs.c4gh
extension.
The downloaded file is created in the current active directory of your terminal (or Command Prompt in case of Windows).
Decrypt¶
Decrypt the downloaded file
- Open terminal and navigate to the folder, where the downloaded file(s) are located.
- Run command: Where:
crypt4gh decrypt --file=<my_data_file> -s c4gh.sec.pem
<my_data_file>
is the name of your file that you want to decrypt,c4gh.sec.pem
is the crypt4gh private key file name.
- You will be asked whether you want to enter passphrase if you added one.
- You should have a new file without the ending
.c4gh
- this is your decrypted file.