-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7d9bf4c
commit 6966dcd
Showing
4 changed files
with
72 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
selenium==4.23.1 | ||
requests==2.32.3 | ||
python-dotenv==1.0.1 |
55 changes: 55 additions & 0 deletions
55
etc/database/screenshot-datasets-automate/screenshot-annotate.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
from selenium import webdriver | ||
from selenium.webdriver.chrome.options import Options | ||
from selenium.webdriver.common.by import By | ||
import time | ||
import os | ||
from datetime import datetime | ||
from dotenv import dotenv_values | ||
|
||
import requests | ||
|
||
config = dotenv_values('.env') | ||
|
||
|
||
|
||
#@ https://local.rosalution.cgds/rosalution/api/analysis/CPAM0002/genomic_units | ||
|
||
# Get the current timestamp for the image name | ||
today = datetime.now() | ||
image_name = today.strftime("%Y-%m-%d %H:%M:%S") | ||
|
||
# Set the path where the screenshot will be saved | ||
path = os.path.dirname(os.path.abspath(__file__)) | ||
|
||
# Configure Chrome WebDriver options | ||
options = Options() | ||
options.add_argument("--window-size=1920,1080") | ||
options.add_argument("--start-maximized") | ||
options.add_argument("--headless") | ||
options.add_argument("--disable-gpu") | ||
|
||
# Initialize the Chrome WebDriver | ||
driver = webdriver.Chrome(options=options) | ||
driver.maximize_window() | ||
|
||
|
||
|
||
|
||
driver.get("https://gtexportal.org/home/gene/CEP104") | ||
|
||
time.sleep(1) | ||
|
||
width = driver.execute_script("return Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth );") | ||
height = driver.execute_script("return Math.max( document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );") | ||
|
||
driver.set_window_size(width, height) | ||
|
||
full_page = driver.find_element(By.ID, "gene-expr-vplot") | ||
full_page.screenshot(f"{image_name}.png") | ||
|
||
# Close the browser window | ||
driver.quit() | ||
|
||
|
||
|
||
# Get genomic units from the analysis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
python3 -m venv rosalution-screenshot-annotations | ||
source rosalution-screenshot-annotations/bin/activate | ||
|
||
# install requirements | ||
pip3 install -r requirements.txt | ||
|
||
# deactivate venv and return to root directory | ||
deactivate |