My problem is solved. Here is a solution :

my $output_galaxy = $ARGV[2];
if (! -e "$output_perl_file") {print STDERR "no output file\n";}
else {`(cp -a $output_perl_file $output_galaxy) >& ./error.log 2>&1`}

And an explanation :
The output file generated by commands in my perl script is not the same file that the output file generated by Galaxy. So, I have to copy or move the content of the output file generated by my perl script in the Galaxy output file (arg).

I'll will add my tool in Galaxy Tool Shed (perl script have been modified).

Sarah Maman

Sarah Maman a écrit :


I have added a tool in my local instance to map BAM files on reference genome fasta file thanks to BWA. This tool runs, and the output file generated in database/files/000 is correct (not empty and good data inside) but the output listed in the history panel of Galaxy interface , is empty.
Could you please help me ?

Here is my xml file:

<tool id="BWA_aln_sampe" name=" BWA with BAM files">
<description>BWA mapping BAM files on reference genome fasta file</description> <command interpreter="perl">bwa_aln_sampe.pl $input1 $input2 $output1 </command>
<param format="fasta" name="input1" type="data" label="Reference genome from your history - fasta file"/>
   <param format="bam" name="input2" type="data" label="Bam file"/>
   <data format="bam" name="output1" />

This tool map BAM files on a reference genome.


Here is my perl file :
#!/usr/bin/perl -w
use strict;
use File::Basename;

my $input_ref_genome = $ARGV[0];
my $input_bam = $ARGV[1];
my $output_bam = $ARGV[2];
my $input_dir=dirname($input_bam);
my $input_basename=basename($input_bam,'.bam');
my $input_bamsorted="$input_dir/${input_basename}-sorted";

#Ouverture des fichiers entrants
open (IN, "<$input_ref_genome") or die "Cannot open $input_ref_genome !";
open (IN, "<$input_bam") or die "Cannot open $input_bam !";

#Indexation du genome de reference
#system("bwa index $input_ref_genome >> ./bwa.log 2>&1");

#Tri par nom du bam entrant pour travailler sur des donnees pairees
system("samtools sort -n $input_bam $input_bamsorted >> ./samtools.log 2>&1");

#Alignement des donnees pairees uniquement
system("bwa aln $input_ref_genome -b1 ${input_bamsorted}.bam > ${input_bamsorted}-1.sai >> ./bwaaln.log 2>&1"); system("bwa aln $input_ref_genome -b2 ${input_bamsorted}.bam > ${input_bamsorted}-2.sai >> ./bwaaln.log 2>&1");

#bwa sampe
system("bwa sampe $input_ref_genome ${input_bamsorted}-1.sai ${input_bamsorted}-2.sai ${input_bamsorted}.bam ${input_bamsorted}.bam | samtools view -bS - > $output_bam >> ./bwa.log 2>&1");

close( IN );
close( IN );

Thanks in advance,

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:


Reply via email to