new file: cell2loc.py
[GalaxyCodeBases.git] / perl / etc / justonce / sperm / getlm.r
blob6740f887522d488ede9d847d8b9065bec6f7a0b4
1 #!/usr/bin/env littler
3 # R --save < lm.R --args bamrsplot.tsv tsv/nrss1m.tsv read.lm uncover.lm base.lm
5 # gzcat bamrsplot8.tsv.gz|perl -lane 'print $_ unless $F[0] =~ /[XYM]/i' > bamrsplot8.auto.tsv
6 # gzcat rss1m.tsv.gz|perl -lane 'print $_ unless $F[0] =~ /[XYM]/i' > rss1m.auto.tsv
7 # mv base.lm read.lm uncover.lm t/
8 names <- c("MDA-Blood","MALBAC-Blood","MDA-Sperm23","MDA-Sperm24","MDA-Sperm28","MALBAC-SpermS01","MALBAC-SpermS02","MALBAC-SpermS03")
9 theLen <- length(names)
11 DATa <- read.table("bamrsplot8.auto.tsv",skip=1)
12 DATb <- read.table("rss1m.auto.tsv",skip=3)
14 for (i in seq(3,1+theLen)) {
15 for (j in seq(i+1,2+theLen)) {
16 ta <- cor.test(DATa[,i],DATa[,j],method='pearson')
17 tb <- cor.test(DATa[,i],DATa[,j],method='kendall')
19 cat(as.character(names[i-2]), as.character(names[j-2]), as.character(ta$p.value), as.character(ta$estimate), as.character(tb$p.value), as.character(tb$estimate),"\n",file='read.lm',append=T,sep="\t")
23 for (i in seq(3,2+theLen)){
24 var=sd(DATa[,i])/mean(DATa[,i])
25 cat(as.character(names[i-2]), as.character(var),"\n",file='read.lm',append=T,sep="\t")
28 for (i in seq(3+theLen,1+2*theLen)) {
29 for (j in seq(i+1,2+2*theLen)) {
30 ta <- cor.test(DATb[,i],DATb[,j],method='pearson')
31 tb <- cor.test(DATb[,i],DATb[,j],method='kendall')
32 cat(as.character(names[i-2-theLen]), as.character(names[j-2-theLen]), as.character(ta$p.value), as.character(ta$estimate), as.character(tb$p.value), as.character(tb$estimate),"\n",file='uncover.lm',append=T,sep="\t")
36 for(i in seq(3+theLen,2+2*theLen)){
37 var=sd(DATb[,i])/mean(DATb[,i])
38 cat(as.character(names[i-2-theLen]), as.character(var),"\n",file='uncover.lm',append=T,sep="\t")
41 for (i in seq(3+3*theLen,1+4*theLen)) {
42 for (j in seq(i+1,2+4*theLen)) {
43 ta <- cor.test(DATb[,i],DATb[,j],method='pearson')
44 tb <- cor.test(DATb[,i],DATb[,j],method='kendall')
45 cat(as.character(names[i-2-3*theLen]), as.character(names[j-2-3*theLen]), as.character(ta$p.value), as.character(ta$estimate), as.character(tb$p.value), as.character(tb$estimate),"\n",file='base.lm',append=T,sep="\t")
49 for(i in seq(3+3*theLen,2+4*theLen)){
50 var=sd(DATb[,i])/mean(DATb[,i])
51 cat(as.character(names[i-2-3*theLen]),as.character(var),"\n",file='base.lm',append=T,sep="\t")