Hello,
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>
<inputs>
<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"/>
</inputs>
<outputs>
<data format="bam" name="output1" />
</outputs>
<help>
This tool map BAM files on a reference genome.
</help>
</tool>
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,
Sarah