You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
INFO:tp53.seshat.find_in_gmail: >>> The input file contained
103
+
INFO:tp53.seshat.find_in_gmail: >>> 23 mutations out of which
104
+
INFO:tp53.seshat.find_in_gmail: >>> 23 were TP53 mutations.
105
+
INFO:tp53.seshat.find_in_gmail:Writing attachment to ZIP archive: sample.library.vcf.seshat.zip
106
+
INFO:tp53.seshat.find_in_gmail:Extracting ZIP archive: sample.library.vcf.seshat.zip
107
+
INFO:tp53.seshat.find_in_gmail:Output file renamed to: sample.library.seshat.short-20241214_034753_129732.tsv
108
+
INFO:tp53.seshat.find_in_gmail:Output file renamed to: sample.library.seshat.long-20241214_034753_217420.tsv
109
+
```
110
+
111
+
This tool is used to programmatically wait for, and retrieve, a batch results email from the Seshat TP53 annotation server.
112
+
113
+
The tool works by searching a user-controlled Gmail inbox for a recent Seshat email that contains the result annotations for a given VCF input file, by name.
114
+
It is critically important to be aware that there is no way to prove which annotation files, as they arrive via email, are to be linked with which VCF file on disk.
115
+
116
+
This tool assists in the correct pairing of VCF input files, and subsequent annotation files, by letting you specify how many hours back in time you will let the Gmail query search (`--newer-than`).
117
+
Limiting the window of time in which an email should have arrived minimizes the chance of discovering stale annotation files from an old Seshat execution in the cases where VCF filenames may be non-unique.
118
+
If the batch results email from the Seshat annotation server has not yet arrived, this tool will wait a set number of seconds (`--wait-for`) before exiting with exception.
119
+
It normally takes less than 1 minute for the Seshat server to annotate an average TP53-only VCF.
120
+
121
+
###### Search Criteria
122
+
123
+
The following rules are used to find annotation files:
124
+
125
+
1. The email contains the filename of the input VCF
126
+
2. The email subject line must contain "Results of batch analysis"
-`<output>.seshat.long-\\d{8}_\\d{6}_\\d{6}.tsv`: The long format Seshat annotations for the input VCF
133
+
-`<output>.seshat.short-\\d{8}_\\d{6}_\\d{6}.tsv`: The short format Seshat annotations for the input VCF
134
+
-`<output>.seshat.zip`: The original ZIP archive from Seshat
135
+
136
+
###### Server Failures
137
+
138
+
If Seshat fails to annotate the VCF file but still emails the user a response, then this tool will emit the email body to STDERR and exit with a non-zero status.
139
+
140
+
#### Gmail Authentication
141
+
142
+
After installing all Python dependencies, you must create a Google developer's OAuth file.
143
+
First-time 2FA may be required depending on the configuration of your Gmail service.
144
+
If 2FA is required, then this script will block until you acknowledge your 2FA prompt.
145
+
A 2FA prompt is often delivered through an auto-opening web browser.
146
+
147
+
To create a Google developer's OAuth file, navigate to the following URL and follow the instructions.
148
+
149
+
-[Authorize Credentials for a Desktop Application](https://developers.google.com/gmail/api/quickstart/python#authorize_credentials_for_a_desktop_application)
150
+
151
+
Ensure your OAuth file is configured as a "Desktop app" and then download the credentials as JSON.
152
+
Save your credentials file somewhere safe, ideally in a secure user folder with restricted permissions (`chmod 700`).
153
+
Set your OAuth file permissions to also restrict unwarranted access (`chmod 600`).
154
+
155
+
This script will store a cached token after first-time authentication is successful.
156
+
This cached token can be found in the user's home directory within a hidden directory.
157
+
Token caching greatly speeds up continued executions of this script.
158
+
As of now, the token is cached at the following location:
159
+
160
+
```bash
161
+
"~/.tp53/seshat/seshat-gmail-find-token.pickle"
162
+
```
163
+
164
+
If the cached token is missing, or becomes stale, then you will need to provide your OAuth credentials file.
165
+
166
+
A typical Google developer's OAuth file is of the format:
0 commit comments