def get_read_positions(self): piece_CDSs, max_gene_length = self.get_CDSs() gene_infos = positions.get_Transcript_position_counts(self.merged_file_names['combined_extended'], piece_CDSs, [], left_buffer=500, right_buffer=500, ) self.read_positions = {} for name, info in gene_infos.iteritems(): five_prime_counts = info['five_prime_positions'] three_prime_counts = info['three_prime_positions'] all_positions = {'all': five_prime_counts['all'], 'three_prime_genomic': three_prime_counts[0], 'three_prime_nongenomic': three_prime_counts['all'] - three_prime_counts[0], 'sequence': info['sequence'], } self.read_positions[name] = all_positions self.write_file('read_positions', self.read_positions) joint_position_counts = {} for transcript in piece_CDSs: counts = positions.get_joint_position_counts_sparse(self.merged_file_names['combined_extended'], transcript, left_buffer=500, right_buffer=500, ) joint_position_counts[transcript.name] = counts self.write_file('joint_positions', joint_position_counts)
def get_joint_position_counts(self, gene_name): CDSs, _ = self.get_CDSs() CDS_dict = {t.name: t for t in CDSs} transcript = CDS_dict[gene_name] joint_position_counts = positions.get_joint_position_counts_sparse(self.file_names['combined_extended_sorted'], transcript, ) return joint_position_counts, transcript