Skip to content

Commit 3294ba9

Browse files
committed
feat: field names
1 parent 2b6ffe8 commit 3294ba9

1 file changed

Lines changed: 16 additions & 14 deletions

File tree

divref/divref/tools/remap_divref.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -263,19 +263,22 @@ def remap_divref(
263263
"""
264264
conn = _get_index_connection(index_path)
265265

266-
df = pd.read_csv(input_path, sep=separator)
267-
chrom_field = "chromosome"
268-
start_field = "coordinate_start"
269-
end_field = "coordinate_end"
270-
271-
required_fields = (
266+
df: pd.DataFrame = pd.read_csv(input_path, sep=separator)
267+
chrom_field: str = "chromosome"
268+
start_field: str = "coordinate_start"
269+
end_field: str = "coordinate_end"
270+
strand_field: str = "strand"
271+
padded_target_field: str = "padded_target"
272+
unpadded_target_field: str = "unpadded_target_sequence"
273+
274+
required_fields: list[str] = [
272275
chrom_field,
273276
start_field,
274277
end_field,
275-
"strand",
276-
"padded_target",
277-
"unpadded_target_sequence",
278-
)
278+
strand_field,
279+
padded_target_field,
280+
unpadded_target_field,
281+
]
279282
if not all(x in df.columns for x in required_fields):
280283
raise ValueError(f"Required fields not found in input file: {', '.join(required_fields)}")
281284

@@ -329,10 +332,9 @@ def remap_divref(
329332
start: int = df_row[start_field]
330333
end: int = df_row[end_field]
331334
hap_id: str = df_row[chrom_field]
332-
333-
strand: str = df_row["strand"]
334-
padded_target: str = df_row["padded_target"]
335-
target: str = df_row["unpadded_target_sequence"]
335+
strand: str = df_row[strand_field]
336+
padded_target: str = df_row[padded_target_field]
337+
target: str = df_row[unpadded_target_field]
336338

337339
padded_len_adj = len(padded_target.replace("-", "")) - len(target)
338340
if strand == "+":

0 commit comments

Comments
 (0)