Skip to content

Commit

Permalink
Merge branch 'main' into story1_divide-by-levels
Browse files Browse the repository at this point in the history
  • Loading branch information
PlushZ authored Feb 25, 2022
2 parents 7d0b0e0 + 0524eb3 commit d35c35b
Show file tree
Hide file tree
Showing 72 changed files with 2,338 additions and 73 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ _site
.DS_Store
*.swp
.sass-cache
__pycache__
__pycache__
node_modules
videos
.jekyll-cache
45 changes: 2 additions & 43 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,57 +37,16 @@ create-env: ## create conda environment
ACTIVATE_ENV = source $(dir ${CONDA})activate ${CONDA_ENV}
install: clean ## install dependencies
$(ACTIVATE_ENV) && \
npm install && \
gem install bundler && \
bundle install
.PHONY: install

serve: ## run a local server
$(ACTIVATE_ENV) && \
bundle exec jekyll serve
bundle exec jekyll serve --strict_front_matter -d _site/DNAnalyzer -P ${PORT} -H ${PDF_HOST} ${FLAGS}
.PHONY: serve

detached-serve: ## run a local server in detached mode
$(ACTIVATE_ENV) && \
bundle exec jekyll serve --detach -P ${PORT} -H ${PDF_HOST} ${FLAGS}
.PHONY: detached-serve

pdf: detached-serve ## generate the PDF of the protocols
mkdir -p $(PDF_DIR)
@for t in $(PROTOCOLS); do \
name="$(PDF_DIR)/$$(echo $$t | tr '/' '-' | sed -e 's/.html/-instructors.pdf/' -e 's/^-//' -e 's/-index//')"; \
${CHROME} \
--headless \
--disable-gpu \
--print-to-pdf="$$name" \
"$(SITE_URL)/protocols/$$t" \
2> /dev/null ; \
name="$(PDF_DIR)/$$(echo $$t | tr '/' '-' | sed -e 's/.html/-learners.pdf/' -e 's/^-//' -e 's/-index//')"; \
${CHROME} \
--headless \
--disable-gpu \
--print-to-pdf="$$name" \
"$(SITE_URL)/protocols/$$t?without-details" \
2> /dev/null ; \
done

${CHROME} \
--headless \
--disable-gpu \
--print-to-pdf="$(PDF_DIR)/beer-dna-sequencing-flongle-instructor.pdf" \
"$(SITE_URL)/protocols/beer-dna-sequencing?flongle" \
2> /dev/null

${CHROME} \
--headless \
--disable-gpu \
--print-to-pdf="$(PDF_DIR)/beer-dna-sequencing-flongle-learners.pdf" \
"$(SITE_URL)/protocols/beer-dna-sequencing?flongle?without-details" \
2> /dev/null


pkill -f jekyll
.PHONY: pdf

help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: help
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,34 @@ In the sequel, we assume you use miniconda.

7. Open the website in your favorite browser at:
[http://127.0.0.1:4000/](http://127.0.0.1:4000/)



## Generate videos

### Requirements

Ubuntu

```
$ sudo apt-get install sox
$ sudo apt-get install libsox-fmt-mp3
```

#### Steps

In different terminals:

1. Run website
1. Launch MozillaTTS for speech

```
$ docker run -it -p 5002:5002 synesthesiam/mozillatts
```

2. Launch scripts

```
$ conda activate dnanalyzer
$ ./bin/ari-make.sh <path to slide>
```
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: DNAnalyzer
description: >
An online & interactive game on DNA data analysis!
url: "https://streetscience.community"
baseurl: "/DNAnalyzer"

# Social
Expand Down
1 change: 0 additions & 1 deletion _includes/default-header.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

<a class="navbar-item" href="{{ site.baseurl }}/">
<img src="{{ site.baseurl }}/images/logo.png" alt="DNAnalyzer">

</a>

<a
Expand Down
2 changes: 1 addition & 1 deletion about.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ we ask that you follow our [code of conduct]({{ site.github.repository_url

Funding
- [University of Freiburg](https://uni-freiburg.de/)
- [de.NBI](https://www.denbi.de/), the German Network for Bioinformatics Infrastructure, for the MinION
- [de.NBI](https://www.denbi.de/)
135 changes: 135 additions & 0 deletions bin/ari-extract-script.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
### Script adapted from Galaxy Training Network script
### https://github.com/galaxyproject/training-material/

#!/usr/bin/env ruby
require 'yaml'
require 'shellwords'
require 'json'

fn = ARGV[0]
metadata = YAML.load_file(fn)

ARI_MAP = File.expand_path(File.join(__dir__, 'ari-map.yml'))
WORD_MAP = {}
YAML.load_file(ARI_MAP).each_pair do |k,v|
WORD_MAP.merge!({k.downcase => v})
end

APPROVED_VOICES = {
"en" => [
{"id" =>"Amy" , "lang" => "en-GB" , "neural" => true},
{"id" =>"Aria" , "lang" => "en-NZ" , "neural" => true},
{"id" =>"Brian" , "lang" => "en-GB" , "neural" => true},
{"id" =>"Emma" , "lang" => "en-GB" , "neural" => true},
{"id" =>"Joanna" , "lang" => "en-US" , "neural" => true},
{"id" =>"Joey" , "lang" => "en-US" , "neural" => true},
{"id" =>"Kendra" , "lang" => "en-US" , "neural" => true},
{"id" =>"Matthew" , "lang" => "en-US" , "neural" => true},
{"id" =>"Nicole" , "lang" => "en-AU" , "neural" => false},
{"id" =>"Olivia" , "lang" => "en-AU" , "neural" => true},
{"id" =>"Raveena" , "lang" => "en-IN" , "neural" => false},
{"id" =>"Salli" , "lang" => "en-US" , "neural" => true}
],
"es" => [
{ "id" => "Miguel" , "lang" => "es-US" , "neural" => false },
{ "id" => "Mia" , "lang" => "es-MX" , "neural" => false },
{ "id" => "Enrique" , "lang" => "es-ES" , "neural" => false },
{ "id" => "Conchita" , "lang" => "es-ES" , "neural" => false },
{ "id" => "Lupe" , "lang" => "es-US" , "neural" => true }
]
}

m_lang = metadata.fetch('lang', 'en')
m_voice = metadata.fetch('voice', nil)

# Parse the material for the slide notes
file = File.open(fn)
lines = file.readlines.map(&:chomp)

# The structure will be
# ---
# meta
# ---
#
# contents

# +1 because we skipped the 0th entry, +1 again to not include the `---`
end_meta = lines[1..-1].index("---") + 2

# Strip off the metadata
contents = lines[end_meta..-1]

# This will be our final script
blocks = [[metadata['title']]]


# Accumulate portions between ??? and ---
current_block = []
in_notes = false
contents.each{ |x|
# Check whether we're in the notes or out of them.
if x == "???" then
in_notes = true
elsif x == "---" or x == "--" then
if in_notes then
blocks.push(current_block)
current_block = []
end

in_notes = false
end

if in_notes then
current_block.push(x)
end
}
blocks.push(current_block)

if m_lang == "en" then
blocks.push(["Thank you for watching!"])
elsif m_lang == "es" then
blocks.push(["¡Gracias por ver este vídeo!"])
else
blocks.push(["Thank you for watching!"])
end

# For each block, cleanup first.
blocks = blocks.map{ |block|
# Remove the - prefix from each line
script_lines = block.map{ |x| x.strip.delete_prefix("- ") }
# Remove the leading ???
if script_lines[0] == '???'
script_lines = script_lines[1..-1]
end
# Remove blank entries
script_lines = script_lines.select{ |x| x.length != 0 }
script_lines = script_lines.map{ |line|
line.delete_prefix("- ")
line.gsub!(/`/, '"')
# If they don't end with punctuation, fix it.
if ! (line.end_with?('.') or line.end_with?('?') or line.end_with?('!'))
line += '.'
end

line
}
script_lines
}

#out_subs.write(blocks.map{ |line| line.join(" ") }.join("\n"))
res = Hash.new
res["blocks"] = blocks

if m_voice.nil? then
if m_lang == "en" then
res["voice"] = APPROVED_VOICES['en'].sample
elsif m_lang == "es" then
res["voice"] = APPROVED_VOICES['es'].sample
else
res["voice"] = APPROVED_VOICES['en'].sample
end
else
res["voice"] = metadata['voice']
end

print JSON.pretty_generate(res)
32 changes: 32 additions & 0 deletions bin/ari-make.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

### Script adapted from Galaxy Training Network script
### https://github.com/galaxyproject/training-material/

set -e

function cleanup(){
kill $(pgrep -f $(npm bin)/http-server) || true
}

trap cleanup EXIT

slides=$1
echo "====== $slides ======"
dir="$(dirname "$slides")"
pdf="$dir/$(basename "$slides" .html).pdf"
mp4="videos/$dir/$(basename "$slides" .html).mp4"
built_slides="_site/$slides"

# Launch small server
$(npm bin)/http-server -p 9876 _site &

# Process the slides
echo $built_slides
$(npm bin)/decktape automatic -s 1920x1080 http://localhost:9876/DNAnalyzer/$slides _site/DNAnalyzer/$pdf; \

# Build the slides
echo ari.sh "_site/DNAnalyzer/$pdf" "$slides" "$mp4"
./bin/ari.sh "_site/DNAnalyzer/$pdf" "$slides" "$mp4"

cleanup
61 changes: 61 additions & 0 deletions bin/ari-map.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
# These aren't needed, they're said correctly. Acronyms work fine.
#CMVFS: C V M F S
#IDC: I D C
# However if the usage is ever lowercase, it'll attempt to pronounce it directly
bwa: BWA
# And for some you'll need to separate the letter part vs pronounced part
BWA-MEM: BWA mem
'usegalaxy.*': usegalaxy dot star
gxadmin: GX admin
nginx: engine X
systemd: system D
/etc: / E T C
systemctl: system C T L
cgroup: C group
cgroups: C groups
telegraf: telegraph
sqlite: SQL light
SQLAlchemy: SQL alchemy
fastqc: fast QC
ntpdate: NTP date
RedHat: Red Hat
ATAC-Seq: ATAC Seq
Tn5: T N five
paired-end: paired end
# For some reason moz-tts doesn't pronounce right in a sentence unless it's
# lowercase. This gives parity with AWS
RAM: ram
uWSGI: "you whiskey"
GIL: gill
DRMAA: drama
hisat2: high sat 2
Node.js: node JS
db-skip-locked: DB skip locked
REST: rest
FASTQ: fast Q
scRNA-seq: S C RNA seq
scRNA: S C RNA
RNAmmer: RNA mer
Rfam: R fam
Pfam: P fam
m/z: MZ
'>': greater than sign
b-ions: B ions
y-ions: Y ions
MSstats: MS stats
LC-MS/MS: LC MS MS
topN: top N
miRNA: micro RNA
miRNAs: micro RNAs
mRNA: m RNA
mRNAs: m RNAs
FastQC: fast QC
MultiQC: multi QC
DESeq2: D E Seq 2
TargetFinder: target finder
MiRDeep2: mir deep 2
cutadapt: cut adapt
b': b prime
e': e prime
/: forward slash
Loading

0 comments on commit d35c35b

Please sign in to comment.