@@ -83,22 +83,56 @@ read_varian_sms <- function(path, what = c("chrom", "MS1"),
83
83
dat <- collapse_list(dat )
84
84
if (read_metadata ){
85
85
offsets <- read_varian_offsets(f )
86
+
86
87
prep_offset <- offsets [grep(" SamplePrep" , offsets $ name ), " start" ]
87
88
seek(f , prep_offset )
88
89
meta $ sample_name <- readBin(f ," character" )
89
- mod_offset <- offsets [grep(" ModAttr" , offsets $ name ), " start" ]
90
- seek(f , mod_offset )
91
- readBin(f , " raw" , n = 2 )
92
- meta $ software <- readBin(f ," character" )
93
- skip_null_bytes(f )
94
- meta $ version <- readBin(f ," character" )
90
+
91
+ meta <- read_mod_metadata(f , offsets , meta )
92
+
95
93
dat <- attach_metadata(dat , meta , format_in = " varian_sms" ,
96
94
format_out = format_out , data_format = data_format ,
97
95
source_file = path )
98
96
}
99
97
dat
100
98
}
101
99
100
+ # ' @noRd
101
+ read_mod_metadata <- function (f , offsets , meta ){
102
+ mod_offset <- offsets [grep(" ModAttr" , offsets $ name ), " start" ]
103
+ seek(f , mod_offset )
104
+ readBin(f , " raw" , n = 2 )
105
+ meta $ software <- readBin(f ," character" )
106
+ skip_null_bytes(f )
107
+
108
+ meta $ version <- readBin(f ," character" )
109
+ skip_null_bytes(f )
110
+
111
+ readBin(f , " raw" , n = 3 ) # skip
112
+ skip_null_bytes(f )
113
+
114
+ meta $ temp_trap <- readBin(f , " integer" , size = 2 ,
115
+ signed = FALSE , endian = " little" )
116
+
117
+ meta $ temp_manifold <- readBin(f , " integer" , size = 2 ,
118
+ signed = FALSE , endian = " little" )
119
+
120
+ meta $ temp_transferline <- readBin(f , " integer" , size = 2 ,
121
+ signed = FALSE , endian = " little" )
122
+
123
+ readBin(f , " integer" , size = 2 ,
124
+ signed = FALSE , endian = " little" )
125
+
126
+ meta $ axial_modulation <- readBin(f , " integer" , size = 2 ,
127
+ signed = FALSE , endian = " little" )/ 10
128
+ # unknown date
129
+ # meta$date <- as.POSIXct(readBin(f, "integer", size=4, endian = "little"))
130
+
131
+ # seek(f, 12, origin = "current") # skip 12 bytes
132
+ # readBin(f, "double", size=8) #air water check
133
+ meta
134
+ }
135
+
102
136
# ' Read 'Varian Workstation' Chromatograms
103
137
# ' @author Ethan Bass
104
138
# ' @noRd
@@ -292,9 +326,9 @@ read_varian_msdata_header <- function(f){
292
326
293
327
u5 <- readBin(f , what = " integer" , size = 2 , endian = " little" ,
294
328
signed = FALSE )
295
- readBin(f , what = " integer" , size = 2 , endian = " little" ) # skip
296
329
297
- readBin(f , what = " raw" , n = 12 ) # skip
330
+ readBin(f , what = " integer" , size = 2 , endian = " little" ) # skip
331
+ readBin(f , what = " raw" , n = 12 ) # skip
298
332
299
333
# reader segment headers
300
334
seg_no <- readBin(f , what = " integer" , size = 2 )
0 commit comments