reebee3 has asked for the wisdom of the Perl Monks concerning the following question:
Hello! I am trying to write a script that detects SNPs and their position in DNA sequences. Simply put, A SNP is when there is a change in A, T, C, or G between sequences, therefore...
A could change to T, C, to G
T could change to C, G, or A
G could change to C, T or A
C could change to G, T or A
For Example:
Sequence 1: ATGGAT
Sequence 2: ACGGAG
There are 2 SNPs here.
SNP 1 is the T --> C is position 2 of the sequence. SNP 2 is the T -->G in position 6 of the sequence.
Criteria for the script:
Only 2 sequences can be entered on the command line The 2 sequences must be equal length Find the SNP and the position of the SNP (starting from position 1 not 0) Print out data- for example using the sample above
Pos 2: T => C
Pos 6: T =>G
Found 2 SNPs.
This is what I have so far, but I am not sure how to proceed...
#!/usr/bin/env perl # file: 08-snps.pl use strict; use warnings; use autodie; my $number_seqs = scalar @ARGV; if($number_seqs != 2){ print "Please provide two sequences \n"; } for (my $i=0; $i<$number_seqs; $i++){ if(length($ARGV[$i]) != length($ARGV[0])){ print "Please ensure the sequences are the same length \n"; } } my $var = $ARGV[0]; print $var,"\n"; my $var2 = my $var[0]; print $var2,"\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Help tracking changes in array
by toolic (Bishop) on Oct 08, 2015 at 18:13 UTC | |
|
Re: Help tracking changes in array
by kcott (Archbishop) on Oct 08, 2015 at 18:35 UTC | |
|
Re: Help tracking changes in array
by stevieb (Canon) on Oct 08, 2015 at 18:14 UTC | |
|
Re: Help tracking changes in array
by Anonymous Monk on Oct 08, 2015 at 18:42 UTC |