Hello
Can anyone help with a perl script I have written to align multiple fastq files using novoalign. I am having trouble declaring the sample name into the script, so that once the alignments are complete, it is output with the correct sample name
So far I have this:
#!/usr/bin/perl
use strict;
my $sample;
chomp (my @fastq_R1list=`ls ./300bp_fastq/${sample}*R1_001.fastq.gz`);
chomp (my @fastq_R2list=`ls ./300bp_fastq/${sample}*R2_001.fastq.gz`);
while ($#fastq_R1list>0) {
my $fastq1=pop(@fastq_R1list);
my $fastq2=pop(@fastq_R2list);
if (! -e "$fastq1"){die "no fastq.gz file found for $fastq1\n";}
if (! -e "$fastq2"){die "no fastq.gz file found for $fastq2\n";}
my $sam="\$\'\@RG\\tID:${sample}\\tSM:${sample}\\tPL:ILLUMINA\'";
system ( "/novoalign -t 100 -H -F ILM1.8 -g 65 -x 7 -o FullNW -c 1 -o SAM $sam -f ./trimmed/${sample}.fastq1.trimmed.gz ./trimmed/${sample}.fastq2.trimmed.gz -d /reference_genomes/novo/human_g1k_v37.k15.s2.novoindex -k -K ./trimmed/${sample}_novocalibration > /dev/null" );
system ( "/novoalign -t 100 -H -F ILM1.8 -g 65 -x 7 -o FullNW -c 1 -o SAM $sam -f ./trimmed/${sample}.fastq1.trimmed.gz ./trimmed/${sample}.fastq2.trimmed.gz -d /reference_genomes/novo/human_g1k_v37.k15.s2.novoindex -k ./trimmed/${sample}_novocalibration > ./trimmed/${sample}.sam" );
system ("rm ./trimmed/${sample}.fastq1.trimmed.gz ./trimmed/${sample}.fastq2.trimmed.gz ./trimmed/${sample}_novocalibration" );
}
#./trimmed is the output folder
No sam files are being output even though the script runs. It's as though the sample names are not being declared but I though I did that with:
my $sample;
chomp (my @fastq_R1list=`ls ./300bp_fastq/${sample}*R1_001.fastq.gz`);
chomp (my @fastq_R2list=`ls ./300bp_fastq/${sample}*R2_001.fastq.gz`);
I am pretty new to perl! Any help is appreciated.
Thanks
Vanisha
Can anyone help with a perl script I have written to align multiple fastq files using novoalign. I am having trouble declaring the sample name into the script, so that once the alignments are complete, it is output with the correct sample name
So far I have this:
#!/usr/bin/perl
use strict;
my $sample;
chomp (my @fastq_R1list=`ls ./300bp_fastq/${sample}*R1_001.fastq.gz`);
chomp (my @fastq_R2list=`ls ./300bp_fastq/${sample}*R2_001.fastq.gz`);
while ($#fastq_R1list>0) {
my $fastq1=pop(@fastq_R1list);
my $fastq2=pop(@fastq_R2list);
if (! -e "$fastq1"){die "no fastq.gz file found for $fastq1\n";}
if (! -e "$fastq2"){die "no fastq.gz file found for $fastq2\n";}
my $sam="\$\'\@RG\\tID:${sample}\\tSM:${sample}\\tPL:ILLUMINA\'";
system ( "/novoalign -t 100 -H -F ILM1.8 -g 65 -x 7 -o FullNW -c 1 -o SAM $sam -f ./trimmed/${sample}.fastq1.trimmed.gz ./trimmed/${sample}.fastq2.trimmed.gz -d /reference_genomes/novo/human_g1k_v37.k15.s2.novoindex -k -K ./trimmed/${sample}_novocalibration > /dev/null" );
system ( "/novoalign -t 100 -H -F ILM1.8 -g 65 -x 7 -o FullNW -c 1 -o SAM $sam -f ./trimmed/${sample}.fastq1.trimmed.gz ./trimmed/${sample}.fastq2.trimmed.gz -d /reference_genomes/novo/human_g1k_v37.k15.s2.novoindex -k ./trimmed/${sample}_novocalibration > ./trimmed/${sample}.sam" );
system ("rm ./trimmed/${sample}.fastq1.trimmed.gz ./trimmed/${sample}.fastq2.trimmed.gz ./trimmed/${sample}_novocalibration" );
}
#./trimmed is the output folder
No sam files are being output even though the script runs. It's as though the sample names are not being declared but I though I did that with:
my $sample;
chomp (my @fastq_R1list=`ls ./300bp_fastq/${sample}*R1_001.fastq.gz`);
chomp (my @fastq_R2list=`ls ./300bp_fastq/${sample}*R2_001.fastq.gz`);
I am pretty new to perl! Any help is appreciated.
Thanks
Vanisha
Comment