changing category of ambiguous muts
This commit is contained in:
parent
eb5491aad9
commit
46b43cf261
3 changed files with 55 additions and 4 deletions
|
@ -59,18 +59,23 @@ rm(my_df, upos, dup_muts)
|
|||
# my_df_u
|
||||
|
||||
# quick checks
|
||||
head(my_df_u[, c("mutation", "mutation2")])
|
||||
head(my_df_u[, c("mutation")])
|
||||
|
||||
cols_to_extract = c("mutationinformation", "mutation", "or_mychisq", "or_kin", "af", "af_kin")
|
||||
foo = my_df_u[, colnames(my_df_u)%in% cols_to_extract]
|
||||
|
||||
|
||||
which(is.na(my_df_u$af_kin)) == which(is.na(my_df_u$af))
|
||||
table(which(is.na(my_df_u$af_kin)) == which(is.na(my_df_u$af)))
|
||||
|
||||
baz = read.csv(file.choose())
|
||||
|
||||
baz = cbind(my_df_u$mutation, my_df_u$or_mychisq, bar$mutation, bar$or_mychisq)
|
||||
baz = as.data.frame(baz)
|
||||
colnames(baz) = c("my_df_u_muts", "my_df_u_or", "real_muts", "real_or")
|
||||
sum(is.na(baz$my_df_u_or)) == sum(is.na(my_df_u$or_mychisq))
|
||||
|
||||
cat("\nNo. of with NA in or_mychisq:", sum(is.na(my_df_u$or_mychisq))
|
||||
,"\nNo. of NA in or_kin:" , sum(is.na(my_df_u$or_kin)))
|
||||
|
||||
# infile 2: gene associated meta data
|
||||
#in_filename_gene_metadata = paste0(tolower(gene), "_meta_data_with_AFandOR.csv")
|
||||
|
@ -109,7 +114,8 @@ gene_metadata <- read.csv(infile_gene_metadata
|
|||
cat("Dim:", dim(gene_metadata))
|
||||
|
||||
|
||||
# counting NAs in AF, OR cols:
|
||||
# counting NAs in AF, OR cols
|
||||
# or_mychisq
|
||||
if (identical(sum(is.na(my_df_u$or_mychisq))
|
||||
, sum(is.na(my_df_u$pval_fisher))
|
||||
, sum(is.na(my_df_u$af)))){
|
||||
|
@ -123,7 +129,7 @@ if (identical(sum(is.na(my_df_u$or_mychisq))
|
|||
, "\nNA in AF:", sum(is.na(my_df_u$af)))
|
||||
}
|
||||
|
||||
|
||||
# or kin
|
||||
if (identical(sum(is.na(my_df_u$or_kin))
|
||||
, sum(is.na(my_df_u$pwald_kin))
|
||||
, sum(is.na(my_df_u$af_kin)))){
|
||||
|
@ -139,6 +145,31 @@ if (identical(sum(is.na(my_df_u$or_kin))
|
|||
|
||||
str(gene_metadata)
|
||||
|
||||
# change category of ambiguos mutations
|
||||
table(gene_metadata$mutation_info)
|
||||
|
||||
cols_to_extract2 = c("mutationinformation", "mutation", "mutation_info")
|
||||
foo2 = gene_metadata[, colnames(gene_metadata)%in% cols_to_extract2]
|
||||
|
||||
dr_muts = foo2[foo2$mutation_info == dr_muts_col,]
|
||||
other_muts = foo2[foo2$mutation_info == other_muts_col,]
|
||||
|
||||
common_muts = dr_muts[dr_muts$mutation%in%other_muts$mutation,]
|
||||
#write.csv(common_muts, 'common_muts.csv')
|
||||
|
||||
# FIXME read properly
|
||||
# "ambiguous_mut_names.csv"
|
||||
#"pnca_p.gly108arg", "pnca_p.gly132ala", "pnca_p.val180phe"
|
||||
ambiguous_muts = read.csv(file.choose())
|
||||
ambiguous_muts_names = ambiguous_muts$mutation
|
||||
|
||||
common_muts_all = gene_metadata[gene_metadata$mutation%in%ambiguous_muts_names,]
|
||||
|
||||
gene_metadata2 = gene_metadata
|
||||
|
||||
if (gene_metadata$mutation_info[gene_metadata$mutation%in%ambiguous_muts_names] == other_muts_col){
|
||||
print('change me')
|
||||
}
|
||||
###################################################################
|
||||
# combining: PS
|
||||
###################################################################
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue