Advertisement
Guest User

Untitled

a guest
Jul 11th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.69 KB | None | 0 0
  1. #!/usr/bin/env perl
  2.  
  3. use strict;
  4. use warnings;
  5.  
  6. my $data = $ARGV[0];
  7.  
  8. my ($line, @line, $effect);
  9.  
  10. print "Chr\tPos\tRef\tAlt\tEffect\tBeta\tBeta_SE\tBeta_pval\n";
  11.  
  12. open(DATA, "<$data");
  13.  
  14.  
  15. while(<DATA>) {
  16.  
  17.     $line = $_;
  18.     chomp($line);
  19.  
  20.     @line = split(" ", $line);
  21.  
  22.     ## Check for the header
  23.  
  24.     if ($line =~ m/CHR/) {
  25.         next;
  26.     }
  27.  
  28.     ## If it is a possible indel, next line
  29.  
  30.     if (length ($line[3]) > 1 or length ($line[4]) > 1) {
  31.         next;
  32.     }
  33.  
  34.     $effect = $line[3];
  35.  
  36.  
  37.     #$line[8] =  log($line[8])/log(10);
  38.  
  39.     if ($line[8] < 0) {
  40.  
  41.         $effect = $line[4];
  42.  
  43.         $line[8] = -$line[8];
  44.  
  45.     }
  46.  
  47.     print "$line[0]\t$line[2]\t$line[3]\t$line[4]\t$effect\t$line[8]\t$line[9]\t$line[10]\n";
  48.    
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement