Mercurial > repos > davidvanzessen > baseline_fasta_generator
comparison script_imgt.py @ 5:048f8cdbb6d2 draft default tip
Uploaded
| author | davidvanzessen |
|---|---|
| date | Thu, 07 Aug 2014 10:19:53 -0400 |
| parents | aa4b95abef11 |
| children |
comparison
equal
deleted
inserted
replaced
| 4:aa4b95abef11 | 5:048f8cdbb6d2 |
|---|---|
| 4 | 4 |
| 5 parser = argparse.ArgumentParser() | 5 parser = argparse.ArgumentParser() |
| 6 parser.add_argument("--input", help="Excel input file containing one or more sheets where column G has the gene annotation, H has the sequence id and J has the sequence") | 6 parser.add_argument("--input", help="Excel input file containing one or more sheets where column G has the gene annotation, H has the sequence id and J has the sequence") |
| 7 parser.add_argument("--ref", help="Reference file") | 7 parser.add_argument("--ref", help="Reference file") |
| 8 parser.add_argument("--output", help="Output file") | 8 parser.add_argument("--output", help="Output file") |
| 9 parser.add_argument("--id", help="ID to be used at the '>>>' line in the output") | |
| 9 | 10 |
| 10 args = parser.parse_args() | 11 args = parser.parse_args() |
| 11 | 12 |
| 12 refdic = dict() | 13 refdic = dict() |
| 13 with open(args.ref, 'r') as ref: | 14 with open(args.ref, 'r') as ref: |
| 46 | 47 |
| 47 | 48 |
| 48 currentSeq = "" | 49 currentSeq = "" |
| 49 currentId = "" | 50 currentId = "" |
| 50 with open(args.input, 'r') as i: | 51 with open(args.input, 'r') as i: |
| 51 with open(args.output, 'w') as o: | 52 with open(args.output, 'a') as o: |
| 52 o.write(">>>IMGT\n") | 53 o.write(">>>" + args.id + "\n") |
| 53 outputdic = dict() | 54 outputdic = dict() |
| 54 for line in i.readlines()[1:]: | 55 for line in i.readlines()[1:]: |
| 55 linesplt = line.split("\t") | 56 linesplt = line.split("\t") |
| 56 ref = filterGene(linesplt[1], vPattern) | 57 ref = filterGene(linesplt[1], vPattern) |
| 57 if not ref or not linesplt[2].rstrip(): | 58 if not ref or not linesplt[2].rstrip(): |
