@@ -12,6 +12,7 @@ rem Backup copy if assay folder exists
12
12
rem robocopy %1 X-%1 /MIR
13
13
rem ------------------------------------------------------
14
14
rem
15
+ TITLE pISA-tree
15
16
setlocal EnableDelayedExpansion
16
17
set LF = ^
17
18
@@ -118,7 +119,7 @@ if exist %tmpldir%\DRY\%NewType% (
118
119
goto Ask4)
119
120
rem type ok
120
121
md %tmpldir% \%IDClass% \%NewType%
121
- copy NUL % tmpldir% \%IDClass% \%NewType% \AssayType.ini /Y > NUL
122
+ echo Creation date %today% > % tmpldir% \%IDClass% \%NewType% \AssayType.ini
122
123
echo New %IDClass% Assay Type was created: %NewType%
123
124
set " IDType = %NewType% "
124
125
)
@@ -235,11 +236,11 @@ call:getLayer _S_ sname
235
236
call :getLayer _A_ aname
236
237
rem -------------------------------------- make ASSAY_DESCRIPTION
237
238
set descFile = " .\_ASSAY_METADATA.TXT"
238
- echo project: %pname% > %descFile%
239
- echo Investigation: %iname% >> %descFile%
239
+ echo Assay: %Adir% > %descFile%
240
240
echo Study: %sname% >> %descFile%
241
- echo Assay: %Adir% >> %descFile%
242
- echo ### ASSAY>> %descFile%
241
+ echo Investigation: %iname% >> %descFile%
242
+ echo project: %pname% >> %descFile%
243
+ rem echo ### ASSAY>> %descFile%
243
244
echo Short Name: %ID% >> %descFile%
244
245
echo Assay Class: %IDClass% >> %descFile%
245
246
echo Assay Type: %IDType% >> %descFile%
@@ -248,7 +249,21 @@ rem ECHO ON
248
249
rem if exist ../%analytesInput% ( copy ../%analytesInput% ./%analytesInput% )
249
250
call :inputMeta " Title" aTitle *
250
251
call :inputMeta " Description" aDesc *
252
+ rem echo Assay Path: %cd:\=/%>> %descFile%
253
+ rem set phenodata file
254
+ SETLOCAL ENABLEDELAYEDEXPANSION
255
+ SET " pfns = "
256
+ FOR /f " delims=" %%i IN ('dir %iroot% \phenodata_20*.* /B') DO (
257
+ SET pfns = !pfns! %%i /
258
+ )
259
+ SETLOCAL DISABLEDELAYEDEXPANSION
260
+ call :getMenu " Select phenodata file" " %pfns% None" pfn
261
+ if " %pfn% " EQU " None" ( echo Phenodata: %pfn% >> %descFile%
262
+ ) ELSE ( echo Phenodata: %iroot:\ =/ % /%pfn% >> %descFile% )
251
263
rem ---- Type specific fields
264
+ set tasdir = %tmpldir% \%IDClass% \%IDType%
265
+ set " line1 = "
266
+ set " line2 = "
252
267
if /I " %IDClass% " == " WET" goto wetclass
253
268
if /I " %IDClass% " == " DRY" goto dryclass
254
269
rem if /I "%IDType%" == "R" goto R
@@ -265,16 +280,13 @@ rem echo tst %tmpldir%\%IDClass%\%IDType%\AssayType.ini
265
280
rem dir %tmpldir%
266
281
rem dir ..\%tmpldir%
267
282
rem Assay type directory
268
- set tasdir = %tmpldir% \%IDClass% \%IDType%
269
283
rem dir %tasdir%
270
284
rem dir %tmpldir%
271
285
:: echo %cd%
272
286
set " analytesInput = Analytes.txt"
273
- call :getSamples %IDName% %iroot% \phenodata.txt %aroot% \%analytesInput%
287
+ call :getSamples %IDName% %iroot% \%pfn% %aroot% \%analytesInput%
274
288
setlocal disabledelayedexpansion
275
289
rem if exist %sroot%\%analytesInput% ( copy %sroot%\%analytesInput% %aroot%\%analytesInput% )
276
- set " line1 = "
277
- set " line2 = "
278
290
rem dir %tmpldir%\%IDClass%\%IDType%\
279
291
if exist %tasdir% \AssayType.ini call :processAnalytes %tasdir% \AssayType.ini
280
292
@@ -292,8 +304,8 @@ REM ---------------------------------------- /dryclass
292
304
:Finish
293
305
echo Data: >> %descFile%
294
306
rem ------------------------------------ include common.ini from project level
295
- copy %descFile% +..\common.ini %descFile% > NUL
296
- echo ASSAY: %ID% >> ..\_STUDY_METADATA.TXT
307
+ copy %descFile% +..\common.ini %descFile% \b > NUL
308
+ rem echo ASSAY: %ID%>> ..\_STUDY_METADATA.TXT
297
309
copy %sroot% \showTree.bat . > NUL
298
310
copy %sroot% \showMetadata.bat . > NUL
299
311
copy %sroot% \xcheckMetadata.bat . > NUL
302
314
rem make main readme.md file
303
315
rem type README.MD
304
316
rem dir .
305
- rem cls
306
- rem type %descFile%
317
+ cls
318
+ echo ======================================
319
+ echo Assay METADATA
320
+ echo ======================================
321
+ rem call:showDesc %descFile%
322
+ type %descFile%
307
323
cd ..
308
324
rem copy existing files from nonversioned tree (if any)
309
325
rem robocopy X-%ID% %ID% /E
@@ -369,7 +385,7 @@ rem call:getInput "%~1" xMeta "%~3"
369
385
rem Type input or get menu?
370
386
371
387
call :getMenu " %~1 " %~3 /getMenu xMeta " %~3 "
372
- echo %~1 : %xMeta% >> %descFile%
388
+ echo %~1 : %xMeta% >> %descFile%
373
389
rem call:writeAnalytes %analytesInput% "%~1" %xMeta%
374
390
rem
375
391
@@ -397,7 +413,7 @@ rem call:getInput "%~1" xMeta "%~3"
397
413
rem Type input or get menu?
398
414
399
415
call :getInput " %~1 " xMeta " %~3 "
400
- echo %~1 : %xMeta% >> %descFile%
416
+ echo %~1 : %xMeta% >> %descFile%
401
417
rem call:writeAnalytes %analytesInput% "%~1" %xMeta%
402
418
rem
403
419
@@ -476,7 +492,7 @@ for /f "tokens=1 delims=/" %%a in ("%~3") do set first=%%a
476
492
rem echo =%~3=%first%= REM test
477
493
if " %xMeta% " == " Other" call :getInput " %~1 " xMeta " %first% "
478
494
:next
479
- echo %~1 : %xMeta%%prefix% >> %descFile%
495
+ echo %~1 : %xMeta%%prefix% >> %descFile%
480
496
rem call:writeAnalytes %analytesInput% "%~1" %xMeta%
481
497
rem
482
498
REM (ENDLOCAL
@@ -529,7 +545,7 @@ rem IF EXIST %~1 (
529
545
rem echo %searchtext% %modified%
530
546
rem pause
531
547
rem should replace special token with SampleId before writing
532
- echo %%a %%b !modified! >> tmp.txt
548
+ echo %%a %%b !modified! >> tmp.txt
533
549
rem echo Write: %%a %%b !modified!
534
550
endlocal
535
551
rem echo off
@@ -737,16 +753,16 @@ setlocal enableextensions disabledelayedexpansion
737
753
set " %~2 = %my_file% " )
738
754
goto :eof
739
755
rem ----------------------------------------------------------
740
- :getSamples --- get sample names from phenodata.txt
756
+ :getSamples --- get sample names from %pfn%
741
757
:: --- %~1 column name
742
- :: --- %~2 phenodata file name (default is "%iroot%/phenodata.txt ")
758
+ :: --- %~2 phenodata file name (default is "%iroot%/%pfn% ")
743
759
:: --- %~3 output file (default is "%sroot%/Analytes.txt")
744
760
:: Return: writes the sample names (first two columns) to the output file
745
761
:: Example: call:getSamples %Assay_ID%
746
762
::
747
763
set " infile = "
748
764
set " outfile = "
749
- if " %~2 " NEQ " " (set " infile=%~2 " ) else (set " infile=%iroot% /phenodata.txt " )
765
+ if " %~2 " NEQ " " (set " infile=%~2 " ) else (set " infile=%iroot% /%pfn% " )
750
766
if " %~3 " NEQ " " (set " outfile=%~3 " ) else (set " outfile=%sroot% /Analytes.txt" )
751
767
:: dir %infile%
752
768
:: First line
@@ -780,7 +796,7 @@ for /f "EOL=: delims=" %%L in (%infile%) do (
780
796
set " param2 = !param2:~1 ! "
781
797
set " param3 = !param3:~1 ! "
782
798
rem echo $1=!param1! $2=*!param2!* $3=*!param3!*
783
- if " !param3! " NEQ " " echo !param1! !param2! !param3! >> %outfile%
799
+ if " !param3! " NEQ " " echo !param1! !param2! !param3! >> %outfile%
784
800
endlocal
785
801
)
786
802
)
@@ -825,9 +841,9 @@ rem ------------------------------------------------------------
825
841
:: --- %~2 optional delimiter
826
842
:: Return: current date in YYYYMMDD form
827
843
:: Example: call:normalizeDate
828
- @ echo on
829
- echo %~1
830
- echo +%~2 +
844
+ rem @echo on
845
+ rem echo %~1
846
+ rem echo +%~2+
831
847
@ Echo OFF
832
848
rem get date format info from registry
833
849
rem https://docs.microsoft.com/en-us/windows/desktop/intl/locale-idate
@@ -852,4 +868,14 @@ IF 1%3 LSS 100 (SET YYYYMMDD=0%3) ELSE (SET YYYYMMDD=%3)
852
868
IF 1%2 LSS 100 (SET YYYYMMDD=0%2 %sep%%YYYYMMDD% ) ELSE (SET YYYYMMDD=%2 %sep%%YYYYMMDD% )
853
869
:: Similarly for the year - I've never seen a single-digit year
854
870
IF 1%1 LSS 100 (SET YYYYMMDD=20%sep%%YYYYMMDD% ) ELSE (SET YYYYMMDD=%1 %sep%%YYYYMMDD% )
855
- GOTO :eof
871
+ GOTO :eof
872
+ rem -------------------------------------------------------------------
873
+ :showDesc --- show description file in columns
874
+ :: --- %~1 file name
875
+ ::
876
+ :: Example: call:showDesc %descFile%
877
+ ::
878
+ setlocal
879
+ For /F " TOKENS=1,2" %%A In (%~1 ) echo %%A %%B
880
+ endlocal
881
+ goto :EOF
0 commit comments