Skip to content

Commit

Permalink
cleaning up development stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
adamcantor22 committed Aug 8, 2024
1 parent 527a2ea commit faeb16e
Show file tree
Hide file tree
Showing 30 changed files with 19 additions and 172 deletions.
4 changes: 2 additions & 2 deletions mmeds/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@


WORKFLOWS = {
"standard_pipeline": {
"core_pipeline_taxonomic": {
"parameters": [
'sampling_depth',
'metadata',
Expand Down Expand Up @@ -350,7 +350,7 @@

CURRENT_PROCESSES = DATABASE_DIR / 'current_processes.yaml'
CONFIG_PARAMETERS = {
'standard_pipeline': [
'core_pipeline_taxonomic': [
'sampling_depth',
'metadata',
'alpha_metrics',
Expand Down
1 change: 0 additions & 1 deletion mmeds/database/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,6 @@ def get_sequencing_run_locations(self, metadata, user, column=("RawDataProtocol"
doc = MMEDSDoc.objects(doc_type='sequencing_run', study_name=run, owner=user).first()
run_paths[run] = {}
# Get individual files within sequencing run directories
print(Path(doc.path) / fig.SEQUENCING_DIRECTORY_FILE)
with open(Path(doc.path) / fig.SEQUENCING_DIRECTORY_FILE, "rt") as f:
content = f.read().split('\n')
# Read the key value pair of datafile type and file location
Expand Down
1 change: 0 additions & 1 deletion mmeds/database/documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ def generate_MMEDSDoc(self, name, workflow_type, analysis_type, config, access_c
files['metadata'] = new_dir / 'metadata.tsv'
string_files = {str(key): str(value) for key, value in files.items()}

print(config)
doc = MMEDSDoc(created=datetime.now(),
last_accessed=datetime.now(),
sub_analysis=False,
Expand Down
11 changes: 0 additions & 11 deletions mmeds/snakemake/test_snakemake/Snakefile

This file was deleted.

Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
93 changes: 0 additions & 93 deletions mmeds/snakemake/test_snakemake/tables/qiime_mapping_file.tsv

This file was deleted.

Binary file not shown.
Binary file not shown.
19 changes: 0 additions & 19 deletions mmeds/snakemake/test_snakemake/test_config.yaml

This file was deleted.

Binary file removed mmeds/snakemake/test_snakemake/test_dag.png
Binary file not shown.
Binary file removed mmeds/snakemake/test_snakemake/test_dag_lefse.png
Binary file not shown.
10 changes: 0 additions & 10 deletions mmeds/snakemake/test_snakemake/test_lefse_config.yaml

This file was deleted.

Binary file removed mmeds/snakemake/test_snakemake/test_rulegraph.png
Binary file not shown.
Binary file not shown.
18 changes: 0 additions & 18 deletions mmeds/snakemake/test_snakemake/test_standard.Snakefile

This file was deleted.

8 changes: 4 additions & 4 deletions mmeds/tests/unit/test_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def setUpClass(self):
self.watcher = Watcher()
self.watcher.connect()
self.queue = self.watcher.get_queue()
self.config = load_config(fig.DEFAULT_CONFIG, fig.TEST_MIXED_METADATA, 'standard_pipeline')
self.config = load_config(fig.DEFAULT_CONFIG, fig.TEST_MIXED_METADATA, 'core_pipeline_taxonomic')
self.config_lefse = load_config(fig.DEFAULT_CONFIG_LEFSE, fig.TEST_MIXED_METADATA, 'lefse')
self.analysis = []
with Database(owner=fig.TEST_USER_0, testing=True) as db:
Expand All @@ -43,15 +43,15 @@ def test_b_analysis_init(self):
with Database(owner=fig.TEST_USER_0, testing=True) as db:
self.runs = db.get_sequencing_run_locations(fig.TEST_MIXED_METADATA, fig.TEST_USER_0)
self.analysis += [Analysis(self.queue, fig.TEST_USER_0, self.analysis_code_0, fig.TEST_CODE_MIXED,
'standard_pipeline', 'default', 'test_init', self.config, True, self.runs, False, threads=2)]
'core_pipeline_taxonomic', 'default', 'test_init', self.config, True, self.runs, False, threads=2)]
self.analysis += [Analysis(self.queue, fig.TEST_USER_0, self.analysis_code_1, fig.TEST_CODE_MIXED,
'lefse', 'default', 'test_lefse', self.config_lefse, True, {}, False, threads=2)]


def test_c_standard_pipeline(self):
def test_c_core_pipeline_taxonomic(self):
""" Test running a standard analysis """
# run_analysis() executes analyses synchronously rather than submitting as a job
run_analysis(self.test_study, 'standard_pipeline', testing=True)
run_analysis(self.test_study, 'core_pipeline_taxonomic', testing=True)

def test_d_analysis_class(self):
""" Test the analysis objects """
Expand Down
2 changes: 1 addition & 1 deletion mmeds/tests/unit/test_documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_creation(self):

def create_from_study(self):
""" Test creating a document """
config = util.load_config(None, fig.TEST_METADATA, 'standard_pipeline')
config = util.load_config(None, fig.TEST_METADATA, 'core_pipeline_taxonomic')
sd = docs.MMEDSDoc.objects(access_code=self.test_code).first()
ad = sd.generate_MMEDSDoc('testDocument', 'qiime2', 'DADA2', config, 'test_documents')
self.assertEqual(Path(sd.path), Path(ad.path).parent)
Expand Down
4 changes: 2 additions & 2 deletions mmeds/tests/unit/test_snakemake.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ def run_snakemake(self, path):
return 0


def test_a_standard_pipeline(self):
def test_a_core_pipeline_taxonomic(self):
""" Test snakemake standard pipeline analysis """
result = self.run_snakemake(Path(fig.TEST_SNAKEMAKE_DIR) / "standard_pipeline")
result = self.run_snakemake(Path(fig.TEST_SNAKEMAKE_DIR) / "core_pipeline_taxonomic")
self.assertEquals(result, 0)


Expand Down
4 changes: 2 additions & 2 deletions mmeds/tests/unit/test_spawn.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def test_a_upload_data(self):
def test_b_start_analysis(self):
""" Test starting analysis through the queue """
for proc in self.infos:
self.q.put(('analysis', proc['owner'], proc['access_code'], 'standard_pipeline',
self.q.put(('analysis', proc['owner'], proc['access_code'], 'core_pipeline_taxonomic',
'default', 'test_analysis', None, {}, -1, False))

Logger.info('Waiting on analysis')
Expand Down Expand Up @@ -114,7 +114,7 @@ def test_c_restart_analysis(self):
def test_d_node_analysis(self):
Logger.info("node analysis")
for i in range(5):
self.q.put(('analysis', self.infos[0]['owner'], self.infos[0]['access_code'], 'standard_pipeline',
self.q.put(('analysis', self.infos[0]['owner'], self.infos[0]['access_code'], 'core_pipeline_taxonomic',
'default', 'test_analysis_node', None, {}, -1, True))

pipe_results = self.receive_all_pipe_output(8)
Expand Down
2 changes: 1 addition & 1 deletion mmeds/tests/unit/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ToolsTests(TestCase):

@classmethod
def setUpClass(self):
self.config = load_config(None, fig.TEST_METADATA_SHORT, 'standard_pipeline')
self.config = load_config(None, fig.TEST_METADATA_SHORT, 'core_pipeline_taxonomic')
self.q = Queue()
self.testing = True

Expand Down
14 changes: 7 additions & 7 deletions mmeds/tests/unit/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,28 +122,28 @@ def test_f_get_valid_columns(self):

def test_g_load_config_file(self):
# Test when no config is given
config = util.load_config(None, fig.TEST_METADATA, 'standard_pipeline')
for param in fig.WORKFLOWS['standard_pipeline']['parameters']:
config = util.load_config(None, fig.TEST_METADATA, 'core_pipeline_taxonomic')
for param in fig.WORKFLOWS['core_pipeline_taxonomic']['parameters']:
assert config.get(param) is not None

config = util.load_config(Path(fig.TEST_CONFIG_ALL), fig.TEST_METADATA, 'standard_pipeline')
config = util.load_config(Path(fig.TEST_CONFIG_ALL), fig.TEST_METADATA, 'core_pipeline_taxonomic')
assert len(config['taxa_levels']) == 7

# Check the config file fail states
with raises(InvalidConfigError) as e_info:
config = util.load_config(Path(fig.TEST_CONFIG_1), fig.TEST_METADATA, 'standard_pipeline')
config = util.load_config(Path(fig.TEST_CONFIG_1), fig.TEST_METADATA, 'core_pipeline_taxonomic')
assert 'Missing parameter' in e_info.value.message

with raises(InvalidConfigError) as e_info:
config = util.load_config(Path(fig.TEST_CONFIG_2), fig.TEST_METADATA, 'standard_pipeline')
config = util.load_config(Path(fig.TEST_CONFIG_2), fig.TEST_METADATA, 'core_pipeline_taxonomic')
assert 'Invalid metadata column' in e_info.value.message

with raises(InvalidConfigError) as e_info:
config = util.load_config(Path(fig.TEST_CONFIG_3), fig.TEST_METADATA, 'standard_pipeline')
config = util.load_config(Path(fig.TEST_CONFIG_3), fig.TEST_METADATA, 'core_pipeline_taxonomic')
assert 'Invalid parameter' in e_info.value.message

with raises(InvalidConfigError) as e_info:
config = util.load_config(Path(fig.TEST_METADATA), fig.TEST_METADATA, 'standard_pipeline')
config = util.load_config(Path(fig.TEST_METADATA), fig.TEST_METADATA, 'core_pipeline_taxonomic')
assert 'YAML format' in e_info.value.message

def test_h_mmeds_to_MIxS(self):
Expand Down

0 comments on commit faeb16e

Please sign in to comment.