Skip to content

Commit

Permalink
Merge pull request #71 from josenavas/py3
Browse files Browse the repository at this point in the history
Adding py3 to travis
  • Loading branch information
teravest committed Jun 4, 2014
2 parents 223b7f0 + 8a4adc4 commit 162cb0f
Show file tree
Hide file tree
Showing 18 changed files with 57 additions and 216 deletions.
18 changes: 15 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
language: python
python:
- "2.7"
env:
- PYTHON_VERSION=3.4
- PYTHON_VERSION=2.7
before_install:
- wget http://repo.continuum.io/miniconda/Miniconda-2.2.2-Linux-x86_64.sh -O miniconda.sh
- chmod +x miniconda.sh
- ./miniconda.sh -b
- export PATH=/home/travis/anaconda/bin:$PATH
# Update conda itself
- conda update --yes conda
install:
- conda create --yes -n env_name python=$PYTHON_VERSION pip nose pep8
- source activate env_name
- pip
- pip install coveralls
- pip install .
script:
- qiita_db make_test_env
- nosetests
- nosetests --with-doctest
- pep8 qiita_db qiita_core qiita_pet setup.py
# we need to run the test suite from setup.py for coveralls to grab the info
- coverage run setup.py test
- coverage report -m
Expand Down
13 changes: 8 additions & 5 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,26 @@ Dependencies

Qiita is a python package, with support for python 2.7 and 3.2, that depends on the following python libraries (all of them can be installed using pip):

<!--
* [tornado 3.1.1](http://www.tornadoweb.org/en/stable/)
* [redis 2.8.0](https://pypi.python.org/pypi/redis/)
* [tornado-redis](https://pypi.python.org/pypi/tornado-redis)
* [Psycopg2](http://initd.org/psycopg/download/)
* [pgbouncer](http://pgfoundry.org/projects/pgbouncer)
* [pyqi 0.3](https://github.com/bipy/pyqi)
* [IPython](https://github.com/ipython/ipython)
* [QIIME](https://github.com/qiime/qiime)
* [NumPy](https://github.com/numpy/numpy)
* [PyCogent](http://pycogent.org)
-->

* [Psycopg2](http://initd.org/psycopg/download/)
* [pyqi 0.3](https://github.com/bipy/pyqi)

And on the following packages:

* [PostgresSQL 9.3](http://www.postgresql.org/download/)

<!--
* [redis-server](http://redis.io)
-->

Install
-------
Expand All @@ -26,7 +31,5 @@ The easiest way to install Qiita is to run the following commands:


```bash
pip install numpy
pip install cogent
pip install https://github.com/biocore/qiita/archive/master.zip
```
8 changes: 7 additions & 1 deletion qiita_core/configuration_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@
# -----------------------------------------------------------------------------

from os.path import join, dirname, abspath
from ConfigParser import ConfigParser, NoOptionError

try:
# Python 2
from ConfigParser import ConfigParser, NoOptionError
except ImportError:
# Python 3
from configparser import ConfigParser, NoOptionError


class ConfigurationManager(object):
Expand Down
2 changes: 1 addition & 1 deletion qiita_db/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
# The full license is in the file LICENSE, distributed with this software.
# -----------------------------------------------------------------------------

__version__ = "0.0.1-dev"
__version__ = "0.0.1-dev"
10 changes: 0 additions & 10 deletions qiita_db/commands/__init__.py

This file was deleted.

50 changes: 0 additions & 50 deletions qiita_db/commands/sample_template_adder.py

This file was deleted.

10 changes: 0 additions & 10 deletions qiita_db/interfaces/__init__.py

This file was deleted.

10 changes: 0 additions & 10 deletions qiita_db/interfaces/optparse/__init__.py

This file was deleted.

10 changes: 0 additions & 10 deletions qiita_db/interfaces/optparse/config/__init__.py

This file was deleted.

58 changes: 0 additions & 58 deletions qiita_db/interfaces/optparse/config/add_sample_template.py

This file was deleted.

23 changes: 0 additions & 23 deletions qiita_db/interfaces/optparse/input_handler.py

This file was deleted.

9 changes: 4 additions & 5 deletions qiita_db/metadata_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
# The full license is in the file LICENSE, distributed with this software.
# -----------------------------------------------------------------------------

from itertools import izip
from string import lower
from future.builtins import zip

from .base import QiitaStatusObject
from .exceptions import QiitaDBNotImplementedError
Expand Down Expand Up @@ -100,7 +99,7 @@ def create(cls, md_template, study_id):

# Get the column names paired with its datatype for SQL
columns = []
for column_name, datatype in izip(sql_safe_column_names, datatypes):
for column_name, datatype in zip(sql_safe_column_names, datatypes):
columns.append('%s %s' % (column_name, datatype))
# Get the columns in a comma-separated string
columns = ", ".join(columns)
Expand All @@ -114,10 +113,10 @@ def create(cls, md_template, study_id):
" values ('" + str(study_id) +
"', %s, %s)")
# The column names should be lowercase and quoted
quoted_lc_headers = [quote_data_value(lower(h)) for h in headers]
quoted_lc_headers = [quote_data_value(h.lower()) for h in headers]
# Pair up the column names with its datatype
sql_args_list = [(column_name, datatype) for column_name, datatype in
izip(quoted_lc_headers, datatypes)]
zip(quoted_lc_headers, datatypes)]
conn_handler.executemany(column_tables_sql_template,
sql_args_list)

Expand Down
5 changes: 2 additions & 3 deletions qiita_db/sql_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def get_postgres_cursor(self):
try:
with self._connection.cursor(cursor_factory=DictCursor) as cur:
yield cur
except PostgresError, e:
except PostgresError as e:
raise QiitaDBConnectionError("Cannot get postgres cursor! %s" % e)

def _check_sql_args(self, sql_args):
Expand Down Expand Up @@ -87,7 +87,6 @@ def _sql_executor(self, sql, sql_args=None, many=False):
else:
self._check_sql_args(sql_args)


# Execute the query
with self.get_postgres_cursor() as cur:
try:
Expand All @@ -97,7 +96,7 @@ def _sql_executor(self, sql, sql_args=None, many=False):
cur.execute(sql, sql_args)
yield cur
self._connection.commit()
except PostgresError, e:
except PostgresError as e:
self._connection.rollback()
try:
err_sql = cur.mogrify(sql, sql_args)
Expand Down
20 changes: 10 additions & 10 deletions qiita_db/support_files/populate_test_db.sql
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,16 @@ INSERT INTO qiita.investigation_study (investigation_id, study_id) VALUES (1, 1)
INSERT INTO qiita.study_experimental_factor (study_id, efo_id) VALUES (1, 1);

-- Insert the raw data filepaths for study 1
INSERT INTO qiita.filepath (filepath, filepath_type_id) VALUES ('$QIITA_TEST_FOLDER/s_G1_L001_sequences.fastq.gz', 1), ('$QIITA_TEST_FOLDER/s_G1_L001_sequences_barcodes.fastq.gz', 2);
INSERT INTO qiita.filepath (filepath, filepath_type_id) VALUES ('s_G1_L001_sequences.fastq.gz', 1), ('s_G1_L001_sequences_barcodes.fastq.gz', 2), ('sequences.fastq.gz', 1), ('sequences_barcodes.fastq.gz', 2);

-- Insert the raw data information for study 1
INSERT INTO qiita.raw_data (filetype_id, submitted_to_insdc) VALUES (2, FALSE);
INSERT INTO qiita.raw_data (filetype_id, submitted_to_insdc) VALUES (2, FALSE), (2, TRUE);

-- Insert (link) the raw data with the raw filepaths
INSERT INTO qiita.raw_filepath (raw_data_id, filepath_id) VALUES (1, 1), (1, 2);
INSERT INTO qiita.raw_filepath (raw_data_id, filepath_id) VALUES (1, 1), (1, 2), (1, 3), (1, 4);

-- Insert (link) the study with the raw data
INSERT INTO qiita.study_raw_data (study_id, raw_data_id) VALUES (1, 1);
INSERT INTO qiita.study_raw_data (study_id, raw_data_id) VALUES (1, 1), (1, 2);

-- Add the required_sample_info for study 1
INSERT INTO qiita.required_sample_info (study_id, sample_id, physical_location, has_physical_specimen, has_extracted_data, sample_type, required_sample_info_status_id, collection_date, host_subject_id, description) VALUES
Expand Down Expand Up @@ -281,31 +281,31 @@ INSERT INTO qiita.prep_1 (sample_id, BarcodeSequence, LIBRARY_CONSTRUCTION_PROTO
('SKM9.640192', 'AGCAGGCACGAA', 'This analysis was done as in Caporaso et al 2011 Genome research. The PCR primers (F515/R806) were developed against the V4 region of the 16S rRNA (both bacteria and archaea), which we determined would yield optimal community clustering with reads of this length using a procedure similar to that of ref. 15. [For reference, this primer pair amplifies the region 533_786 in the Escherichia coli strain 83972 sequence (greengenes accession no. prokMSA_id:470367).] The reverse PCR primer is barcoded with a 12-base error-correcting Golay code to facilitate multiplexing of up to Ê1,500 samples per lane, and both PCR primers contain sequencer adapter regions.', 'GTGCCAGCMGCCGCGGTAA', 'V4', '16S rRNA', 'ANL', 's_G1_L001_sequences', '8/1/12', 'ANL', 'micro biome of soil and rhizosphere of cannabis plants from CA', 'Cannabis Soil Microbiome', 'Illumina', '.25,g', 'Sequencing by synthesis', 'MiSeq', 'ANL', 'FWD:GTGCCAGCMGCCGCGGTAA; REV:GGACTACHVGGGTWTCTAAT', 'CCME');

-- Insert preprocessed information for raw data 1
INSERT INTO qiita.preprocessed_data (raw_data_id, preprocessed_params_table, preprocessed_params_id) VALUES (1, 'preprocessed_sequence_illumina_params', 1);
INSERT INTO qiita.preprocessed_data (raw_data_id, preprocessed_params_table, preprocessed_params_id) VALUES (1, 'preprocessed_sequence_illumina_params', 1), (1, 'preprocessed_sequence_illumina_params', 2);

-- Insert (link) preprocessed information to study 1
INSERT INTO qiita.study_preprocessed_data (preprocessed_data_id, study_id) VALUES (1, 1);
INSERT INTO qiita.study_preprocessed_data (preprocessed_data_id, study_id) VALUES (1, 1), (2, 1);

-- Insert the preprocessed filepath for raw data 1
INSERT INTO qiita.filepath (filepath, filepath_type_id) VALUES ('$QIITA_TEST_FOLDER/seqs.fna', 4), ('$QIITA_TEST_FOLDER/seqs.qual', 5);
INSERT INTO qiita.filepath (filepath, filepath_type_id) VALUES ('seqs.fna', 4), ('seqs.qual', 5);

-- Insert (link) the preprocessed data with the preprocessed filepaths
INSERT INTO qiita.preprocessed_filepath (preprocessed_data_id, filepath_id) VALUES (1, 3), (1, 4);

-- Insert the preprocessed illumina params used for raw data 1
INSERT INTO qiita.preprocessed_sequence_illumina_params (trim_length) VALUES (151);
INSERT INTO qiita.preprocessed_sequence_illumina_params (trim_length) VALUES (151), (100);

-- Insert processed information for study 0 and processed data 1
INSERT INTO qiita.processed_data (preprocessed_data_id, processed_params_table, processed_params_id, processed_date) VALUES (1, 'processed_params_uclust', 1, 'Mon Oct 1 09:30:27 2012');

-- Populate the reference table
INSERT INTO qiita.reference (reference_name, reference_version, sequence_filepath, taxonomy_filepath, tree_filepath) VALUES ('GreenGenes', '4feb2011', '$QIITA_TEST_FOLDER/gg_97_otus_4feb2011.fasta', '$QIITA_TEST_FOLDER/greengenes_tax.txt', '$QIITA_TEST_FOLDER/gg_97_otus_4feb2011.tre');
INSERT INTO qiita.reference (reference_name, reference_version, sequence_filepath, taxonomy_filepath, tree_filepath) VALUES ('GreenGenes', '4feb2011', 'gg_97_otus_4feb2011.fasta', 'greengenes_tax.txt', 'gg_97_otus_4feb2011.tre');

-- Insert the processed params uclust used for preprocessed data 1
INSERT INTO qiita.processed_params_uclust (similarity, enable_rev_strand_match, suppress_new_clusters, reference_id) VALUES (0.97, TRUE, TRUE, 1);

-- Insert the biom table filepath for processed data 1
INSERT INTO qiita.filepath (filepath, filepath_type_id) VALUES ('$QIITA_TEST_FOLDER/study_1001_closed_reference_otu_table.biom', 6);
INSERT INTO qiita.filepath (filepath, filepath_type_id) VALUES ('study_1001_closed_reference_otu_table.biom', 6);

-- Insert (link) the processed data with the processed filepath
INSERT INTO qiita.processed_filepath (processed_data_id, filepath_id) VALUES (1, 5);
2 changes: 1 addition & 1 deletion qiita_db/test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
# The full license is in the file LICENSE, distributed with this software.
# -----------------------------------------------------------------------------

__version__ = "0.0.1-dev"
__version__ = "0.0.1-dev"
Loading

0 comments on commit 162cb0f

Please sign in to comment.