Skip to content

Split metadata template #1030

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Apr 2, 2015

Conversation

josenavas
Copy link
Contributor

This is the first of multiple PR that are going to implement all the functionality included in the giant PR #1021.

I split the metadata_template.py file in 5 files (similarly for the test code):

  • metadata_template/base_metadata_template.py: base classes
  • metadata_template/sample_template.py: Sample and SampleTemplate classes
  • metadata_template/prep_template.py: PrepSample and PrepTemplate classes
  • metadata_template/util.py: All util functions
  • metadata_template/constants.py: Hold constant values. This will be useful in the refactor, although it looks silly now.

I wanted to modify the minimal amount of code but I had to made a couple of changes:

  • Some functions in metadata_template/util.py had a leading underscores on their name because they're private to the module. Since now they live in their own module, I remove that leading underscore (just a name change)
  • The function create_qiime_mapping_file in the PrepTemplate class was using the SampleTemplate class. I changed this lines:
# getting the latest sample template
_, sample_template_fp = SampleTemplate(
    self.study_id).get_filepaths()[0]

to

# getting the latest sample template
conn_handler = SQLConnectionHandler()
sql = """SELECT filepath_id, filepath
         FROM qiita.filepath
            JOIN qiita.sample_template_filepath
            USING (filepath_id)
         WHERE study_id=%s
         ORDER BY filepath_id DESC"""
sample_template_fname = conn_handler.execute_fetchall(
    sql, (self.study_id,))[0][1]
_, fp = get_mountpoint('templates')[0]
sample_template_fp = join(fp, sample_template_fname)

to avoid the circular import.

More changes are required in the metadata template, I will start submitting PR based on this one starting tomorrow, so having this merged is important.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.11%) to 79.23% when pulling cd35e3f on josenavas:split-metadata-template into 9350269 on biocore:master.

@antgonza
Copy link
Member

antgonza commented Apr 2, 2015

👍

squirrelo added a commit that referenced this pull request Apr 2, 2015
@squirrelo squirrelo merged commit 7482bed into qiita-spots:master Apr 2, 2015
@ElDeveloper
Copy link
Contributor

🎆

On (Apr-02-15| 8:18), Joshua Shorenstein wrote:

Merged #1030.


Reply to this email directly or view it on GitHub:
#1030 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants