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
import bjorn_support as bs | |
import mutations as bm | |
import pandas as pd | |
# FASTA must include reference NC_045512.2 (e.g. use cat to add the reference) | |
fasta_filepath = '2021-02-08_release.fa' | |
# specify name for output alignment | |
msa_filepath = 'msa.fa' | |
# run alignment (uses MAFFT but can be changed from bjorn_support.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
import numpy as np | |
nentity = 100 | |
nhidden = 20 | |
nrelations = 10 | |
entity_embedding = np.random.uniform(-10, 10, (nentity, nhidden)) | |
relation_embedding = np.random.uniform(-1, 1, (nrelations, nhidden)) | |
# For every iteration |
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
from datetime import datetime ,timedelta | |
import sys | |
given_year = float(sys.argv[1]) | |
base = datetime(int(given_year),1,1) | |
year_rem = given_year - int(given_year) | |
calc_date = (base + timedelta(seconds = (base.replace(year = base.year+1) - base).total_seconds() * year_rem )) | |
print(calc_date.strftime("%d %b %Y")) |
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
# Naming scheme -> <samplename>_R1.fastq.gz and <samplename>_R2.fastq.gz | |
echo -e "forward\treverse\tsample\tsample_library" > samples.tsv | |
find /path/to/folder -name "*.fastq.gz" | sort | xargs -n 2 bash -c 'name=$(basename $0 | cut -f 1 -d _);echo -e "$0\t$1\t${name}\t${name}_L1"' >> samples.tsv |
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
import vcf | |
import os | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
def create_vcf_df(file_name): | |
data = [] | |
csq_fields = ["impact", "aa.pos", "aa.mut", "nuc.pos", "codon.change"] | |
vcf_reader = vcf.Reader(open("../data/"+file_name)) | |
for rec in vcf_reader: |
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
const { Observable, Subject, BehaviorSubject, throwError, forkJoin, of, from, EMPTY } = require('./node_modules/rxjs'); | |
const { map, catchError, tap, mergeMap, reduce, finalize, expand } = require("./node_modules/rxjs/operators"); | |
const { ajax } = require('rxjs/ajax'); | |
const {XMLHttpRequest} = require("xmlhttprequest"); | |
function fetchAllGeneric(endpoint, qParams) { | |
return fetchOne(endpoint, qParams).pipe( | |
expand((data) => { | |
return data.next ? fetchOne(endpoint, data.next) : EMPTY; | |
}), |
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
from Bio import Phylo | |
import datetime | |
from decimal import Decimal | |
import numpy as np | |
import pandas as pd | |
import matplotlib.gridspec as gridspec | |
import matplotlib.pyplot as plt |
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
# Using Emacs Restclient Mode to explore the Elasticsearch REST API | |
# http://www.elasticsearch.org/guide/en/elasticsearch/reference/ | |
:es = http://127.0.0.1:9200 | |
# Cluster Health | |
GET :es/_cat/health?v | |
# List of nodes |
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
# BEAST v1.8.4 | |
# Generated Thu Feb 07 22:51:42 PST 2019 [seed=1549608699682] | |
# -beagle_gpu downsampled_ca.xml | |
state Posterior Prior Likelihood downsampled_ca_7.rootHeight downsampled_ca_6.rootHeight downsampled_ca_5.rootHeight downsampled_ca_3.rootHeight downsampled_ca_1.rootHeight shared.ucld.mean location.clock.rate | |
0 -813839.4208 -30233.6058 -783605.8150 186.311 188.566 386.793 485.184 86.8928 1.00000 1.00000 - | |
Exception in thread "Thread-1" java.lang.ArrayIndexOutOfBoundsException: 353 | |
at dr.evomodel.tree.TreeModel.getNode(Unknown Source) | |
at dr.app.beagle.evomodel.treelikelihood.BeagleTreeLikelihood.handleModelChangedEvent(Unknown Source) | |
at dr.inference.model.AbstractModel.modelChangedEvent(Unknown Source) | |
at dr.inference.model.Model$ListenerHelper.fireModelChanged(Unknown Source) |
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
bases = "tcag" | |
codons = [a + b + c for a in bases for b in bases for c in bases] | |
amino_acids = 'FFLLSSSSYY**CC*WLLLLPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG' | |
codon_table = dict(zip(codons, amino_acids)) | |
# To get amino acid | |
codon_table['atg'] |
NewerOlder