Re: [galaxy-dev] Creating R galaxy wrapper where a function checks file extension

2015-10-02 Thread Martin Vickers

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Peter,

That's great, worked perfectly.

Thank you very much,

Martin

On 10/02/2015 11:26 AM, Peter Cock wrote:
> If you have a wrapper script, then you can do it there.
>
> It is also possible in the XML directly by building a composite
> command with && separators (which must be escaped as
>  or using CDATA), e.g.
>
>
https://github.com/galaxyproject/tools-devteam/blob/master/tools/samtool_filter2/samtool_filter2.xml
> (nice BAM and BAI example)
>
>
https://github.com/galaxyproject/tools-devteam/blob/master/tools/freebayes/freebayes.xml
> (does a lot of symlinks)
>
>
https://github.com/galaxyproject/tools-iuc/blob/master/tools/bedtools/multiCov.xml
> (part of a for loop for multiple BAM and BAI files)
>
> Note you can't use  in this
> style as the first command is the shell command ln.
>
> Peter
>
>
> On Fri, Oct 2, 2015 at 11:17 AM, Martin Vickers  wrote:
>>
> Hi Peter,
>
> Thanks for the reply. Are there any examples of this in action? Is it done
> in the xml wrapper somewhere or do I need to write a script that does this
> and then call the Rscript?
>
> Cheers,
>
> Martin
>
> On 10/02/2015 11:13 AM, Peter Cock wrote:
> >>> Creating symlinks with normal extensions is a common
> >>> approach here where the Galaxy filenames won't work.
> >>>
> >>> Peter
> >>>
> >>> On Fri, Oct 2, 2015 at 10:57 AM, Martin Vickers 
wrote:
> 
> >>> Hi all,
> >>>
> >>> I've been tasked with getting someone's R script working in our galaxy
> >>> installation and I'm struggling to resolve an issue with an
bioconductor
> >>> function that appears to not like the galaxy naming convention (e.g.
> >>> dataset_2.dat) for the bam index file.
> >>>
> >>> The R script can run from the command line like this;
> >>>
> >>> Rscript script.R input1.xls alignment.bam alignment.bai p
> >>>
> >>> so I have created a wrapper using planemo that does this, and
that's fine.
> >>>
> >>> The problem is, when I run the script in galaxy, I get the
following error
> >>> from R;
> >>>
> >>> Error in value[[3L]](cond) :
> >>> failed to open BamFile: failed to load BAM index
> >>> file: /tmp/tmpdP2eBC/files/000/dataset_3.dat
> >>> Calls: f_oGRSeparateStrands ... tryCatch -> tryCatchList ->
tryCatchOne ->
> >>> 
> >>> In addition: Warning messages:
> >>> In doTryCatch(return(expr), name, parentenv, handler) :
> >>> [bam_index_load] fail to load BAM index.
> >>> Execution halted
> >>>
> >>> The function that reads the bam + bai file in the script is;
> >>>
> >>> bam = readGAlignments(file=bam.file, index=bai.file,
> >>> param=ScanBamParam(which=gr.signal))
> >>>
> >>>
http://www.rdocumentation.org/packages/GenomicRanges/html/GAlignments.html
> >>>
> >>> In the documentation for this function it states the following;
> >>>
> >>> "file, index, The path to the BAM file to read, and to the index
file of
> >>> the
> >>> BAM file to read, respectively. The latter is given /without/ the
'.bai'
> >>> extension. See |scanBam
> >>>
|
> >>> for more information."
> >>>
> >>> I've played around with this a little and from the command line
I've been
> >>> successfully able to run the script to completion when the input
bam file
> >>> and bai are completely different names;
> >>>
> >>> e.g.
> >>>
> >>> Rscript script.R input1.xls something.bam meh.bai p
> >>>
> >>> but I can't run it if I change the extension, e.g.
> >>>
> >>> Rscript script.R input1.xls something.dat meh.dat p
> >>> Error in value[[3L]](cond) :
> >>>
> >>> failed to open BamFile: failed to load BAM index
> >>> file: /tmp/tmpdP2eBC/files/000/dataset_3.dat
> >>> Calls: f_oGRSeparateStrands ... tryCatch -> tryCatchList ->
tryCatchOne ->
> >>> 
> >>> In addition: Warning messages:
> >>> In doTryCatch(return(expr), name, parentenv, handler) :
> >>> [bam_index_load] fail to load BAM index.
> >>> Execution halted
> >>>
> >>>
> >>> Does anyone have any experience of resolving this kind of issue?
> >>>
> >>>
> 
> 
>  ___
>  Please keep all replies on the list by using "reply all"
>  in your mail client.  To manage your subscriptions to this
>  and other Galaxy lists, please use the interface at:
>    https://lists.galaxyproject.org/
> 
>  To search Galaxy mailing lists use the unified search at:
>    http://galaxyproject.org/search/mailinglists/
>
>>

- -- 

- --
Dr. Martin Vickers

Data Manager/HPC Systems Administrator
Institute of Biological, Environmental and Rural Sciences
IBERS New Building
Aberystwyth University
SY23 3FG

w: http://www.martin-vickers.co.uk/
e: mj...@aber.ac.uk
t: 01970 62 2807
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.14 (GNU/Linux)

iQEcBAEBAgAGBQJWDnpKAAoJEHa0a8GkKQgIKwgH/0U7reSPcg/45xhMgoqd3XBT
kLYiIvg1zufLLw2CEYxci/LD2ZdwvqI+Df3BrsTJgpT3tQxjOWsEHzVkVZfkcS+3

Re: [galaxy-dev] Creating R galaxy wrapper where a function checks file extension

2015-10-02 Thread Peter Cock
Creating symlinks with normal extensions is a common
approach here where the Galaxy filenames won't work.

Peter

On Fri, Oct 2, 2015 at 10:57 AM, Martin Vickers  wrote:
>
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Hi all,
>
> I've been tasked with getting someone's R script working in our galaxy
> installation and I'm struggling to resolve an issue with an bioconductor
> function that appears to not like the galaxy naming convention (e.g.
> dataset_2.dat) for the bam index file.
>
> The R script can run from the command line like this;
>
> Rscript script.R input1.xls alignment.bam alignment.bai p
>
> so I have created a wrapper using planemo that does this, and that's fine.
>
> The problem is, when I run the script in galaxy, I get the following error
> from R;
>
> Error in value[[3L]](cond) :
> failed to open BamFile: failed to load BAM index
> file: /tmp/tmpdP2eBC/files/000/dataset_3.dat
> Calls: f_oGRSeparateStrands ... tryCatch -> tryCatchList -> tryCatchOne ->
> 
> In addition: Warning messages:
> In doTryCatch(return(expr), name, parentenv, handler) :
> [bam_index_load] fail to load BAM index.
> Execution halted
>
> The function that reads the bam + bai file in the script is;
>
> bam = readGAlignments(file=bam.file, index=bai.file,
> param=ScanBamParam(which=gr.signal))
>
> http://www.rdocumentation.org/packages/GenomicRanges/html/GAlignments.html
>
> In the documentation for this function it states the following;
>
> "file, index, The path to the BAM file to read, and to the index file of the
> BAM file to read, respectively. The latter is given /without/ the '.bai'
> extension. See |scanBam
> |
> for more information."
>
> I've played around with this a little and from the command line I've been
> successfully able to run the script to completion when the input bam file
> and bai are completely different names;
>
> e.g.
>
> Rscript script.R input1.xls something.bam meh.bai p
>
> but I can't run it if I change the extension, e.g.
>
> Rscript script.R input1.xls something.dat meh.dat p
> Error in value[[3L]](cond) :
>
> failed to open BamFile: failed to load BAM index
> file: /tmp/tmpdP2eBC/files/000/dataset_3.dat
> Calls: f_oGRSeparateStrands ... tryCatch -> tryCatchList -> tryCatchOne ->
> 
> In addition: Warning messages:
> In doTryCatch(return(expr), name, parentenv, handler) :
> [bam_index_load] fail to load BAM index.
> Execution halted
>
>
> Does anyone have any experience of resolving this kind of issue?
>
>
> - --
>
> - --
> Dr. Martin Vickers
>
> Data Manager/HPC Systems Administrator
> Institute of Biological, Environmental and Rural Sciences
> IBERS New Building
> Aberystwyth University
> SY23 3FG
>
> w: http://www.martin-vickers.co.uk/
> e: mj...@aber.ac.uk
> t: 01970 62 2807
>
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v2.0.14 (GNU/Linux)
>
> iQEcBAEBAgAGBQJWDlUgAAoJEHa0a8GkKQgIpUcIAK9OZ9402FRaROF89b6bO1CY
> d+KP/X0NCxY+AXEddU3lhXi8O9haaKRA/pmxsGyydP0VQfaCrSSlS9nzhncG6Zav
> gpXe5NjFkwe8a/qaZTVf0YjlYq0sI81S7QAJnzlKXvYSjcz1xNDE9O4qSHqdhefX
> oI6GWmR+vHi7CTqNuHwpyY9Qoafd5nls0oQoCYDh9YWrn9GZ8fe1qQ9W7iUli/oT
> dPMYwWs0OL8NfSCuIcz2Dbr1XMt+o5HpQY/afoGWaq3zz5Ie0NhCLKz34bFps3IW
> 8K0DEROmCTxsXBa54gnnkhVgCI3zkfFCfa47xp13vT2dJALdzYoT6vDj8aC/mes=
> =ijgr
> -END PGP SIGNATURE-
>
>
> ___
> Please keep all replies on the list by using "reply all"
> in your mail client.  To manage your subscriptions to this
> and other Galaxy lists, please use the interface at:
>   https://lists.galaxyproject.org/
>
> To search Galaxy mailing lists use the unified search at:
>   http://galaxyproject.org/search/mailinglists/
___
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
  https://lists.galaxyproject.org/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/

Re: [galaxy-dev] Creating R galaxy wrapper where a function checks file extension

2015-10-02 Thread Peter Cock
If you have a wrapper script, then you can do it there.

It is also possible in the XML directly by building a composite
command with && separators (which must be escaped as
 or using CDATA), e.g.

https://github.com/galaxyproject/tools-devteam/blob/master/tools/samtool_filter2/samtool_filter2.xml
(nice BAM and BAI example)

https://github.com/galaxyproject/tools-devteam/blob/master/tools/freebayes/freebayes.xml
(does a lot of symlinks)

https://github.com/galaxyproject/tools-iuc/blob/master/tools/bedtools/multiCov.xml
(part of a for loop for multiple BAM and BAI files)

Note you can't use  in this
style as the first command is the shell command ln.

Peter


On Fri, Oct 2, 2015 at 11:17 AM, Martin Vickers  wrote:
>
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Hi Peter,
>
> Thanks for the reply. Are there any examples of this in action? Is it done
> in the xml wrapper somewhere or do I need to write a script that does this
> and then call the Rscript?
>
> Cheers,
>
> Martin
>
> On 10/02/2015 11:13 AM, Peter Cock wrote:
>> Creating symlinks with normal extensions is a common
>> approach here where the Galaxy filenames won't work.
>>
>> Peter
>>
>> On Fri, Oct 2, 2015 at 10:57 AM, Martin Vickers  wrote:
>>>
>> Hi all,
>>
>> I've been tasked with getting someone's R script working in our galaxy
>> installation and I'm struggling to resolve an issue with an bioconductor
>> function that appears to not like the galaxy naming convention (e.g.
>> dataset_2.dat) for the bam index file.
>>
>> The R script can run from the command line like this;
>>
>> Rscript script.R input1.xls alignment.bam alignment.bai p
>>
>> so I have created a wrapper using planemo that does this, and that's fine.
>>
>> The problem is, when I run the script in galaxy, I get the following error
>> from R;
>>
>> Error in value[[3L]](cond) :
>> failed to open BamFile: failed to load BAM index
>> file: /tmp/tmpdP2eBC/files/000/dataset_3.dat
>> Calls: f_oGRSeparateStrands ... tryCatch -> tryCatchList -> tryCatchOne ->
>> 
>> In addition: Warning messages:
>> In doTryCatch(return(expr), name, parentenv, handler) :
>> [bam_index_load] fail to load BAM index.
>> Execution halted
>>
>> The function that reads the bam + bai file in the script is;
>>
>> bam = readGAlignments(file=bam.file, index=bai.file,
>> param=ScanBamParam(which=gr.signal))
>>
>> http://www.rdocumentation.org/packages/GenomicRanges/html/GAlignments.html
>>
>> In the documentation for this function it states the following;
>>
>> "file, index, The path to the BAM file to read, and to the index file of
>> the
>> BAM file to read, respectively. The latter is given /without/ the '.bai'
>> extension. See |scanBam
>> |
>> for more information."
>>
>> I've played around with this a little and from the command line I've been
>> successfully able to run the script to completion when the input bam file
>> and bai are completely different names;
>>
>> e.g.
>>
>> Rscript script.R input1.xls something.bam meh.bai p
>>
>> but I can't run it if I change the extension, e.g.
>>
>> Rscript script.R input1.xls something.dat meh.dat p
>> Error in value[[3L]](cond) :
>>
>> failed to open BamFile: failed to load BAM index
>> file: /tmp/tmpdP2eBC/files/000/dataset_3.dat
>> Calls: f_oGRSeparateStrands ... tryCatch -> tryCatchList -> tryCatchOne ->
>> 
>> In addition: Warning messages:
>> In doTryCatch(return(expr), name, parentenv, handler) :
>> [bam_index_load] fail to load BAM index.
>> Execution halted
>>
>>
>> Does anyone have any experience of resolving this kind of issue?
>>
>>
>>>
>>>
>>> ___
>>> Please keep all replies on the list by using "reply all"
>>> in your mail client.  To manage your subscriptions to this
>>> and other Galaxy lists, please use the interface at:
>>>   https://lists.galaxyproject.org/
>>>
>>> To search Galaxy mailing lists use the unified search at:
>>>   http://galaxyproject.org/search/mailinglists/
>
> - --
>
> - --
> Dr. Martin Vickers
>
> Data Manager/HPC Systems Administrator
> Institute of Biological, Environmental and Rural Sciences
> IBERS New Building
> Aberystwyth University
> SY23 3FG
>
> w: http://www.martin-vickers.co.uk/
> e: mj...@aber.ac.uk
> t: 01970 62 2807
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v2.0.14 (GNU/Linux)
>
> iQEcBAEBAgAGBQJWDlmjAAoJEHa0a8GkKQgIqqkH/RwvFjF//9z3ucrAziYKbuia
> qe9fFiAUhfgMFYUxVxatdR1CqzLChcONonPDgcouxGO7i1EgGNmoRqYdEdCrHbPF
> WXpS/1txd8ieIxIp4IjrrozoXnd7x360M6MZd8yh6YxNd+LXQdZyWBAYUePwl5RQ
> x/rwaJHnfw2hiWtHLWlrqHQJESz4zo1L0Wjymy8ehyvo9zG6760/zZSInaHmFPkN
> 6YJVmr0o/k1FpQrXNaRlmxMKC9jbPoDvF6ZkpseA9y1ojmFpS0mrBBLxZyaGaru9
> iKH4TYnD2PTU5L+2bmCbAiEa7us0KXEx74Mq8WaKQ/hwsvXQiCpXXmvPj7oCFSI=
> =MVS2
> -END PGP SIGNATURE-
>
___
Please keep all replies on the list by 

[galaxy-dev] Creating R galaxy wrapper where a function checks file extension

2015-10-02 Thread Martin Vickers

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi all,

I've been tasked with getting someone's R script working in our galaxy
installation and I'm struggling to resolve an issue with an bioconductor
function that appears to not like the galaxy naming convention (e.g.
dataset_2.dat) for the bam index file.

The R script can run from the command line like this;

Rscript script.R input1.xls alignment.bam alignment.bai p

so I have created a wrapper using planemo that does this, and that's fine.

The problem is, when I run the script in galaxy, I get the following
error from R;

Error in value[[3L]](cond) :
failed to open BamFile: failed to load BAM index
file: /tmp/tmpdP2eBC/files/000/dataset_3.dat
Calls: f_oGRSeparateStrands ... tryCatch -> tryCatchList -> tryCatchOne
-> 
In addition: Warning messages:
In doTryCatch(return(expr), name, parentenv, handler) :
[bam_index_load] fail to load BAM index.
Execution halted

The function that reads the bam + bai file in the script is;

bam = readGAlignments(file=bam.file, index=bai.file,
param=ScanBamParam(which=gr.signal))

http://www.rdocumentation.org/packages/GenomicRanges/html/GAlignments.html

In the documentation for this function it states the following;

"file, index, The path to the BAM file to read, and to the index file of
the BAM file to read, respectively. The latter is given /without/ the
'.bai' extension. See |scanBam
|
for more information."

I've played around with this a little and from the command line I've
been successfully able to run the script to completion when the input
bam file and bai are completely different names;

e.g.

Rscript script.R input1.xls something.bam meh.bai p

but I can't run it if I change the extension, e.g.

Rscript script.R input1.xls something.dat meh.dat p
Error in value[[3L]](cond) :

failed to open BamFile: failed to load BAM index
file: /tmp/tmpdP2eBC/files/000/dataset_3.dat
Calls: f_oGRSeparateStrands ... tryCatch -> tryCatchList -> tryCatchOne
-> 
In addition: Warning messages:
In doTryCatch(return(expr), name, parentenv, handler) :
[bam_index_load] fail to load BAM index.
Execution halted


Does anyone have any experience of resolving this kind of issue?


- -- 

- --
Dr. Martin Vickers

Data Manager/HPC Systems Administrator
Institute of Biological, Environmental and Rural Sciences
IBERS New Building
Aberystwyth University
SY23 3FG

w: http://www.martin-vickers.co.uk/
e: mj...@aber.ac.uk
t: 01970 62 2807

-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.14 (GNU/Linux)

iQEcBAEBAgAGBQJWDlUgAAoJEHa0a8GkKQgIpUcIAK9OZ9402FRaROF89b6bO1CY
d+KP/X0NCxY+AXEddU3lhXi8O9haaKRA/pmxsGyydP0VQfaCrSSlS9nzhncG6Zav
gpXe5NjFkwe8a/qaZTVf0YjlYq0sI81S7QAJnzlKXvYSjcz1xNDE9O4qSHqdhefX
oI6GWmR+vHi7CTqNuHwpyY9Qoafd5nls0oQoCYDh9YWrn9GZ8fe1qQ9W7iUli/oT
dPMYwWs0OL8NfSCuIcz2Dbr1XMt+o5HpQY/afoGWaq3zz5Ie0NhCLKz34bFps3IW
8K0DEROmCTxsXBa54gnnkhVgCI3zkfFCfa47xp13vT2dJALdzYoT6vDj8aC/mes=
=ijgr
-END PGP SIGNATURE-

___
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
  https://lists.galaxyproject.org/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/

Re: [galaxy-dev] Creating R galaxy wrapper where a function checks file extension

2015-10-02 Thread Martin Vickers

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Peter,

Thanks for the reply. Are there any examples of this in action? Is it
done in the xml wrapper somewhere or do I need to write a script that
does this and then call the Rscript?

Cheers,

Martin

On 10/02/2015 11:13 AM, Peter Cock wrote:
> Creating symlinks with normal extensions is a common
> approach here where the Galaxy filenames won't work.
>
> Peter
>
> On Fri, Oct 2, 2015 at 10:57 AM, Martin Vickers  wrote:
>>
> Hi all,
>
> I've been tasked with getting someone's R script working in our galaxy
> installation and I'm struggling to resolve an issue with an bioconductor
> function that appears to not like the galaxy naming convention (e.g.
> dataset_2.dat) for the bam index file.
>
> The R script can run from the command line like this;
>
> Rscript script.R input1.xls alignment.bam alignment.bai p
>
> so I have created a wrapper using planemo that does this, and that's fine.
>
> The problem is, when I run the script in galaxy, I get the following error
> from R;
>
> Error in value[[3L]](cond) :
> failed to open BamFile: failed to load BAM index
> file: /tmp/tmpdP2eBC/files/000/dataset_3.dat
> Calls: f_oGRSeparateStrands ... tryCatch -> tryCatchList -> tryCatchOne ->
> 
> In addition: Warning messages:
> In doTryCatch(return(expr), name, parentenv, handler) :
> [bam_index_load] fail to load BAM index.
> Execution halted
>
> The function that reads the bam + bai file in the script is;
>
> bam = readGAlignments(file=bam.file, index=bai.file,
> param=ScanBamParam(which=gr.signal))
>
> http://www.rdocumentation.org/packages/GenomicRanges/html/GAlignments.html
>
> In the documentation for this function it states the following;
>
> "file, index, The path to the BAM file to read, and to the index file
of the
> BAM file to read, respectively. The latter is given /without/ the '.bai'
> extension. See |scanBam
> |
> for more information."
>
> I've played around with this a little and from the command line I've been
> successfully able to run the script to completion when the input bam file
> and bai are completely different names;
>
> e.g.
>
> Rscript script.R input1.xls something.bam meh.bai p
>
> but I can't run it if I change the extension, e.g.
>
> Rscript script.R input1.xls something.dat meh.dat p
> Error in value[[3L]](cond) :
>
> failed to open BamFile: failed to load BAM index
> file: /tmp/tmpdP2eBC/files/000/dataset_3.dat
> Calls: f_oGRSeparateStrands ... tryCatch -> tryCatchList -> tryCatchOne ->
> 
> In addition: Warning messages:
> In doTryCatch(return(expr), name, parentenv, handler) :
> [bam_index_load] fail to load BAM index.
> Execution halted
>
>
> Does anyone have any experience of resolving this kind of issue?
>
>
>>
>>
>> ___
>> Please keep all replies on the list by using "reply all"
>> in your mail client.  To manage your subscriptions to this
>> and other Galaxy lists, please use the interface at:
>>   https://lists.galaxyproject.org/
>>
>> To search Galaxy mailing lists use the unified search at:
>>   http://galaxyproject.org/search/mailinglists/

- -- 

- --
Dr. Martin Vickers

Data Manager/HPC Systems Administrator
Institute of Biological, Environmental and Rural Sciences
IBERS New Building
Aberystwyth University
SY23 3FG

w: http://www.martin-vickers.co.uk/
e: mj...@aber.ac.uk
t: 01970 62 2807
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.14 (GNU/Linux)

iQEcBAEBAgAGBQJWDlmjAAoJEHa0a8GkKQgIqqkH/RwvFjF//9z3ucrAziYKbuia
qe9fFiAUhfgMFYUxVxatdR1CqzLChcONonPDgcouxGO7i1EgGNmoRqYdEdCrHbPF
WXpS/1txd8ieIxIp4IjrrozoXnd7x360M6MZd8yh6YxNd+LXQdZyWBAYUePwl5RQ
x/rwaJHnfw2hiWtHLWlrqHQJESz4zo1L0Wjymy8ehyvo9zG6760/zZSInaHmFPkN
6YJVmr0o/k1FpQrXNaRlmxMKC9jbPoDvF6ZkpseA9y1ojmFpS0mrBBLxZyaGaru9
iKH4TYnD2PTU5L+2bmCbAiEa7us0KXEx74Mq8WaKQ/hwsvXQiCpXXmvPj7oCFSI=
=MVS2
-END PGP SIGNATURE-

___
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
  https://lists.galaxyproject.org/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/