Mercurial > repos > davidvanzessen > mutation_analysis
changeset 21:c9f9623f1f76 draft
Uploaded
author | davidvanzessen |
---|---|
date | Thu, 02 Apr 2015 03:31:23 -0400 |
parents | 850857bc8605 |
children | d84c9791d8c4 |
files | gene_identification.py mutation_analysis.py wrapper.sh |
diffstat | 3 files changed, 20 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/gene_identification.py Wed Apr 01 05:26:52 2015 -0400 +++ b/gene_identification.py Thu Apr 02 03:31:23 2015 -0400 @@ -170,7 +170,6 @@ pass ID = linesplt[1] currentIDHits = hits[ID] - print currentIDHits possibleca = float(len(compiledregex["ca"])) possiblecg = float(len(compiledregex["cg"])) possiblecm = float(len(compiledregex["cm"]))
--- a/mutation_analysis.py Wed Apr 01 05:26:52 2015 -0400 +++ b/mutation_analysis.py Thu Apr 02 03:31:23 2015 -0400 @@ -72,6 +72,7 @@ aggctatIndex = 0 atagcctIndex = 0 first = True +IDlist = [] with open(infile, 'r') as i: for line in i: if first: @@ -93,6 +94,7 @@ WRCYCount[ID] = sum([1 for (x,y,z) in WRCY if z and z != "CDR3" and any([(x <= int(where) <= y) for (frm, where, to, a,b,c,d) in mutationdic[ID + "_" + z]])]) WACount[ID] = sum([1 for (x,y,z) in WA if z and z != "CDR3" and any([(x <= int(where) <= y) for (frm, where, to, a,b,c,d) in mutationdic[ID + "_" + z]])]) TWCount[ID] = sum([1 for (x,y,z) in TW if z and z != "CDR3" and any([(x <= int(where) <= y) for (frm, where, to, a,b,c,d) in mutationdic[ID + "_" + z]])]) + IDlist += [ID] directory = outfile[:outfile.rfind("/") + 1] @@ -124,3 +126,20 @@ y = valuedic["total"] z = str(round(x / float(valuedic["total"]) * 100, 1)) o.write("," + str(x) + "," + str(y) + "," + z + "\n") + + +#for testing +seq_motif_file = outfile[:outfile.rindex("/")] + "/motif_per_seq.txt" +first = True +with open(seq_motif_file, 'w') as o: + for ID in IDlist: + if first: + o.write("ID\tRGYWC\tWRCY\tWA\tTW\n") + first = False + continue + print ID + print RGYWCount[ID] + print WRCYCount[ID] + print WACount[ID] + print TWCount[ID] + o.write(ID + "\t" + str(RGYWCount[ID]) + "\t" + str(WRCYCount[ID]) + "\t" + str(WACount[ID]) + "\t" + str(TWCount[ID]) + "\n")
--- a/wrapper.sh Wed Apr 01 05:26:52 2015 -0400 +++ b/wrapper.sh Thu Apr 02 03:31:23 2015 -0400 @@ -70,7 +70,7 @@ echo "<tr><td>$name</td><td>${cax}/${cay} (${caz}%)</td><td>${ca1x}/${ca1y} (${ca1z}%)</td><td>${ca2x}/${ca2y} (${ca2z}%)</td><td>${cgx}/${cgy} (${cgz}%)</td><td>${cg1x}/${cg1y} (${cg1z}%)</td><td>${cg2x}/${cg2y} (${cg2z}%)</td><td>${cg3x}/${cg3y} (${cg3z}%)</td><td>${cg4x}/${cg4y} (${cg4z}%)</td><td>${cmx}/${cmy} (${cmz}%)</td><td>${allx}/${ally} (${allz}%)</td></tr>" >> $output done < $outdir/result.txt echo "</table>" >> $output -echo "<a href='unmatched.txt'>unmatched</a><br />" >> $output +echo "<a href='unmatched.txt'>unmatched</a><br /><a href='motif_per_seq.txt'>motif per sequence</a><br />" >> $output echo "<img src='all.png'/><br />" >> $output