Skip to content

Commit

Permalink
reference files
Browse files Browse the repository at this point in the history
  • Loading branch information
Michiel van Setten committed Oct 20, 2017
1 parent efb1f5c commit 53dbd48
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 33 deletions.
23 changes: 5 additions & 18 deletions tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def setUp(self):
self.test_dir = tempfile.mkdtemp()
os.chdir(self.test_dir)
self.c = YGtPM()
self.store_ref = False
# self.store_ref = False
# at various places out put is compared to stored reference files. put this to true
# to regenerate all reference files

Expand All @@ -44,39 +44,26 @@ def test_class_creation(self):
testing the creation of YGtPM
"""
self.assertIsInstance(self.c, YGtPM)
self.c.pTMdata()
self.assertTrue(os.path.isfile('uniprot_mod_raw.txt'))

def test_data(self):
"""
testing the steps in data()
"""
self.assertIsInstance(self.c, YGtPM)
try: # the actual download can only be performed a limit number of times per hour
raise RuntimeError # this is to prevent connecting the database during development comment for real tesing
self.c.pTMdata()
if self.store_ref:
shutil.copy('uniprot_mod_raw.txt', ref_dir) # saving the reference data
except:
shutil.copy(os.path.join(ref_dir, 'uniprot_mod_raw.txt'), '.')
self.assertTrue(os.path.isfile('uniprot_mod_raw.txt'))
self.c.clean('uniprot_mod_raw.txt') # produces PTMs.txt
shutil.copy(os.path.join(ref_dir, 'uniprot_mod_raw.txt'), '.') # saving the reference data

self.c.clean('uniprot_mod_raw.txt') # produces PTMs.txt
self.assertTrue(os.path.isfile('PTMs.txt'))
if self.store_ref:
shutil.copy('PTMs.txt', ref_dir) # saving the reference data
self.assertTrue(filecmp.cmp('PTMs.txt', os.path.join(ref_dir, 'PTMs.txt')))

self.c.iD()
self.assertTrue(os.path.isfile('yeastID.txt'))
if self.store_ref:
shutil.copy('yeastID.txt', ref_dir) # saving the reference data
self.assertTrue(filecmp.cmp('yeastID.txt', os.path.join(ref_dir, 'yeastID.txt')))

self.c.pmap('yeastID.txt', 'PTMs.txt')
self.assertTrue(os.path.isfile('PTM_id_file.txt'))
if self.store_ref:
shutil.copy('PTM_id_file.txt', ref_dir) # saving the reference data
self.assertTrue(filecmp.cmp('PTM_id_file.txt', os.path.join(ref_dir, 'PTM_id_file.txt')))
self.assertTrue(False)

def test_ymap_proteins(self):
self.assertTrue(True)
Expand Down
29 changes: 14 additions & 15 deletions ymap/ymap.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
#try:
# from builtins import next
# from builtins import str
# from builtins import range
# from builtins import object
# from builtins import bytes
#except ImportError:
# pass
try:
from builtins import next
from builtins import str
from builtins import range
from builtins import object
from builtins import bytes
except ImportError:
pass
import os
import sys
import math
Expand Down Expand Up @@ -1050,27 +1050,27 @@ def data():
except IOError:
pass
try:
m = c.pmap('yeastID.txt', 'PTMs.txt')
c.pmap('yeastID.txt', 'PTMs.txt')
except IOError:
pass
try:
d = c.dclean('uniprot_mod_raw.txt')
c.dclean('uniprot_mod_raw.txt')
except IOError:
pass
try:
dm = c.d_map('yeastID.txt', 'domains.txt')
c.d_map('yeastID.txt', 'domains.txt')
except IOError:
pass
try:
ab = c.ab('uniprot_mod_raw.txt')
c.ab('uniprot_mod_raw.txt')
except IOError:
pass
try:
ii = c.id('bact.txt', 'yeast_id.txt')
c.id('bact.txt', 'yeast_id.txt')
except IOError:
pass
try:
bio=c.bioGrid()
c.bioGrid()
except IOError:
pass
try:
Expand Down Expand Up @@ -1696,4 +1696,3 @@ def path():
pass
else:
print ("to run a function seek help")

0 comments on commit 53dbd48

Please sign in to comment.