Mercurial > repos > jampradinuk > repo_testing
changeset 5:f87183778470 draft
Uploaded
author | jampradinuk |
---|---|
date | Thu, 10 May 2012 17:19:17 -0400 |
parents | a8eccdcc0800 |
children | 84889c68396d |
files | fastq_paired_reads_convention.pl |
diffstat | 1 files changed, 50 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fastq_paired_reads_convention.pl Thu May 10 17:19:17 2012 -0400 @@ -0,0 +1,50 @@ +#! /usr/bin/perl -w + +use strict; +use warnings; + +# fastq_paired_reads_convention2.pl [input file] [left output file] [right output file] + +die "Check arguments" unless @ARGV == 3; + +#open (LEFT, '>data/left2.fastq') or die "Cannot create $ARGV[1]: $!\n"; +#open (RIGHT, '>data/right2.fastq') or die "Cannot create $ARGV[2]: $!\n"; +#open (INPUT, '<data/interlaced.fastq') or die "Cannot open $ARGV[0]: $!\n"; + +open (LEFT, '>', $ARGV[1]) or die "Cannot create $ARGV[1]: $!\n"; +open (RIGHT, '>', $ARGV[2]) or die "Cannot create $ARGV[2]: $!\n"; +open (INPUT, '<', $ARGV[0]) or die "Cannot open $ARGV[0]: $!\n"; + +my $which = 0; +my $current_id; + +while(<INPUT>) { + chomp; + if(/ 1\S*/){ + $_ =~ s/ 1\S*//; + $_.='/1'; + $current_id = substr $_, 1; + $which = 1; + } + if(/ 2\S*/){ + $_ =~ s/ 2\S*//; + $_.='/2'; + $current_id = substr $_, 1; + $which = 2; + } + + if($_ eq '+'){ + $_.=$current_id; + } + + if($which == 1){ + print LEFT "$_\n"; + } + if($which == 2){ + print RIGHT "$_\n"; + } +} + +close (LEFT); +close (RIGHT); +close (INPUT); \ No newline at end of file