Help for this page

Select Code to Download


  1. or download this
    open (FILE1, "Mock3_SNP.txt");
  2. or download this
    while (<FILE1>) {
        chomp;
        my $input_orig = $_;
    
  3. or download this
    while (defined (my $input_line = <$input>)) {
      chomp $input_line;
    
  4. or download this
        my @line = split /\s+/, $_;
  5. or download this
    my @line = split ' ', $input_line;
    
  6. or download this
    my $chr = "chr$line[1]";
  7. or download this
        $input{$name}[0] = $name;
        $input{$name}[1] = $chr;
        $input{$name}[2] = $pos;
    
  8. or download this
    $input{$name} = [ $name, $chr, $pos ];
    
  9. or download this
    push @{$input[$chr]} => [ $name, $pos ];
    
  10. or download this
    push @{$input[$chr]} => { name => $name, pos => $pos };
    
  11. or download this
    open (OUT, "> test.txt"); ### Change if file name changes
    
  12. or download this
    ### At the top:
    my $output_file = 'test.txt'; ### Change if the file name changes
    
    ### the open is then:
    open my $out, '>', $output_file or die "Can't open $output_file: $!";
    
  13. or download this
        foreach my $name(keys %input) {
            if ($input{$name}[1] eq $chr) {
                if ($input{$name}[2] > $pos-1 && $input{$name}[2] < $pos+3
    +6) {
    
  14. or download this
    $chr =~ s/^chr//; # remove chr if it's there
    ### or, if chr must be there:
    ...
    if (defined $input[$chr]) {
      for my $i (@{$input[$chr]}) {
        if ($pos <= $i->{pos} && $i->{pos} <= $pos+35) {
    
  15. or download this
                    if ($input{$name}[2] == $pos) {
                        my $fSNP = substr($seq, 0, 1);
                        print OUT "$fSNP\n";    
    ...
                        my $fSNP = substr($SNP, $input{$name}[2]-$pos);   
    +     
                        print OUT "$fSNP\n";    
                    }
    
  16. or download this
    my $fSNP = substr($seq, $i->{pos} - $pos, 1);
    print $out "$fSNP\n";