Skip to content

Commit 9bf8d15

Browse files
authored
Merge pull request #26 from pombo-lab/v1.1.1-dev
Merge V1.1.1 dev
2 parents 18a24e0 + fd4d3f2 commit 9bf8d15

File tree

13 files changed

+160
-21
lines changed

13 files changed

+160
-21
lines changed

.pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ confidence=
6565
# --enable=similarities". If you want to run only the classes checker, but have
6666
# no Warning level messages displayed, use"--disable=all --enable=classes
6767
# --disable=W"
68-
disable=import-star-module-level,old-octal-literal,oct-method,print-statement,unpacking-in-except,parameter-unpacking,backtick,old-raise-syntax,old-ne-operator,long-suffix,dict-view-method,dict-iter-method,metaclass-assignment,next-method-called,raising-string,indexing-exception,raw_input-builtin,long-builtin,file-builtin,execfile-builtin,coerce-builtin,cmp-builtin,buffer-builtin,basestring-builtin,apply-builtin,filter-builtin-not-iterating,using-cmp-argument,useless-suppression,range-builtin-not-iterating,suppressed-message,no-absolute-import,old-division,cmp-method,reload-builtin,zip-builtin-not-iterating,intern-builtin,unichr-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,input-builtin,round-builtin,hex-method,nonzero-method,map-builtin-not-iterating,no-member,fixme,anomalous-backslash-in-string,too-many-public-methods,no-self-use
68+
disable=import-star-module-level,old-octal-literal,oct-method,print-statement,unpacking-in-except,parameter-unpacking,backtick,old-raise-syntax,old-ne-operator,long-suffix,dict-view-method,dict-iter-method,metaclass-assignment,next-method-called,raising-string,indexing-exception,raw_input-builtin,long-builtin,file-builtin,execfile-builtin,coerce-builtin,cmp-builtin,buffer-builtin,basestring-builtin,apply-builtin,filter-builtin-not-iterating,using-cmp-argument,useless-suppression,range-builtin-not-iterating,suppressed-message,no-absolute-import,old-division,cmp-method,reload-builtin,zip-builtin-not-iterating,intern-builtin,unichr-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,input-builtin,round-builtin,hex-method,nonzero-method,map-builtin-not-iterating,no-member,fixme,anomalous-backslash-in-string,too-many-public-methods,no-self-use,useless-object-inheritance
6969

7070

7171
[REPORTS]

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
language: python
22
python:
33
- '2.7'
4-
- '3.4'
54
- '3.5'
65
- '3.6'
76
install:

CHANGELOG.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
## [1.1.1] - 2019-02-08
8+
### Added
9+
- Added a CHANGELOG
10+
11+
### Changed
12+
- Fix problem processing uncompressed fastas
13+
- Fix bug where pandas converts sample names to numeric types
14+
15+
### Removed
16+
- Removed command line option for MACS window calling
17+
- Removed support for Python3.4
18+
19+
## [1.1.0] - 2017-05-06
20+
### Added
21+
- Added fixed threshold option to process_nps
22+
- Added functions for extracting sub-regions of a matrix
23+
24+
### Changed
25+
- Enable coveralls
26+
- Enable codeclimate
27+
28+
29+
## [1.0.0] - 2017-03-04
30+
### Added
31+
- First release of GAMtools package
32+
- Created a master command line script
33+
- Added support for gzipped input/output
34+
- Added a command to calculate enrichments
35+
- Added a command to convert different matrix formats
36+
- Added a command for circular permutation
37+
- Added a command for getting compaction
38+
- Added a command for getting radial position
39+
- Added QC scripts and automatic exclusion of bad samples
40+
- Added documentation
41+
- Added unit tests
42+
- Added tutorial
43+
- Added continuous integration through tox and Travis
44+
45+
### Changed
46+
- Made code PEP8 compliant
47+
- Made code python3 compatible
48+
49+
### Removed
50+
- Old command line scripts
51+
52+
[1.0.0]: https://github.com/pombo-lab/gamtools/compare/nature-2017...v1.0.0
53+
[1.1.0]: https://github.com/pombo-lab/gamtools/compare/v1.0.0...v1.1.0
54+
[1.1.1]: https://github.com/pombo-lab/gamtools/compare/v1.1.0...v1.1.1
55+

lib/gamtools/call_windows.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -763,10 +763,6 @@ def threshold_from_args(args):
763763
Wrapper function to pass arguments to threshold_file from argparse.
764764
"""
765765

766-
if args.macs:
767-
raise NotImplementedError('Thresholding using macs is not supported')
768-
769-
else:
770-
threshold_file(args.coverage_file, args.output_file,
771-
args.fitting_folder, args.details_file,
772-
args.fitting_function)
766+
threshold_file(args.coverage_file, args.output_file,
767+
args.fitting_folder, args.details_file,
768+
args.fitting_function)

lib/gamtools/cosegregation.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ class InvalidDataError(Exception):
4545
"""
4646
Exception raised if segregation data contains anything other than 0s and 1s.
4747
"""
48-
pass
4948

5049

5150
def regions_are_valid(regions):

lib/gamtools/data/scripts/mapping_stats.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ echo -e "Sample\tReads_sequenced\tReads_mapped\tUnique_reads_mapped\tPercent_map
55
for fq in $*;
66
do
77
if [ ${fq: -10} == '.rmdup.bam' ]; then continue; fi;
8+
cat_cmd=cat;
9+
if [ ${fq##*.} '==' 'gz' ]; then cat_cmd=zcat; fi;
810
sample=$(basename $fq);
911
name_no_ext=$(echo -n $fq | tr "." "\n" | sed '/^gz$/ d' | sed '$ d' | perl -pe 'chomp if eof' | tr "\n" ".");
10-
nlines=$(zcat ${fq} | wc -l);
12+
nlines=$(${cat_cmd} ${fq} | wc -l);
1113
nreads=$(echo "${nlines} / 4" | bc);
1214
nmap=$(samtools view -c ${name_no_ext}.bam);
1315
if [ -z $nmap ]; then $nmap=0; fi;

lib/gamtools/qc/fastqc.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,7 @@ def process_file(filename):
156156
# Get start and end position of all modules:
157157
mod_start = []
158158
mod_end = []
159-
for i in range(0, len(fq_lines)):
160-
line = fq_lines[i]
159+
for i, line in enumerate(fq_lines):
161160

162161
if line == '>>END_MODULE':
163162
mod_end.append(i)

lib/gamtools/qc/merge.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,30 @@ def merge_stats(input_stats_files, output_merged_file):
2626
stats_file = pd.read_csv(stats_file_path, delim_whitespace=True, index_col=0)
2727
base = pd.merge(base, stats_file, left_index=True, right_index=True)
2828

29-
base.to_csv(output_merged_file, sep='\t')
29+
final_df = check_index_column(input_stats_files, base)
30+
final_df.to_csv(output_merged_file, sep='\t')
31+
32+
def check_index_column(input_stats_files, merged_df):
33+
"""
34+
After merging several stats files together, check that the index column
35+
(i.e. the sample name) has not been converted to an integer or a float.
36+
37+
:param list input_stats_files: String paths to input dataframes.
38+
:param merged_df: Pandas dataframe of merged statistics files.
39+
40+
:returns: Pandas dataframe with corrected index column.
41+
"""
42+
43+
try:
44+
first_col = pd.read_csv(input_stats_files[0], delim_whitespace=True, dtype=str).iloc[:, 0]
45+
except pd.io.common.EmptyDataError:
46+
input_stats_files[0].seek(0)
47+
first_col = pd.read_csv(input_stats_files[0], delim_whitespace=True, dtype=str).iloc[:, 0]
48+
49+
if not all(merged_df.index.get_level_values(0) == first_col):
50+
merged_df.index = first_col
51+
52+
return merged_df
3053

3154
def merge_stats_from_doit(dependencies, targets):
3255
"""

lib/gamtools/qc/pass_qc.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,6 @@ class QcParamError(Exception):
9696
Exception to be raised if the QC Parameters file is malformed.
9797
"""
9898

99-
pass
100-
10199

102100
def do_comparison(left_str, operator, right_str, stats_df):
103101
"""

lib/gamtools/segregation.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@
6666

6767
class InvalidChromError(Exception):
6868
"""Exception to be raised when an invalid chromosome is specified"""
69-
pass
7069

7170

7271
def open_segregation(path_or_buffer):
@@ -100,7 +99,7 @@ def index_from_interval(segregation_table, interval):
10099
'Interval start {0} larger than interval end {1}'.format(
101100
*interval))
102101

103-
window_in_region = np.logical_and(
102+
window_in_region = np.logical_and( #pylint: disable=assignment-from-no-return
104103
np.logical_and(
105104
segregation_table.index.get_level_values('stop') > start,
106105
segregation_table.index.get_level_values('start') < stop),

0 commit comments

Comments
 (0)