Question: Making a Temporary Directory in an XML File
0
gravatar for mccoykg
3.1 years ago by
mccoykg80
United States
mccoykg80 wrote:

Hi all. I'm making a custom bowtie tool, because the current bowtie tool only accepts FASTQ files and outputs sam files; my lab needs a bowtie tool that accepts FASTA files and outputs map files. However, I'm running into an issue with the way bowtie reads indexes and the way Galaxy stores data.

I'm trying to combine the index building and mapping into one tool the way the current bowtie tool does, but I'm having trouble saving the index output to a temporary directory to then be called by bowtie. I get the following error:

Error:
Could not locate a Bowtie index corresponding to basename "indexes/index"

The code I currently have is as follows:

<tool id="bowtie" name="FASTA Bowtie Mapper">
  <command>
    /Users/vanopijn/Desktop/Tn-Seq/bowtie/bowtie-build $genome indexes/index |
    /Users/vanopijn/galaxy/scripts/stderr_wrapper.py
    /Users/vanopijn/Desktop/Tn-Seq/bowtie/bowtie
    -f
    #if $discard.multi  == "yes":
      -m 1
    #end if
    -n $mismatches
    --best
    -k 1
    -y
    -p 2
    #if $show.unmatched  == "yes":
      --un $output2
    #end if
    #if $show.unmatched  == "yes":
      --un $output2
    #end if
    indexes/index
    $input
    > $output
  </command>
  <inputs>
    <param name="input" type="data" label="Reads to map" />
    <param name="genome" type="data" label="Genome to which to map (fasta file)"/>
    <conditional name="discard">
      <param name="multi" type="select" label="Discard reads mapped to multiple locations?">
        <option value="no">No</option>
        <option value="yes">Yes</option>
      </param>
    </conditional>
    <conditional name="show">
      <param name="unmatched" type="select" label="Send unmatched reads to an output file?">
        <option value="no">No</option>
        <option value="yes">Yes</option>
      </param>
    </conditional>
    <param name="mismatches" type="float" value="1" label="Number of mismatches allowed"/>
  </inputs>
  <outputs>
    <data format="map" name="output" />
    <data format="fasta" name="output2" />
  </outputs>
  <help>
</help>
</tool>

The way I see it I can either do this - combining the index building and mapping - or make indexes first then use them as input for the bowtie tool. However, either way I need a way to make a temporary "directory" for the bowtie tool to use. Does anyone have any experience making a temporary directory with the xml file (as I'm trying to do above) or with history files? Any ideas on getting around all this would be appreciated as well, although I definitely can't use the in-built mapping tool because of its output format.

Thanks much,

K

bowtie mapping • 1000 views
ADD COMMENTlink modified 3.1 years ago by Bjoern Gruening5.1k • written 3.1 years ago by mccoykg80
1
gravatar for Bjoern Gruening
3.1 years ago by
Bjoern Gruening5.1k
Germany
Bjoern Gruening5.1k wrote:

I'm totally on Jen's site here. I guess a SAM to MAP converter would be more useful. Have a look at this script: https://github.com/lh3/samtools-legacy/blob/master/misc/bowtie2sam.pl

It converts MAP to SAM. It should be easy to revert this script to it can convert the other way around.

To answer you initial problem. If you tell bowtie-build to store the index under indexes/index you need to create this directory as first step. Simply do a

mkdir indexes

Ciao,

Bjoern

ADD COMMENTlink written 3.1 years ago by Bjoern Gruening5.1k

Thanks! I've looked into using a SAM to MAP converter, but realized that doing that as well as converting our FASTA files to FASTQ would slow down our pipeline considerably; since we run so many files in batch I'm going to try going with a mapper tool that just takes FASTA files and outputs map files.

Like you suggested I just tried adding mkdir indexes to the start of my code, but it creates another error:

Error reading _plen[] array: 0, 4

To trouble-shoot this I tried to see the indexes built by adding ebwt files to my expected outputs, and got all 6 outputs turning up green but empty; I think something in the way Galaxy saves its data is moving or deleting those files so the mapping tool is trying to use empty indexes. Do you have any idea of what that could be? Otherwise I think my script would work fine, I just can't seem to get the index files produced to the mapper tool.

ADD REPLYlink written 3.1 years ago by mccoykg80
0
gravatar for Jennifer Hillman Jackson
3.1 years ago by
United States
Jennifer Hillman Jackson25k wrote:

Hello,

What kind of output format are you trying to create? I am asking because transforming the SAM/BAM output to pretty much any other format you want is likely possible using other existing tools. Bundling these together into a workflow could be a much simpler solution than writing a new tool wrapper.

Thanks! Jen, Galaxy team

 

ADD COMMENTlink modified 3.1 years ago • written 3.1 years ago by Jennifer Hillman Jackson25k

Thanks! I think you're right that it would be easier to transform the sam output, but I can't find a tool that turns .sam files into .map files. I couldn't find one in a quick google search either - do you know if one exists, or if a broader tool includes that as one of its options?

ADD REPLYlink written 3.1 years ago by mccoykg80

Ok, I see now. Maybe just modify the existing wrapper to output .map files instead? That is the default so a command-line change is all that would be needed. But be aware that this will require creating a new datatype in Galaxy, unless you plan on just downloading the output and not using it in Galaxy (no tools that are already wrapped use this format anyway, intact, although it could be type of tabular data). 

Hopefully this helps! Good luck with the project, Jen

ADD REPLYlink written 3.1 years ago by Jennifer Hillman Jackson25k

That would be great! I'm having trouble editing the existing wrappers, however; I've tried messing around with them, but they're complex enough I don't quite understand everything going on. Is this the sort of thing I could submit a trello card for - asking for a fasta input option and map output option?

ADD REPLYlink written 3.1 years ago by mccoykg80
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: 169 users visited in the last hour