Skip to content

Commit

Permalink
Combine coverage scores for MIDI #412.
Browse files Browse the repository at this point in the history
Fix broken tests by upgrading pyvdrm to support bangs.
  • Loading branch information
donkirkby committed Jan 18, 2018
1 parent feb4df0 commit f79df1b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
32 changes: 29 additions & 3 deletions micall/utils/genreport_rerun.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,45 @@ def parse_sample_info(sample_name):
name=sample_name)


def rewrite_file(filename):
backup_csv = filename + '.original.csv'
os.rename(filename, backup_csv)
with open(backup_csv) as source, open(filename, 'w') as dest:
reader = DictReader(source)
writer = DictWriter(dest, reader.fieldnames)
writer.writeheader()
for row in reader:
yield row # Caller can modify it.
if row: # Skips a row that got cleared.
writer.writerow(row)


def combine_files(base_path, groups):
amino_columns = list(AMINO_ALPHABET) + ['del', 'coverage']
for group in groups:
src_filename = os.path.join(base_path,
group.names[1],
'coverage_scores.csv')
midi_covered_seeds = set()
with open(src_filename) as src:
reader = DictReader(src)
has_good_coverage = False
for row in reader:
if row['region'].endswith('-NS5b') and row['on.score'] == '4':
has_good_coverage = True
if (row['region'].endswith('-NS5b') and
row['project'] == 'MidHCV' and
row['on.score'] == '4'):
midi_covered_seeds.add(row['seed'])
break
dest_filename = os.path.join(base_path,
group.names[0],
'coverage_scores.csv')
has_good_coverage = False
for row in rewrite_file(dest_filename):
if (row['region'].endswith('-NS5b') and
row['on.score'] == '4'):
if row['seed'] in midi_covered_seeds:
has_good_coverage = True
else:
row['on.score'] = '1'
if has_good_coverage:
dest_filename = os.path.join(base_path,
group.names[0],
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Requirements for running the bare pipeline under Kive or BaseSpace
micall/alignment
git+https://github.com/cfe-lab/pyvdrm.git@v0.1.1
git+https://github.com/cfe-lab/pyvdrm.git@v0.2.0
numpy==1.12.0
matplotlib==2.0.0
python-Levenshtein==0.12.0
Expand Down

0 comments on commit f79df1b

Please sign in to comment.