/bin/apps/utils/replaceAtQual.pl

https://github.com/stuartpyoung/agua · Perl · 125 lines · 70 code · 35 blank · 20 comment · 3 complexity · 795dff8b542206b804e26ac701653ad6 MD5 · raw file

  1. #!/usr/bin/perl -w
  2. #### DEBUG
  3. $DEBUG = 1;
  4. #### TIME
  5. my $time = time();
  6. =head2
  7. APPLICATION replaceAtQual
  8. PURPOSE
  9. REPLACE THE '@' QUALITY VALUE WITH 'A' (ONE VALUE HIGHER)
  10. BECAUSE IT INTERFERES WITH MAQ CONVERSION FROM solexa TO fastq
  11. INPUT
  12. 1. solexa-FORMAT FASTQ FILE
  13. OUTPUT
  14. 1. sanger-FORMAT FASTQ FILE
  15. USAGE
  16. ./replaceAtQual.pl <--inputfile String> <--outputfile String> [--dot Integer] [-h]
  17. --inputfile : /Full/path/to/inputfile
  18. --outputfile : /Full/path/to/outputfile
  19. --dot : Print counter every 'dot' number of records
  20. --help : print help info
  21. EXAMPLES
  22. perl /nethome/bioinfo/apps/agua/0.4/bin/apps/utils/replaceAtQual.pl \
  23. --inputfile /mihg/data/NGS/syoung/base/pipeline/SRA/NA18507/samples/reads_1.1.fastq \
  24. --outputfile /mihg/data/NGS/syoung/base/pipeline/SRA/NA18507/samples/reads_sanger_1.1.fastq \
  25. --dot 100000
  26. =cut
  27. use strict;
  28. #### USE LIBRARY
  29. use FindBin qw($Bin);
  30. use lib "$Bin/../../../lib";
  31. #### FLUSH BUFFER
  32. $| = 1;
  33. #### GET TEMP DIRECTORY
  34. my $configfile = "$Bin/../../../../conf/default.conf";
  35. my $conf = Conf::Agua->new(inputfile=>$configfile);
  36. my $tempdir = $conf->getKeyValue("agua", 'EXECUTION_TEMPDIR');
  37. #### INTERNAL MODULES
  38. use Sampler;
  39. use Timer;
  40. use Util;
  41. use Conf::Agua;
  42. #### EXTERNAL MODULES
  43. use Term::ANSIColor qw(:constants);
  44. use Getopt::Long;
  45. use IO::Pipe;
  46. #### SET DEFAULT SEPARATOR
  47. my $DEFAULT_SEPARATOR = "\\s+";
  48. #### SAVE ARGUMENTS
  49. my @arguments = @ARGV;
  50. #### GET OPTIONS
  51. my $inputfile;
  52. my $outputfile;
  53. my $dot = 10000;
  54. my $help;
  55. if ( not GetOptions (
  56. 'inputfile=s' => \$inputfile,
  57. 'outputfile=s' => \$outputfile,
  58. 'dot=i' => \$dot,
  59. 'help' => \$help
  60. ) )
  61. { print "Use option --help for usage instructions.\n"; exit; };
  62. #### PRINT HELP
  63. if ( defined $help ) { usage(); }
  64. #### CHECK INPUTS
  65. die "Input file not defined (Use --help for usage)\n" if not defined $inputfile;
  66. #die "Output file not defined (Use --help for usage)\n" if not defined $outputfile;
  67. #### GET THE INFO FILES AND TOTAL READ COUNTS FOR EACH DIRECTORY
  68. my $args =
  69. {
  70. 'inputfile' => $inputfile,
  71. 'outputfile' => $outputfile,
  72. 'dot' => $dot
  73. };
  74. #### SET FILES
  75. Sampler::replaceAtQual($args);
  76. #### PRINT RUN TIME
  77. my $runtime = Timer::runtime( $time, time() );
  78. print "\nRun time: $runtime\n";
  79. print "Completed $0\n";
  80. print Util::datetime(), "\n";
  81. print "****************************************\n\n\n";
  82. exit;
  83. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  84. # SUBROUTINES
  85. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  86. sub usage
  87. {
  88. print `perldoc $0`;
  89. exit;
  90. }