rbbt-util 5.21.53 → 5.21.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/share/Rlib/util.R +23 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2694c3dd908e3b5711942aa887313585c82eb817
|
4
|
+
data.tar.gz: 3f2383f88770be0bb1dabab5dd365f46ce46752f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd8982733ba669ea67403459e8fbe0742c5909cffedfe1725629bd704c716669ec64a3f177d00ed2daf6d85af83b8ed6a25fd1cda23f92b88e40c1c343d53d68
|
7
|
+
data.tar.gz: a2f22166721bd4a0d752afaf1062df290524fabe899e4fb383b85a2edfd5d4b27e3611781b5076bd26d73f16f9e123cdc12fb1f84df12887b7f50c646ae5e7b8
|
data/share/Rlib/util.R
CHANGED
@@ -97,8 +97,7 @@ rbbt.flat.tsv <- function(filename, sep = "\t", comment.char ="#", ...){
|
|
97
97
|
return(result);
|
98
98
|
}
|
99
99
|
|
100
|
-
rbbt.tsv <- function(filename, sep
|
101
|
-
data=read.table(file=filename, sep=sep, fill=fill, as.is=as.is, quote=quote, row.names= row.names, comment.char = comment.char, ...);
|
100
|
+
rbbt.tsv.columns <- function(filename, sep="\t"){
|
102
101
|
f = file(filename, 'r');
|
103
102
|
headers = readLines(f, 1);
|
104
103
|
if (length(grep("^#:", headers)) > 0){
|
@@ -106,13 +105,33 @@ rbbt.tsv <- function(filename, sep = "\t", comment.char ="#", row.names=1, check
|
|
106
105
|
}
|
107
106
|
if (length(grep("^#", headers)) > 0){
|
108
107
|
fields = strsplit(headers, sep)[[1]];
|
109
|
-
|
110
|
-
|
108
|
+
close(f);
|
109
|
+
return(fields);
|
111
110
|
}
|
112
111
|
close(f);
|
112
|
+
return(NULL);
|
113
|
+
}
|
114
|
+
|
115
|
+
rbbt.tsv <- function(filename, sep = "\t", comment.char ="#", row.names=1, check.names=FALSE, fill=TRUE, as.is=TRUE, quote='', ...){
|
116
|
+
data=read.table(file=filename, sep=sep, fill=fill, as.is=as.is, quote=quote, row.names= row.names, comment.char = comment.char, ...);
|
117
|
+
|
118
|
+
columns = rbbt.tsv.columns(filename, sep)
|
119
|
+
if (! is.null(columns)){
|
120
|
+
names(data) <- columns[2:length(columns)];
|
121
|
+
}
|
122
|
+
|
113
123
|
return(data);
|
114
124
|
}
|
115
125
|
|
126
|
+
rbbt.tsv.numeric <- function(filename, sep="\t", ...){
|
127
|
+
|
128
|
+
columns = rbbt.tsv.columns(filename, sep)
|
129
|
+
|
130
|
+
colClasses = c('character', rep('numeric', length(columns) - 1))
|
131
|
+
|
132
|
+
return(rbbt.tsv(filename, sep, colClasses= colClasses, ...))
|
133
|
+
}
|
134
|
+
|
116
135
|
rbbt.tsv2matrix <- function(data){
|
117
136
|
new <- data.matrix(data);
|
118
137
|
colnames(new) <- colnames(data);
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbbt-util
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.21.
|
4
|
+
version: 5.21.54
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|