Mercurial > repos > mcharles > rapsodyn
changeset 30:2b15c0cab0ae draft
Uploaded
author | mcharles |
---|---|
date | Thu, 09 Oct 2014 06:42:00 -0400 |
parents | 7b8646f46010 |
children | 7631b341e0cf |
files | rapsodyn/Galaxy-Workflow-rapsosnp_v1.20_-_10x_-_sam.ga rapsodyn/PrepareFastqLight.pl rapsodyn/PrepareFastqLight.xml |
diffstat | 2 files changed, 58 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/rapsodyn/PrepareFastqLight.pl Wed Oct 08 09:06:53 2014 -0400 +++ b/rapsodyn/PrepareFastqLight.pl Thu Oct 09 06:42:00 2014 -0400 @@ -41,11 +41,12 @@ my $nb_base_current_t=0; - open(READ1, $read1_file) or die ("Can't open $read1_file\n"); open(READ2, $read2_file) or die ("Can't open $read2_file\n"); open(OUT1, ">$output1_file") or die ("Can't open $output1_file\n"); open(OUT2, ">$output2_file") or die ("Can't open $output2_file\n"); +open (LF,">$log_file") or die("Can't open $log_file\n"); + my $error1=0; my $error2=0; @@ -58,6 +59,59 @@ my $error9=0; my $error10=0; +my $auto_type=""; +my %qual; +if ($TYPE eq "auto"){ + my $compt=0; + open(DETECT, $read1_file) or die ("Can't open $read1_file\n"); + while (my $ligne1_r1 =<DETECT>){ + my $ligne2_r1 =<DETECT>; + my $ligne3_r1 =<DETECT>; + my $ligne4_r1 =<DETECT>; + $compt++; + if ($ligne4_r1 =~ /^(.*)\s*$/i){ + my $qual = $1; + my @q = split(//,$qual); + for (my $i=0;$i<=$#q;$i++){ + my $num = ord($q[$i]); + if ($qual{$num}){ + $qual{$num}++; + } + else { + $qual{$num} = 1; + } + #range sanger / illumina 1.8+ : 33->94 + #range illumina 1.3->1.7 : 64->105 + if ($num > 94){$auto_type = "illumina";last;} + if ($num < 64){$auto_type = "sanger";last;} + } + } + else { + print STDERR "Error in format detection : quality not recognized\n$ligne4_r1"; + exit(0); + } + + if ($auto_type ne ""){ + last; + } + + } + close (DETECT); + if ($auto_type eq ""){ + print STDERR "Error in format detection : type not recognized parsing read1\n"; + foreach my $key (sort {$a <=> $b} keys %qual){ + print "$key\t:\t",$qual{$key},"\n"; + } + exit(0); + } + else { + $TYPE = $auto_type; + } +} + + + + while (my $ligne1_r1 =<READ1>){ my $ligne2_r1 =<READ1>; my $ligne3_r1 =<READ1>; @@ -298,8 +352,8 @@ close (OUT1); close (OUT2); -open (LF,">$log_file") or die("Can't open $log_file\n"); print LF "\n####\t Fastq preparation \n"; +print LF "Fastq format : $TYPE\n"; print LF "## Before preparation\n"; print LF "#Read1 :\t$nb_read1\t#Base :\t$nb_base_read1\n"; print LF "#Read2 :\t$nb_read2\t#Base :\t$nb_base_read2\n";
--- a/rapsodyn/PrepareFastqLight.xml Wed Oct 08 09:06:53 2014 -0400 +++ b/rapsodyn/PrepareFastqLight.xml Thu Oct 09 06:42:00 2014 -0400 @@ -1,4 +1,4 @@ -<tool id="PrepareFastqLight" name="PrepareFastqLight" version="1.01"> +<tool id="PrepareFastqLight" name="PrepareFastqLight" version="1.02"> <description>Fastq preparation</description> <command interpreter="perl"> PrepareFastqLight.pl -read1_file $input_read1_file -read2_file $input_read2_file -output1 $output_read1_file -output2 $output_read2_file -log_file $log_file -type $quality_type -min_quality $min_quality -min_length $min_length @@ -7,6 +7,7 @@ <param name="input_read1_file" type="data" format="txt,fastq" label="Select a suitable FASTQ READ 1 file from your history"/> <param name="input_read2_file" type="data" format="txt,fastq" label="Select a suitable FASTQ READ 2 file from your history"/> <param name="quality_type" type="select" label="Select input quality format"> + <option value="auto">Auto-detect</option> <option value="sanger">Sanger</option> <option value="illumina">Illumina 1.3-1.7</option> </param>