Question: How do I retrieve filenames from a dataset collection inside <command> tags?
3
gravatar for mrals89
2.7 years ago by
mrals8950
United States
mrals8950 wrote:

Hello Galaxy users and developers. I have an interesting question today concerning some of the exciting developments in galaxy concerning collation of dataset collections (p19). I am trying to develop a tool in galaxy that takes a dataset collection and produces some tabular results. In order to do this, I need to specify the filenames of interest (or their directory) to bash.

Looking at some of the code for Picard's MergeBamAlignments (as in the presentation above) I observe the following lines of Cheetah code:

        #for $dataset in $aligned_or_read1_and_read2.aligned_bams:
          ALIGNED_BAM="${dataset.aligned_bam}"
        #end for

From this, it looks like the code iterates through the repeated inputs ("aligned_bams;" which seems to include dataset collections as an option) and allows access to the filename as dataset.aligned_bam. This code works great for However, the

following code merely echoes a full DatasetCollectionWrapper python object as a string into stdout. Other attempts have yielded segfaults and all sorts of goodies. I would like to cat the filenames into outFile, or merely have access to the filenames programmatically. Thanks for your help!

    #for $dataset in $fastqc_results:
      echo "$dataset"
    #end for
galaxy cheetah • 979 views
ADD COMMENTlink modified 2.7 years ago • written 2.7 years ago by mrals8950
1
gravatar for mrals89
2.7 years ago by
mrals8950
United States
mrals8950 wrote:

I have found the solution to this, which doesn't seem to be documented. Also, I am curious if anyone has found a version of the so-called "metadata spec" referred to in the section of the tool config documentation? Anyway, the solution for a list of pairs is to instead use the following:

 

#for $file1, $file2 in $paired_list_data_collection:
  echo "$file1  $file2"
#end for

For a simple list dataset collection, the first solutions works

#for $file in $list_data_collection:
  echo "$file"
#end for

 

 

ADD COMMENTlink written 2.7 years ago by mrals8950

Also, I have found that when creating code in "cheetah", it helps to use the "str" function to evaluate these file objects and retrieve their filepaths. Also, for any users hoping to change their "labels" to reference internally, check out this thread 

ADD REPLYlink modified 2.7 years ago • written 2.7 years ago by mrals8950
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 110 users visited in the last hour