Skip to content

Commit

Permalink
add test dataset for acqus file that needs symlink
Browse files Browse the repository at this point in the history
and remove redundant post symlink check as the links are only done when
no files exist
  • Loading branch information
cpauvert committed Aug 29, 2023
1 parent 2d23094 commit 66956a2
Show file tree
Hide file tree
Showing 5 changed files with 307 additions and 14 deletions.
6 changes: 0 additions & 6 deletions R/import_biotyper_spectra.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,6 @@ import_biotyper_spectra <- function(biotyper_directory, remove_calibration = c("
from = acqus_files[do_symbolic_links],
to = acqu_files[do_symbolic_links]
)
if (any(!links_status)) {
stop(
"Symbolic links could not be created for the files:",
acqus_files[!links_status]
)
}
}
# MALDIquantForeign::importBrukerFlex depends on
# readMzXmlData (>= 2.7) which itself needs R >= 4.2.0
Expand Down
22 changes: 15 additions & 7 deletions dev/import-data.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -499,12 +499,6 @@ import_biotyper_spectra <- function(biotyper_directory, remove_calibration = c("
from = acqus_files[do_symbolic_links],
to = acqu_files[do_symbolic_links]
)
if (any(!links_status)) {
stop(
"Symbolic links could not be created for the files:",
acqus_files[!links_status]
)
}
}
# MALDIquantForeign::importBrukerFlex depends on
# readMzXmlData (>= 2.7) which itself needs R >= 4.2.0
Expand Down Expand Up @@ -551,15 +545,29 @@ spectra_list

```{r tests-import_biotyper_spectra}
directory_biotyper_spectra <- system.file("toy-species-spectra", package = "maldipickr")
spectra_list <- import_biotyper_spectra(directory_biotyper_spectra)
directory_biotyper_spectra_with_acqus <- system.file("with-acqus", package = "maldipickr")
test_that("import_biotyper_spectra works", {
expect_no_error(
spectra_list <- import_biotyper_spectra(directory_biotyper_spectra)
)
expect_length(
spectra_list, 6
)
expect_type(
spectra_list, "list"
)
})
test_that("import_biotyper_spectra works with symlinks",{
expect_no_error(
spectra_with_acqus <- import_biotyper_spectra(directory_biotyper_spectra_with_acqus)
)
expect_length(
spectra_with_acqus, 1
)
expect_type(
spectra_with_acqus, "list"
)
})
test_that("import_biotyper_spectra fails", {
expect_error(
import_biotyper_spectra(
Expand Down
277 changes: 277 additions & 0 deletions inst/with-acqus/species1/0_G2/1/1SLin/acqus
Original file line number Diff line number Diff line change
@@ -0,0 +1,277 @@
##TITLE= XMASS Parameter file
##JCAMPDX= 5.0
##DATATYPE= CONTINUOUS MASS SPECTRUM
##ORIGIN= XMASS, Bruker-Daltonics (USA) and Bruker-Daltonik (GER)
##OWNER= TOF User
##SPECTROMETER/DATASYSTEM= Bruker Flex Series
##.SPECTROMETER TYPE= TOF
##.INLET= DIRECT
##.IONIZATION MODE= LD+
##$ACQMID= 0
##$ACQVSMA= 3
##$ACQVSMI= 0
##$ADC= 1
##$ANT= no
##$AOfs= 1.3
##$AQOP_m= 0
##$AQ_mod= 1
##$ATTEN= 69.814812
##$AccE= 20000
##$AccE_is= 0
##$AppTyp= 0
##$BYTORDA= 0
##$CIDOn= no
##$CTOF= 0
##$Calmet= 1
##$CapEnt= -4000
##$CapExit= 0
##$CapHtr= 0
##$Corona= 0
##$Cycle= 100
##$Cyl= 0
##$DATE= 0
##$DCOff1= 0
##$DComp= no
##$DE= 625
##$DELAY= 19462
##$DIGTYP= 19
##$DPCAL1= 0
##$DR_end= 6
##$DR_set= 12
##$DR_strt= 12
##$DS= 0
##$DTATYPE= 0
##$DW= 2
##$DataTyp= 0
##$DefDly= 0
##$DeflOff= 30
##$DigDep= 8
##$DigTrig= 100
##$DryFlow= 0
##$DrySW= 0
##$DryTemp= 150
##$EOSTime= 0.92799997
##$EndP= -3500
##$Enhance= no
##$EsiMode= 0
##$Extract= 0
##$FASTON= no
##$FOV= 20
##$FPCAL1= 1
##$FPCAL2= 0
##$FPCAL3= 0
##$FPMASS= 2466.7
##$FPON= no
##$FPSHIFT= 0
##$FW= 2500
##$Flatlin= no
##$FpWinHi= 0
##$FpWinLo= 0
##$GDEDLY= 0
##$GDEON= yes
##$GDETime= 0
##$GSpotId= 0
##$GSpotno= 0
##$GatStr= 0
##$Gate= 100
##$HITURBO= no
##$HPCML3= 0
##$HPClBHi= 0
##$HPClBLo= 0
##$HPClOrd= 0
##$HPClUse= no
##$Hpcgc0= 0
##$Hpcgc2= 0
##$IS2BNDV= 0
##$ISD= no
##$InstTyp= 9
##$IsCalib= no
##$LASP= 1
##$LBNDVAL= 0
##$LINDIS= 0
##$LLNSBND= no
##$LasFoc= -1
##$LftHV1= 0
##$LftHV2= 0
##$Lift1= 0
##$Lift2= 0
##$MC2= 4
##$ML1= 5392738.36267813
##$ML1_raw= 5392738.36267813
##$ML2= 417.483287542185
##$ML2_raw= 417.483287542185
##$ML3= -0.0156441528320176
##$ML3_raw= -0.0156441528320176
##$MSupMz= 0
##$MW_low= 15
##$MapMode= 0
##$Masserr= 127.81149
##$MatSup= 0
##$NBL= 1
##$NC= 0
##$NS= 16
##$NSdigit= 1
##$NebFlow= 0
##$NebSW= 0
##$NebTemp= 30
##$NoSHOTS= 240
##$OFFSET= 1000
##$PAPS= 0
##$PIEDLY= 120
##$POLARI= 1
##$PR= 1
##$PULSER= 10
##$PULSREP= 10000
##$Parent= 1000
##$RBNDVAL= 0
##$REPHZ= 60
##$RFAmp= 600
##$RFFreq= 5
##$RG= 1
##$RLNSBND= no
##$RTSmoo= 0
##$Realign= 0
##$Ref2= 0
##$RefFull= 0
##$ReflE= 0
##$Repel= 20
##$RetTime= 0
##$RunDId= 0
##$RunId= 0
##$SF= 0
##$SFO1= 0
##$SPType= 0
##$SW= 0
##$SW_p= 100
##$SampId= 0
##$Sens1= 100
##$Sens2= 0
##$Skim1= 20
##$SumShot= 0
##$Sync= 1
##$TD= 20882
##$TIB= 5
##$TLft= 0
##$TLftCor= 0
##$TLift= 0
##$TPLMS= 0
##$TargId= 0
##$TgCount= 0
##$Trans= 100
##$Trap= 45
##$UDeflL= 0
##$UGrid= 0
##$UIS2BND= no
##$ULensR= 0
##$UPAcc= 0
##$URepel= 9000
##$Udefl= 0
##$UdetL= 2.722
##$UdetR= 0
##$Uhim= 0
##$Uhimass= 0
##$Uis1= 20
##$Uis2= 18.049999
##$Ulens= 6
##$Uref_is= 0
##$Urefl= 0
##$XLens= -50
##$YMAX_a= 36085
##$YMIN_a= 0
##$ACQMETH= <D:\Methods\flexControlMethods\MBT_FC.par>
##$AQ_DATE= <2014-05-06T13:11:26.609+02:00>
##$AUNM= <>
##$AXMeth= <MBT_AutoX>
##$CALME= (0..15)
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
##$CALMR= (0..15)
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
##$CALNAM1= <>
##$CALNAM2= <>
##$CALNAM3= <>
##$CALNAM4= <>
##$CALNAM5= <>
##$CALNAM6= <>
##$CALNAM7= <>
##$CHIPNO= <0>
##$CMT1= <>
##$CMT2= <>
##$CMT3= <>
##$CMT4= <>
##$CalStar= <<?xml version="1.0" encoding="ISO-8859-1"?><cs version="1.0"><ca>ReferenceMassAssignement</ca><cm>Quadratic</cm><cd>2014-05-06T11:21:19.000+00:00</cd><cr>OK</cr><pn>flexControl</pn><pv>3.4.85.1</pv><un>BDAL@US</un><rsid>5BC2906A-A1A2-41F6-A49E-CB0AC4F010C6</rsid><mcl>MBT_Standard</mcl><cocp>8</cocp><devb>179.847749855607</devb><deca>127.8114908253231</deca><acs><ac><rv>26330.20461009428</rv><mb>3636.561019263758</mb><ma>3636.976524855778</ma><cm>3637.8</cm><cn>RL29 [M+2H]2+</cn><me>226.3662499924011</me><tol>0</tol></ac><ac><rv>31081.88823581826</rv><mb>5096.646188865623</mb><ma>5097.230117505811</ma><cm>5096.8</cm><cn>RS32 [M+H]+</cn><me>84.38971625545693</me><tol>0</tol></ac><ac><rv>31925.02046434016</rv><mb>5381.539531227037</mb><ma>5382.156799298541</ma><cm>5381.4</cm><cn>RS34 [M+H]+</cn><me>140.6324188020607</me><tol>0</tol></ac><ac><rv>34379.86513180079</rv><mb>6255.400000000001</mb><ma>6256.120476096623</ma><cm>6255.4</cm><cn>RS33meth [M+H]+</cn><me>115.1766628230513</me><tol>0</tol></ac><ac><rv>37031.59711113338</rv><mb>7273.637351545591</mb><ma>7274.479838003712</ma><cm>7274.5</cm><cn>RL29 [M+H]+</cn><me>2.771598912386046</me><tol>0</tol></ac><ac><rv>43957.4668590187</rv><mb>10297.76280878344</mb><ma>10298.97810004552</ma><cm>10300.1</cm><cn>RS19 [M+H]+</cn><me>108.9212681897948</me><tol>0</tol></ac><ac><rv>50573.41534476768</rv><mb>13680.45372577411</mb><ma>13682.10297914885</ma><cm>13683.2</cm><cn>RNAse A [M+H]+</cn><me>80.17282880817682</me><tol>0</tol></ac><ac><rv>56221.47098805699</rv><mb>16951.37106769465</mb><ma>16953.45534485023</ma><cm>16952.3</cm><cn>Myoglobin [M+H]+</cn><me>68.15269020926611</me><tol>0</tol></ac></acs></cs>>
##$D= (0..31)
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
##$DOMNAME= <>
##$FAMeth= <>
##$FASTCal= <>
##$FCVer= <flexControl 3.4.85.1>
##$GEOFILE= <>
##$Gelcode= <>
##$HPCStr= <>
##$HPCal= (0..31)
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
##$ID_raw= <168D0DB7-2BE9-47A8-90E4-970883B68328>
##$IN= (0..31)
0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001
0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001
0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001
0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001
##$INSTRUM= <FLEX-PC>
##$InstrID= <269944.00766>
##$LIFTC= (0..2)
0 0 0
##$MOTPOS= <(-58980.0,-31845.0)>
##$Mctrlst= <>
##$NTBCal= <V3.0CCalibrator 1 1 0 0 -2147483648 2147483647 V1.0CHPCData Order 0 vCoeff V1.0VectorDouble 0 c2 0 c0 0 minMass 0 maxMass 0 bUse 0 endCHPCData V3.0CTOFCalibrationConstants 19462 2 417.48328754218528 5392738.3626781264 -0.015644152832017623 2 V3.0CTOFCalibrationConstants 19462 2 417.48328754218528 5392738.3626781264 -0.015644152832017623 2 >
##$NTBCalr= <V3.0CCalibrator 1 1 0 0 -2147483648 2147483647 V1.0CHPCData Order 0 vCoeff V1.0VectorDouble 0 c2 0 c0 0 minMass 0 maxMass 0 bUse 0 endCHPCData V3.0CTOFCalibrationConstants 19462 2 417.48328754218528 5392738.3626781264 -0.015644152832017623 2 V3.0CTOFCalibrationConstants 19462 2 417.48328754218528 5392738.3626781264 -0.015644152832017623 2 >
##$OS9PATH= <>
##$OpId= <BDAL@US>
##$P= (0..31)
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
##$PARNM= <>
##$PATCHNO= <G2>
##$PATH= <D:\Data\species1\0_G2\1\1SLin>
##$PDELAY= (0..3)
10 10 10 10
##$PDURA= (0..3)
10 10 10 10
##$PEPURL= <>
##$PLMSC= (0..2)
0 0 0
##$PULPROG= <>
##$PostPr= <>
##$QS= (0..7)
83 83 83 83 83 83 83 83
##$RUNNM= <>
##$SMOPTS= (0..15)
6 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
##$SPOTNO= <G2>
##$TgIDS= <G_AE943FD1_6700_444C_804FF0BA11906792>
##$TgSer= <>
##$TgTyp= <>
##$VDLIST= <DDDDDDDDDDDDDDD>
##$VOLTNM= <>
##$WEND= (0..3)
30000 30000 30000 30000
##$WINY= (0..3)
3 3 3 3
##$WSTART= (0..3)
0 0 0 0
##$Warplc1= <>
##$Warplc2= <>
##$XACQVS= <3.0>
##$Xml1= <>
##END=

Binary file added inst/with-acqus/species1/0_G2/1/1SLin/fid
Binary file not shown.
16 changes: 15 additions & 1 deletion tests/testthat/test-import_biotyper_spectra.R
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
# WARNING - Generated by {fusen} from dev/import-data.Rmd: do not edit by hand

directory_biotyper_spectra <- system.file("toy-species-spectra", package = "maldipickr")
spectra_list <- import_biotyper_spectra(directory_biotyper_spectra)
directory_biotyper_spectra_with_acqus <- system.file("with-acqus", package = "maldipickr")
test_that("import_biotyper_spectra works", {
expect_no_error(
spectra_list <- import_biotyper_spectra(directory_biotyper_spectra)
)
expect_length(
spectra_list, 6
)
expect_type(
spectra_list, "list"
)
})
test_that("import_biotyper_spectra works with symlinks",{
expect_no_error(
spectra_with_acqus <- import_biotyper_spectra(directory_biotyper_spectra_with_acqus)
)
expect_length(
spectra_with_acqus, 1
)
expect_type(
spectra_with_acqus, "list"
)
})
test_that("import_biotyper_spectra fails", {
expect_error(
import_biotyper_spectra(
Expand Down

0 comments on commit 66956a2

Please sign in to comment.