Mercurial > repos > jampradinuk > repo_testing
view fastq_paired_reads_convention.pl @ 2:50905eb47f2d draft
Uploaded
author | jampradinuk |
---|---|
date | Thu, 10 May 2012 16:36:35 -0400 |
parents | |
children |
line wrap: on
line source
#! /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);