This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
assignment5 [2018/10/18 09:01] dokuroot |
assignment5 [2018/10/20 17:37] (current) dokuroot |
||
---|---|---|---|
Line 20: | Line 20: | ||
\\ | \\ | ||
+ | |||
+ | **Additional Hints** (avoid reading these until you get stuck)\\ | ||
+ | \\ | ||
+ | 1) Your code will likely have a nested for loop. Use the length of the nested list within the matrix (''len(matrix[0])'') for the number of iterations in the outer for loop.\\ | ||
+ | \\ | ||
+ | 2) Use the length of the matrix (''len(matrix)'') for the number of iterations in the nested for loop.\\ | ||
+ | \\ | ||
+ | 3) Append each element from the original nested lists within the matrix (''matrix[n][i]'', where n and i are the two iteration variables in the for loops - but which order?) to a new list within the nested for loop and then append the new list to a second new list in the outer for loop. | ||
+ | \\ | ||
+ | |||
====Exercise 2==== | ====Exercise 2==== | ||
Line 60: | Line 70: | ||
let-7 1 | let-7 1 | ||
lin-4 0 | lin-4 0 | ||
+ | |||
+ | **Additional Hints** (avoid reading these until you get stuck)\\ | ||
+ | 1) Your first for loop should loop through the fastq file creating a dictionary with the sequence lines (''if (line_number + 3) % 4 == 1'') as the keys and the numbers of times each sequence appears as the values. You can increment the values using get (''fastq_dictionary[sequence] = fastq_dictionary.get(sequence, 0) + 1'').\\ | ||
+ | \\ | ||
+ | 2) The second for loop should loop through the fasta file and retrieve the number of reads for each sequence and should write the miRNA name and reads to a new file (''outfile.write(mirna_name[1:] + '\t' + str(fastq_dictionary.get(line, 0)) + '\n')''). |