Mercurial > repos > mcharles > rapsosnp
changeset 9:0e7c6fe60646 draft
Uploaded
author | mcharles |
---|---|
date | Mon, 20 Oct 2014 05:58:31 -0400 |
parents | d857538d9fea |
children | 0a6c1cfe4dc8 |
files | rapsodyn/SplitFileUpTo10x.pl rapsodyn/SplitFileUpTo10x.xml rapsodyn/extractseq.pl |
diffstat | 3 files changed, 239 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rapsodyn/SplitFileUpTo10x.pl Mon Oct 20 05:58:31 2014 -0400 @@ -0,0 +1,110 @@ +#!/usr/bin/perl +#V1.0.0 +use strict; +use warnings; + +my $in = $ARGV[0]; +my $NB_LINE_GROUP = $ARGV[1]; +my $NB_FILE = $ARGV[2]; +my $out1 = $ARGV[3]; +my $out2 = $ARGV[4]; +my $out3 = $ARGV[5]; +my $out4 = $ARGV[6]; +my $out5 = $ARGV[7]; +my $out6 = $ARGV[8]; +my $out7 = $ARGV[9]; +my $out8 = $ARGV[10]; +my $out9 = $ARGV[11]; +my $out10 = $ARGV[12]; + +if (($NB_FILE<2)||($NB_FILE>10)){ + print STDERR "File must be split in 2-10\n"; + exit(0); +} +my @in; +my $current_aggregate; +open(IN, $in) or die ("Can't open $in\n"); +while (my $line =<IN>){ + $current_aggregate = $line; + my $nb_line=1; + if ($NB_LINE_GROUP>1){ + while (my $add_line = <IN>){ + $current_aggregate .= $add_line; + $nb_line++; + if ($nb_line == $NB_LINE_GROUP){ + last; + } + } + } + push (@in,$current_aggregate); +} +close (IN); + +open (OUT1,">$out1") or die ("Can't open $out1"); +open (OUT2,">$out2") or die ("Can't open $out2"); +open (OUT3,">$out3") or die ("Can't open $out3"); +open (OUT4,">$out4") or die ("Can't open $out4"); +open (OUT5,">$out5") or die ("Can't open $out5"); +open (OUT6,">$out6") or die ("Can't open $out6"); +open (OUT7,">$out7") or die ("Can't open $out7"); +open (OUT8,">$out8") or die ("Can't open $out8"); +open (OUT9,">$out9") or die ("Can't open $out9"); +open (OUT10,">$out10") or die ("Can't open $out10"); + + +for (my $i=0;$i<=$#in;$i++){ + if ($i <= $#in * 1 / $NB_FILE){ + print OUT1 $in[$i]; + } + elsif ($i <= $#in * 2 / $NB_FILE){ + print OUT2 $in[$i]; + } + elsif (($NB_FILE>=3)&&($i <= $#in * 3 / $NB_FILE)){ + print OUT3 $in[$i]; + } + elsif (($NB_FILE>=4)&&($i <= $#in * 4 / $NB_FILE)){ + print OUT4 $in[$i]; + } + elsif (($NB_FILE>=5)&&($i <= $#in * 5 / $NB_FILE)){ + print OUT5 $in[$i]; + } + elsif (($NB_FILE>=6)&&($i <= $#in * 6 / $NB_FILE)){ + print OUT6 $in[$i]; + } + elsif (($NB_FILE>=7)&&($i <= $#in * 7 / $NB_FILE)){ + print OUT7 $in[$i]; + } + elsif (($NB_FILE>=8)&&($i <= $#in * 8 / $NB_FILE)){ + print OUT8 $in[$i]; + } + elsif (($NB_FILE>=9)&&($i <= $#in * 9 / $NB_FILE)){ + print OUT9 $in[$i]; + } + elsif (($NB_FILE>=10)&&($i <= $#in * 10 / $NB_FILE)){ + print OUT10 $in[$i]; + } + else { + + } + + +} + + +close (OUT1); +close (OUT2); +close (OUT3); +close (OUT4); +close (OUT5); +close (OUT6); +close (OUT7); +close (OUT8); +close (OUT9); +close (OUT10); + + + + + + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rapsodyn/SplitFileUpTo10x.xml Mon Oct 20 05:58:31 2014 -0400 @@ -0,0 +1,128 @@ +<tool id="SplitFileUpTo10x" name="SplitFileUpTo10x" version="1.00"> +<description>Split file in 2-10</description> +<command interpreter="perl"> + SplitFileUpTo10x.pl $input_file $line_number $file_number $output_file1 $output_file2 $output_file3 $output_file4 $output_file5 $output_file6 $output_file7 $output_file8 $output_file9 $output_file10 +</command> +<inputs> +<param name="out_format" type="select" label="Format"> + <option value="pileup">pileup</option> + <option value="fastq">fastq</option> + <option value="fastqsanger">fastqsanger</option> + <option value="sam">sam</option> + <option value="fasta">fasta</option> + <option value="tabular">tabular</option> +</param> +<param name="input_file" type="data" format="txt,tabular,astq,fastqsanger,fastqillumina,pileup,sam,fasta" label="Select a suitable input file from your history"/> +<param name="line_number" type="integer" value="4" label="Number of line read at a time before splitting"/> +<param name="file_number" type="integer" value="4" label="Number of split files"/> +</inputs> +<outputs> +<data name="output_file1" format="txt" label="PART1 on ${on_string}"> + <change_format> + <when input="out_format" value="pileup" format="pileup" /> + <when input="out_format" value="fastq" format="fastq" /> + <when input="out_format" value="sam" format="sam" /> + <when input="out_format" value="fasta" format="fasta" /> + <when input="out_format" value="tabular" format="tabular" /> + <when input="out_format" value="fastqsanger" format="fastqsanger" /> + </change_format> +</data> +<data name="output_file2" format="txt" label="PART2 on ${on_string}"> + <change_format> + <when input="out_format" value="pileup" format="pileup" /> + <when input="out_format" value="fastq" format="fastq" /> + <when input="out_format" value="sam" format="sam" /> + <when input="out_format" value="fasta" format="fasta" /> + <when input="out_format" value="tabular" format="tabular" /> + <when input="out_format" value="fastqsanger" format="fastqsanger" /> + </change_format> +</data> +<data name="output_file3" format="txt" label="PART3 on ${on_string}"> + <change_format> + <when input="out_format" value="pileup" format="pileup" /> + <when input="out_format" value="fastq" format="fastq" /> + <when input="out_format" value="sam" format="sam" /> + <when input="out_format" value="fasta" format="fasta" /> + <when input="out_format" value="tabular" format="tabular" /> + <when input="out_format" value="fastqsanger" format="fastqsanger" /> + </change_format> +</data> +<data name="output_file4" format="txt" label="PART4 on ${on_string}"> + <change_format> + <when input="out_format" value="pileup" format="pileup" /> + <when input="out_format" value="fastq" format="fastq" /> + <when input="out_format" value="sam" format="sam" /> + <when input="out_format" value="fasta" format="fasta" /> + <when input="out_format" value="tabular" format="tabular" /> + <when input="out_format" value="fastqsanger" format="fastqsanger" /> + </change_format> +</data> +<data name="output_file5" format="txt" label="PART5 on ${on_string}"> + <change_format> + <when input="out_format" value="pileup" format="pileup" /> + <when input="out_format" value="fastq" format="fastq" /> + <when input="out_format" value="sam" format="sam" /> + <when input="out_format" value="fasta" format="fasta" /> + <when input="out_format" value="tabular" format="tabular" /> + <when input="out_format" value="fastqsanger" format="fastqsanger" /> + </change_format> +</data> +<data name="output_file6" format="txt" label="PART6 on ${on_string}"> + <change_format> + <when input="out_format" value="pileup" format="pileup" /> + <when input="out_format" value="fastq" format="fastq" /> + <when input="out_format" value="sam" format="sam" /> + <when input="out_format" value="fasta" format="fasta" /> + <when input="out_format" value="tabular" format="tabular" /> + <when input="out_format" value="fastqsanger" format="fastqsanger" /> + </change_format> +</data> +<data name="output_file7" format="txt" label="PART7 on ${on_string}"> + <change_format> + <when input="out_format" value="pileup" format="pileup" /> + <when input="out_format" value="fastq" format="fastq" /> + <when input="out_format" value="sam" format="sam" /> + <when input="out_format" value="fasta" format="fasta" /> + <when input="out_format" value="tabular" format="tabular" /> + <when input="out_format" value="fastqsanger" format="fastqsanger" /> + </change_format> +</data> +<data name="output_file8" format="txt" label="PART8 on ${on_string}"> + <change_format> + <when input="out_format" value="pileup" format="pileup" /> + <when input="out_format" value="fastq" format="fastq" /> + <when input="out_format" value="sam" format="sam" /> + <when input="out_format" value="fasta" format="fasta" /> + <when input="out_format" value="tabular" format="tabular" /> + <when input="out_format" value="fastqsanger" format="fastqsanger" /> + </change_format> +</data> +<data name="output_file9" format="txt" label="PART9 on ${on_string}"> + <change_format> + <when input="out_format" value="pileup" format="pileup" /> + <when input="out_format" value="fastq" format="fastq" /> + <when input="out_format" value="sam" format="sam" /> + <when input="out_format" value="fasta" format="fasta" /> + <when input="out_format" value="tabular" format="tabular" /> + <when input="out_format" value="fastqsanger" format="fastqsanger" /> + </change_format> +</data> +<data name="output_file10" format="txt" label="PART10 on ${on_string}"> + <change_format> + <when input="out_format" value="pileup" format="pileup" /> + <when input="out_format" value="fastq" format="fastq" /> + <when input="out_format" value="sam" format="sam" /> + <when input="out_format" value="fasta" format="fasta" /> + <when input="out_format" value="tabular" format="tabular" /> + <when input="out_format" value="fastqsanger" format="fastqsanger" /> + </change_format> +</data> + +</outputs> + +<help> + + + +</help> +</tool>
--- a/rapsodyn/extractseq.pl Fri Oct 10 07:05:36 2014 -0400 +++ b/rapsodyn/extractseq.pl Mon Oct 20 05:58:31 2014 -0400 @@ -89,7 +89,7 @@ } $variant{"desc"}=$descriptor; - print ">",$variant{"ref"},"_",$descriptor,"\n",$variant{"SEQ"},"\n"; + print ">",$variant{"ref"},"_",$descriptor,"_","\n",$variant{"SEQ"},"\n";