mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-19 18:27:29 -05:00
Apply prettier to css, html, js, md, ts, and yml (#1249)
* Apply prettier to css, js, html, md, ts, and yml As a followup I will add prettier to the .pre-commit config. This patch is 100% generated by prettier. I used a forked version of prettier that understands the py-script tag. See https://github.com/hoodmane/pyscript-prettier-precommit for more info. * Apply old pre-commit * Revert some problems * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Revert some changes * More changes * Fix pre-commit * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -1,129 +1,172 @@
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset='utf-8'>
|
||||
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<title>PyScript — Simple Bioinformatics Example</title>
|
||||
<link rel="icon" type="image/x-icon" href="./favicon.png">
|
||||
<meta name='viewport' content='width=device-width, initial-scale=1'>
|
||||
<link rel='stylesheet' type='text/css' media='screen' href='https://cdn.jsdelivr.net/npm/bulma@0.9.3/css/bulma.min.css'>
|
||||
<link rel="icon" type="image/png" href="https://user-images.githubusercontent.com/49681382/166738771-d0c26557-426c-4688-9641-8db5e6b08348.png" />
|
||||
<link rel="icon" type="image/x-icon" href="./favicon.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
media="screen"
|
||||
href="https://cdn.jsdelivr.net/npm/bulma@0.9.3/css/bulma.min.css"
|
||||
/>
|
||||
<link
|
||||
rel="icon"
|
||||
type="image/png"
|
||||
href="https://user-images.githubusercontent.com/49681382/166738771-d0c26557-426c-4688-9641-8db5e6b08348.png"
|
||||
/>
|
||||
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- Header -->
|
||||
<section class="hero is-primary is-small">
|
||||
<div class="hero-body">
|
||||
<p class="title is-3">PyScript — Simple Bioinformatics Example <span class="tag is-white">v.1</span></p>
|
||||
<p class="subtitle is-6">
|
||||
Demonstrates the simple use of <a href="https://pyscript.net/" target="_blank"><code>PyScript</code></a>
|
||||
in <strong>Bioinformatics/Computational Biology</strong> fields!
|
||||
</head>
|
||||
<body>
|
||||
<!-- Header -->
|
||||
<section class="hero is-primary is-small">
|
||||
<div class="hero-body">
|
||||
<p class="title is-3">
|
||||
PyScript — Simple Bioinformatics Example
|
||||
<span class="tag is-white">v.1</span>
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
<p class="subtitle is-6">
|
||||
Demonstrates the simple use of
|
||||
<a href="https://pyscript.net/" target="_blank"
|
||||
><code>PyScript</code></a
|
||||
>
|
||||
in <strong>Bioinformatics/Computational Biology</strong> fields!
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Main Content -->
|
||||
<div class="container is-white is-fluid" style="margin-top: 45px">
|
||||
<p class="title is-3">🧬 DNA Sequence Tool</p>
|
||||
|
||||
<!-- Main Content -->
|
||||
<div class="container is-white is-fluid" style="margin-top:45px">
|
||||
<p class="title is-3">🧬 DNA Sequence Tool</p>
|
||||
|
||||
<!--- DNA Sequence Input -->
|
||||
<div class="field">
|
||||
<!--- DNA Sequence Input -->
|
||||
<div class="field">
|
||||
<label class="label">Input DNA Sequence</label>
|
||||
<div class="control">
|
||||
<textarea class="textarea" placeholder="GATTACA" id="dna_seq"></textarea>
|
||||
<textarea
|
||||
class="textarea"
|
||||
placeholder="GATTACA"
|
||||
id="dna_seq"
|
||||
></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Operation Selection -->
|
||||
<label class="label">Pick the operation to be applied</label>
|
||||
<div class="field has-addons">
|
||||
<!-- Operation Selection -->
|
||||
<label class="label">Pick the operation to be applied</label>
|
||||
<div class="field has-addons">
|
||||
<div class="control is-expanded">
|
||||
<div class="select is-fullwidth">
|
||||
<div class="select is-fullwidth">
|
||||
<select name="operation" id="operation">
|
||||
<option value="Reverse">Compute the reverse counterpart</option>
|
||||
<option value="Complement">Compute the complement counterpart</option>
|
||||
<option value="ReverseComplement">Compute the reverse complement counterpart</option>
|
||||
<option value="Reverse">Compute the reverse counterpart</option>
|
||||
<option value="Complement">
|
||||
Compute the complement counterpart
|
||||
</option>
|
||||
<option value="ReverseComplement">
|
||||
Compute the reverse complement counterpart
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control">
|
||||
<button id="run" type="button" class="button is-primary" py-onClick="run()">Run!</button>
|
||||
<button id="clear" type="button" class="button is-danger" py-onClick="clear()">Clear</button>
|
||||
</div>
|
||||
<button
|
||||
id="run"
|
||||
type="button"
|
||||
class="button is-primary"
|
||||
py-onClick="run()"
|
||||
>
|
||||
Run!
|
||||
</button>
|
||||
<button
|
||||
id="clear"
|
||||
type="button"
|
||||
class="button is-danger"
|
||||
py-onClick="clear()"
|
||||
>
|
||||
Clear
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<hr />
|
||||
|
||||
<!--- DNA Sequence Output -->
|
||||
<label class="label">Output for the <code id="operation_name_output">given operation</code></label>
|
||||
<div id="output"></div>
|
||||
</div>
|
||||
|
||||
<br><br>
|
||||
<!-- Footer -->
|
||||
<footer class="footer">
|
||||
<div class="content has-text-centered">
|
||||
<p>
|
||||
Developed by <a href="mailto:furkanmtorun@gmail.com"><strong>Furkan M. Torun (@furkanmtorun)</strong></a>
|
||||
<br>
|
||||
<a href="https://github.com/furkanmtorun">GitHub</a>
|
||||
| <a href="https://scholar.google.com/citations?user=d5ZyOZ4AAAAJ">Google Scholar</a>
|
||||
| <a href="https://twitter.com/furkanmtorun">Twitter</a>
|
||||
| <a href="https://www.linkedin.com/in/furkanmtorun/">LinkedIn</a>
|
||||
</p>
|
||||
<!--- DNA Sequence Output -->
|
||||
<label class="label"
|
||||
>Output for the
|
||||
<code id="operation_name_output">given operation</code></label
|
||||
>
|
||||
<div id="output"></div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<py-script>
|
||||
# Define HTML elements and inputs
|
||||
dna_alphabet = "ATGC"
|
||||
output = Element("output")
|
||||
dna_seq_element = Element("dna_seq")
|
||||
operation_element = Element("operation")
|
||||
operation_name_output_element = Element("operation_name_output")
|
||||
<br /><br />
|
||||
<!-- Footer -->
|
||||
<footer class="footer">
|
||||
<div class="content has-text-centered">
|
||||
<p>
|
||||
Developed by
|
||||
<a href="mailto:furkanmtorun@gmail.com"
|
||||
><strong>Furkan M. Torun (@furkanmtorun)</strong></a
|
||||
>
|
||||
<br />
|
||||
<a href="https://github.com/furkanmtorun">GitHub</a>
|
||||
|
|
||||
<a href="https://scholar.google.com/citations?user=d5ZyOZ4AAAAJ"
|
||||
>Google Scholar</a
|
||||
>
|
||||
| <a href="https://twitter.com/furkanmtorun">Twitter</a> |
|
||||
<a href="https://www.linkedin.com/in/furkanmtorun/">LinkedIn</a>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
# DNA Sequene Operations
|
||||
def return_reverse(dna_seq):
|
||||
return dna_seq[::-1]
|
||||
def return_complement(dna_seq):
|
||||
return dna_seq.translate(str.maketrans("ATCG", "TAGC"))
|
||||
def return_reverse_complement(dna_seq):
|
||||
return dna_seq.translate(str.maketrans("ATCG", "TAGC"))[::-1]
|
||||
<py-script>
|
||||
# Define HTML elements and inputs
|
||||
dna_alphabet = "ATGC"
|
||||
output = Element("output")
|
||||
dna_seq_element = Element("dna_seq")
|
||||
operation_element = Element("operation")
|
||||
operation_name_output_element = Element("operation_name_output")
|
||||
|
||||
# Check DNA seq is valid
|
||||
def check_dna_seq(dna_seq):
|
||||
return all(letter in dna_alphabet for letter in dna_seq.upper())
|
||||
# DNA Sequene Operations
|
||||
def return_reverse(dna_seq):
|
||||
return dna_seq[::-1]
|
||||
def return_complement(dna_seq):
|
||||
return dna_seq.translate(str.maketrans("ATCG", "TAGC"))
|
||||
def return_reverse_complement(dna_seq):
|
||||
return dna_seq.translate(str.maketrans("ATCG", "TAGC"))[::-1]
|
||||
|
||||
# Clear the form and output
|
||||
def clear(*args, **kwargs):
|
||||
dna_seq_element.clear()
|
||||
output.clear()
|
||||
# Check DNA seq is valid
|
||||
def check_dna_seq(dna_seq):
|
||||
return all(letter in dna_alphabet for letter in dna_seq.upper())
|
||||
|
||||
# Run
|
||||
def run(*args, **kwargs):
|
||||
dna_seq = dna_seq_element.value
|
||||
is_dna_seq_valid = check_dna_seq(dna_seq)
|
||||
if is_dna_seq_valid:
|
||||
operation_name = operation_element.value
|
||||
operation_name_output_element.write(operation_name)
|
||||
# Clear the form and output
|
||||
def clear(*args, **kwargs):
|
||||
dna_seq_element.clear()
|
||||
output.clear()
|
||||
|
||||
# Compute the desired outputs
|
||||
if operation_name == "Reverse":
|
||||
output_dna_seq = return_reverse(dna_seq)
|
||||
elif operation_name == "Complement":
|
||||
output_dna_seq = return_complement(dna_seq)
|
||||
elif operation_name == "ReverseComplement":
|
||||
output_dna_seq = return_reverse_complement(dna_seq)
|
||||
# Run
|
||||
def run(*args, **kwargs):
|
||||
dna_seq = dna_seq_element.value
|
||||
is_dna_seq_valid = check_dna_seq(dna_seq)
|
||||
if is_dna_seq_valid:
|
||||
operation_name = operation_element.value
|
||||
operation_name_output_element.write(operation_name)
|
||||
|
||||
# Output the result
|
||||
output.write(output_dna_seq)
|
||||
elif (dna_seq.strip() == "") or (dna_seq is None):
|
||||
output.write("No DNA sequence provided")
|
||||
else:
|
||||
output.write("Invalid DNA sequence entered")
|
||||
</py-script>
|
||||
# Compute the desired outputs
|
||||
if operation_name == "Reverse":
|
||||
output_dna_seq = return_reverse(dna_seq)
|
||||
elif operation_name == "Complement":
|
||||
output_dna_seq = return_complement(dna_seq)
|
||||
elif operation_name == "ReverseComplement":
|
||||
output_dna_seq = return_reverse_complement(dna_seq)
|
||||
|
||||
</body>
|
||||
# Output the result
|
||||
output.write(output_dna_seq)
|
||||
elif (dna_seq.strip() == "") or (dna_seq is None):
|
||||
output.write("No DNA sequence provided")
|
||||
else:
|
||||
output.write("Invalid DNA sequence entered")
|
||||
</py-script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user