Mercurial > repos > greg > meme_fimo
comparison fimo_wrapper.py @ 2:97fb2d36c482 draft
Uploaded
author | greg |
---|---|
date | Thu, 14 Apr 2016 11:18:57 -0400 |
parents | a64feed0d508 |
children | ce656b846c8e |
comparison
equal
deleted
inserted
replaced
1:a64feed0d508 | 2:97fb2d36c482 |
---|---|
117 shutil.move(os.path.join(args.output_path, 'fimo.txt'), args.txt_output) | 117 shutil.move(os.path.join(args.output_path, 'fimo.txt'), args.txt_output) |
118 | 118 |
119 gff_file = os.path.join(args.output_path, 'fimo.gff') | 119 gff_file = os.path.join(args.output_path, 'fimo.gff') |
120 if args.remove_duplicate_coords == 'yes': | 120 if args.remove_duplicate_coords == 'yes': |
121 tmp_stderr = tempfile.NamedTemporaryFile() | 121 tmp_stderr = tempfile.NamedTemporaryFile() |
122 # Sort GFF output by a combination of: score, start and coordinate. | 122 # Identify and eliminating identical motif occurrences. These |
123 # The output file is specified by -o FILE, and this operation is | 123 # are identical if the combination of chrom, start, end and |
124 # guaranteed safe (the file is read before being overwritten for output). | 124 # motif id are identical. |
125 cmd = 'sort -k6,6n -k4,4n -o %s %s' % (gff_file, gff_file) | 125 cmd = 'sort -k1,1 -k4,4n -k5,5n -k9.1,9.6 -u -o %s %s' % (gff_file, gff_file) |
126 proc = subprocess.Popen(args=cmd, stderr=tmp_stderr, shell=True) | 126 proc = subprocess.Popen(args=cmd, stderr=tmp_stderr, shell=True) |
127 returncode = proc.wait() | 127 returncode = proc.wait() |
128 if returncode != 0: | 128 if returncode != 0: |
129 stderr = get_stderr(tmp_stderr) | 129 stderr = get_stderr(tmp_stderr) |
130 stop_err(stderr) | 130 stop_err(stderr) |
131 # Sort by chromosome id, identifying and eliminating identical | 131 # Sort GFF output by a combination of chrom, score, start. |
132 # motif occurrences. | 132 cmd = 'sort -k6,6n -k4,4n -k1,1 -o %s %s' % (gff_file, gff_file) |
133 cmd = 'sort -k1,1 -o %s %s' % (gff_file, gff_file) | |
134 proc = subprocess.Popen(args=cmd, stderr=tmp_stderr, shell=True) | 133 proc = subprocess.Popen(args=cmd, stderr=tmp_stderr, shell=True) |
135 returncode = proc.wait() | 134 returncode = proc.wait() |
136 if returncode != 0: | 135 if returncode != 0: |
137 stderr = get_stderr(tmp_stderr) | 136 stderr = get_stderr(tmp_stderr) |
138 stop_err(stderr) | 137 stop_err(stderr) |