Order of 10+ samples
Jelinek-J opened this issue · 1 comments
Jelinek-J commented
If there are less than 10 samples, they are correctly ordered S1_X...
, S2_X...
, S3_X...
...
But if there are e.g. 21 samples, they are ordered as S1_X...
, S10_X...
, S11_X...
, ...,S19_X...
, S2_X...
, S20_X...
, S21_X...
, S3_X...
, S4_X...
, ..., S9_X...
, so the original order is lost.
Probably the easiest repair is to add enough leading zeros to all numbers have the same length.
E.g. to replace
tmp[[paste("S", as.character(i), "_", sample, "_reads_info", sep="")]] <- reads[,sample]
tmp[[paste("S", as.character(i), "_", sample, "_rrna_per_info", sep="")]] <- rperc[,sample]
with
tmp[[paste("S", sprintf(paste0("%0",nchar(as.character(length(samples))),"d"),i), "_", sample, "_reads_info", sep="")]] <- reads[,sample]
tmp[[paste("S", sprintf(paste0("%0",nchar(as.character(length(samples))),"d"),i), "_", sample, "_rrna_per_info", sep="")]] <- rperc[,sample]
I.e. replace as.character(i)
with sprintf(paste0("%0",nchar(as.character(length(samples))),"d"),i)
.
ferhatalkan commented
Thank you very much for noticing this. In the new release I will fix this.