Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
luyiyun committed Jul 28, 2022
0 parents commit a399806
Show file tree
Hide file tree
Showing 35 changed files with 6,184 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.*
**/__pycache__/
!.gitignore
*.out
logs*/
results/
Subtype-GAN/
data/
.Rproj.user
*.Rproj
Depracated/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Zhiwei Rong

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
37 changes: 37 additions & 0 deletions conf/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# 关于hydra的设置
hydra:
job:
# 将工作路径设置到自动生成的路径中
chdir: true
run:
# 设置自动生成路径的位置
dir: /mnt/data1/share_data/rongzhiwei/outputs/${now:%Y-%m-%d}/${now:%H-%M-%S}

defaults:
- dataset: pan
- model: big
- train: ${dataset}
- _self_

dataset:
# 组成batch的方式
iter_method: "loader" # "random"
# 数据预处理:标准化的组学
normalize: ["meth", "rna", "CN", "miRNA"]
# 数据预处理:限制值的范围
clip: null
# 数据预处理:根据方差进行变量筛选
select: null
# 组学所服从的分布,会影响重构误差的形式
omic_dist_kind: "normal_varconst"
# omic_dist_kind:
# meth: "binary_conti"
# rna: "normal_varconst"
# CN: "laplace_varconst"
# miRNA: "normal_varconst"

seed: 1
cv: null
test_size: 0.2 # 如果test_size是NULL且cv>1,则test_size默认是0.1

save_model: false
9 changes: 9 additions & 0 deletions conf/dataset/pan.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
dat_name: "PAN"
root: "/mnt/data1/share_data/TCGA/PAN2"
csvfn:
meth: "meth.csv"
rna: "rna.csv"
CN: "CN.csv"
miRNA: "miRNA.csv"
cli: "clinic.csv"
n_clusters: 32
19 changes: 19 additions & 0 deletions conf/dataset/sub.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
dat_name: "BRCA"
root: "/mnt/data1/share_data/TCGA/SubtypeGAN/${dataset.dat_name}"
csvfn:
meth: "meth.csv"
rna: "rna.csv"
CN: "CN.csv"
miRNA: "miRNA.csv"
cli: "clinic.csv"
n_clusters:
BRCA: 5
BLCA: 5
KIRC: 4
GBM: 3
LUAD: 3
PAAD: 2
SKCM: 4
STAD: 3
UCEC: 4
UVM: 4
19 changes: 19 additions & 0 deletions conf/model/big.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
omic_cls_hiddens: [512, 512]
omic_cls_latents: 512
global_hiddens: [512, 512]
att_method: "gate"
att_kwargs:
use_tanh: false
attention_score_method: "sigmoid"
add_bn_after_att: true
gumbel_reparam: true
y_gen: true

omic_enc_hiddens: [512, 512]
omic_n_latents: 512
omic_dec_hiddens: [512, 512]
omic_enc_inject: true
omic_dec_inject: false
prior_kind: "uniform"
bn: true
dp: null
19 changes: 19 additions & 0 deletions conf/model/middle.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
omic_cls_hiddens: [512]
omic_cls_latents: 512
global_hiddens: [512]
att_method: "gate"
att_kwargs:
use_tanh: false
attention_score_method: "sigmoid"
add_bn_after_att: true
gumbel_reparam: true
y_gen: true

omic_enc_hiddens: [512]
omic_n_latents: 512
omic_dec_hiddens: [512]
omic_enc_inject: true
omic_dec_inject: false
prior_kind: "uniform"
bn: true
dp: null
23 changes: 23 additions & 0 deletions conf/model/small.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
omic_cls_hiddens: []
omic_cls_latents: 100
global_hiddens: []
att_method: "gate"
att_kwargs:
use_tanh: false
attention_score_method: "sigmoid"
add_bn_after_att: true
gumbel_reparam: true
y_gen: true

omic_enc_hiddens: [250]
omic_n_latents:
rna: 100
CN: 100
meth: 100
miRNA: 30
omic_dec_hiddens: [100]
omic_enc_inject: true
omic_dec_inject: false
prior_kind: "uniform" # [0.9, 0.1]
bn: true
dp: null
21 changes: 21 additions & 0 deletions conf/train/pan.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
n_epoch: 500
bs: 512
lr: 0.0005
nw: 8
device: cuda:0
tensorboard: "PAN"
evaluation: 1
verbose: null
early_stop:
metric: "loss"
patience: 10
verbose: false
delta: 1.0
lr_sch: true
optim_method: "adam"
weight_decay: 0.
kly_anneal: "cosine"
kly_anneal_args: {"maxv": 10, "minv": 3}
rec_anneal: "constant"
rec_anneal_args: {"minv": 1.}
kl_weight: 1.
21 changes: 21 additions & 0 deletions conf/train/sub.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
n_epoch: 500
bs: 32
lr: 0.0005
nw: 2
device: cuda:2
tensorboard: _datname
evaluation: 1
verbose: null
early_stop:
metric: "loss"
patience: 10
verbose: false
delta: 1.0
lr_sch: true
optim_method: "adam"
weight_decay: 0.
kly_anneal: "cosine"
kly_anneal_args: {"maxv": 10, "minv": 1}
rec_anneal: "constant"
rec_anneal_args: {"minv": 1}
kl_weight: 1.
13 changes: 13 additions & 0 deletions environment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# first, make sure that there is enough disk space
# then, create a new conda environment
# finally, run this script
set -v

conda install python=3.9 -y
conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch -y
conda install numpy pandas matplotlib seaborn tqdm scikit-learn -c conda-forge -y
conda install lifelines optuna -c conda-forge -y
conda install flake8 ipdb jupyterlab tensorboard -c conda-forge -y

# pip的版本更高
pip install hydra-core
Loading

0 comments on commit a399806

Please sign in to comment.