- or download this
open (FILE1, "Mock3_SNP.txt"); - or download this
while (<FILE1>) {
chomp;
my $input_orig = $_;
- or download this
while (defined (my $input_line = <$input>)) {
chomp $input_line;
- or download this
my @line = split /\s+/, $_; - or download this
my @line = split ' ', $input_line;
- or download this
my $chr = "chr$line[1]"; - or download this
$input{$name}[0] = $name;
$input{$name}[1] = $chr;
$input{$name}[2] = $pos;
- or download this
$input{$name} = [ $name, $chr, $pos ];
- or download this
push @{$input[$chr]} => [ $name, $pos ];
- or download this
push @{$input[$chr]} => { name => $name, pos => $pos };
- or download this
open (OUT, "> test.txt"); ### Change if file name changes
- 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: $!";
- 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) {
- 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) {
- 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";
}
- or download this
my $fSNP = substr($seq, $i->{pos} - $pos, 1);
print $out "$fSNP\n";