2222# #######################################################################################################
2323# #######################################################################################################
2424
25+
2526extract_linksXCP = function (manifest = " datastructure_manifest.txt" ,task ,surf ,filename = " downloadlist.txt" , subjects )
2627{
2728 # read manifest and remove first row; the first row contains description of the column, hence not used.
@@ -30,16 +31,13 @@ extract_linksXCP=function(manifest="datastructure_manifest.txt",task,surf,filena
3031 # select subjects
3132 if (! missing(subjects ))
3233 {
34+ sub.list = list ()
3335 for (sub in 1 : length(subjects ))
3436 {
35- if (sub == 1 )
36- {
37- filelist.incsub = manifest $ associated_file [stringr :: str_detect(string = manifest $ associated_file ,pattern = subjects [sub ])]
38- } else
39- {
40- filelist.incsub = c(filelist.incsub ,manifest [stringr :: str_detect(string = manifest $ associated_file ,pattern = subjects [sub ])])
41- }
37+ sub.list [[sub ]]= which(stringr :: str_detect(string = manifest $ associated_file ,pattern = subjects [sub ]))
4238 }
39+ filelist.incsub = manifest $ associated_file [unique(unlist(sub.list ))]
40+
4341 } else
4442 {
4543 filelist.incsub = manifest $ associated_file
@@ -51,10 +49,12 @@ extract_linksXCP=function(manifest="datastructure_manifest.txt",task,surf,filena
5149
5250 files = c(paste0(" _" ,task ," _.._Atlas_MSMAll.dtseries.nii" ),
5351 paste0(" _" ,task ," ._.._Atlas_MSMAll.dtseries.nii" ),
52+ paste0(" _" ,task ," .._.._Atlas_MSMAll.dtseries.nii" ),
5453 " brainmask_fs.2.nii.gz" ,
5554 " _SBRef.nii.gz" ,
5655 " Movement_Regressors.txt" ,
5756 " Movement_AbsoluteRMS.txt" ,
57+ paste0(" _" ,task ," .._...nii.gz" ),
5858 paste0(" _" ,task ," ._...nii.gz" ),
5959 paste0(" _" ,task ," _...nii.gz" ))
6060
@@ -124,6 +124,7 @@ extract_linksXCP=function(manifest="datastructure_manifest.txt",task,surf,filena
124124 write.table(filelist.sel.tasks.MNI [order(filelist.sel.tasks.MNI )],file = filename , quote = F , row.names = F , col.names = F )
125125}
126126
127+
127128# ###########################################################################################################################
128129# ###########################################################################################################################
129130# ' @title extract_links
0 commit comments