alignment = u.SequenceSource(sys.argv[1])
quals_dict = cPickle.load(open(sys.argv[2]))

quals_dict_filtered = {}

ids_in_alignment_file = []
while alignment.next():
    ids_in_alignment_file.append(alignment.id)
ids_in_alignment_file = set(ids_in_alignment_file)

for read_id in quals_dict:
    if read_id in ids_in_alignment_file:
        quals_dict_filtered[read_id] = quals_dict[read_id]
        ids_in_alignment_file.remove(read_id)

qual_stats_dict = get_qual_stats_dict(quals_dict_filtered)

colors = get_list_of_colors(21, colormap="RdYlGn")
colors = [colors[0] for _ in range(0, 20)] + colors
max_count = max([qual_stats_dict[q]['count'] for q in qual_stats_dict if qual_stats_dict[q]])

alignment_length = len(quals_dict.values()[0])

fig = plt.figure(figsize = (25, 8))
plt.rc('grid', color='0.50', linestyle='-', linewidth=0.1)
plt.grid(True)

plt.subplots_adjust(left=0.02, bottom = 0.09, top = 0.95, right = 0.98)

for position in range(0, alignment_length):
    print position
Ejemplo n.º 2
0
alignment = u.SequenceSource(sys.argv[1])
quals_dict = cPickle.load(open(sys.argv[2]))

quals_dict_filtered = {}

ids_in_alignment_file = []
while alignment.next():
    ids_in_alignment_file.append(alignment.id)
ids_in_alignment_file = set(ids_in_alignment_file)

for read_id in quals_dict:
    if read_id in ids_in_alignment_file:
        quals_dict_filtered[read_id] = quals_dict[read_id]
        ids_in_alignment_file.remove(read_id)

qual_stats_dict = get_qual_stats_dict(quals_dict_filtered)

colors = get_list_of_colors(21, colormap="RdYlGn")
colors = [colors[0] for _ in range(0, 20)] + colors
max_count = max([
    qual_stats_dict[q]['count'] for q in qual_stats_dict if qual_stats_dict[q]
])

alignment_length = len(quals_dict.values()[0])

fig = plt.figure(figsize=(25, 8))
plt.rc('grid', color='0.50', linestyle='-', linewidth=0.1)
plt.grid(True)

plt.subplots_adjust(left=0.02, bottom=0.09, top=0.95, right=0.98)
Ejemplo n.º 3
0
 def test_01_RunWeightedEntropy(self):
     output_file = os.path.join(self.output_directory_path, 'entropy.txt')
     QD = get_quals_dict(self.qual_scores_file, self.alignment, output_file_path = os.path.join(self.output_directory_path, 'QUALS_DICT'), verbose = False)
     QSD = get_qual_stats_dict(QD, output_file_path = os.path.join(self.output_directory_path, 'QUAL_STATS_DICT'), verbose = False)
     entropy_analysis(self.alignment, output_file = output_file, verbose = False, weighted = True, qual_stats_dict = QSD)
     self.assertTrue(files_are_the_same(self.expected_result, output_file))