|
25 | 25 | from .assignment_io import ReadAssignmentType
|
26 | 26 | from .gene_info import GeneInfo, StrandDetector, TranscriptModel, TranscriptModelType
|
27 | 27 | from .intron_graph import IntronGraph, VERTEX_polya, VERTEX_polyt, VERTEX_read_end, VERTEX_read_start
|
28 |
| -from .isoform_assignment import is_matching_assignment, match_subtype_to_str_with_additional_info, MatchEventSubtype |
| 28 | +from .isoform_assignment import ( |
| 29 | + is_matching_assignment, |
| 30 | + match_subtype_to_str_with_additional_info, |
| 31 | + MatchEventSubtype, |
| 32 | + ReadAssignment, |
| 33 | + MatchClassification, |
| 34 | + IsoformMatch |
| 35 | +) |
29 | 36 | from .long_read_assigner import LongReadAssigner
|
30 | 37 | from .long_read_profiles import CombinedProfileConstructor
|
31 | 38 | from .polya_finder import PolyAInfo
|
@@ -163,6 +170,32 @@ def forward_counts(self):
|
163 | 170 | self.transcript_counter.add_confirmed_features([model.transcript_id for model in self.transcript_model_storage])
|
164 | 171 |
|
165 | 172 | def compare_models_with_known(self):
|
| 173 | + if not self.gene_info.all_isoforms_exons: |
| 174 | + for model in self.transcript_model_storage: |
| 175 | + # create intergenic |
| 176 | + assignment = ReadAssignment(model.transcript_id, |
| 177 | + ReadAssignmentType.intergenic, |
| 178 | + IsoformMatch(MatchClassification.intergenic)) |
| 179 | + if model.strand == "-": |
| 180 | + polya_info = PolyAInfo(-1, model.exon_blocks[0][0], -1, -1) |
| 181 | + else: |
| 182 | + polya_info = PolyAInfo(model.exon_blocks[-1][1], -1, -1, -1) |
| 183 | + |
| 184 | + assignment.polya_info = polya_info |
| 185 | + assignment.cage_found = False |
| 186 | + assignment.exons = model.exon_blocks |
| 187 | + assignment.strand = model.strand |
| 188 | + assignment.chr_id = model.chr_id |
| 189 | + assignment.set_additional_info("indel_count", "NA") |
| 190 | + assignment.set_additional_info("junctions_with_indels", "NA") |
| 191 | + assignment.introns_match = False |
| 192 | + assignment.gene_info = self.gene_info |
| 193 | + |
| 194 | + FSM_class = "C" |
| 195 | + assignment.set_additional_info("FSM_class", FSM_class) |
| 196 | + self.transcript2transcript.append(assignment) |
| 197 | + return |
| 198 | + |
166 | 199 | gene_to_model_dict = defaultdict(list)
|
167 | 200 | for model in self.transcript_model_storage:
|
168 | 201 | gene_to_model_dict[model.gene_id].append(model.transcript_id)
|
|
0 commit comments