Skip to content

Instantly share code, notes, and snippets.

@sash-kan
Last active May 10, 2021 17:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sash-kan/2e629bdae2fe9250ceb0d312de261adf to your computer and use it in GitHub Desktop.
Save sash-kan/2e629bdae2fe9250ceb0d312de261adf to your computer and use it in GitHub Desktop.
#!/urs/bin/env Rscript
# параметрами передать список csv-файлов:
# Rscript script.r *.csv
f <- function(n) {
csv <- read.csv(n)
list(name = tools::file_path_sans_ext(n),
dgmin = min(csv$dG),
popmin = paste('(',csv[which.min(csv$dG), 'POP'],')',sep=''),
dgpopmx = csv[which.max(csv$POP), 'dG'],
popmax = paste('(',csv[which.max(csv$dG), 'POP'],')',sep=''),
dgmean = mean(csv$dG)
)
}
write.table(
do.call(
rbind,
lapply(
commandArgs(
trailingOnly = T
),
f
)
),
#col.names = c("Lig(CNE).","dG(min)","POP(min)","dG(popMAX)","POP(max)","dG(mean)"),
row.names = F,
quote = F,
sep = "\t"
)
@sash-kan
Copy link
Author

не устанавливая пакета r-base-core, можно и docker-образом воспользоваться для теста. поместите этот скрипт и ваши *.csv в текущий каталог и выполните что-нибудь вроде $ docker run -it --rm -v $(pwd):/f dongzhuoer/rlang:base sh -c 'cd /f && Rscript script.r *.csv'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment