├── .github
└── workflows
│ └── actions.yml
├── .gitignore
├── LICENSE
├── README.md
├── gnomad_api_cli.py
├── gnomad_api_gui.py
├── img
├── main_screen.png
├── results.png
└── results_2.png
├── myFavoriteGenes.txt
└── requirements.txt
/.github/workflows/actions.yml:
--------------------------------------------------------------------------------
1 | name: Actions for gnomad_python_api
2 | on: [push]
3 | jobs:
4 | build_and_run:
5 | runs-on: ubuntu-latest
6 | strategy:
7 | matrix:
8 | python-version: [3.6, 3.7, 3.8]
9 | steps:
10 | - uses: actions/checkout@v2
11 | - name: Set up Python ${{ matrix.python-version }}
12 | uses: actions/setup-python@v2
13 | with:
14 | python-version: ${{ matrix.python-version }}
15 | - name: Install dependencies
16 | run: |
17 | python -m pip install --upgrade pip
18 | if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
19 | - name: Test a single transcript
20 | run: |
21 | # Test the script by retrieving a transcript data
22 | python gnomad_api_cli.py -filter_by=gene_name -search_by="BRCA1" -dataset="gnomad_r2_1" -sv_dataset="gnomad_sv_r2_1"
23 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .ipynb_checkpoints
2 | outputs/
3 | outputs/*
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # 🧬 gnomAD Python API
2 |
3 | 
4 | 
5 | 
6 |
7 | - [🧬 gnomAD Python API](#-gnomad-python-api)
8 | - [:hash: What is *gnomAD* and the purpose of this script?](#hash-what-is-gnomad-and-the-purpose-of-this-script)
9 | - [:hash: Update on the repository and gnomadR tool](#hash-update-on-the-repository-and-gnomadr-tool)
10 | - [:hash: Requirements and Installation](#hash-requirements-and-installation)
11 | - [:hash: GUI | Usage](#hash-gui--usage)
12 | - [:hash: CLI | Usage & Options](#hash-cli--usage--options)
13 | - [:hash: CLI | Example Usages](#hash-cli--example-usages)
14 | - [:hash: Disclaimer](#hash-disclaimer)
15 | - [:hash: Contributing & Feedback](#hash-contributing--feedback)
16 | - [:hash: Developer](#hash-developer)
17 | - [:hash: References](#hash-references)
18 |
19 | ## :hash: What is *gnomAD* and the purpose of this script?
20 | [gnomAD (The Genome Aggregation Database)](http://gnomad.broadinstitute.org/) [[1]](#hash-references) is aggregation of thousands of exomes and genomes human sequencing studies. Also, gnomAD consortium annotates the variants with allelic frequency in genomes and exomes.
21 |
22 | **Here**, this API with both CLI and GUI versions is able to search the genes or transcripts of your interest and retrieve variant data from the database via [gnomAD backend API](https://gnomad.broadinstitute.org/api) that based on GraphQL query language.
23 |
24 |
25 |
26 | ## :hash: Update on the repository and `gnomadR` tool
27 |
28 | After the last update on the repository, [gnomAD GraphQL API](https://gnomad.broadinstitute.org/api) has been updated, and the query syntax and most of the keywords were deprecated or altered. Hence, the batch script is currently not able to retrieve the data from the gnomAD API and not able to generate outputs and plots.
29 |
30 | **If you are still looking forward a tool that automates fetching the data from gnomAD and you like R lang, you might check `gnomadR`!**
31 |
32 | gnomadR: Query gnomAD API from R
by [Dayne Filer (@daynefiler)](https://github.com/daynefiler)
33 |
34 | https://github.com/daynefiler/gnomadR
35 |
36 | `gnomadR` package intends to provide an interface between R and the [gnomAD](https://gnomad.broadinstitute.org/) API, powered by [GraphQL](https://graphql.org). This package utilizes the [qhql](https://docs.ropensci.org/ghql/) R package to send queries to gnomAD.
37 |
38 |
39 |
40 | ---
41 |
42 | ## :hash: Requirements and Installation
43 | - Create a directory and download the "**gnomad_api_cli.py**" and "**requirements.txt**" files or clone the repository via Git using following command:
44 |
45 | `git clone https://github.com/furkanmtorun/gnomad_python_api.git`
46 |
47 | - Install the required packages if you do not already:
48 |
49 | ` pip3 install -r requirements.txt`
50 |
51 | > The `requirements.txt` contains required libraries for both GUI (graphical user interface) and CLI (command-line interface) versions.
52 |
53 | - It's ready to use now!
54 |
55 | > If you did not install **pip** yet, please follow the instruction [here](https://pip.pypa.io/en/stable/installing/).
56 |
57 | ## :hash: GUI | Usage
58 |
59 | In the GUI version of gnomAD Python API, [Streamlit](https://www.streamlit.io/) has been used.
60 |
61 | > **Note:** In GUI version, it is possible to generate plots from the data retrieved.
62 | > This option is not available in CLI version since it is still under development.
63 | >
64 | > **So, it is recommended to use GUI version.**
65 |
66 | - To use GUI version of gnomAD Python API:
67 |
68 | `streamlit run gnomad_api_gui.py`
69 |
70 |
71 | - Here are the screenshots for the GUI version:
72 |
73 | 
74 |
75 | _gnomAD Python API GUI - Main Screen_
76 |
77 | 
78 |
79 | _gnomAD Python API GUI - Outputs_
80 |
81 | 
82 |
83 | _gnomAD Python API GUI - Outputs and Plots_
84 |
85 | > The outputs are also saved into `outputs/` folder in the GUI version.
86 |
87 | ## :hash: CLI | Usage & Options
88 | | Options | Description | Parameters |
89 | |--|--|--|
90 | | -filter_by | *It defines the input type.* |`gene_name`, `gene_id`, `transcript_id`, or `rs_id` |
91 | | -search_by | *It defines the input.* | Type a gene/transcript identifier
*e.g.: TP53, ENSG00000169174, ENST00000544455*
Type the name of file containig your inputs
*e.g: myGenes.txt*
92 | | -dataset | *It defines the dataset.* | `exac`, `gnomad_r2_1`, `gnomad_r3`, `gnomad_r2_1_controls`, `gnomad_r2_1_non_neuro`, `gnomad_r2_1_non_cancer`, or `gnomad_r2_1_non_topmed`
93 | | -sv_dataset | *It defines structural variants dataset.* | `gnomad_sv_r2_1`, `gnomad_sv_r2_1_controls`, or `gnomad_sv_r2_1_non_neuro`
94 | | -reference_genome | *It defines reference genome build.* | `GRCh37` or `GRCh38`
95 | | -h | *It displays the parameters.* | *To get help via script:* `python gnomad_api_cli.py -h`
96 |
97 |
98 | > ❗ Here, for getting variants, `gnomad_r2_1` and `gnomad_sv_r2_1` are defined as default values for these two `-dataset` and `-sv_dataset` options, respectively.
99 | >
100 | >
101 | > ❗ Also, you need to choose `GRCh38` for retrieving variants from the `gnomad_r3` dataset. However, in the `GRCh38` build, structural variants are not available.
102 |
103 | ## :hash: CLI | Example Usages
104 | - **How to list the variants by gene name or gene id?**
105 |
106 | *For gene name:*
107 |
108 | `python gnomad_api_cli.py -filter_by=gene_name -search_by="BRCA1" -dataset="gnomad_r2_1" -sv_dataset="gnomad_sv_r2_1"`
109 |
110 | If you get data from `gnomad_r3`:
111 |
112 | `python gnomad_api_cli.py -filter_by=gene_name -search_by="BRCA1" -dataset="gnomad_r3" -reference_genome="GRCh38"`
113 |
114 | *For Ensembl gene ID*
115 |
116 | `python gnomad_api_cli.py -filter_by=gene_id -search_by="ENSG00000169174" -dataset="gnomad_r2_1" -sv_dataset="gnomad_sv_r2_1"`
117 |
118 | - **How to list the variants by transcript ID?**
119 |
120 | `python gnomad_api_cli.py -filter_by=transcript_id -search_by="ENST00000407236" -dataset="gnomad_r2_1"`
121 |
122 | - **How to get variant info by RS ID (rsId)?**
123 |
124 | `python gnomad_api_cli.py -filter_by=rs_id -search_by="rs201857604" -dataset="gnomad_r2_1"`
125 |
126 | - **How to list the variants using a file containing genes/transcripts?**
127 |
128 | - Prepare your file that contains gene name, Ensembl gene IDs, Ensembl transcript IDs or RS IDs line-by-line.
129 | > ENSG00000169174
ENSG00000171862
ENSG00000170445
130 |
131 | - Then, run the following command:
132 |
133 | `python gnomad_api_cli.py -filter_by="gene_id" -search_by="myFavoriteGenes.txt" -dataset="gnomad_r2_1" -sv_dataset="gnomad_sv_r2_1"`
134 |
135 | > Please, use only one type of identifier in the file.
136 |
137 | - Then, the variants will be listed in "**outputs**" folder in the folders according to their identifier (gene name, gene id, transcript id or rsId).
138 |
139 | - That's all!
140 |
141 | ## :hash: Disclaimer
142 | All the outputs provided by this tool are for informational purposes only.
143 |
144 | The information is not intended to replace any consultation, diagnosis, and/or medical treatment offered by physicians or healthcare providers.
145 |
146 | The author of the app will not be liable for any direct, indirect, consequential, special, exemplary, or other damages arising therefrom.
147 |
148 | ## :hash: Contributing & Feedback
149 | I would be very happy to see any feedback or contributions to the project.
150 |
151 | For problems and enhancement requests, please `open an issue` above.
152 |
153 | ⭐ If you like it, please do not forget give a star!
154 |
155 | ## :hash: Developer
156 | **Furkan M. Torun ([@furkanmtorun](http://github.com/furkanmtorun)) | [furkanmtorun@gmail.com](mailto:furkanmtorun@gmail.com) |
157 | Academia: [Google Scholar Profile](https://scholar.google.com/citations?user=d5ZyOZ4AAAAJ)**
158 |
159 | ## :hash: References
160 | 1. Karczewski, K.J., Francioli, L.C., Tiao, G. et al. The mutational constraint spectrum quantified from variation in 141,456 humans. Nature 581, 434–443 (2020). https://doi.org/10.1038/s41586-020-2308-7
161 |
162 |
163 |
--------------------------------------------------------------------------------
/gnomad_api_cli.py:
--------------------------------------------------------------------------------
1 | # gnomAD Python API by @furkanmtorun
2 | # E-Mail: furkanmtorun@gmail.com
3 | # GitHub: https://github.com/furkanmtorun
4 | # Google Scholar: https://scholar.google.com/citations?user=d5ZyOZ4AAAAJ
5 | # Personal Website : https://furkanmtorun.github.io/
6 |
7 | # Import required libraries and packages
8 | import warnings
9 | warnings.simplefilter(action='ignore', category=FutureWarning)
10 | from pandas.io.json import json_normalize as json_normalize
11 | from tqdm import tqdm
12 | import pandas as pd
13 | import requests
14 | import argparse
15 | import json
16 | import os
17 | import shutil
18 | import sys
19 |
20 | # Create folders for outputs in the current directory
21 | if not os.path.exists('outputs/'):
22 | os.mkdir('outputs/')
23 |
24 | # Argument Parsing
25 | def arg_parser():
26 | global filter_by
27 | global search_by
28 | global dataset
29 | global sv_dataset
30 | parser = argparse.ArgumentParser()
31 | parser.add_argument("-filter_by", type=str, required=True, default="gene_name", help="Get your variants according to: `gene_name`, `gene_id, `transcript_id` or `rs_id`.")
32 | parser.add_argument("-search_by", type=str, required=True, default="TP53", help="Type your input for searching or type the file name (e.g: myGenes.txt) containing your inputs")
33 | parser.add_argument("-dataset", type=str, required=True, default="gnomad_r2_1", help="Select your dataset: exac, gnomad_r2_1, gnomad_r3, gnomad_r2_1_controls, gnomad_r2_1_non_neuro, gnomad_r2_1_non_cancer, gnomad_r2_1_non_topmed")
34 | parser.add_argument("-reference_genome", type=str, required=False, default="GRCh37", help="Select a proper reference genome build : `GRCh37` or `GRCh38`")
35 | parser.add_argument("-sv_dataset", type=str, required=False, default="gnomad_sv_r2_1", help="Select your structural variants dataset : `gnomad_sv_r2_1`, `gnomad_sv_r2_1_controls` or `gnomad_sv_r2_1_non_neuro`")
36 | args = parser.parse_args()
37 |
38 | # Control the given arguments
39 | if args.dataset not in ["exac", "gnomad_r2_1", "gnomad_r3", "gnomad_r2_1_controls", "gnomad_r2_1_non_neuro", "gnomad_r2_1_non_cancer", "gnomad_r2_1_non_topmed"]:
40 | sys.exit("! Select a proper gnomAD data set:\n\texac, gnomad_r2_1, gnomad_r3, gnomad_r2_1_controls, gnomad_r2_1_non_neuro, gnomad_r2_1_non_cancer, gnomad_r2_1_non_topmed")
41 |
42 | if args.sv_dataset not in ["gnomad_sv_r2_1", "gnomad_sv_r2_1_controls", "gnomad_sv_r2_1_non_neuro"]:
43 | sys.exit("! Select a proper gnomAD data set:\n\t`gnomad_sv_r2_1`, `gnomad_sv_r2_1_controls` or `gnomad_sv_r2_1_non_neuro`")
44 |
45 | if args.filter_by not in ["gene_name", "gene_id", "transcript_id", "rs_id"]:
46 | sys.exit("! Select a proper filter type :\n\t `gene_name`, `gene_id, `transcript_id` or `rs_id`")
47 |
48 | if args.reference_genome not in ["GRCh37", "GRCh38"]:
49 | sys.exit("! Select a proper reference genome build :\n\t `GRCh37` or `GRCh38`")
50 |
51 | if (args.dataset == "gnomad_r3") and (args.reference_genome == "GRCh37"):
52 | sys.exit("! You need to select `GRCh38` reference genome build for getting data from `gnomad_r3`.")
53 |
54 | # Define variables
55 | filter_by = args.filter_by
56 | search_by = args.search_by
57 | dataset = args.dataset
58 | sv_dataset = args.sv_dataset
59 | reference_genome = args.reference_genome
60 |
61 | return filter_by, search_by, dataset, sv_dataset, reference_genome
62 |
63 | # gnomAD API
64 | end_point = "https://gnomad.broadinstitute.org/api/"
65 |
66 | # Main Function
67 | def get_variants_by(filter_by, search_term, dataset, reference_genome, sv_dataset, timeout=None):
68 |
69 | query_for_transcripts = """
70 | {
71 | transcript(transcript_id: "%s", reference_genome: %s) {
72 | transcript_id,
73 | transcript_version,
74 | gene {
75 | gene_id,
76 | symbol,
77 | start,
78 | stop,
79 | strand,
80 | chrom,
81 | hgnc_id,
82 | gene_name,
83 | full_gene_name,
84 | omim_id
85 | }
86 | variants(dataset: %s) {
87 | pos
88 | rsid
89 | ref
90 | alt
91 | consequence
92 | genome {
93 | genome_af:af
94 | genome_ac:ac
95 | genome_an:an
96 | genome_ac_hemi:ac_hemi
97 | genome_ac_hom:ac_hom
98 | }
99 | exome {
100 | exome_af:af
101 | exome_ac:ac
102 | exome_an:an
103 | exome_ac_hemi:ac_hemi
104 | exome_ac_hom:ac_hom
105 | }
106 | flags
107 | lof
108 | consequence_in_canonical_transcript
109 | gene_symbol
110 | hgvsc
111 | lof_filter
112 | lof_flags
113 | hgvsc
114 | hgvsp
115 | reference_genome
116 | variant_id: variantId
117 | }
118 | gtex_tissue_expression{
119 | adipose_subcutaneous,
120 | adipose_visceral_omentum,
121 | adrenal_gland,
122 | artery_aorta,
123 | artery_coronary,
124 | artery_tibial,
125 | bladder,
126 | brain_amygdala,
127 | brain_anterior_cingulate_cortex_ba24,
128 | brain_caudate_basal_ganglia,
129 | brain_cerebellar_hemisphere,
130 | brain_cerebellum,
131 | brain_cortex,
132 | brain_frontal_cortex_ba9,
133 | brain_hippocampus,
134 | brain_hypothalamus,
135 | brain_nucleus_accumbens_basal_ganglia,
136 | brain_putamen_basal_ganglia,
137 | brain_spinal_cord_cervical_c_1,
138 | brain_substantia_nigra,
139 | breast_mammary_tissue,
140 | cells_ebv_transformed_lymphocytes,
141 | cells_transformed_fibroblasts,
142 | cervix_ectocervix,
143 | cervix_endocervix,
144 | colon_sigmoid,
145 | colon_transverse,
146 | esophagus_gastroesophageal_junction,
147 | esophagus_mucosa,
148 | esophagus_muscularis,
149 | fallopian_tube,
150 | heart_atrial_appendage,
151 | heart_left_ventricle,
152 | kidney_cortex,
153 | liver,
154 | lung,
155 | minor_salivary_gland,
156 | muscle_skeletal,
157 | nerve_tibial,
158 | ovary,
159 | pancreas,
160 | pituitary,
161 | prostate,
162 | skin_not_sun_exposed_suprapubic,
163 | skin_sun_exposed_lower_leg,
164 | small_intestine_terminal_ileum,
165 | spleen,
166 | stomach,
167 | testis,
168 | thyroid,
169 | uterus,
170 | vagina,
171 | whole_blood
172 | }
173 | clinvar_variants{
174 | variant_id,
175 | clinvar_variation_id,
176 | reference_genome,
177 | chrom,
178 | pos,
179 | ref,
180 | alt,
181 | clinical_significance,
182 | gold_stars,
183 | major_consequence,
184 | review_status
185 | }
186 | coverage(dataset: %s){
187 | genome{
188 | pos,
189 | mean,
190 | median,
191 | over_1,
192 | over_5,
193 | over_10,
194 | over_15,
195 | over_20,
196 | over_25,
197 | over_30,
198 | over_50,
199 | over_100
200 | }
201 |
202 | exome{
203 | pos,
204 | mean,
205 | median,
206 | over_1,
207 | over_5,
208 | over_10,
209 | over_15,
210 | over_20,
211 | over_25,
212 | over_30,
213 | over_50,
214 | over_100
215 | }
216 | }
217 | gnomad_constraint{
218 | exp_lof,
219 | exp_mis,
220 | exp_syn,
221 | obs_lof,
222 | obs_mis,
223 | obs_syn,
224 | oe_lof,
225 | oe_lof_lower,
226 | oe_lof_upper,
227 | oe_mis,
228 | oe_mis_lower,
229 | oe_mis_upper,
230 | oe_syn,
231 | oe_syn_lower,
232 | oe_syn_upper,
233 | lof_z,
234 | mis_z,
235 | syn_z,
236 | pLI,
237 | flags
238 | }
239 | exac_constraint{
240 | exp_syn,
241 | exp_mis,
242 | exp_lof,
243 | obs_syn,
244 | obs_mis,
245 | obs_lof,
246 | mu_syn,
247 | mu_mis,
248 | mu_lof,
249 | syn_z,
250 | mis_z,
251 | lof_z,
252 | pLI
253 | }
254 | }
255 | }
256 | """
257 |
258 | query_for_variants = """
259 | {
260 | variant(%s: "%s", dataset: %s) {
261 | variantId
262 | reference_genome
263 | chrom
264 | pos
265 | ref
266 | alt
267 | colocatedVariants
268 | multiNucleotideVariants {
269 | combined_variant_id
270 | changes_amino_acids
271 | n_individuals
272 | other_constituent_snvs
273 | }
274 | exome {
275 | ac
276 | an
277 | ac_hemi
278 | ac_hom
279 | faf95 {
280 | popmax
281 | popmax_population
282 | }
283 | filters
284 | populations {
285 | id
286 | ac
287 | an
288 | ac_hemi
289 | ac_hom
290 | }
291 | age_distribution {
292 | het {
293 | bin_edges
294 | bin_freq
295 | n_smaller
296 | n_larger
297 | }
298 | hom {
299 | bin_edges
300 | bin_freq
301 | n_smaller
302 | n_larger
303 | }
304 | }
305 | qualityMetrics {
306 | alleleBalance {
307 | alt {
308 | bin_edges
309 | bin_freq
310 | n_smaller
311 | n_larger
312 | }
313 | }
314 | genotypeDepth {
315 | all {
316 | bin_edges
317 | bin_freq
318 | n_smaller
319 | n_larger
320 | }
321 | alt {
322 | bin_edges
323 | bin_freq
324 | n_smaller
325 | n_larger
326 | }
327 | }
328 | genotypeQuality {
329 | all {
330 | bin_edges
331 | bin_freq
332 | n_smaller
333 | n_larger
334 | }
335 | alt {
336 | bin_edges
337 | bin_freq
338 | n_smaller
339 | n_larger
340 | }
341 | }
342 | }
343 | }
344 | genome {
345 | ac
346 | an
347 | ac_hemi
348 | ac_hom
349 | faf95 {
350 | popmax
351 | popmax_population
352 | }
353 | filters
354 | populations {
355 | id
356 | ac
357 | an
358 | ac_hemi
359 | ac_hom
360 | }
361 | age_distribution {
362 | het {
363 | bin_edges
364 | bin_freq
365 | n_smaller
366 | n_larger
367 | }
368 | hom {
369 | bin_edges
370 | bin_freq
371 | n_smaller
372 | n_larger
373 | }
374 | }
375 | qualityMetrics {
376 | alleleBalance {
377 | alt {
378 | bin_edges
379 | bin_freq
380 | n_smaller
381 | n_larger
382 | }
383 | }
384 | genotypeDepth {
385 | all {
386 | bin_edges
387 | bin_freq
388 | n_smaller
389 | n_larger
390 | }
391 | alt {
392 | bin_edges
393 | bin_freq
394 | n_smaller
395 | n_larger
396 | }
397 | }
398 | genotypeQuality {
399 | all {
400 | bin_edges
401 | bin_freq
402 | n_smaller
403 | n_larger
404 | }
405 | alt {
406 | bin_edges
407 | bin_freq
408 | n_smaller
409 | n_larger
410 | }
411 | }
412 | }
413 | }
414 | flags
415 | rsid
416 | sortedTranscriptConsequences {
417 | canonical
418 | gene_id
419 | gene_version
420 | gene_symbol
421 | hgvs
422 | hgvsc
423 | hgvsp
424 | lof
425 | lof_flags
426 | lof_filter
427 | major_consequence
428 | polyphen_prediction
429 | sift_prediction
430 | transcript_id
431 | transcript_version
432 | }
433 | }
434 |
435 | }
436 | """
437 |
438 | query_for_genes = """
439 | {
440 | gene(%s: "%s", reference_genome: %s) {
441 | gene_id
442 | symbol
443 | start
444 | stop
445 | strand
446 | chrom
447 | hgnc_id
448 | gene_name
449 | symbol
450 | full_gene_name
451 | reference_genome
452 | omim_id
453 | canonical_transcript_id
454 |
455 | structural_variants(dataset: %s){
456 | ac,
457 | ac_hom,
458 | an,
459 | af,
460 | reference_genome,
461 | chrom,
462 | chrom2,
463 | end,
464 | end2,
465 | consequence,
466 | filters,
467 | length,
468 | pos,
469 | pos2,
470 | type,
471 | variant_id
472 | }
473 |
474 | variants(dataset: %s) {
475 | pos
476 | rsid
477 | ref
478 | alt
479 | consequence
480 | genome {
481 | genome_af:af
482 | genome_ac:ac
483 | genome_an:an
484 | genome_ac_hemi:ac_hemi
485 | genome_ac_hom:ac_hom
486 | }
487 | exome {
488 | exome_af:af
489 | exome_ac:ac
490 | exome_an:an
491 | exome_ac_hemi:ac_hemi
492 | exome_ac_hom:ac_hom
493 | }
494 | flags
495 | lof
496 | consequence_in_canonical_transcript
497 | gene_symbol
498 | hgvsc
499 | lof_filter
500 | lof_flags
501 | hgvsc
502 | hgvsp
503 | reference_genome
504 | variant_id: variantId
505 | }
506 |
507 | mane_select_transcript{
508 | ensembl_id
509 | ensembl_version
510 | refseq_id
511 | refseq_version
512 | }
513 |
514 | transcripts{
515 | reference_genome
516 | gene_id
517 | transcript_id
518 | strand
519 | start
520 | stop
521 | chrom
522 | }
523 |
524 | exac_regional_missense_constraint_regions {
525 | start
526 | stop
527 | obs_mis
528 | exp_mis
529 | obs_exp
530 | chisq_diff_null
531 | }
532 |
533 | clinvar_variants {
534 | variant_id
535 | clinvar_variation_id
536 | reference_genome
537 | chrom
538 | pos
539 | ref
540 | alt
541 | clinical_significance
542 | gold_stars
543 | major_consequence
544 | review_status
545 | }
546 |
547 | coverage(dataset: %s) {
548 | exome {
549 | pos
550 | mean
551 | median
552 | over_1
553 | over_5
554 | over_10
555 | over_15
556 | over_20
557 | over_25
558 | over_30
559 | over_50
560 | over_100
561 | }
562 | genome {
563 | pos
564 | mean
565 | median
566 | over_1
567 | over_5
568 | over_10
569 | over_15
570 | over_20
571 | over_25
572 | over_30
573 | over_50
574 | over_100
575 | }
576 | }
577 |
578 |
579 | gnomad_constraint {
580 | exp_lof
581 | exp_mis
582 | exp_syn
583 | obs_lof
584 | obs_mis
585 | obs_syn
586 | oe_lof
587 | oe_lof_lower
588 | oe_lof_upper
589 | oe_mis
590 | oe_mis_lower
591 | oe_mis_upper
592 | oe_syn
593 | oe_syn_lower
594 | oe_syn_upper
595 | lof_z
596 | mis_z
597 | syn_z
598 | pLI
599 | flags
600 | }
601 |
602 | exac_constraint {
603 | exp_syn
604 | exp_mis
605 | exp_lof
606 | obs_syn
607 | obs_mis
608 | obs_lof
609 | mu_syn
610 | mu_mis
611 | mu_lof
612 | syn_z
613 | mis_z
614 | lof_z
615 | pLI
616 | }
617 | }
618 | }
619 | """
620 |
621 | if filter_by == "transcript_id":
622 | query = query_for_transcripts % (search_term.upper(), reference_genome, dataset, dataset)
623 |
624 | elif filter_by == "rs_id":
625 | query = query_for_variants % ("rsid", search_term.lower(), dataset)
626 |
627 | elif filter_by == "gene_id":
628 | query = query_for_genes % ("gene_id", search_term.upper(), reference_genome, sv_dataset, dataset, dataset)
629 |
630 | elif filter_by == "gene_name":
631 | query = query_for_genes % ("gene_name", search_term.upper(), reference_genome, sv_dataset, dataset, dataset)
632 |
633 | else:
634 | print("Unknown `filter_by` type!")
635 |
636 | # Get repsonse
637 | response = requests.post(end_point, data={'query': query}, timeout=timeout)
638 |
639 | # Parse response
640 | if response.status_code == 200:
641 | try:
642 |
643 | if filter_by == "transcript_id":
644 | if not os.path.exists('outputs/' + search_term + "/"):
645 | os.mkdir('outputs/'+ search_term + "/")
646 | else:
647 | shutil.rmtree('outputs/'+ search_term + "/")
648 | os.mkdir('outputs/'+ search_term + "/")
649 | json_keys = list(response.json()["data"]["transcript"].keys())
650 | for json_key in json_keys:
651 | if response.json()["data"]["transcript"][json_key] is not None and type(response.json()["data"]["transcript"][json_key]) not in [str, int]:
652 | data = json_normalize(response.json()["data"]["transcript"][json_key])
653 | data.columns = data.columns.map(lambda x: x.split(".")[-1])
654 | data.to_csv("outputs/" + search_term + "/" + json_key + ".tsv", sep="\t", index=False)
655 |
656 | elif filter_by == "rs_id":
657 | if not os.path.exists('outputs/' + search_term + "/"):
658 | os.mkdir('outputs/'+ search_term + "/")
659 | else:
660 | shutil.rmtree('outputs/'+ search_term + "/")
661 | os.mkdir('outputs/'+ search_term + "/")
662 | json_keys = list(response.json()["data"]["variant"].keys())
663 | for json_key in json_keys:
664 | # print(json_key, type(response.json()["data"]["variant"][json_key]))
665 |
666 | # Basic info in `variant` part
667 | if response.json()["data"]["variant"][json_key] is not None and type(response.json()["data"]["variant"][json_key]) in [str, int]:
668 | with open("outputs/" + search_term + "/" + search_term + ".txt", "a") as f:
669 | f.write("\n" + json_key + ":" + str(response.json()["data"]["variant"][json_key]))
670 |
671 | # Other parts rather than `genome` and `exome`
672 | if response.json()["data"]["variant"][json_key] is not None and type(response.json()["data"]["variant"][json_key]) not in [str, int] and json_key not in ["genome", "exome"]:
673 | data = json_normalize(response.json()["data"]["variant"][json_key])
674 | data.columns = data.columns.map(lambda x: x.split(".")[-1])
675 | data.to_csv("outputs/" + search_term + "/" + json_key + ".tsv", sep="\t", index=False)
676 |
677 | # Deep parsing for nested things in `genome` and `exome`
678 | if json_key in ["genome", "exome"]:
679 | for sub_json_key in list(response.json()["data"]["variant"][json_key].keys()):
680 | # print(json_key, sub_json_key, type(response.json()["data"]["variant"][json_key][sub_json_key]))
681 |
682 | if response.json()["data"]["variant"][json_key][sub_json_key] is not None and type(response.json()["data"]["variant"][json_key][sub_json_key]) in [str, int]:
683 | with open("outputs/" + search_term + "/" + search_term + ".txt", "a") as f:
684 | f.write("\n" + json_key + "_" + sub_json_key + ":" + str(response.json()["data"]["variant"][json_key][sub_json_key]))
685 |
686 | if response.json()["data"]["variant"][json_key][sub_json_key] is not None and type(response.json()["data"]["variant"][json_key][sub_json_key]) not in [str, int]:
687 | data = json_normalize(response.json()["data"]["variant"][json_key][sub_json_key])
688 | data.columns = data.columns.map(lambda x: x.split(".")[-1])
689 | data.to_csv("outputs/" + search_term + "/" + json_key + "_" + sub_json_key + ".tsv", sep="\t", index=False)
690 |
691 | elif filter_by == "gene_id":
692 | if not os.path.exists('outputs/' + search_term + "/"):
693 | os.mkdir('outputs/'+ search_term + "/")
694 | else:
695 | shutil.rmtree('outputs/'+ search_term + "/")
696 | os.mkdir('outputs/'+ search_term + "/")
697 |
698 | json_keys = list(response.json()["data"]["gene"].keys())
699 | for json_key in json_keys:
700 | # print(json_key, type(response.json()["data"]["gene"][json_key]), response.json()["data"]["gene"][json_key] is None, type(response.json()["data"]["gene"][json_key]) not in [str, int])
701 | if response.json()["data"]["gene"][json_key] is not None and type(response.json()["data"]["gene"][json_key]) in [str, int]:
702 | with open("outputs/" + search_term + "/" + search_term + ".txt", "a") as f:
703 | f.write("\n" + json_key + ":" + str(response.json()["data"]["gene"][json_key]))
704 |
705 | if response.json()["data"]["gene"][json_key] is not None and type(response.json()["data"]["gene"][json_key]) not in [str, int]:
706 | data = json_normalize(response.json()["data"]["gene"][json_key])
707 | data.columns = data.columns.map(lambda x: x.split(".")[-1])
708 | data.to_csv("outputs/" + search_term + "/" + json_key + ".tsv", sep="\t", index=False)
709 |
710 | elif filter_by == "gene_name":
711 | if not os.path.exists('outputs/' + search_term + "/"):
712 | os.mkdir('outputs/'+ search_term + "/")
713 | else:
714 | shutil.rmtree('outputs/'+ search_term + "/")
715 | os.mkdir('outputs/'+ search_term + "/")
716 |
717 | json_keys = list(response.json()["data"]["gene"].keys())
718 | for json_key in json_keys:
719 | # print(json_key, type(response.json()["data"]["gene"][json_key]), response.json()["data"]["gene"][json_key] is None, type(response.json()["data"]["gene"][json_key]) not in [str, int])
720 | if response.json()["data"]["gene"][json_key] is not None and type(response.json()["data"]["gene"][json_key]) in [str, int]:
721 | with open("outputs/" + search_term + "/" + search_term + ".txt", "a") as f:
722 | f.write("\n" + json_key + ":" + str(response.json()["data"]["gene"][json_key]))
723 |
724 | if response.json()["data"]["gene"][json_key] is not None and type(response.json()["data"]["gene"][json_key]) not in [str, int]:
725 | data = json_normalize(response.json()["data"]["gene"][json_key])
726 | data.columns = data.columns.map(lambda x: x.split(".")[-1])
727 | data.to_csv("outputs/" + search_term + "/" + json_key + ".tsv", sep="\t", index=False)
728 |
729 | except (ConnectionError, ConnectionAbortedError, ConnectionRefusedError, ConnectionResetError):
730 | sys.exit("An unknown error occured regarding the internet connection!")
731 |
732 | except AttributeError as ae:
733 | # Error Message from gnomAD
734 | try:
735 | for msg in response.json()["errors"]:
736 | sys.exit("Errors from gnomAD for your process:\n\t" + msg["message"])
737 | except Exception as anyOtherException:
738 | pass
739 |
740 | if filter_by != "rs_id":
741 | # General Error Message
742 | print("""
743 | It might be caused since the search did not find a result from the database.
744 | Try to check the `input` for `{}` or other `options`.
745 | """.format(filter_by))
746 |
747 | # Technical Error Message
748 | print("""
749 | > As a note, technical reason is `{}`.
750 | >
751 | > If you think this should not occur, you can contact with developer to issue this problem on Github page.
752 | """.format(ae))
753 |
754 | except (TypeError, KeyError):
755 | try:
756 | for msg in response.json()["errors"]:
757 | print("Errors from gnomAD for your process:\n\t" + msg["message"])
758 | except Exception as anyOtherException:
759 | pass
760 |
761 | else:
762 | print(" ! DONE: Check out the 'outputs/' folder")
763 |
764 | elif response.status_code == 404:
765 | sys.exit('API is not accessible right now. Check the end point out!')
766 |
767 | # Action
768 | if __name__ == "__main__":
769 | filter_by, search_by, dataset, sv_dataset, reference_genome = arg_parser()
770 | if "." in search_by:
771 | try:
772 | with open(search_by, "r") as f:
773 | search_list = [line.rstrip() for line in f]
774 | for search_item in tqdm(search_list):
775 | get_variants_by(filter_by, search_item, dataset, reference_genome, sv_dataset)
776 | except:
777 | print("A problem occured while reading the file namely `{}` or the filter type `{}` is wrong!"\
778 | .format(search_by, filter_by))
779 | finally:
780 | f.close()
781 | elif "." not in search_by:
782 | get_variants_by(filter_by, search_by, dataset, reference_genome, sv_dataset)
783 |
--------------------------------------------------------------------------------
/gnomad_api_gui.py:
--------------------------------------------------------------------------------
1 | # gnomAD Python API by @furkanmtorun
2 | # E-Mail: furkanmtorun@gmail.com
3 | # GitHub: https://github.com/furkanmtorun
4 | # Google Scholar: https://scholar.google.com/citations?user=d5ZyOZ4AAAAJ
5 | # Personal Website : https://furkanmtorun.github.io/
6 |
7 | # Import required libraries and packages
8 | import warnings
9 | warnings.simplefilter(action='ignore', category=FutureWarning)
10 | from pandas.io.json import json_normalize as json_normalize
11 | import plotly.express as px
12 | import streamlit as st
13 | import pandas as pd
14 | import requests
15 | import json
16 | import os
17 | import shutil
18 |
19 | # Create folders for outputs in the current directory
20 | if not os.path.exists('outputs/'):
21 | os.mkdir('outputs/')
22 |
23 | # gnomAD API
24 | end_point = "https://gnomad.broadinstitute.org/api/"
25 |
26 | # Welcome
27 | main_external_css = """
28 |
31 | """
32 | version = "v1.0"
33 |
34 | st.markdown(main_external_css, unsafe_allow_html=True)
35 | st.title("🧬 gnomAD Python API {}".format(version))
36 |
37 | st.markdown("""
38 |
39 | > - gnomAD Python API {} by **Furkan M. Torun**
40 | > - E-Mail: [furkanmtorun@gmail.com](mailto:furkanmtorun@gmail.com)
41 | > - GitHub: https://github.com/furkanmtorun
42 | > - Google Scholar: https://scholar.google.com/citations?user=d5ZyOZ4AAAAJ
43 | > - Personal Website : https://furkanmtorun.github.io/
44 | > - ⭐ If you like it, please do not forget give a star on [GitHub](https://github.com/furkanmtorun/gnomad_python_api)!
45 |
46 | ---
47 | """.format(version))
48 |
49 | st.info("""
50 | - This API tool uses [gnomAD GraphQL backend service](https://gnomad.broadinstitute.org/api).
51 | - Upload your .csv/tsv/txt file containing the single type of identifiers as one column.
52 | - Each row should correspond to single record (i.e. gene name, gene ID, transcript ID or rsID).
53 | - By using the app, you agree that you accepting [the disclaimer](https://github.com/furkanmtorun/gnomad_python_api#hash-disclaimer).
54 | """)
55 |
56 | # File - content uploading
57 | @st.cache(persist=True)
58 | def upload_file(file_buffer):
59 | df = pd.DataFrame()
60 | if file_buffer is not None:
61 | try:
62 | df = pd.read_csv(file_buffer, sep=",", header=None, names=["search_term"])
63 | except:
64 | df = pd.read_csv(file_buffer, sep='\t', header=None, names=["search_term"])
65 | return df
66 |
67 | # Input
68 | st.subheader("Set the input")
69 | file_buffer = st.file_uploader("Upload your search list below as *.csv, *.tsv or *.txt (without header):", type=["csv", "tsv", "txt"])
70 |
71 | if file_buffer is not None:
72 | search_df = upload_file(file_buffer)
73 | search_by = search_df
74 | st.text("Here is your file:")
75 | st.dataframe(search_df)
76 | if file_buffer is None:
77 | single_search = st.text_input("Or write a single ID here:", value="TP53")
78 | search_by = single_search
79 |
80 | # Input type
81 | st.subheader("Select the input type")
82 | filter_by = st.selectbox("Select a proper input type", ["gene_name", "gene_id", "transcript_id", "rs_id"])
83 |
84 | # Datasets
85 | st.subheader("Choose the source for dataset")
86 | dataset = st.selectbox("Select a proper gnomAD data set:", ["gnomad_r2_1", "gnomad_r3", "gnomad_r2_1_controls", "gnomad_r2_1_non_neuro", "gnomad_r2_1_non_cancer", "gnomad_r2_1_non_topmed", "exac"])
87 |
88 | # Reference Genome
89 | st.subheader("Choose the reference genome")
90 | reference_genome = st.selectbox("Select a proper reference genome build:", ["GRCh37", "GRCh38"])
91 |
92 | if reference_genome == "GRCh38":
93 | st.warning("gnomAD structural variant (SV) data might not available on reference genome `GRCh38`.")
94 |
95 | # SV Dataset
96 | if filter_by in ["gene_id", "gene_name"]:
97 | st.subheader("Choose the source for structural variant (SV) dataset")
98 | sv_dataset = st.selectbox("Select a proper SV gnomAD data set:", ["gnomad_sv_r2_1", "gnomad_sv_r2_1_controls", "gnomad_sv_r2_1_non_neuro"])
99 |
100 | # Main Function for Getting Data and Saving them
101 | def get_variants_by(filter_by, search_term, dataset, mode, timeout=None):
102 |
103 | query_for_transcripts = """
104 | {
105 | transcript(transcript_id: "%s", reference_genome: %s) {
106 | transcript_id,
107 | transcript_version,
108 | gene {
109 | gene_id,
110 | symbol,
111 | start,
112 | stop,
113 | strand,
114 | chrom,
115 | hgnc_id,
116 | gene_name,
117 | full_gene_name,
118 | omim_id
119 | }
120 | variants(dataset: %s) {
121 | pos
122 | rsid
123 | ref
124 | alt
125 | consequence
126 | genome {
127 | genome_af:af
128 | genome_ac:ac
129 | genome_an:an
130 | genome_ac_hemi:ac_hemi
131 | genome_ac_hom:ac_hom
132 | }
133 | exome {
134 | exome_af:af
135 | exome_ac:ac
136 | exome_an:an
137 | exome_ac_hemi:ac_hemi
138 | exome_ac_hom:ac_hom
139 | }
140 | flags
141 | lof
142 | consequence_in_canonical_transcript
143 | gene_symbol
144 | hgvsc
145 | lof_filter
146 | lof_flags
147 | hgvsc
148 | hgvsp
149 | reference_genome
150 | variant_id: variantId
151 | }
152 | gtex_tissue_expression{
153 | adipose_subcutaneous,
154 | adipose_visceral_omentum,
155 | adrenal_gland,
156 | artery_aorta,
157 | artery_coronary,
158 | artery_tibial,
159 | bladder,
160 | brain_amygdala,
161 | brain_anterior_cingulate_cortex_ba24,
162 | brain_caudate_basal_ganglia,
163 | brain_cerebellar_hemisphere,
164 | brain_cerebellum,
165 | brain_cortex,
166 | brain_frontal_cortex_ba9,
167 | brain_hippocampus,
168 | brain_hypothalamus,
169 | brain_nucleus_accumbens_basal_ganglia,
170 | brain_putamen_basal_ganglia,
171 | brain_spinal_cord_cervical_c_1,
172 | brain_substantia_nigra,
173 | breast_mammary_tissue,
174 | cells_ebv_transformed_lymphocytes,
175 | cells_transformed_fibroblasts,
176 | cervix_ectocervix,
177 | cervix_endocervix,
178 | colon_sigmoid,
179 | colon_transverse,
180 | esophagus_gastroesophageal_junction,
181 | esophagus_mucosa,
182 | esophagus_muscularis,
183 | fallopian_tube,
184 | heart_atrial_appendage,
185 | heart_left_ventricle,
186 | kidney_cortex,
187 | liver,
188 | lung,
189 | minor_salivary_gland,
190 | muscle_skeletal,
191 | nerve_tibial,
192 | ovary,
193 | pancreas,
194 | pituitary,
195 | prostate,
196 | skin_not_sun_exposed_suprapubic,
197 | skin_sun_exposed_lower_leg,
198 | small_intestine_terminal_ileum,
199 | spleen,
200 | stomach,
201 | testis,
202 | thyroid,
203 | uterus,
204 | vagina,
205 | whole_blood
206 | }
207 | clinvar_variants{
208 | variant_id,
209 | clinvar_variation_id,
210 | reference_genome,
211 | chrom,
212 | pos,
213 | ref,
214 | alt,
215 | clinical_significance,
216 | gold_stars,
217 | major_consequence,
218 | review_status
219 | }
220 | coverage(dataset: %s){
221 | genome{
222 | pos,
223 | mean,
224 | median,
225 | over_1,
226 | over_5,
227 | over_10,
228 | over_15,
229 | over_20,
230 | over_25,
231 | over_30,
232 | over_50,
233 | over_100
234 | }
235 |
236 | exome{
237 | pos,
238 | mean,
239 | median,
240 | over_1,
241 | over_5,
242 | over_10,
243 | over_15,
244 | over_20,
245 | over_25,
246 | over_30,
247 | over_50,
248 | over_100
249 | }
250 | }
251 | gnomad_constraint{
252 | exp_lof,
253 | exp_mis,
254 | exp_syn,
255 | obs_lof,
256 | obs_mis,
257 | obs_syn,
258 | oe_lof,
259 | oe_lof_lower,
260 | oe_lof_upper,
261 | oe_mis,
262 | oe_mis_lower,
263 | oe_mis_upper,
264 | oe_syn,
265 | oe_syn_lower,
266 | oe_syn_upper,
267 | lof_z,
268 | mis_z,
269 | syn_z,
270 | pLI,
271 | flags
272 | }
273 | exac_constraint{
274 | exp_syn,
275 | exp_mis,
276 | exp_lof,
277 | obs_syn,
278 | obs_mis,
279 | obs_lof,
280 | mu_syn,
281 | mu_mis,
282 | mu_lof,
283 | syn_z,
284 | mis_z,
285 | lof_z,
286 | pLI
287 | }
288 | }
289 | }
290 | """
291 |
292 | query_for_variants = """
293 | {
294 | variant(%s: "%s", dataset: %s) {
295 | variantId
296 | reference_genome
297 | chrom
298 | pos
299 | ref
300 | alt
301 | colocatedVariants
302 | multiNucleotideVariants {
303 | combined_variant_id
304 | changes_amino_acids
305 | n_individuals
306 | other_constituent_snvs
307 | }
308 | exome {
309 | ac
310 | an
311 | ac_hemi
312 | ac_hom
313 | faf95 {
314 | popmax
315 | popmax_population
316 | }
317 | filters
318 | populations {
319 | id
320 | ac
321 | an
322 | ac_hemi
323 | ac_hom
324 | }
325 | age_distribution {
326 | het {
327 | bin_edges
328 | bin_freq
329 | n_smaller
330 | n_larger
331 | }
332 | hom {
333 | bin_edges
334 | bin_freq
335 | n_smaller
336 | n_larger
337 | }
338 | }
339 | qualityMetrics {
340 | alleleBalance {
341 | alt {
342 | bin_edges
343 | bin_freq
344 | n_smaller
345 | n_larger
346 | }
347 | }
348 | genotypeDepth {
349 | all {
350 | bin_edges
351 | bin_freq
352 | n_smaller
353 | n_larger
354 | }
355 | alt {
356 | bin_edges
357 | bin_freq
358 | n_smaller
359 | n_larger
360 | }
361 | }
362 | genotypeQuality {
363 | all {
364 | bin_edges
365 | bin_freq
366 | n_smaller
367 | n_larger
368 | }
369 | alt {
370 | bin_edges
371 | bin_freq
372 | n_smaller
373 | n_larger
374 | }
375 | }
376 | }
377 | }
378 | genome {
379 | ac
380 | an
381 | ac_hemi
382 | ac_hom
383 | faf95 {
384 | popmax
385 | popmax_population
386 | }
387 | filters
388 | populations {
389 | id
390 | ac
391 | an
392 | ac_hemi
393 | ac_hom
394 | }
395 | age_distribution {
396 | het {
397 | bin_edges
398 | bin_freq
399 | n_smaller
400 | n_larger
401 | }
402 | hom {
403 | bin_edges
404 | bin_freq
405 | n_smaller
406 | n_larger
407 | }
408 | }
409 | qualityMetrics {
410 | alleleBalance {
411 | alt {
412 | bin_edges
413 | bin_freq
414 | n_smaller
415 | n_larger
416 | }
417 | }
418 | genotypeDepth {
419 | all {
420 | bin_edges
421 | bin_freq
422 | n_smaller
423 | n_larger
424 | }
425 | alt {
426 | bin_edges
427 | bin_freq
428 | n_smaller
429 | n_larger
430 | }
431 | }
432 | genotypeQuality {
433 | all {
434 | bin_edges
435 | bin_freq
436 | n_smaller
437 | n_larger
438 | }
439 | alt {
440 | bin_edges
441 | bin_freq
442 | n_smaller
443 | n_larger
444 | }
445 | }
446 | }
447 | }
448 | flags
449 | rsid
450 | sortedTranscriptConsequences {
451 | canonical
452 | gene_id
453 | gene_version
454 | gene_symbol
455 | hgvs
456 | hgvsc
457 | hgvsp
458 | lof
459 | lof_flags
460 | lof_filter
461 | major_consequence
462 | polyphen_prediction
463 | sift_prediction
464 | transcript_id
465 | transcript_version
466 | }
467 | }
468 |
469 | }
470 | """
471 |
472 | query_for_genes = """
473 | {
474 | gene(%s: "%s", reference_genome: %s) {
475 | gene_id
476 | symbol
477 | start
478 | stop
479 | strand
480 | chrom
481 | hgnc_id
482 | gene_name
483 | symbol
484 | full_gene_name
485 | reference_genome
486 | omim_id
487 | canonical_transcript_id
488 |
489 | structural_variants(dataset: %s){
490 | ac,
491 | ac_hom,
492 | an,
493 | af,
494 | reference_genome,
495 | chrom,
496 | chrom2,
497 | end,
498 | end2,
499 | consequence,
500 | filters,
501 | length,
502 | pos,
503 | pos2,
504 | type,
505 | variant_id
506 | }
507 |
508 | variants(dataset: %s) {
509 | pos
510 | rsid
511 | ref
512 | alt
513 | consequence
514 | genome {
515 | genome_af:af
516 | genome_ac:ac
517 | genome_an:an
518 | genome_ac_hemi:ac_hemi
519 | genome_ac_hom:ac_hom
520 | }
521 | exome {
522 | exome_af:af
523 | exome_ac:ac
524 | exome_an:an
525 | exome_ac_hemi:ac_hemi
526 | exome_ac_hom:ac_hom
527 | }
528 | flags
529 | lof
530 | consequence_in_canonical_transcript
531 | gene_symbol
532 | hgvsc
533 | lof_filter
534 | lof_flags
535 | hgvsc
536 | hgvsp
537 | reference_genome
538 | variant_id: variantId
539 | }
540 |
541 | mane_select_transcript{
542 | ensembl_id
543 | ensembl_version
544 | refseq_id
545 | refseq_version
546 | }
547 |
548 | transcripts{
549 | reference_genome
550 | gene_id
551 | transcript_id
552 | strand
553 | start
554 | stop
555 | chrom
556 | }
557 |
558 | exac_regional_missense_constraint_regions {
559 | start
560 | stop
561 | obs_mis
562 | exp_mis
563 | obs_exp
564 | chisq_diff_null
565 | }
566 |
567 | clinvar_variants {
568 | variant_id
569 | clinvar_variation_id
570 | reference_genome
571 | chrom
572 | pos
573 | ref
574 | alt
575 | clinical_significance
576 | gold_stars
577 | major_consequence
578 | review_status
579 | }
580 |
581 | coverage(dataset: %s) {
582 | exome {
583 | pos
584 | mean
585 | median
586 | over_1
587 | over_5
588 | over_10
589 | over_15
590 | over_20
591 | over_25
592 | over_30
593 | over_50
594 | over_100
595 | }
596 | genome {
597 | pos
598 | mean
599 | median
600 | over_1
601 | over_5
602 | over_10
603 | over_15
604 | over_20
605 | over_25
606 | over_30
607 | over_50
608 | over_100
609 | }
610 | }
611 |
612 |
613 | gnomad_constraint {
614 | exp_lof
615 | exp_mis
616 | exp_syn
617 | obs_lof
618 | obs_mis
619 | obs_syn
620 | oe_lof
621 | oe_lof_lower
622 | oe_lof_upper
623 | oe_mis
624 | oe_mis_lower
625 | oe_mis_upper
626 | oe_syn
627 | oe_syn_lower
628 | oe_syn_upper
629 | lof_z
630 | mis_z
631 | syn_z
632 | pLI
633 | flags
634 | }
635 |
636 | exac_constraint {
637 | exp_syn
638 | exp_mis
639 | exp_lof
640 | obs_syn
641 | obs_mis
642 | obs_lof
643 | mu_syn
644 | mu_mis
645 | mu_lof
646 | syn_z
647 | mis_z
648 | lof_z
649 | pLI
650 | }
651 | }
652 | }
653 | """
654 |
655 | if filter_by == "transcript_id":
656 | query = query_for_transcripts % (search_term.upper(), reference_genome, dataset, dataset)
657 |
658 | elif filter_by == "rs_id":
659 | query = query_for_variants % ("rsid", search_term.lower(), dataset)
660 |
661 | elif filter_by == "gene_id":
662 | query = query_for_genes % ("gene_id", search_term.upper(), reference_genome, sv_dataset, dataset, dataset)
663 |
664 | elif filter_by == "gene_name":
665 | query = query_for_genes % ("gene_name", search_term.upper(), reference_genome, sv_dataset, dataset, dataset)
666 |
667 | else:
668 | print("Unknown `filter_by` type!")
669 |
670 | # Get repsonse
671 | global response
672 | response = requests.post(end_point, data={'query': query}, timeout=timeout)
673 |
674 | # Parse response
675 | if response.status_code == 200:
676 |
677 | st.markdown("---")
678 | st.subheader("Outputs for `{}` is being prepared.".format(search_term))
679 | st.markdown("\n")
680 |
681 | if filter_by == "transcript_id":
682 | if not os.path.exists('outputs/' + search_term + "/"):
683 | os.mkdir('outputs/'+ search_term + "/")
684 | else:
685 | shutil.rmtree('outputs/'+ search_term + "/")
686 | os.mkdir('outputs/'+ search_term + "/")
687 | json_keys = list(response.json()["data"]["transcript"].keys())
688 | for json_key in json_keys:
689 | if response.json()["data"]["transcript"][json_key] is not None and type(response.json()["data"]["transcript"][json_key]) not in [str, int]:
690 | data = json_normalize(response.json()["data"]["transcript"][json_key])
691 | data.columns = data.columns.map(lambda x: x.split(".")[-1])
692 | data.to_csv("outputs/" + search_term + "/" + json_key + ".tsv", sep="\t", index=False)
693 | if (len(data) > 0) and (mode == "single"):
694 | st.markdown("\n **Table for: `" + json_key + "`**")
695 | st.dataframe(data)
696 |
697 | elif filter_by == "rs_id":
698 | if not os.path.exists('outputs/' + search_term + "/"):
699 | os.mkdir('outputs/'+ search_term + "/")
700 | else:
701 | shutil.rmtree('outputs/'+ search_term + "/")
702 | os.mkdir('outputs/'+ search_term + "/")
703 | json_keys = list(response.json()["data"]["variant"].keys())
704 |
705 | general_info = "```"
706 | for json_key in json_keys:
707 | # print(json_key, type(response.json()["data"]["variant"][json_key]))
708 |
709 | # Basic info in `variant` part
710 | if response.json()["data"]["variant"][json_key] is not None and type(response.json()["data"]["variant"][json_key]) in [str, int]:
711 | with open("outputs/" + search_term + "/" + search_term + ".txt", "a") as f:
712 | f.write("\n" + json_key + ":" + str(response.json()["data"]["variant"][json_key]))
713 | general_info += "\n" + json_key + ":" + str(response.json()["data"]["variant"][json_key])
714 | # Other parts rather than `genome` and `exome`
715 | if response.json()["data"]["variant"][json_key] is not None and type(response.json()["data"]["variant"][json_key]) not in [str, int] and json_key not in ["genome", "exome"]:
716 | data = json_normalize(response.json()["data"]["variant"][json_key])
717 | data.columns = data.columns.map(lambda x: x.split(".")[-1])
718 | data.to_csv("outputs/" + search_term + "/" + json_key + ".tsv", sep="\t", index=False)
719 | if (len(data) > 0) and (mode == "single"):
720 | st.markdown("\n **Table for: `" + json_key + "`**")
721 | st.dataframe(data)
722 |
723 | # Deep parsing for nested things in `genome` and `exome`
724 | if json_key in ["genome", "exome"]:
725 | for sub_json_key in list(response.json()["data"]["variant"][json_key].keys()):
726 | # print(json_key, sub_json_key, type(response.json()["data"]["variant"][json_key][sub_json_key]))
727 |
728 | if response.json()["data"]["variant"][json_key][sub_json_key] is not None and type(response.json()["data"]["variant"][json_key][sub_json_key]) in [str, int]:
729 | with open("outputs/" + search_term + "/" + search_term + ".txt", "a") as f:
730 | f.write("\n" + json_key + "_" + sub_json_key + ":" + str(response.json()["data"]["variant"][json_key][sub_json_key]))
731 | general_info += "\n" + json_key + "_" + sub_json_key + ":" + str(response.json()["data"]["variant"][json_key][sub_json_key])
732 |
733 | if response.json()["data"]["variant"][json_key][sub_json_key] is not None and type(response.json()["data"]["variant"][json_key][sub_json_key]) not in [str, int]:
734 | data = json_normalize(response.json()["data"]["variant"][json_key][sub_json_key])
735 | data.columns = data.columns.map(lambda x: x.split(".")[-1])
736 | data.to_csv("outputs/" + search_term + "/" + json_key + "_" + sub_json_key + ".tsv", sep="\t", index=False)
737 | if (len(data) > 0) and (mode == "single"):
738 | st.markdown("\n **Table for: `" + sub_json_key + "`**")
739 | st.dataframe(data)
740 |
741 | general_info += "```"
742 | if mode == "single":
743 | st.markdown("--- \n **General Info for your query**")
744 | st.info(general_info)
745 |
746 | elif filter_by == "gene_id":
747 | if not os.path.exists('outputs/' + search_term + "/"):
748 | os.mkdir('outputs/'+ search_term + "/")
749 | else:
750 | shutil.rmtree('outputs/'+ search_term + "/")
751 | os.mkdir('outputs/'+ search_term + "/")
752 |
753 | json_keys = list(response.json()["data"]["gene"].keys())
754 | general_info ="```"
755 | for json_key in json_keys:
756 | # print(json_key, type(response.json()["data"]["gene"][json_key]), response.json()["data"]["gene"][json_key] is None, type(response.json()["data"]["gene"][json_key]) not in [str, int])
757 | if response.json()["data"]["gene"][json_key] is not None and type(response.json()["data"]["gene"][json_key]) in [str, int]:
758 | with open("outputs/" + search_term + "/" + search_term + ".txt", "a") as f:
759 | f.write("\n" + json_key + ":" + str(response.json()["data"]["gene"][json_key]))
760 | general_info += "\n" + json_key + ":" + str(response.json()["data"]["gene"][json_key])
761 |
762 | if response.json()["data"]["gene"][json_key] is not None and type(response.json()["data"]["gene"][json_key]) not in [str, int]:
763 | data = json_normalize(response.json()["data"]["gene"][json_key])
764 | data.columns = data.columns.map(lambda x: x.split(".")[-1])
765 | data.to_csv("outputs/" + search_term + "/" + json_key + ".tsv", sep="\t", index=False)
766 | if (len(data) > 0) and (mode == "single"):
767 | st.markdown("\n **Table for: `" + json_key + "`**")
768 | st.dataframe(data)
769 |
770 | general_info += "```"
771 | if mode == "single":
772 | st.markdown("--- \n **General Info for your query**")
773 | st.info(general_info)
774 |
775 | elif filter_by == "gene_name":
776 | if not os.path.exists('outputs/' + search_term + "/"):
777 | os.mkdir('outputs/'+ search_term + "/")
778 | else:
779 | shutil.rmtree('outputs/'+ search_term + "/")
780 | os.mkdir('outputs/'+ search_term + "/")
781 |
782 | json_keys = list(response.json()["data"]["gene"].keys())
783 | general_info ="```"
784 | for json_key in json_keys:
785 | # print(json_key, type(response.json()["data"]["gene"][json_key]), response.json()["data"]["gene"][json_key] is None, type(response.json()["data"]["gene"][json_key]) not in [str, int])
786 | if response.json()["data"]["gene"][json_key] is not None and type(response.json()["data"]["gene"][json_key]) in [str, int]:
787 | with open("outputs/" + search_term + "/" + search_term + ".txt", "a") as f:
788 | f.write("\n" + json_key + ": " + str(response.json()["data"]["gene"][json_key]))
789 | general_info += ("\n" + json_key + ": " + str(response.json()["data"]["gene"][json_key]))
790 |
791 | if response.json()["data"]["gene"][json_key] is not None and type(response.json()["data"]["gene"][json_key]) not in [str, int]:
792 | data = json_normalize(response.json()["data"]["gene"][json_key])
793 | data.columns = data.columns.map(lambda x: x.split(".")[-1])
794 | data.to_csv("outputs/" + search_term + "/" + json_key + ".tsv", sep="\t", index=False)
795 | if (len(data) > 0) and (mode == "single"):
796 | st.markdown("\n **Table for: `" + json_key + "`**")
797 | st.dataframe(data)
798 |
799 | general_info += "```"
800 | if mode == "single":
801 | st.markdown("--- \n **General Info for your query**")
802 | st.info(general_info)
803 |
804 | return response
805 |
806 | # Plotting
807 | ## Generate grouping and freq plot
808 | def make_grouping_freq_plot(df, group_by, title):
809 | df[group_by] = df[group_by].str.replace("_", " ").str.title()
810 | df2 = df.groupby(group_by).size().reset_index(name='Number of Variants')
811 | fig = px.bar(df2, x=group_by, y="Number of Variants", color=group_by, barmode='stack', template="ggplot2",
812 | hover_data=[group_by]).for_each_trace(lambda t: t.update(name=t.name.split("=")[1]))
813 | fig.update_layout(
814 | title_text=title,
815 | xaxis_tickangle=-45,
816 | yaxis=dict(title='Variants', titlefont_size=14, tickfont_size=12),
817 | xaxis=dict(
818 | title="Categories of {}".format(group_by.replace("_", " ").title()),
819 | titlefont_size=14,
820 | tickfont_size=12))
821 | return fig
822 |
823 | def generate_plot(search_by, filter_by, mode):
824 | st.subheader("Plots \n ")
825 | try:
826 | if filter_by in ["gene_name", "gene_id", "transcript_id"]:
827 | variant_file = "./outputs/" + search_by + "/variants.tsv"
828 |
829 | if os.path.isfile(variant_file):
830 | ## gnomad
831 | variants_df = pd.read_csv(variant_file, sep="\t")
832 | fig1 = make_grouping_freq_plot(variants_df, "consequence", 'Consequence of gnomAD Variants')
833 | fig2 = make_grouping_freq_plot(variants_df, "lof", 'LoF of gnomAD Variants')
834 | fig3 = make_grouping_freq_plot(variants_df, "lof_filter", 'LoF Filtes of gnomAD Variants')
835 |
836 | ## clinvar
837 | clivar_df = pd.read_csv("./outputs/" + search_by + "/clinvar_variants.tsv", sep="\t")
838 | clivar_df["clinical_significance"] = clivar_df["clinical_significance"].apply(lambda x: x.split("'")[1])
839 | fig4 = make_grouping_freq_plot(clivar_df, "clinical_significance", 'Clinical Significance of ClinVar Variants')
840 | fig5 = make_grouping_freq_plot(clivar_df, "major_consequence", 'Major Consequence of ClinVar Variants')
841 |
842 | # Show in the app
843 | if mode == "single":
844 | st.plotly_chart(fig1)
845 | st.plotly_chart(fig2)
846 | st.plotly_chart(fig3)
847 | st.plotly_chart(fig4)
848 | st.plotly_chart(fig5)
849 |
850 | # Export as HTML
851 | fig1.write_html("./outputs/" + search_by + "/gnomAD_variants_by_consequence.html")
852 | fig2.write_html("./outputs/" + search_by + "/gnomAD_variants_by_lof.html")
853 | fig3.write_html("./outputs/" + search_by + "/gnomAD_variants_by_lof_filter.html")
854 | fig4.write_html("./outputs/" + search_by + "/clinvar_variants_by_clinical_significance.html")
855 | fig5.write_html("./outputs/" + search_by + "/clinvar_variants_by_major_consequence.html")
856 | else:
857 | st.warning("Plots were not generated since `variants.tsv` could not be created. It may happens if the data is not available for your dataset")
858 |
859 | if filter_by in ["gene_name", "gene_id"]:
860 | structural_variants_file = "./outputs/" + search_by + "/structural_variants.tsv"
861 | if os.path.isfile(variant_file):
862 | ## structural_variants
863 | sv_df = pd.read_csv(structural_variants_file, sep="\t")
864 | fig6 = make_grouping_freq_plot(sv_df, "consequence", 'Major Consequence of Structural Variants')
865 |
866 | # Show in the app
867 | if mode == "single":
868 | st.plotly_chart(fig6)
869 |
870 | # Export as HTML
871 | fig6.write_html("./outputs/" + search_by + "/structural_variants_by_consequence.html")
872 | else:
873 | st.warning("Plots were not generated since `structural_variants.tsv` could not be created. It may happens if the data is not available for your dataset")
874 |
875 | except Exception as plotError:
876 | # st.text(plotError)
877 | pass
878 |
879 | # Action
880 | if (filter_by is not None) and (search_by is not None) and (st.button('Get Data and Generate Plots', key='run')):
881 | try:
882 | if file_buffer is None:
883 | # Single
884 | with st.spinner('Getting data and generating the plots ...'):
885 | response = get_variants_by(filter_by, search_by, dataset, "single")
886 | if response.status_code in [404, 405, 503]:
887 | st.error('API is not accessible right now. Check the end point out for gnomAD API!')
888 | st.markdown("""
889 | > For techinal detail, status code is `{}` and
890 | >
891 | > current end point is `{}`.
892 | """.format(response.status_code, end_point))
893 |
894 | else:
895 | generate_plot(search_by, filter_by, "single")
896 | st.markdown("\n --- \n")
897 | st.success("DONE! Check your `outputs/` folder.")
898 |
899 | elif file_buffer is not None:
900 | # Multiple
901 | with st.spinner('Getting data and will back soon...'):
902 | for i, search_item in search_df.iterrows():
903 | response = get_variants_by(filter_by, search_item[0], dataset, "multiple")
904 |
905 | if response.status_code in [404, 405, 503]:
906 | st.error('API is not accessible right now. Check the end point out for gnomAD API!')
907 | st.markdown("""
908 | > For techinal detail, status code is `{}` and
909 | >
910 | > current end point is `{}`.
911 | """.format(response.status_code, end_point))
912 |
913 | else:
914 | generate_plot(search_item[0], filter_by, "multiple")
915 | st.progress(100)
916 |
917 | st.markdown("\n --- \n")
918 | st.success("DONE! Check your `outputs/` folder.")
919 |
920 | except (ConnectionError, ConnectionAbortedError, ConnectionRefusedError, ConnectionResetError):
921 | st.error("An unknown error occured regarding the internet connection!")
922 |
923 | except AttributeError as ae:
924 |
925 | # Error Message from gnomAD
926 | try:
927 | for msg in response.json()["errors"]:
928 | st.error("Errors from gnomAD for your process:\n\t" + msg["message"])
929 | except Exception as anyOtherException:
930 | pass
931 |
932 | if filter_by != "rs_id":
933 | # General Error Message
934 | st.warning("""
935 | It might be caused since the search did not find a result from the database.
936 | Try to check the `input` for `{}` or other `options`.
937 | """.format(filter_by))
938 |
939 | # Technical Error Message
940 | st.markdown("""
941 | > As a note, technical reason is `{}`.
942 | >
943 | > If you think this should not occur, you can contact with developer to issue this problem on Github page.
944 | """.format(ae))
945 |
946 | except (TypeError, KeyError):
947 | try:
948 | for msg in response.json()["errors"]:
949 | st.error("Errors from gnomAD for your process:\n\t" + msg["message"])
950 | except Exception as anyOtherException:
951 | pass
--------------------------------------------------------------------------------
/img/main_screen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/furkanmtorun/gnomad_python_api/7018b845d9437c9617662192c523789c2592d597/img/main_screen.png
--------------------------------------------------------------------------------
/img/results.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/furkanmtorun/gnomad_python_api/7018b845d9437c9617662192c523789c2592d597/img/results.png
--------------------------------------------------------------------------------
/img/results_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/furkanmtorun/gnomad_python_api/7018b845d9437c9617662192c523789c2592d597/img/results_2.png
--------------------------------------------------------------------------------
/myFavoriteGenes.txt:
--------------------------------------------------------------------------------
1 | ENSG00000169174
2 | ENSG00000171862
3 | ENSG00000170445
4 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | pandas
2 | requests
3 | plotly
4 | streamlit
5 | tqdm
6 | argparse
--------------------------------------------------------------------------------