From 1ea253dbb36eb2a85b998b0845a58edeb6b1c871 Mon Sep 17 00:00:00 2001 From: Libby Fortin Date: Sat, 14 Oct 2017 11:27:46 -0500 Subject: [PATCH 1/2] Question 1 --- CfloridaCounts.txt | 1001 ++++++++++++++++++++++++++++++++++++++++++++ Exercise8.R | 34 ++ 2 files changed, 1035 insertions(+) create mode 100644 CfloridaCounts.txt create mode 100644 Exercise8.R diff --git a/CfloridaCounts.txt b/CfloridaCounts.txt new file mode 100644 index 0000000..b8b52da --- /dev/null +++ b/CfloridaCounts.txt @@ -0,0 +1,1001 @@ +##Deleted a large header, all lines starting with ## +#CHROM POS INFO FORMAT Cf.Sfa.003 Cf.Sfa.004 Cf.Sfa.005 Cf.Sfa.006 Cf.Sfa.007 Cf.Sfa.008 Cf.Sfa.009 Cf.Sfa.010 Cf.Sfa.011 Cf.Sfa.012 Cf.Sfa.013 Cf.Sfa.014 Cf.Sfa.028 Cf.Sfa.029 Cf.Sfa.030 Cf.Sfa.031 Cf.Sfa.032 Cf.Sfa.033 Cf.Sfa.003 Cf.Sfa.004 Cf.Sfa.007 Cf.Sfa.011 Cf.Sfa.012 Cf.Sfa.013 Cf.Sfa.014 Cf.Gai.001 Cf.Gai.003 Cf.Gai.004 Cf.Gai.006 Cf.Gai.007 Cf.Gai.008 Cf.Gai.002 Cf.Gai.003 Cf.Gai.004 Cf.Gai.005 Cf.Gai.006 Cf.Gai.007 Cf.Gai.008 Cf.Gai.009 Cf.Gai.010 Cf.Gai.011 Cf.Gai.012 Cf.Gai.013 Cf.Gai.014 Cf.Gai.016 Cf.Gai.017 Cf.Gai.019 Cf.Gai.023 Cf.Gai.024 Cf.Gai.025 Cf.Gai.027 Cf.Sfa.001 Cf.Sfa.002 Cf.Sfa.012 Cf.Sfa.013 Cf.Sfa.017 Cf.Sfa.027 Cf.Sfa.030 Cf.Sfa.033 Cf.Sfa.036 Cf.Sfa.037 Cf.Sfa.038 Cf.Sfa.040 Cf.Sfa.041 Cf.Sfa.042 Cf.Sfa.043 Cf.Sfa.045 Cf.Sfa.046 Cf.Sfa.048 Cf.Sfa.050 Cf.Sfa.052 Cf.Sfa.058 Cf.Sfa.064 Cf.Sfa.067 Cf.Sfa.074 Cf.Sfa.077 Cf.Sfa.080 Cf.Sfa.084 Cf.Sfa.089 Cf.Sfa.090 Cf.Sfa.092 Cf.Sfa.093 Cf.Sfa.017 Cf.Sfa.019 Cf.Gai.020 Cf.Gai.021 +:1,0: +:5,0: +:1,0: +:5,0: +:5,0: +:5,0: +:1,0: +:1,0: +:2,0: +:2,0: +:2,0: +:2,0: +:5,0: +:1,0: +:1,0: +:2,0: +:2,0: +:1,0: +:1,0: +:1,0: +:4,0: +:3,0: +:1,0: +:3,0: +:3,0: +:6,0: +:3,0: +:5,0: +:5,0: +:5,0: +:5,0: +:2,0: +:0,3: +:3,0: +:4,0: +:1,0: +:1,0: +:5,0: +:5,0: +:3,0: +:3,0: +:2,0: +:0,2: +:2,0: +:2,0: +:1,0: +:3,0: +:0,3: +:2,0: +:2,0: +:1,0: +:2,0: +:5,0: +:3,0: +:3,0: +:1,0: +:1,0: +:1,0: +:2,0: +:0,2: +:2,0: +:2,0: +:2,0: +:2,0: +:4,0: +:2,0: +:2,0: +:3,0: +:5,0: +:1,0: +:1,0: +:1,0: +:4,0: +:4,0: +:0,2: +:2,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,3: +:4,0: +:4,0: +:6,0: +:2,1: +:2,0: +:3,0: +:3,0: +:1,0: +:1,0: +:1,0: +:1,0: +:2,0: +:1,0: +:1,0: +:1,1: +:2,0: +:2,0: +:2,0: +:2,0: +:2,0: +:1,0: +:1,0: +:6,0: +:5,0: +:5,0: +:5,0: +:5,0: +:3,0: +:3,0: +:0,3: +:3,0: +:3,0: +:3,0: +:5,2: +:5,2: +:1,0: +:1,0: +:4,0: +:4,0: +:4,0: +:5,0: +:1,0: +:1,0: +:2,0: +:2,0: +:3,0: +:1,2: +:0,1: +:1,0: +:1,0: +:2,0: +:2,0: +:2,0: +:2,0: +:5,0: +:3,0: +:3,0: +:1,0: +:1,0: +:2,1: +:4,3: +:7,0: +:2,1: +:3,0: +:2,0: +:1,2: +:3,0: +:3,0: +:3,0: +:1,0: +:2,0: +:2,0: +:2,0: +:2,0: +:2,0: +:3,0: +:3,0: +:3,0: +:3,0: +:0,1: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:2,0: +:3,0: +:3,1: +:3,0: +:1,0: +:1,0: +:1,0: +:2,0: +:2,0: +:3,0: +:3,0: +:5,0: +:5,0: +:3,0: +:1,1: +:3,0: +:3,0: +:0,3: +:1,0: +:2,0: +:2,0: +:3,0: +:2,1: +:1,0: +:1,0: +:4,0: +:2,0: +:3,0: +:1,0: +:1,0: +:3,0: +:3,0: +:3,0: +:1,0: +:1,0: +:3,2: +:4,0: +:4,0: +:1,2: +:3,0: +:3,0: +:3,0: +:1,2: +:3,0: +:3,0: +:2,0: +:2,0: +:0,1: +:3,0: +:4,0: +:4,0: +:4,0: +:4,0: +:2,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:0,2: +:1,2: +:1,0: +:1,0: +:2,0: +:2,0: +:2,0: +:0,5: +:2,0: +:2,0: +:2,0: +:3,0: +:5,0: +:5,0: +:2,0: +:2,0: +:2,0: +:2,0: +:3,0: +:3,0: +:6,0: +:6,0: +:2,0: +:1,0: +:1,0: +:1,0: +:1,0: +:3,0: +:7,0: +:6,0: +:6,0: +:3,0: +:3,0: +:3,0: +:3,0: +:0,3: +:3,0: +:3,0: +:0,3: +:0,3: +:3,0: +:6,0: +:6,0: +:2,0: +:2,0: +:1,2: +:2,0: +:2,0: +:2,0: +:2,0: +:1,1: +:2,0: +:1,0: +:1,0: +:1,0: +:1,0: +:4,0: +:4,0: +:4,0: +:4,0: +:4,0: +:3,0: +:3,0: +:2,0: +:1,2: +:3,0: +:1,0: +:1,0: +:1,0: +:1,2: +:1,2: +:1,2: +:1,0: +:6,0: +:1,0: +:1,0: +:1,0: +:3,0: +:0,3: +:3,1: +:2,0: +:3,0: +:3,0: +:2,0: +:4,0: +:2,0: +:2,0: +:1,0: +:2,0: +:2,0: +:2,0: +:1,0: +:2,0: +:2,0: +:2,0: +:0,5: +:0,5: +:5,0: +:5,0: +:5,0: +:3,0: +:4,0: +:4,0: +:4,0: +:4,0: +:4,0: +:4,0: +:1,0: +:2,0: +:1,0: +:1,0: +:3,0: +:2,0: +:2,0: +:0,2: +:2,0: +:2,0: +:1,0: +:1,0: +:1,0: +:6,0: +:3,0: +:2,0: +:2,0: +:2,0: +:1,0: +:4,0: +:8,0: +:0,1: +:0,1: +:2,0: +:2,0: +:2,0: +:0,1: +:3,0: +:0,4: +:2,0: +:2,0: +:2,0: +:2,0: +:5,0: +:5,0: +:5,0: +:5,0: +:5,0: +:3,0: +:6,0: +:6,0: +:0,1: +:3,0: +:1,0: +:1,0: +:2,0: +:2,0: +:3,0: +:3,0: +:3,0: +:1,0: +:1,0: +:2,0: +:2,0: +:2,0: +:4,0: +:4,0: +:4,0: +:4,0: +:2,2: +:4,0: +:4,0: +:1,0: +:1,0: +:1,0: +:1,0: +:2,0: +:2,2: +:2,2: +:4,0: +:1,0: +:5,0: +:2,3: +:5,0: +:1,1: +:2,3: +:0,2: +:2,0: +:4,0: +:1,0: +:3,0: +:3,0: +:3,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:2,0: +:2,0: +:1,0: +:1,0: +:1,0: +:1,0: +:4,0: +:2,0: +:2,0: +:4,0: +:4,0: +:2,0: +:1,0: +:1,0: +:1,0: +:5,0: +:5,0: +:4,1: +:5,0: +:0,5: +:4,1: +:3,0: +:0,3: +:3,0: +:4,0: +:2,0: +:2,0: +:4,0: +:4,0: +:4,0: +:4,0: +:2,0: +:3,0: +:2,0: +:4,0: +:4,0: +:0,1: +:2,0: +:1,0: +:1,0: +:2,0: +:1,0: +:1,0: +:1,0: +:1,0: +:4,0: +:4,0: +:4,0: +:1,0: +:4,0: +:3,0: +:2,0: +:2,0: +:2,0: +:2,0: +:1,0: +:4,0: +:0,3: +:1,1: +:2,0: +:2,0: +:2,0: +:0,2: +:1,0: +:1,0: +:1,0: +:2,0: +:0,1: +:0,1: +:1,0: +:3,0: +:3,0: +:5,0: +:1,0: +:1,0: +:1,0: +:1,0: +:5,0: +:5,0: +:3,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:2,0: +:2,0: +:3,0: +:3,0: +:2,0: +:2,0: +:3,0: +:1,4: +:3,0: +:3,0: +:5,0: +:2,0: +:1,0: +:2,0: +:2,0: +:2,0: +:1,0: +:1,0: +:1,0: +:1,0: +:4,0: +:2,0: +:1,0: +:1,0: +:1,0: +:1,0: +:2,0: +:2,0: +:2,0: +:2,0: +:2,0: +:2,0: +:1,1: +:1,0: +:3,0: +:3,0: +:3,0: +:4,0: +:4,0: +:3,0: +:3,0: +:1,0: +:1,0: +:1,0: +:1,0: +:3,0: +:1,0: +:1,0: +:0,1: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:3,0: +:3,0: +:3,0: +:2,0: +:1,0: +:2,0: +:2,0: +:1,0: +:1,0: +:1,0: +:5,0: +:5,0: +:1,0: +:1,0: +:1,0: +:1,0: +:0,1: +:1,0: +:1,0: +:6,0: +:6,0: +:2,0: +:1,0: +:1,0: +:2,0: +:3,0: +:3,0: +:3,0: +:3,0: +:3,0: +:3,0: +:2,1: +:2,0: +:5,0: +:2,0: +:3,0: +:1,0: +:1,0: +:1,0: +:1,0: +:3,0: +:3,0: +:1,0: +:1,0: +:1,0: +:6,0: +:6,0: +:6,0: +:3,0: +:2,0: +:1,0: +:1,0: +:2,0: +:2,0: +:2,0: +:4,0: +:4,0: +:4,0: +:5,0: +:1,0: +:1,0: +:1,0: +:2,0: +:1,0: +:3,0: +:2,0: +:1,0: +:5,0: +:5,0: +:1,0: +:0,2: +:1,0: +:5,0: +:5,0: +:4,0: +:4,0: +:4,0: +:2,0: +:1,0: +:1,0: +:1,0: +:1,0: +:2,0: +:1,0: +:4,0: +:4,0: +:2,2: +:1,0: +:2,0: +:4,0: +:4,0: +:4,0: +:3,0: +:1,0: +:1,0: +:3,0: +:1,0: +:1,0: +:4,0: +:1,0: +:4,0: +:2,0: +:2,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,1: +:4,0: +:1,0: +:1,0: +:2,0: +:2,0: +:2,0: +:1,0: +:1,0: +:1,0: +:2,0: +:2,0: +:2,0: +:2,0: +:2,0: +:0,2: +:2,0: +:0,2: +:2,0: +:6,0: +:6,0: +:6,0: +:2,0: +:2,0: +:1,0: +:1,0: +:1,0: +:5,0: +:4,0: +:1,1: +:3,0: +:3,0: +:3,0: +:1,0: +:1,0: +:3,0: +:2,0: +:2,0: +:2,0: +:2,0: +:2,0: +:2,0: +:2,0: +:3,0: +:2,0: +:5,0: +:1,0: +:1,0: +:1,0: +:1,0: +:4,0: +:4,0: +:3,1: +:4,0: +:4,0: +:2,0: +:0,1: +:1,1: +:1,0: +:1,0: +:1,0: +:1,0: +:2,0: +:2,0: +:1,0: +:1,0: +:1,1: +:5,0: +:5,0: +:5,0: +:5,0: +:3,2: +:5,0: +:5,0: +:4,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:2,0: +:2,0: +:3,0: +:4,0: +:4,0: +:2,0: +:2,0: +:1,0: +:2,0: +:2,0: +:2,0: +:3,0: +:0,3: +:3,0: +:2,0: +:3,0: +:3,0: +:3,0: +:2,0: +:2,0: +:2,0: +:3,0: +:3,0: +:3,0: +:9,0: +:9,0: +:3,0: +:3,0: +:2,0: +:3,0: +:1,2: +:4,0: +:1,0: +:0,1: +:0,1: +:1,0: +:4,0: +:6,0: +:1,0: +:2,0: +:3,0: +:3,0: +:3,0: +:1,0: +:3,0: +:0,3: +:1,0: +:2,0: +:2,0: +:2,0: +:1,0: +:1,0: +:1,0: +:1,0: +:0,1: +:1,0: +:2,0: +:2,0: +:2,0: +:4,0: +:2,0: +:1,1: +:2,0: +:2,0: +:2,0: +:2,0: +:1,0: +:3,0: +:2,1: +:4,0: +:2,0: +:3,0: +:3,0: +:3,0: +:3,0: +:3,0: +:0,3: +:3,0: +:2,0: +:2,0: +:3,1: +:4,0: +:4,0: +:4,0: +:4,0: +:2,0: +:2,0: +:4,0: +:4,0: +:4,0: +:3,1: +:4,0: +:1,0: +:1,0: +:1,0: +:1,0: +:0,1: +:3,0: +:0,3: +:3,0: +:2,0: +:2,0: +:3,0: +:2,0: +:4,0: +:4,0: +:4,0: +:4,0: +:4,0: +:4,0: +:4,0: +:2,0: +:2,0: +:2,0: +:2,0: +:3,0: +:3,0: +:3,0: +:2,0: +:2,0: +:2,0: +:2,0: +:2,0: +:2,0: +:2,0: +:1,0: +:3,0: +:3,0: +:3,0: +:1,0: +:0,1: +:2,0: +:2,0: +:2,0: +:2,0: +:2,0: +:2,0: +:2,0: +:2,0: +:2,0: +:2,0: +:1,0: +:2,0: +:2,0: +:4,0: +:1,0: +:1,0: +:0,1: +:1,0: +:4,0: +:4,0: +:4,0: +:2,0: +:2,0: +:3,0: +:1,0: +:1,0: +:1,0: +:2,0: +:3,0: +:3,0: +:3,0: +:3,0: +:2,0: +:1,0: +:1,0: +:6,0: +:2,0: +:1,0: +:1,0: +:2,0: +:4,0: +:4,0: +:2,0: +:3,0: +:3,0: +:3,0: +:3,0: +:2,0: +:2,0: +:4,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:2,0: +:2,0: +:3,0: +:3,0: +:5,0: +:3,2: +:5,0: +:5,0: +:3,0: +:3,0: +:1,0: +:1,0: +:2,0: +:1,2: +:2,0: +:2,0: +:2,0: +:0,1: +:0,1: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:0,1: +:2,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:1,0: +:2,0: +:2,0: +:2,0: diff --git a/Exercise8.R b/Exercise8.R new file mode 100644 index 0000000..99c9ef0 --- /dev/null +++ b/Exercise8.R @@ -0,0 +1,34 @@ +##Question 1 + +library(stringr) + +vcr <- scan('/Users/elizabethfortin12/Documents/ND First Year/Biocomputing/R_Programming/Exercise8/Cflorida.vcf', what = character(), sep="\n") +write(vcr, "vcr.txt") + +head(vcr) +header <- c() +name <- c() +allele <- c() + +for(i in 1:length(vcr)){ + if (str_detect(vcr[i],"##")=='TRUE'){ + header <- vcr[i] + write(header, "CfloridaCounts.txt") + } + else if (str_detect(vcr[i],"#")=='TRUE'){ + name <- vcr[i] + for (j in 1:length(name)){ + name[j] <- str_replace_all(name[j],"[Cc][Ff](07)?\\.[Aa]2?","Cf.Sfa") + name[j] <- str_replace_all(name[j],"[Cc][Ff]\\.[Gg]([Aa][Ii])?2?","Cf.Gai") + } + write(name, "CfloridaCounts.txt", append = TRUE) + } + else if (str_detect(vcr[i], "#")=='FALSE'){ + allele <- vcr[i] + for (j in 1:length(allele)){ + allele[j] <- str_extract(allele[j], ":[0-9],[0-9]:") + } + write(allele, "CfloridaCounts.txt", append = TRUE) + } +} + From ddaf09438fd4bd9e461ac8aa511e47acb440b13c Mon Sep 17 00:00:00 2001 From: Libby Fortin Date: Fri, 27 Oct 2017 10:40:36 -0400 Subject: [PATCH 2/2] Final Question 1 --- Fortin_Weibel_Exercise8.R | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Fortin_Weibel_Exercise8.R diff --git a/Fortin_Weibel_Exercise8.R b/Fortin_Weibel_Exercise8.R new file mode 100644 index 0000000..99c9ef0 --- /dev/null +++ b/Fortin_Weibel_Exercise8.R @@ -0,0 +1,34 @@ +##Question 1 + +library(stringr) + +vcr <- scan('/Users/elizabethfortin12/Documents/ND First Year/Biocomputing/R_Programming/Exercise8/Cflorida.vcf', what = character(), sep="\n") +write(vcr, "vcr.txt") + +head(vcr) +header <- c() +name <- c() +allele <- c() + +for(i in 1:length(vcr)){ + if (str_detect(vcr[i],"##")=='TRUE'){ + header <- vcr[i] + write(header, "CfloridaCounts.txt") + } + else if (str_detect(vcr[i],"#")=='TRUE'){ + name <- vcr[i] + for (j in 1:length(name)){ + name[j] <- str_replace_all(name[j],"[Cc][Ff](07)?\\.[Aa]2?","Cf.Sfa") + name[j] <- str_replace_all(name[j],"[Cc][Ff]\\.[Gg]([Aa][Ii])?2?","Cf.Gai") + } + write(name, "CfloridaCounts.txt", append = TRUE) + } + else if (str_detect(vcr[i], "#")=='FALSE'){ + allele <- vcr[i] + for (j in 1:length(allele)){ + allele[j] <- str_extract(allele[j], ":[0-9],[0-9]:") + } + write(allele, "CfloridaCounts.txt", append = TRUE) + } +} +