Description Usage Arguments Value See Also Examples
View source: R/principal.component.R
In order to perform the projection method, disease status for all individuals are required. First, PCA is performed only in control group, then project the scores from control group into case group.
1 2 3 4 5 6 7 8 | cal.pc.projection(
X,
status,
individual_id = NULL,
labels = NULL,
no.pc = NA,
data.type = "linear"
)
|
X |
A data matrix which rows represent samples and columns represent features. |
status |
A vector of numbers that contains disease status for all individuals. For control group, the status is "1", and "2" for case group. Individuals with unknown status (other numbers) are ignored and excluded from the result. |
individual_id |
A vector of charactors that contains individuals IDs |
labels |
A vector of charactors that contains labels for all lindividuals |
no.pc |
A number of PCs to be calculated. If no.pc is set, PCs are patially calculated. Otherwise all PCs are obtained after calculation. Default = NA. |
data.type |
To specify a type of data matrix X. It can be set to "linear" and "snp". Default = "linear". |
The returned value is a list with 4 objects, $PC
,
$id
, $label
,and $status
. Individuals with unknown status
are excluded.
$PC
is a PC matrix which rows represent samples and columns
represent PCs.
$individual_id
is a vector of charactors that contains individuals IDs.
$label
is a vector of charactors that contains labels for all lindividuals.
$status
is a vector of numbers that contains disease status for all.
individuals.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | data(example_SNP)
#Create a random list of disease status, 1 = Control and 2 = Case
ind_status <- sample(c(1,2), size = length(sample_labels), replace = TRUE)
PCs <- cal.pc.projection(simsnp$snp, status = ind_status,
labels = sample_labels)
summary(PCs)
#Preview $PC
print(PCs$PC[1:5,1:3])
#Preview $status
print(PCs$status[1:3])
plot3views(PCs$PC[,1:3], PCs$label)
#Calculate the top 3 PCs
PCs <- cal.pc.projection(simsnp$snp, status = ind_status,
labels = sample_labels, no.pc = 3)
summary(PCs)
#Preview $PC
print(PCs$PC[1:5,1:3])
plot3views(PCs$PC[,1:3], PCs$label)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.