Im trying to map my clinical traits file in WGCNA but there seems to be some problem with the mataching (Note- My pheno/trait file has only the fields i require)
Code chunk 7-Read in Clinical Traits csv file
traitData = read.csv("phenofile_reqd_fields.csv");
dim(traitData) names(traitData)`
dim(traitData)
[1] 2611 11
names(traitData)
[1] "sid" "gender" "race" "ethnic"
[5] "smoking_status" "finalGold" "eosinphl_pct_calc" "monocyt_pct_calc"
[9] "neutrophl_pct_calc" "basophl_pct_calc" "lymphcyt_pct_calc"
-- remove columns that hold information we do not need-my csv file has only the fields i need so im not removing any columns:
allTraits = traitData;
allTraits = allTraits[,];
dim(allTraits)
names(allTraits)
--Form a data frame analogous to expression data that will hold the clinical traits.
femaleSamples = rownames(datExpr0);
traitRows = match(femaleSamples, allTraits$sid);
datTraits = allTraits[traitRows, -1];
rownames(datTraits) = allTraits[traitRows, 1];
dim(allTraits)
[1] 2611 11
names(allTraits)
[1] "sid" "gender" "race" "ethnic"
[5] "smoking_status" "finalGold" "eosinphl_pct_calc" "monocyt_pct_calc"
[9] "neutrophl_pct_calc" "basophl_pct_calc" "lymphcyt_pct_calc"
--Form a data frame analogous to expression data that will hold the clinical traits.
femaleSamples = rownames(datExpr0);
traitRows = match(femaleSamples, allTraits$sid);
datTraits = allTraits[traitRows, -1];
rownames(datTraits) = allTraits[traitRows, 1];
when i run the above i get:
Error in
.rowNamesDF<-
(x, value = value) : duplicate 'row.names' are not allowed In addition: Warning message: non-unique values when setting 'row.names':
But ive checked and there are no duplicate records in my data.
Also my allTraits looks like my original csv file with the first column with my "sid" values and has all the values under the column headings.
allTraits
sid gender race ethnic smoking_status finalGold eosinphl_pct_calc monocyt_pct_calc
10010J 2 1 2 1 3 2 7
. 10025W 1 2 2 1 4 0 7
10052Z 1 1 2 2 3 2 9 4 10055F 1 2 2 1 0 3 8 5 10060Y 1 1 2 1 4 3 12 6 10065I 2 1 2 1 1 4 8 7 10076N 1 1 2 1 1 1 7
But my datTraits looks like this-
datTraits
gender race ethnic smoking_status finalGold eosinphl_pct_calc monocyt_pct_calc NA NA NA NA NA NA NA NA NA.1 NA NA NA NA NA NA NA NA.2 NA NA NA NA NA NA NA NA.3 NA NA NA NA NA NA NA NA.4 NA NA NA NA NA NA NA NA.5 NA NA NA NA NA NA NA NA.6 NA NA NA NA NA NA NA NA.7 NA NA NA NA NA NA NA