Skip to content

Commit 2bd58d2

Browse files
committed
Mapper API: add c. metadata before dropping Nonetype layers
1 parent 0ad233d commit 2bd58d2

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/api/routers/map.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -194,21 +194,6 @@ async def map_scoreset(urn: str, store_path: Path | None = None) -> JSONResponse
194194
# drop annotation layer from mapping object
195195
mapped_scores.append(ScoreAnnotation(**m.model_dump()))
196196

197-
# drop Nonetype reference sequences
198-
for target_gene in reference_sequences:
199-
for layer in list(reference_sequences[target_gene].keys()):
200-
if (
201-
reference_sequences[target_gene][layer][
202-
"mapped_reference_sequence"
203-
]
204-
is None
205-
and reference_sequences[target_gene][layer][
206-
"computed_reference_sequence"
207-
]
208-
is None
209-
) or layer is None:
210-
del reference_sequences[target_gene][layer]
211-
212197
# if genomic layer, not accession-based, and target gene type is coding, add cdna entry (just the sequence accession) to reference_sequences dict
213198
if (
214199
AnnotationLayer.GENOMIC in reference_sequences[target_gene_name]
@@ -226,6 +211,21 @@ async def map_scoreset(urn: str, store_path: Path | None = None) -> JSONResponse
226211
},
227212
}
228213

214+
# drop Nonetype reference sequences
215+
for target_gene in reference_sequences:
216+
for layer in list(reference_sequences[target_gene].keys()):
217+
if (
218+
reference_sequences[target_gene][layer][
219+
"mapped_reference_sequence"
220+
]
221+
is None
222+
and reference_sequences[target_gene][layer][
223+
"computed_reference_sequence"
224+
]
225+
is None
226+
) or layer is None:
227+
del reference_sequences[target_gene][layer]
228+
229229
except Exception as e:
230230
return JSONResponse(
231231
content=ScoresetMapping(

0 commit comments

Comments
 (0)