diff --git a/setup.py b/setup.py index 4d69d4c..5b3f06b 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ inst_requires = ['numpy>=1.10', 'pandas>=0.20', 'seaborn>=0.7', - 'scikit-learn>=0.18', + 'scikit-learn==0.19.1', 'pyfaidx>=0.5.4', 'pysam>=0.10.0', 'HTSeq>=0.6', diff --git a/smallrnaseq/data/styles.css b/smallrnaseq/data/styles.css index 8e0160d..79c7ab9 100644 --- a/smallrnaseq/data/styles.css +++ b/smallrnaseq/data/styles.css @@ -58,7 +58,7 @@ hr margin-top: 30px; padding: 1em 1.25em; background-color: #fff; - width: 70%; + width: 65%; float: right; overflow: hidden; } @@ -127,9 +127,9 @@ a:active { color: red; } padding: 5px; margin-top: 40px; margin-right: 5px; - float: right; + float: left; height: 650px; - width: 25%; + width: 30%; position: fixed; overflow:hidden; top: 30; @@ -147,8 +147,39 @@ a:active { color: red; } .sidebar td, th { text-align: left; - font-size: 12px; + font-size: 11px; +} + +/* Sortable tables */ +.sortable { + margin:0px;padding:0px; + width:100%; + border:1px solid #b2a7a7; + font-family: monospace; + font-size:11px; +} +.sortable table{ + table-layout: fixed; + border-collapse: collapse; + border-spacing: 0; + height:100%; + margin:0px;padding:2px; } +.sortable td{ + font-size: 11px; + border-width: 0px 0px 0px 0px; + margin: 1px; + padding: 2px 3px; + width: 100%; +} +.sortable th{ + background-color: #ECF0F1; + border-width: 0px 0px 0px 0px; + max-width: 300px; + min-width: 40px; + word-wrap: break-word; +} +.sortable tr:nth-child(even){ background-color:#F7F7F7; } .main, .aside { diff --git a/smallrnaseq/novel.py b/smallrnaseq/novel.py index 3bc68f5..4939c75 100644 --- a/smallrnaseq/novel.py +++ b/smallrnaseq/novel.py @@ -362,6 +362,9 @@ def build_classifier(known, neg): def precursor_classifier(): """Get the stored miRNA precursor classifier model""" + #avoid being flooded with userwarnings + import warnings + warnings.filterwarnings("ignore", category=UserWarning) from sklearn.externals import joblib rf = joblib.load(os.path.join(datadir, 'premirna_model.joblib')) return rf @@ -432,7 +435,10 @@ def get_read_clusters(reads, cluster_distance=0, min_size=3, key='align_id'): c = c.groupby(['strand']).filter(lambda x: len(x) > 1) groups.append(c) i+=1 - df = pd.concat(groups) + if len(groups) > 0: + df = pd.concat(groups) + else: + df = pd.DataFrame() return df def get_cluster_groups(rcl): @@ -707,6 +713,9 @@ def find_mirnas(reads, ref_fasta, score_cutoff=.8, read_cutoff=50, species='', rcl=rcl, ref_fasta=ref_fasta, score_cutoff=score_cutoff, read_cutoff=read_cutoff) + if len(new) == 0: + print ('no precursors found above cutoff') + return None, None new['seed'] = new.apply(lambda x: x.mature[1:7], 1) #get coords column new['coords'] = new.apply(get_coords_string,1) @@ -720,6 +729,7 @@ def find_mirnas(reads, ref_fasta, score_cutoff=.8, read_cutoff=50, species='', u = summarize(new) print ('found %s unique novel mirnas' %len(u)) + print ('score cutoff=%s' %score_cutoff) print ('%s with known mature sequences' %len(u[-u.known_id.isnull()])) #also return all the reads found in clusters #found = pd.concat(X) @@ -836,15 +846,16 @@ def create_report(df, reads, species=None, outfile='report.html'): css = get_css() h = ' novel miRNA' h += '' %css + h += '' h += '' h += '' h += '
' h += '

novel miRNA predictions

' h += '
' h += ''