#!usr/bin/perl

# Motif-finding using Lol's Vrs1/vrs1 barley samples. Will include file I/O and loops (for reading in sequence lines and for counting motifs).
# Concept focus: A lot of biology data is stored in files and databases. We can read those files and databases to get data, analyze it with our code,
# and generate new information as file, database, and/or image output. Read sequence data from files, locate feature(s), output information about those locations.

# this is a function. you can call it many times
sub lookup($) {
    my $motif = "ACG";
    print "Is $motif found in $_[0]? ";
    if ($_[0] =~ /$motif/) {
        print "Found it!\n";
    }
    else {
        print "Nope...\n";
    }
}
# end of function


# main body of code
my $seq = "ACGT";
print "My sequence: " . $seq . "\n";
lookup($seq);

my $rev_seq = reverse($seq);
print "Reversed: " . $rev_seq . "\n";
lookup($rev_seq);

$more_seq = $seq . "CCGAAT";
print "Longer sequence: " . $more_seq . "\n";
lookup($more_seq);
