Mercurial > repos > davidvanzessen > shm_csr
changeset 16:4e596473c25c draft
Uploaded
author | davidvanzessen |
---|---|
date | Wed, 23 Nov 2016 09:05:40 -0500 |
parents | 61d0a6318711 |
children | b95fa7e426c3 |
files | merge_and_filter.r shm_csr.py wrapper.sh |
diffstat | 3 files changed, 57 insertions(+), 44 deletions(-) [+] |
line wrap: on
line diff
--- a/merge_and_filter.r Thu Nov 17 07:33:21 2016 -0500 +++ b/merge_and_filter.r Wed Nov 23 09:05:40 2016 -0500 @@ -96,6 +96,8 @@ result$JGene = gsub("^Homsap ", "", result$J.GENE.and.allele) result$JGene = gsub("[*].*", "", result$JGene) +print(result[result$Sequence.ID == "JY8QFUQ01C310D",c("Sequence.ID","best_match")]) + splt = strsplit(class.filter, "_")[[1]] chunk_hit_threshold = as.numeric(splt[1]) nt_hit_threshold = as.numeric(splt[2]) @@ -110,6 +112,8 @@ result$best_match = "all" } +print(result[result$Sequence.ID == "JY8QFUQ01C310D",c("Sequence.ID","best_match")]) + write.table(x=result, file=gsub("merged.txt$", "before_filters.txt", output), sep="\t",quote=F,row.names=F,col.names=T) print(paste("Number of empty CDR1 sequences:", sum(result$CDR1.IMGT.seq == ""))) @@ -135,6 +139,8 @@ filtering.steps = rbind(filtering.steps, c("After empty CDR2, FR3 filter", nrow(result))) } +print(result[result$Sequence.ID == "JY8QFUQ01C310D",c("Sequence.ID","best_match")]) + if(empty.region.filter == "leader"){ result = result[!(grepl("n|N", result$FR1.IMGT.seq) | grepl("n|N", result$FR2.IMGT.seq) | grepl("n|N", result$FR3.IMGT.seq) | grepl("n|N", result$CDR1.IMGT.seq) | grepl("n|N", result$CDR2.IMGT.seq) | grepl("n|N", result$CDR3.IMGT.seq)),] } else if(empty.region.filter == "FR1"){ @@ -145,6 +151,9 @@ result = result[!(grepl("n|N", result$FR3.IMGT.seq) | grepl("n|N", result$CDR2.IMGT.seq) | grepl("n|N", result$CDR3.IMGT.seq)),] } +print(result[result$Sequence.ID == "JY8QFUQ01C310D",c("Sequence.ID","best_match")]) +print(result[result$Sequence.ID == "JY8QFUQ01BNS72",c("Sequence.ID","best_match")]) + print(paste("Number of sequences in result after n filtering:", nrow(result))) filtering.steps = rbind(filtering.steps, c("After N filter", nrow(result))) @@ -183,6 +192,9 @@ result = result[!duplicated(result$unique.def),] } +print(result[result$Sequence.ID == "JY8QFUQ01C310D",c("Sequence.ID","best_match")]) +print(result[result$Sequence.ID == "JY8QFUQ01BNS72",c("Sequence.ID","best_match")]) + write.table(result, gsub("before_unique_filter.txt", "after_unique_filter.txt", before.unique.file), sep="\t", quote=F,row.names=F,col.names=T) filtering.steps = rbind(filtering.steps, c("After filter unique sequences", nrow(result))) @@ -207,7 +219,7 @@ - +print(result[result$Sequence.ID == "JY8QFUQ01C310D",c("Sequence.ID","best_match")]) result = result[,!(names(result) %in% c("past", "best_match_class"))]
--- a/shm_csr.py Thu Nov 17 07:33:21 2016 -0500 +++ b/shm_csr.py Wed Nov 23 09:05:40 2016 -0500 @@ -284,4 +284,5 @@ with open(seq_motif_file, 'w') as o: o.write("ID\tRGYWC\tWRCY\tWA\tTW\n") for ID in IDlist: - o.write(ID + "\t" + str(round(RGYWCount[ID], 2)) + "\t" + str(round(WRCYCount[ID], 2)) + "\t" + str(round(WACount[ID], 2)) + "\t" + str(round(TWCount[ID], 2)) + "\n") + #o.write(ID + "\t" + str(round(RGYWCount[ID], 2)) + "\t" + str(round(WRCYCount[ID], 2)) + "\t" + str(round(WACount[ID], 2)) + "\t" + str(round(TWCount[ID], 2)) + "\n") + o.write(ID + "\t" + str(RGYWCount[ID]) + "\t" + str(WRCYCount[ID]) + "\t" + str(WACount[ID]) + "\t" + str(TWCount[ID]) + "\n")
--- a/wrapper.sh Thu Nov 17 07:33:21 2016 -0500 +++ b/wrapper.sh Wed Nov 23 09:05:40 2016 -0500 @@ -447,58 +447,58 @@ PWD="$tmp" -echo "<div class='tabbertab' title='Clonality'>" >> $output #clonality tab + echo "<div class='tabbertab' title='Clonality'>" >> $output #clonality tab -function clonality_table { - local infile=$1 - local outfile=$2 - - echo "<table class='pure-table pure-table-striped'>" >> $outfile - echo "<thead><tr><th>Clone size</th><th>Nr of clones</th><th>Nr of sequences</th></tr></thead>" >> $outfile - - first='true' - - while read size clones seqs - do - if [[ "$first" == "true" ]]; then - first="false" - continue - fi - echo "<tr><td>$size</td><td>$clones</td><td>$seqs</td></tr>" >> $outfile - done < $infile - - echo "</table>" >> $outfile -} -echo "<div class='tabber'>" >> $output + function clonality_table { + local infile=$1 + local outfile=$2 + + echo "<table class='pure-table pure-table-striped'>" >> $outfile + echo "<thead><tr><th>Clone size</th><th>Nr of clones</th><th>Nr of sequences</th></tr></thead>" >> $outfile + + first='true' + + while read size clones seqs + do + if [[ "$first" == "true" ]]; then + first="false" + continue + fi + echo "<tr><td>$size</td><td>$clones</td><td>$seqs</td></tr>" >> $outfile + done < $infile + + echo "</table>" >> $outfile + } + echo "<div class='tabber'>" >> $output -echo "<div class='tabbertab' title='All'>" >> $output -clonality_table $outdir/change_o/change-o-defined_clones-summary.txt $output -echo "</div>" >> $output + echo "<div class='tabbertab' title='All'>" >> $output + clonality_table $outdir/change_o/change-o-defined_clones-summary.txt $output + echo "</div>" >> $output -echo "<div class='tabbertab' title='IGA'>" >> $output -clonality_table $outdir/change_o/change-o-defined_clones-summary-IGA.txt $output -echo "</div>" >> $output + echo "<div class='tabbertab' title='IGA'>" >> $output + clonality_table $outdir/change_o/change-o-defined_clones-summary-IGA.txt $output + echo "</div>" >> $output -echo "<div class='tabbertab' title='IGG'>" >> $output -clonality_table $outdir/change_o/change-o-defined_clones-summary-IGG.txt $output -echo "</div>" >> $output + echo "<div class='tabbertab' title='IGG'>" >> $output + clonality_table $outdir/change_o/change-o-defined_clones-summary-IGG.txt $output + echo "</div>" >> $output -echo "<div class='tabbertab' title='IGM'>" >> $output -clonality_table $outdir/change_o/change-o-defined_clones-summary-IGM.txt $output -echo "</div>" >> $output + echo "<div class='tabbertab' title='IGM'>" >> $output + clonality_table $outdir/change_o/change-o-defined_clones-summary-IGM.txt $output + echo "</div>" >> $output -echo "<div class='tabbertab' title='IGE'>" >> $output -clonality_table $outdir/change_o/change-o-defined_clones-summary-IGM.txt $output -echo "</div>" >> $output + echo "<div class='tabbertab' title='IGE'>" >> $output + clonality_table $outdir/change_o/change-o-defined_clones-summary-IGM.txt $output + echo "</div>" >> $output -echo "<div class='tabbertab' title='Overview'>" >> $output -cat "$outdir/sequence_overview/index.html" >> $output -echo "</div>" >> $output + echo "<div class='tabbertab' title='Overview'>" >> $output + cat "$outdir/sequence_overview/index.html" >> $output + echo "</div>" >> $output -echo "</div>" >> $output #clonality tabber end + echo "</div>" >> $output #clonality tabber end -echo "</div>" >> $output #clonality tab end + echo "</div>" >> $output #clonality tab end fi