Skip to content

Commit

Permalink
get rid redundant code
Browse files Browse the repository at this point in the history
  • Loading branch information
armish committed Aug 31, 2015
1 parent 07f12c1 commit f60581f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 2 additions & 3 deletions workers/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,16 @@ def load_vcf(vcf_path):
if config.ALLOW_LOCAL_VCFS and vcf_path.startswith('/tests/'):
filepath = vcf_path[1:];
text = open(filepath).read()
release = guess_ensembl_release(filepath)
elif vcf_path.startswith('file://'):
filepath = vcf_path[6:];
text = open(filepath).read()
release = guess_ensembl_release(filepath)
elif vcf_path.startswith('hdfs://'):
return load_vcf(vcf_path[6:])
else:
text = get_contents_from_hdfs(vcf_path)
release = guess_ensembl_release(hdfs_to_local_path(vcf_path))
filepath = hdfs_to_local_path(vcf_path)
header = '\n'.join(l for l in text.split('\n') if l.startswith('#'))
release = guess_ensembl_release(filepath)

return pyvcf.Reader(l for l in text.split('\n')), header, release

Expand Down
2 changes: 0 additions & 2 deletions workers/varcode_annotator.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ def _annotate(vcf_id):
engine = sqlalchemy.create_engine(DATABASE_URI)
# See if we have any guesses for a release version
with tables(engine, 'vcfs') as (con, vcfs):
metadata = sqlalchemy.MetaData(bind=con)
metadata.reflect()
vcf = vcfs.select().where(vcfs.c.id == vcf_id).execute().fetchone()
release = vcf['vcf_release']

Expand Down

0 comments on commit f60581f

Please sign in to comment.