comparison imgt_loader/imgt_loader.r @ 46:4d2a8f98a502 draft

Uploaded
author davidvanzessen
date Mon, 28 Jan 2019 09:37:41 -0500
parents 106275b54470
children 124b7fd92a3e
comparison
equal deleted inserted replaced
45:942eea8359fe 46:4d2a8f98a502
31 print("found V.DOMAIN.Functionality.comment, changed") 31 print("found V.DOMAIN.Functionality.comment, changed")
32 } 32 }
33 return(df) 33 return(df)
34 } 34 }
35 35
36 print_missing_columns = function(df, cols, label=""){
37 cols_in_df = cols %in% names(df)
38 if(sum(!cols_in_df) > 0){
39 print("Columns are missing from summary file, don't have:")
40 print(cols[!cols_in_df])
41 } else {
42 print(paste("No missing columns for", label))
43 }
44 }
45
36 summ = fix_column_names(summ) 46 summ = fix_column_names(summ)
37 sequences = fix_column_names(sequences) 47 sequences = fix_column_names(sequences)
38 aa = fix_column_names(aa) 48 aa = fix_column_names(aa)
39 gapped.aa = fix_column_names(gapped.aa) 49 gapped.aa = fix_column_names(gapped.aa)
40 junction = fix_column_names(junction) 50 junction = fix_column_names(junction)
49 added_sequence_columns=c('FR1.IMGT','FR2.IMGT','FR3.IMGT','CDR3.IMGT','JUNCTION','J.REGION','FR4.IMGT') 59 added_sequence_columns=c('FR1.IMGT','FR2.IMGT','FR3.IMGT','CDR3.IMGT','JUNCTION','J.REGION','FR4.IMGT')
50 60
51 added_junction_columns=c('P3.V.nt.nb','N.REGION.nt.nb','N1.REGION.nt.nb','P5.D.nt.nb','P3.D.nt.nb','N2.REGION.nt.nb','P5.J.nt.nb','X3.V.REGION.trimmed.nt.nb','X5.D.REGION.trimmed.nt.nb','X3.D.REGION.trimmed.nt.nb','X5.J.REGION.trimmed.nt.nb','N.REGION','N1.REGION','N2.REGION') 61 added_junction_columns=c('P3.V.nt.nb','N.REGION.nt.nb','N1.REGION.nt.nb','P5.D.nt.nb','P3.D.nt.nb','N2.REGION.nt.nb','P5.J.nt.nb','X3.V.REGION.trimmed.nt.nb','X5.D.REGION.trimmed.nt.nb','X3.D.REGION.trimmed.nt.nb','X5.J.REGION.trimmed.nt.nb','N.REGION','N1.REGION','N2.REGION')
52 added_junction_columns=c(added_junction_columns, 'P5.D1.nt.nb', 'P3.D1.nt.nb', 'N2.REGION.nt.nb', 'P5.D2.nt.nb', 'P3.D2.nt.nb', 'N3.REGION.nt.nb', 'P5.D3.nt.nb', 'P3.D2.nt.nb', 'N4.REGION.nt.nb', 'X5.D1.REGION.trimmed.nt.nb', 'X3.D1.REGION.trimmed.nt.nb', 'X5.D2.REGION.trimmed.nt.nb', 'X3.D2.REGION.trimmed.nt.nb', 'X5.D3.REGION.trimmed.nt.nb', 'X3.D3.REGION.trimmed.nt.nb', 'D.REGION.nt.nb', 'D1.REGION.nt.nb', 'D2.REGION.nt.nb', 'D3.REGION.nt.nb') 62 added_junction_columns=c(added_junction_columns, 'P5.D1.nt.nb', 'P3.D1.nt.nb', 'N2.REGION.nt.nb', 'P5.D2.nt.nb', 'P3.D2.nt.nb', 'N3.REGION.nt.nb', 'P5.D3.nt.nb', 'P3.D2.nt.nb', 'N4.REGION.nt.nb', 'X5.D1.REGION.trimmed.nt.nb', 'X3.D1.REGION.trimmed.nt.nb', 'X5.D2.REGION.trimmed.nt.nb', 'X3.D2.REGION.trimmed.nt.nb', 'X5.D3.REGION.trimmed.nt.nb', 'X3.D3.REGION.trimmed.nt.nb', 'D.REGION.nt.nb', 'D1.REGION.nt.nb', 'D2.REGION.nt.nb', 'D3.REGION.nt.nb')
53 63
54 out=summ[,c("Sequence.ID","JUNCTION.frame","V.GENE.and.allele","D.GENE.and.allele","J.GENE.and.allele")] 64 minimum_columns=c("Sequence.ID","JUNCTION.frame","V.GENE.and.allele","D.GENE.and.allele","J.GENE.and.allele")
65 print_missing_columns(summ, minimum_columns)
66 out=summ[,minimum_columns]
55 67
56 print(paste("nrow(summ)", nrow(summ))) 68 print(paste("nrow(summ)", nrow(summ)))
57 print(paste("nrow(aa)", nrow(aa))) 69 print(paste("nrow(aa)", nrow(aa)))
58 70
59 out[,"CDR1.Seq"] = aa[,"CDR1.IMGT"] 71 out[,"CDR1.Seq"] = aa[,"CDR1.IMGT"]