rbbt-util 5.21.86 → 5.21.87
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/lib/rbbt/tsv/util.rb +1 -1
- data/lib/rbbt/util/misc/system.rb +1 -0
- data/share/Rlib/util.R +17 -9
- 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: 88ef613a2ceb07588403878b6f87982221a4d7fb
|
4
|
+
data.tar.gz: d9d54cd91f619d9bead8d8d072f115eff635774b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65fc0ea4c70a2ca5902e786addebf0741d11f6ad402087cf1e8516b953365fa1ae8c42091185a8a6d6352e710cb1b7269dba00c7c149ea8b55bfb93445865c28
|
7
|
+
data.tar.gz: f5a050a28355d674cbb95d887686bb13a74feac6ecd1540548912acc34ac4442c829e103223871d9e98d2a925324562734c829237df05de924ae5bddebc04b10
|
data/lib/rbbt/tsv/util.rb
CHANGED
data/share/Rlib/util.R
CHANGED
@@ -89,29 +89,32 @@ rbbt.load.data <- function(filename, sep = "\t", ...){
|
|
89
89
|
|
90
90
|
rbbt.flat.tsv <- function(filename, sep = "\t", comment.char ="#", ...){
|
91
91
|
f = file(filename, 'r');
|
92
|
-
|
93
|
-
if (length(grep("^#: ",
|
94
|
-
|
92
|
+
line = readLines(f, 1);
|
93
|
+
if (length(grep("^#: ", line)) > 0){
|
94
|
+
line = readLines(f, 1);
|
95
|
+
}
|
96
|
+
if (comment.char=="" || length(grep("^# ", line)) > 0){
|
97
|
+
line = readLines(f, 1);
|
95
98
|
}
|
96
99
|
result = list();
|
97
100
|
while( TRUE ){
|
98
|
-
line = readLines(f, 1);
|
99
|
-
if (length(line) == 0){ break;}
|
100
101
|
parts = unlist(strsplit(line, sep, fixed = TRUE));
|
101
102
|
id = parts[1];
|
102
103
|
result[[id]] = parts[2:length(parts)];
|
104
|
+
line = readLines(f, 1);
|
105
|
+
if (length(line) == 0){ break;}
|
103
106
|
}
|
104
107
|
close(f);
|
105
108
|
return(result);
|
106
109
|
}
|
107
110
|
|
108
|
-
rbbt.tsv.columns <- function(filename, sep="\t"){
|
111
|
+
rbbt.tsv.columns <- function(filename, sep="\t", comment.char="#"){
|
109
112
|
f = file(filename, 'r');
|
110
113
|
headers = readLines(f, 1);
|
111
114
|
if (length(grep("^#:", headers)) > 0){
|
112
115
|
headers = readLines(f, 1);
|
113
116
|
}
|
114
|
-
if (length(grep("^#", headers)) > 0){
|
117
|
+
if (comment.char == "" || length(grep("^#", headers)) > 0){
|
115
118
|
fields = strsplit(headers, sep)[[1]];
|
116
119
|
close(f);
|
117
120
|
return(fields);
|
@@ -121,9 +124,14 @@ rbbt.tsv.columns <- function(filename, sep="\t"){
|
|
121
124
|
}
|
122
125
|
|
123
126
|
rbbt.tsv <- function(filename, sep = "\t", comment.char ="#", row.names=1, check.names=FALSE, fill=TRUE, as.is=TRUE, quote='', ...){
|
124
|
-
|
127
|
+
|
128
|
+
if (comment.char == ""){
|
129
|
+
data=read.table(file=filename, sep=sep, fill=fill, as.is=as.is, quote=quote, row.names= row.names, comment.char = comment.char, skip=1, ...);
|
130
|
+
}else{
|
131
|
+
data=read.table(file=filename, sep=sep, fill=fill, as.is=as.is, quote=quote, row.names= row.names, comment.char = comment.char, ...);
|
132
|
+
}
|
125
133
|
|
126
|
-
columns = rbbt.tsv.columns(filename, sep)
|
134
|
+
columns = rbbt.tsv.columns(filename, sep, comment.char=comment.char)
|
127
135
|
if (! is.null(columns)){
|
128
136
|
names(data) <- columns[2:length(columns)];
|
129
137
|
}
|
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.87
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|