From 1bb3c5e0826b99312f1b9a39cc07a3857e913782 Mon Sep 17 00:00:00 2001 From: Laura Denies Date: Tue, 20 Apr 2021 14:06:03 +0200 Subject: [PATCH] Add new file --- Integron_Prediction/Integron.R | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Integron_Prediction/Integron.R diff --git a/Integron_Prediction/Integron.R b/Integron_Prediction/Integron.R new file mode 100644 index 0000000..ad13a7c --- /dev/null +++ b/Integron_Prediction/Integron.R @@ -0,0 +1,22 @@ +#!/user/bin/env R + +library(tidyverse) + +attc <- read.delim(file = snakemake@input[["attc"]]) +attc$ID <- gsub(" ","",attc$ID) +attc <- attc %>% filter(Vscore <=1) +attc$attc_prediction <- "attc" + +intI <- read.table(file = snakemake@input[["intI"]], quote="\"") %>% select(3,13) %>% filter(V13 <= 1) +colnames(intI) <- c("ID","E_value") +intI$intI_prediction <- "intI" + +Integrons <- merge(attc, intI, by="ID", all=TRUE) %>% select(1,3,5) +Integrons <- unique(Integrons) +Integrons$attc_prediction <- fct_explicit_na(Integrons$attc_prediction, na_level = "-") +Integrons$intI_prediction <- fct_explicit_na(Integrons$intI_prediction, na_level = "-") +Integrons$Prediction <- ifelse(Integrons$attc_prediction == "attc" & Integrons$intI_prediction == "intI", "complete", + ifelse(Integrons$attc_prediction == "attc" & Integrons$intI_prediction == "-", "intI_incomplete", + ifelse(Integrons$attc_prediction == "-" & Integrons$intI_prediction == "intI", "attc_incomplete", "incomplete"))) + +write.table(Integrons, file = snakemake@output[["Integrons"]], sep="\t", row.names=FALSE, quote=FALSE) -- GitLab