-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
57 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from isatools import isatab, magetab | ||
import logging | ||
|
||
logging.basicConfig(format='%(asctime)s %(levelname)s: %(message)s', level=logging.INFO) | ||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def convert(source_inv_fp, output_path): | ||
""" Converter for ISA-Tab to MAGE-TAB. | ||
:param source_inv_fp: File descriptor of input investigation file | ||
:param output_dir: Path to directory to write output MAGE-TAB files to | ||
""" | ||
ISA = isatab.load(source_inv_fp) | ||
magetab.dump(ISA, output_path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import unittest | ||
import os | ||
import shutil | ||
from isatools.convert import isatab2magetab | ||
from tests import utils | ||
import tempfile | ||
|
||
|
||
def setUpModule(): | ||
if not os.path.exists(utils.DATA_DIR): | ||
raise FileNotFoundError("Could not fine test data directory in {0}. Ensure you have cloned the ISAdatasets " | ||
"repository using " | ||
"git clone -b tests --single-branch [email protected]:ISA-tools/ISAdatasets {0}" | ||
.format(utils.DATA_DIR)) | ||
|
||
|
||
class TestIsaTab2MageTab(unittest.TestCase): | ||
|
||
def setUp(self): | ||
self._json_data_dir = utils.JSON_DATA_DIR | ||
self._tab_data_dir = utils.TAB_DATA_DIR | ||
self._tmp_dir = tempfile.mkdtemp() | ||
|
||
def tearDown(self): | ||
shutil.rmtree(self._tmp_dir) | ||
|
||
def test_json2magetab_convert_bii_i_1(self): | ||
with open(os.path.join(self._tab_data_dir, 'BII-I-1', 'i_investigation.txt')) as inv_fp: | ||
isatab2magetab.convert(inv_fp, self._tmp_dir) |