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 torch | |
from torch import nn | |
from torch.autograd import Variable | |
class AdaptiveSoftmax(nn.Module): | |
def __init__(self, input_size, cutoff): | |
super().__init__() | |
self.input_size = input_size | |
self.cutoff = cutoff |
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 | |
import matplotlib.pyplot as plt | |
from skbio.stats.ordination import pcoa | |
from skbio import DistanceMatrix | |
from scipy.spatial.distance import pdist, squareform | |
# embedding = < your language model embedding > # dim L x D where L is the length, D is the dimension | |
rr_dist = squareform(pdist(embedding)) | |
dm = DistanceMatrix(rr_dists_d.mean(2)) |
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
data { | |
int<lower=0> N; // number of samples | |
int<lower=0> D; // number of dimensions | |
int<lower=0> J; // number of subjects | |
int<lower=0> p; // number of covariates | |
real depth[N]; // sequencing depths of microbes | |
matrix[N, p] x; // covariate matrix | |
int y[N, D]; // observed microbe abundances | |
int<lower=1, upper=J> subj_ids[N]; // subject ids |
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
data { | |
int<lower=0> N; // number of samples | |
int<lower=0> D; // number of dimensions | |
int<lower=0> p; // number of covariates | |
real depth[N]; // sequencing depths of microbes | |
matrix[N, p] x; // covariate matrix | |
int y[N, D]; // observed microbe abundances | |
} | |
parameters { |
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
""" | |
Installation can be done with conda via | |
conda create -n textminer beautifulsoup4 numpy pandas scipy scikit-learn nltk lxml jupyter notebook matplotlib seaborn | |
""" | |
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 modules | |
import os | |
import copy | |
import time | |
from tqdm import tqdm | |
import numpy as np | |
from skbio.stats.composition import clr_inv as softmax | |
from scipy.stats import spearmanr | |
import datetime | |
import pandas as pd |
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 | |
import patsy | |
import pandas as pd | |
from biom import Table | |
# This is the main function | |
def poisson_cat(table, metadata, category, ref=None): | |
""" Poisson differential abundance. | |
Parameters |
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
#!/usr/bin/env python | |
""" | |
Filter sequences from a biom table based on a fasta file | |
used for AG bloom filtering | |
""" | |
# amnonscript |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
"Achimill" "Agrostol" "Airaprae" "Alopgeni" "Anthodor" "Bellpere" "Bromhord" "Ch | |
"1" 1 0 0 0 0 0 0 0 0 0 0 4 0 0 0 0 7 0 4 2 0 0 0 0 0 0 0 0 0 0 | |
"2" 3 0 0 2 0 3 4 0 0 0 0 4 0 0 0 0 5 0 4 7 0 0 0 0 5 0 5 0 0 0 | |
"3" 0 4 0 7 0 2 0 0 0 0 0 4 0 0 0 0 6 0 5 6 0 0 0 0 2 0 2 0 2 0 | |
"4" 0 8 0 2 0 2 3 0 2 0 0 4 0 0 0 0 5 0 4 5 0 0 5 0 2 0 1 0 2 0 | |
"5" 2 0 0 0 4 2 2 0 0 0 0 4 0 0 0 0 2 5 2 6 0 5 0 0 3 2 2 0 2 0 | |
"6" 2 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 6 5 3 4 0 6 0 0 3 5 5 0 6 0 | |
"7" 2 0 0 0 2 0 2 0 0 0 0 0 0 0 0 2 6 5 4 5 0 3 0 0 3 2 2 0 2 0 | |
"8" 0 4 0 5 0 0 0 0 0 0 4 0 0 0 4 0 4 0 4 4 2 0 2 0 3 0 2 0 2 0 | |
"9" 0 3 0 3 0 0 0 0 0 0 0 6 0 0 4 4 2 0 4 5 0 2 2 0 2 0 3 0 2 0 |