Skip to content

Commit 10aaa8e

Browse files
committed
refactor: update renaming logic
1 parent 1fd9692 commit 10aaa8e

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

workflow/scripts/merge_annotation.R

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ library(logger)
1111

1212
log_threshold(INFO)
1313

14-
log_info("Reading variants table, replacing CHROM with the reference name")
14+
log_info("Reading variants table, replacing REGION with the reference name")
1515
variants <- read_tsv(
1616
snakemake@input$tsv,
1717
col_types = list(
18-
CHROM = col_character(),
18+
REGION = col_character(),
1919
POS = col_integer(),
2020
REF = col_character(),
2121
ALT = col_character()
2222
)
2323
) %>%
2424
mutate(
25-
CHROM = snakemake@params$ref_name,
25+
REGION = snakemake@params$ref_name,
2626
is_insertion = startsWith(ALT, "+"),
2727
is_deletion = startsWith(ALT, "-"),
2828
REF_VCF = case_when(
@@ -35,8 +35,7 @@ variants <- read_tsv(
3535
TRUE ~ ALT
3636
)
3737
) %>%
38-
select(-is_insertion, -is_deletion) %>%
39-
rename(CHROM = REGION)
38+
select(-is_insertion, -is_deletion)
4039

4140
log_info("Reading annotation table")
4241
annotation <- read_tsv(
@@ -68,15 +67,16 @@ merged <- left_join(
6867
variants,
6968
annotation,
7069
by = c(
71-
"CHROM" = "CHROM",
70+
"REGION" = "CHROM",
7271
"POS" = "POS",
7372
"REF_VCF" = "REF",
7473
"ALT_VCF" = "ALT"
7574
)
7675
) %>%
7776
mutate(
7877
SAMPLE = snakemake@params$sample
79-
)
78+
) %>%
79+
rename(CHROM = REGION)
8080

8181
log_info("Saving results")
8282
write_tsv(

0 commit comments

Comments
 (0)