Skip to content

Commit 8f96632

Browse files
committed
minor bugfixes
1 parent 1bbb804 commit 8f96632

File tree

8 files changed

+94
-146
lines changed

8 files changed

+94
-146
lines changed

DESCRIPTION

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: IgGeneUsage
22
Type: Package
33
Title: Differential gene usage in immune repertoires
4-
Version: 1.17.14
4+
Version: 1.17.15
55
Authors@R:
66
person(given = "Simo",
77
family = "Kitanovski",
@@ -33,8 +33,7 @@ Suggests:
3333
ggplot2,
3434
ggforce,
3535
gridExtra,
36-
ggrepel,
37-
MASS
36+
ggrepel
3837
LinkingTo:
3938
BH (>= 1.66.0),
4039
Rcpp (>= 0.12.0),

inst/stan/dgu.stan

+14-14
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@ data {
3333
int<lower=0> N_gene; // gene
3434
int<lower=0> N_individual; // number of individuals
3535
int<lower=0> N_condition; // number of conditions
36-
array[N_individual] int N; // number of tries (repertoire size)
37-
array[N_gene, N_individual] int Y; // number of heads for each coin
38-
array[N_individual] int condition_id; // id of conditions
39-
array[N_individual] int individual_id; // id of replicate
36+
array [N_individual] int N; // number of tries (repertoire size)
37+
array [N_gene, N_individual] int Y; // number of heads for each coin
38+
array [N_individual] int condition_id; // id of conditions
39+
array [N_individual] int individual_id; // id of replicate
4040
}
4141

4242
transformed data {
4343
// convert int N -> real N fo convenient division
4444
// in generated quantities block
45-
real Nr [N_individual];
45+
array [N_individual] real Nr;
4646
Nr = N;
4747
}
4848

@@ -55,14 +55,14 @@ parameters {
5555
vector <lower=0> [N_condition] sigma_condition;
5656
vector <lower=0> [N_condition] sigma_individual;
5757

58-
array[N_individual] vector [N_gene] z_beta_individual;
59-
array[N_condition] vector [N_gene] z_beta_condition;
58+
array [N_individual] vector [N_gene] z_beta_individual;
59+
array [N_condition] vector [N_gene] z_beta_condition;
6060
}
6161

6262
transformed parameters {
63-
array[N_individual] vector <lower=0, upper=1> [N_gene] theta;
64-
array[N_individual] vector [N_gene] beta_individual;
65-
array[N_condition] vector [N_gene] beta_condition;
63+
array [N_individual] vector <lower=0, upper=1> [N_gene] theta;
64+
array [N_individual] vector [N_gene] beta_individual;
65+
array [N_condition] vector [N_gene] beta_condition;
6666

6767
for(i in 1:N_condition) {
6868
beta_condition[i] = 0 + sigma_condition[i] * z_beta_condition[i];
@@ -98,16 +98,16 @@ model {
9898

9999
generated quantities {
100100
// PPC: count usage (repertoire-level)
101-
int Yhat_rep [N_gene, N_individual];
101+
array [N_gene, N_individual] int Yhat_rep;
102102

103103
// PPC: proportion usage (repertoire-level)
104-
real Yhat_rep_prop [N_gene, N_individual];
104+
array [N_gene, N_individual] real Yhat_rep_prop;
105105

106106
// PPC: proportion usage at a gene level in condition
107-
vector [N_gene] Yhat_condition_prop [N_condition];
107+
array [N_condition] vector [N_gene] Yhat_condition_prop;
108108

109109
// LOG-LIK
110-
vector [N_gene] log_lik [N_individual];
110+
array [N_individual] vector [N_gene] log_lik;
111111

112112
// DGU matrix
113113
matrix [N_gene, N_condition*(N_condition-1)/2] dgu;

inst/stan/dgu_rep.stan

+16-16
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,16 @@ data {
3232
int<lower=0> N_gene; // gene
3333
int<lower=0> N_individual; // number of individuals
3434
int<lower=0> N_condition; // number of conditions
35-
array[N_sample] int N; // number of tries (repertoire size)
36-
array[N_gene, N_sample] int Y; // number of heads for each coin
37-
array[N_individual] int condition_id; // id of conditions
38-
array[N_sample] int individual_id; // id of replicate
35+
array [N_sample] int N; // number of tries (repertoire size)
36+
array [N_gene, N_sample] int Y; // number of heads for each coin
37+
array [N_individual] int condition_id; // id of conditions
38+
array [N_sample] int individual_id; // id of replicate
3939
}
4040

4141
transformed data {
4242
// convert int N -> real N fo convenient division
4343
// in generated quantities block
44-
real Nr [N_sample];
44+
array [N_sample] real Nr;
4545
Nr = N;
4646
}
4747

@@ -55,17 +55,17 @@ parameters {
5555
vector <lower=0> [N_condition] sigma_individual;
5656
real <lower=0> sigma_replicate;
5757

58-
array[N_sample] vector [N_gene] z_beta_sample;
59-
array[N_individual] vector [N_gene] z_beta_individual;
60-
array[N_condition] vector [N_gene] z_beta_condition;
58+
array [N_sample] vector [N_gene] z_beta_sample;
59+
array [N_individual] vector [N_gene] z_beta_individual;
60+
array [N_condition] vector [N_gene] z_beta_condition;
6161
}
6262

6363

6464
transformed parameters {
65-
array[N_sample] vector <lower=0, upper=1> [N_gene] theta;
66-
array[N_sample] vector [N_gene] beta_sample;
67-
array[N_condition] vector [N_gene] beta_condition;
68-
array[N_individual] vector [N_gene] beta_individual;
65+
array [N_sample] vector <lower=0, upper=1> [N_gene] theta;
66+
array [N_sample] vector [N_gene] beta_sample;
67+
array [N_condition] vector [N_gene] beta_condition;
68+
array [N_individual] vector [N_gene] beta_individual;
6969

7070
for(i in 1:N_condition) {
7171
beta_condition[i] = 0 + sigma_condition[i] * z_beta_condition[i];
@@ -109,16 +109,16 @@ model {
109109

110110
generated quantities {
111111
// PPC: count usage (repertoire-level)
112-
int Yhat_rep [N_gene, N_sample];
112+
array [N_gene, N_sample] int Yhat_rep;
113113

114114
// PPC: proportion usage (repertoire-level)
115-
real Yhat_rep_prop [N_gene, N_sample];
115+
array [N_gene, N_sample] real Yhat_rep_prop;
116116

117117
// PPC: proportion usage at a gene level in condition
118-
vector [N_gene] Yhat_condition_prop [N_condition];
118+
array [N_condition] vector [N_gene] Yhat_condition_prop;
119119

120120
// LOG-LIK
121-
vector [N_gene] log_lik [N_sample];
121+
array [N_sample] vector [N_gene] log_lik;
122122

123123
// DGU matrix
124124
matrix [N_gene, N_condition*(N_condition-1)/2] dgu;

inst/stan/gu.stan

+12-12
Original file line numberDiff line numberDiff line change
@@ -33,31 +33,31 @@ data {
3333
int<lower=0> N_gene; // gene
3434
int<lower=0> N_individual; // number of individuals
3535
int<lower=0> N_condition; // number of conditions
36-
array[N_individual] int N; // number of tries (repertoire size)
37-
array[N_gene, N_individual] int Y; // number of heads for each coin
38-
array[N_individual] int condition_id; // id of conditions
39-
array[N_individual] int individual_id; // id of replicate
36+
array [N_individual] int N; // number of tries (repertoire size)
37+
array [N_gene, N_individual] int Y; // number of heads for each coin
38+
array [N_individual] int condition_id; // id of conditions
39+
array [N_individual] int individual_id; // id of replicate
4040
}
4141

4242
transformed data {
4343
// convert int N -> real N fo convenient division
4444
// in generated quantities block
45-
real Nr [N_individual];
45+
array [N_individual] real Nr;
4646
Nr = N;
4747
}
4848

4949
parameters {
5050
real <lower=0> phi;
5151
real <lower=0, upper=1> kappa;
5252
real <lower=0> sigma_individual;
53-
array[N_individual] vector [N_gene] z_beta_individual;
53+
array [N_individual] vector [N_gene] z_beta_individual;
5454
vector [N_gene] beta_condition;
5555
}
5656

5757
transformed parameters {
58-
array[N_individual] vector <lower=0, upper=1> [N_gene] theta;
59-
array[N_individual] vector [N_gene] beta_sample;
60-
array[N_individual] vector [N_gene] beta_individual;
58+
array [N_individual] vector <lower=0, upper=1> [N_gene] theta;
59+
array [N_individual] vector [N_gene] beta_sample;
60+
array [N_individual] vector [N_gene] beta_individual;
6161

6262
for(i in 1:N_individual) {
6363
beta_individual[i] = beta_condition + sigma_individual * z_beta_individual[i];
@@ -85,16 +85,16 @@ model {
8585

8686
generated quantities {
8787
// PPC: count usage (repertoire-level)
88-
int Yhat_rep [N_gene, N_individual];
88+
array [N_gene, N_individual] int Yhat_rep;
8989

9090
// PPC: proportion usage (repertoire-level)
91-
real Yhat_rep_prop [N_gene, N_individual];
91+
array [N_gene, N_individual] real Yhat_rep_prop;
9292

9393
// PPC: proportion usage at a gene level in condition
9494
vector [N_gene] Yhat_condition_prop;
9595

9696
// LOG-LIK
97-
vector [N_gene] log_lik [N_individual];
97+
array [N_individual] vector [N_gene] log_lik;
9898

9999
//TODO: speedup, run in C++ not big factor on performance
100100
for(j in 1:N_gene) {

inst/stan/gu_rep.stan

+13-13
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,16 @@ data {
3232
int<lower=0> N_gene; // gene
3333
int<lower=0> N_individual; // number of individuals
3434
int<lower=0> N_condition; // number of conditions
35-
array[N_sample] int N; // number of tries (repertoire size)
36-
array[N_gene, N_sample] int Y; // number of heads for each coin
37-
array[N_individual] int condition_id; // id of conditions
38-
array[N_sample] int individual_id; // id of replicate
35+
array [N_sample] int N; // number of tries (repertoire size)
36+
array [N_gene, N_sample] int Y; // number of heads for each coin
37+
array [N_individual] int condition_id; // id of conditions
38+
array [N_sample] int individual_id; // id of replicate
3939
}
4040

4141
transformed data {
4242
// convert int N -> real N fo convenient division
4343
// in generated quantities block
44-
real Nr [N_sample];
44+
array [N_sample] real Nr;
4545
Nr = N;
4646
}
4747

@@ -52,17 +52,17 @@ parameters {
5252
real <lower=0> sigma_individual;
5353
real <lower=0> sigma_replicate;
5454

55-
array[N_sample] vector [N_gene] z_beta_sample;
56-
array[N_individual] vector [N_gene] z_beta_individual;
55+
array [N_sample] vector [N_gene] z_beta_sample;
56+
array [N_individual] vector [N_gene] z_beta_individual;
5757

5858
vector [N_gene] beta_condition;
5959
}
6060

6161

6262
transformed parameters {
63-
array[N_sample] vector <lower=0, upper=1> [N_gene] theta;
64-
array[N_sample] vector [N_gene] beta_sample;
65-
array[N_individual] vector [N_gene] beta_individual;
63+
array [N_sample] vector <lower=0, upper=1> [N_gene] theta;
64+
array [N_sample] vector [N_gene] beta_sample;
65+
array [N_individual] vector [N_gene] beta_individual;
6666

6767
for(i in 1:N_individual) {
6868
beta_individual[i] = beta_condition + sigma_individual * z_beta_individual[i];
@@ -98,16 +98,16 @@ model {
9898

9999
generated quantities {
100100
// PPC: count usage (repertoire-level)
101-
int Yhat_rep [N_gene, N_sample];
101+
array [N_gene, N_sample] int Yhat_rep;
102102

103103
// PPC: proportion usage (repertoire-level)
104-
real Yhat_rep_prop [N_gene, N_sample];
104+
array [N_gene, N_sample] real Yhat_rep_prop;
105105

106106
// PPC: proportion usage at a gene level in condition
107107
vector [N_gene] Yhat_condition_prop;
108108

109109
// LOG-LIK
110-
vector [N_gene] log_lik [N_sample];
110+
array [N_sample] vector [N_gene] log_lik;
111111

112112
//TODO: speedup, run in C++ not big factor on performance
113113
for(j in 1:N_gene) {

man/DGU.Rd

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ DGU(ud,
2222
}
2323

2424
\arguments{
25-
\item{ud}{Data.frame with 4 columns:
25+
\item{ud}{Data.frame with 4 or 5 columns:
2626
\itemize{
2727
\item 'individual_id' = character, name of the donor (e.g. Pt1)
2828
\item 'condition' = character, name of biological conditions (e.g. tumor)
2929
\item 'gene_name' = character, Ig gene name (e.g. IGHV1-69)
3030
\item 'gene_usage_count' = number, frequency (=usage) of rearrangements from
3131
individual_id x condition x gene_name
32-
\item [optional] 'repertoire' = character or number, if more than one
33-
repertoire (biological replicates) is available per individual
32+
\item [optional] 'replicate' = character or number. Replicate id, if more than
33+
one repertoire (biological replicates) is available per individual
3434
}
3535
ud can also be be a SummarizedExperiment object. See examplary data
3636
'data(Ig_SE)' for more information.

man/LOO.Rd

+2-3
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,8 @@ LOO(ud,
5050
\item 'gene_name' = character, Ig gene name (e.g. IGHV1-69)
5151
\item 'gene_usage_count' = number, frequency (=usage) of rearrangements from
5252
individual_id x condition x gene_name
53-
54-
\item [optional] 'repertoire' = character or number, if more than one
55-
repertoire (biological replicates) is available per individual
53+
\item [optional] 'replicate' = character or number. Replicate id, if more than
54+
one repertoire (biological replicates) is available per individual
5655
}
5756
ud can also be be a SummarizedExperiment object. See dataset
5857
'data(Ig_SE)' for more information.

0 commit comments

Comments
 (0)