Problem Set: Perl IV

Perl IV Problem Set Files for Perl IV Problem Set
  1. Perl_IV.fasta
Perl IV Problem Set
==================
1. Iterate through each element of this array using a foreach loop: (101,2,15,22,95,33,2,27,72,15,52);
        - Print out only the values that are even (use modulus operator).
2. Iterate through each of the elements of the above array, but sort them numerically.
        - Print each element.
        - Create two cumulative sums, one of all the even values and one of all the odd values. 
        - Print the two sums.
3. Iterate through each element in the above array using a for loop.
        - Print only the values of the indices that are odd    
4. Create a shuffled sequence
	Turn a DNA string into an array with split()
	Use a for loop to perform the following procedure N times (N = length of seq)
		Select a random position A with rand()
		Select a random position B with rand()
		Exchange the letters at array indices A and B
	Print the now shuffled sequence
 
5a. Start with 2 very similar DNA sequences. 
	Align with ClustalW, TCoffee, or some other web alignment application. 
	Output should be in fasta format.
	Store (copy and paste) the sequence, including dashes, from each ClustalW fasta output in a separate string variable inside your script.
	Turn each string into an array with split()
	Use a for loop to compare each index for nucleotide differences.
	Report the nucleotide position of each difference.
 
5b. Do the same as above but instead of coping and pasting into string variables
import from a file.
 
6. Calculate GC content
	Turn a DNA string into an array with split()
	Use a foreach loop to look at each nucleotide in turn
	Calculate total length of the sequence
	Keep a running total of C's and G's
	Print the calculated GC content as a percent.
 
 
7.  Run this code. Is its output what you expect? Why?
                  for (my $i = 0; $i < 10; $i++) {
                   if ($i = 2) {
                       print "\$i = $i\n";
                   }
                  }

Comments are closed.