# HG changeset patch # User davidvanzessen # Date 1427959883 14400 # Node ID c9f9623f1f7614edd3bb186bda68af0ff5b13099 # Parent 850857bc8605a3039eb8b18c62681f7f7f6e24c6 Uploaded diff -r 850857bc8605 -r c9f9623f1f76 gene_identification.py --- 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"])) diff -r 850857bc8605 -r c9f9623f1f76 mutation_analysis.py --- 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") diff -r 850857bc8605 -r c9f9623f1f76 wrapper.sh --- 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 "