Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ All notable changes to this project are documented in this file.
Unreleased
==========

Fixed
-----
* Fix ``get_bam`` and ``get_primary_bam`` functions
* Fix imports and line breaks for linting


==================
3.0.0 - 2018-02-21
Expand Down
6 changes: 3 additions & 3 deletions resdk/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ def __getitem__(self, index):
# pylint: disable=protected-access
if not isinstance(index, (slice,) + six.integer_types):
raise TypeError
if ((not isinstance(index, slice) and index < 0) or
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't change the code, if the functionality stays the same.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm attempting to fix the Travis-CI test here. The tests started failing because of this change: PyCQA/pycodestyle#502
In this discussion on pycodestyle, they mention that W503 has been added to the default ignore list, and W504 will take precedence. However, in our Travis-CI tests, W503 is still reported as a failure. Is there a way to set up our .tox file so that certain ignored warnings are not reported as failures?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I see. You have to argue such changes better and put a description in the commit message.

(isinstance(index, slice) and index.start is not None and index.start < 0) or
(isinstance(index, slice) and index.stop is not None and index.stop < 0)):
if ((not isinstance(index, slice) and index < 0)
or (isinstance(index, slice) and index.start is not None and index.start < 0)
or (isinstance(index, slice) and index.stop is not None and index.stop < 0)):
raise ValueError("Negative indexing is not supported.")
if isinstance(index, slice) and index.step is not None:
raise ValueError("`step` parameter in slice is not supported")
Expand Down
6 changes: 3 additions & 3 deletions resdk/resolwe.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

"""
from __future__ import absolute_import, division, print_function
from six.moves.urllib.parse import urljoin

import copy
import logging
Expand All @@ -23,7 +24,6 @@
import yaml
# Needed because we mock requests in test_resolwe.py
from requests.exceptions import ConnectionError # pylint: disable=redefined-builtin
from six.moves.urllib.parse import urljoin # pylint: disable=import-error
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the problem instead of disabling the checker.


from .exceptions import ValidationError, handle_http_exception
from .query import ResolweQuery
Expand Down Expand Up @@ -344,8 +344,8 @@ def run(self, slug=None, input={}, descriptor=None, # pylint: disable=redefined
:return: data object that was just created
:rtype: Data object
"""
if ((descriptor and not descriptor_schema) or
(not descriptor and descriptor_schema)):
if ((descriptor and not descriptor_schema)
or (not descriptor and descriptor_schema)):
raise ValueError("Set both or neither descriptor and descriptor_schema.")

if src is not None:
Expand Down
8 changes: 4 additions & 4 deletions resdk/resources/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ def __setattr__(self, name, value):
more comprehensive check is called before save.

"""
if (hasattr(self, '_original_values') and
name in self._original_values and
name in self.READ_ONLY_FIELDS and
value != self._original_values[name]):
if (hasattr(self, '_original_values')
and name in self._original_values
and name in self.READ_ONLY_FIELDS
and value != self._original_values[name]):
raise ValueError("Can not change read only field {}".format(name))

super(BaseResource, self).__setattr__(name, value)
Expand Down
8 changes: 4 additions & 4 deletions resdk/resources/data.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""Data resource."""
from __future__ import absolute_import, division, print_function, unicode_literals
from six.moves.urllib.parse import urljoin

import json
import logging

import requests
from six.moves.urllib.parse import urljoin # pylint: disable=import-error

from .base import BaseResolweResource
from .descriptor import DescriptorSchema
Expand Down Expand Up @@ -210,9 +210,9 @@ def put_in_download_list(elm, fname):
field_name = 'output.{}'.format(field_name)

for ann_field_name, ann in self.annotation.items():
if (ann_field_name.startswith('output') and
(field_name is None or field_name == ann_field_name) and
ann['value'] is not None):
if (ann_field_name.startswith('output')
and (field_name is None or field_name == ann_field_name)
and ann['value'] is not None):
if ann['type'].startswith('basic:{}:'.format(field_type)):
put_in_download_list(ann['value'], ann_field_name)
elif ann['type'].startswith('list:basic:{}:'.format(field_type)):
Expand Down
8 changes: 4 additions & 4 deletions resdk/resources/sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def get_reads(self):

def get_bam(self):
"""Return ``bam`` object on the sample."""
return self.data.get(type='data:alignment:bam:')
return self.data.get(type='data:alignment:bam')

def get_primary_bam(self, fallback_to_bam=False):
"""Return ``primary bam`` object on the sample.
Expand All @@ -30,7 +30,7 @@ def get_primary_bam(self, fallback_to_bam=False):

"""
try:
return self.data.get(type='data:alignment:bam:primary:')
return self.data.get(type='data:alignment:bam:primary')
except LookupError:
if fallback_to_bam:
return self.get_bam()
Expand All @@ -39,11 +39,11 @@ def get_primary_bam(self, fallback_to_bam=False):

def get_macs(self):
"""Return list of ``bed`` objects on the sample."""
return self.data.filter(type='data:chipseq:macs14:')
return self.data.filter(type='data:chipseq:macs14')

def get_cuffquant(self):
"""Return ``cuffquant`` object on the sample."""
return self.data.get(type='data:cufflinks:cuffquant:')
return self.data.get(type='data:cufflinks:cuffquant')


class Sample(SampleUtilsMixin, BaseCollection):
Expand Down
4 changes: 2 additions & 2 deletions resdk/scripts/reads.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ def upload_reads():
print("\nERROR: Incorrect file path(s).\n")
exit(1)
else:
if (all(os.path.isfile(file) for file in args.r1) and
all(os.path.isfile(file) for file in args.r2)):
if (all(os.path.isfile(file) for file in args.r1)
and all(os.path.isfile(file) for file in args.r2)):
resolwe.run('upload-fastq-paired', {'src1': args.r1, 'src2': args.r2},
collections=args.collection)
else:
Expand Down
4 changes: 2 additions & 2 deletions resdk/scripts/sequp.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,8 @@ def parse_annotation_file(annotation_file):
if exp_type:
descriptor['experiment_type'] = exp_type
# Paired-end reads
if (annotations[sample_n]['PAIRED_END'] == 'Y' and
annotations[sample_n]['FASTQ_PATH_PAIR']):
if (annotations[sample_n]['PAIRED_END'] == 'Y'
and annotations[sample_n]['FASTQ_PATH_PAIR']):
rw_reads = annotations[sample_n]['FASTQ_PATH_PAIR'].split(',')
slug = 'upload-fastq-paired'
input_['src1'] = fw_reads
Expand Down