Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
20b89eb
RR9 documentation and code checkin
GoJian Mar 14, 2024
33f8e92
RR9 RNA-Seq Analysis (modified from James' script)
GoJian Mar 14, 2024
7ddd1af
minor update on setup notes
GoJian Mar 14, 2024
0b4eb8f
minor updates on RR9 scripts
GoJian Mar 14, 2024
0c781e9
Minor edits
GoJian Mar 14, 2024
e60e321
Updated to also download differential gene expression data
GoJian May 1, 2024
1207cbb
checking in files and reorganize
GoJian Dec 20, 2024
fcd81d1
reorganize
GoJian Dec 20, 2024
88f0983
checking in library list requirements.txt from my pip freeze
GoJian Dec 20, 2024
422b537
imputation methods and validation approach 1
vnageshbio Dec 21, 2024
994cb57
remove working files to clean up
GoJian Dec 21, 2024
ab21fda
reorganize genAI examples
GoJian Dec 21, 2024
a238ff0
reorganize
GoJian Dec 21, 2024
8388e97
moving to working_code
GoJian Dec 21, 2024
fcb29fa
clean tree
GoJian Dec 21, 2024
d94e26f
clean up
GoJian Dec 21, 2024
2f28bc6
Validation of Imputation methods
vnageshbio Dec 21, 2024
1cd41b9
unmodified the original requirements.txt and added a requirements_penv
vnageshbio Dec 21, 2024
792c2bd
commiting without result cells to reduce commit size
vnageshbio Dec 22, 2024
5f1d436
Merge pull request #1 from GoJian/impute_methods
GoJian Jan 10, 2025
d2b7fbe
small changes
GoJian Feb 7, 2025
2ec43b2
adding markdowns to reduce memory
vnageshbio Feb 28, 2025
93edb9a
removing dependency on external files for html report
vnageshbio Feb 28, 2025
a66261d
adding requirements and the qmd
vnageshbio Feb 28, 2025
c0e14b0
Merge pull request #2 from GoJian/cleanup_impute
GoJian Feb 28, 2025
f429dd4
adding PCA analysis
vnageshbio Mar 1, 2025
8277df7
Revert "Adding Quarto Markdown and Manuscript Code"
vnageshbio Mar 2, 2025
3b59b59
Merge pull request #4 from GoJian/revert-2-cleanup_impute
vnageshbio Mar 2, 2025
862a118
resolving conflict
vnageshbio Mar 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Working_Code/data
Working_Code/.pybiomart.sqlite
Working_Code/GenAI/kaggle.json
.DS_Store
1 change: 1 addition & 0 deletions Working_Code/AI4LS
Submodule AI4LS added at 1204a2
628 changes: 628 additions & 0 deletions Working_Code/GenAI/DIFFUSION.ipynb

Large diffs are not rendered by default.

388 changes: 388 additions & 0 deletions Working_Code/GenAI/GAN.ipynb

Large diffs are not rendered by default.

1,616 changes: 1,616 additions & 0 deletions Working_Code/GenAI/VAE.ipynb

Large diffs are not rendered by default.

145 changes: 145 additions & 0 deletions Working_Code/GenAI/VAE_RNASeq.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
import torch
import torch.nn as nn
from torch.utils.tensorboard import SummaryWriter
writer = SummaryWriter('runs/lgbm')


def idx2onehot(idx, n):

assert torch.max(idx).item() < n
if idx.dim() == 1:
idx = idx.unsqueeze(1)

onehot = torch.zeros(idx.size(0), n)
onehot.scatter_(1, idx, 1)

return onehot


class VAE(nn.Module):
def __init__(self, encoder_layer_sizes, latent_size, decoder_layer_sizes,
conditional=False, num_labels=0):

super().__init__()

if conditional:
assert num_labels > 0

assert type(encoder_layer_sizes) == list
assert type(latent_size) == int
assert type(decoder_layer_sizes) == list

self.latent_size = latent_size
self.num_labels = num_labels

self.encoder = Encoder(
encoder_layer_sizes, latent_size, conditional, num_labels)
self.decoder = Decoder(
decoder_layer_sizes, latent_size, conditional, num_labels)

def forward(self, x, c=None):
view_size = 1000
if x.dim() > 2:
x = x.view(-1, view_size)

batch_size = x.size(0)

means, log_var = self.encoder.forward(x, c)

std = torch.exp(0.5 * log_var)
eps = torch.randn([batch_size, self.latent_size])
z = eps * std + means

recon_x = self.decoder.forward(z, c)

return recon_x, means, log_var, z

def inference(self, n=0, c=None):
if n == 0:
n = self.num_labels
batch_size = n
z = torch.randn([batch_size, self.latent_size])

recon_x = self.decoder.forward(z, c)

return recon_x

def embedding(self, x, c=None):
view_size = 1000
#if x.dim() > 2:
# x = x.view(-1, view_size)

batch_size = x.size(0)

means, log_var = self.encoder.forward(x, c)
std = torch.exp(0.5 * log_var)
eps = torch.randn([1, self.latent_size])
z = eps * std + means

return z


class Encoder(nn.Module):
def __init__(self, layer_sizes, latent_size, conditional, num_labels):

super().__init__()

self.conditional = conditional
if self.conditional:
layer_sizes[0] += num_labels

self.MLP = nn.Sequential()

for i, (in_size, out_size) in enumerate(zip(layer_sizes[:-1], layer_sizes[1:])):
self.MLP.add_module(
name="L{:d}".format(i), module=nn.Linear(in_size, out_size))
self.MLP.add_module(name="A{:d}".format(i), module=nn.ReLU())

self.linear_means = nn.Linear(layer_sizes[-1], latent_size)
self.linear_log_var = nn.Linear(layer_sizes[-1], latent_size)

def forward(self, x, c=None):

if self.conditional:
c = idx2onehot(c, n=self.num_labels)
x = torch.cat((x, c), dim=-1)

x = self.MLP(x)

means = self.linear_means(x)
log_vars = self.linear_log_var(x)

return means, log_vars


class Decoder(nn.Module):
def __init__(self, layer_sizes, latent_size, conditional, num_labels):

super().__init__()

self.MLP = nn.Sequential()
self.num_labels = num_labels

self.conditional = conditional
if self.conditional:
input_size = latent_size + num_labels
else:
input_size = latent_size

for i, (in_size, out_size) in enumerate(zip([input_size]+layer_sizes[:-1], layer_sizes)):
self.MLP.add_module(
name="L{:d}".format(i), module=nn.Linear(in_size, out_size))
if i+1 < len(layer_sizes):
self.MLP.add_module(name="A{:d}".format(i), module=nn.ReLU())
else:
self.MLP.add_module(name="sigmoid", module=nn.Sigmoid())

def forward(self, z, c):

if self.conditional:
c = idx2onehot(c, n=self.num_labels)
z = torch.cat((z, c), dim=-1)

x = self.MLP(z)

return x
Loading