Skip to content

Commit

Permalink
changes to novel precursor code and others
Browse files Browse the repository at this point in the history
  • Loading branch information
dmnfarrell committed Oct 8, 2018
1 parent 588b9c3 commit 363b928
Show file tree
Hide file tree
Showing 12 changed files with 259 additions and 4,212 deletions.
13 changes: 13 additions & 0 deletions CHANGES
Expand Up @@ -2,6 +2,19 @@
CHANGES
=======

------
0.5.0
------

fixes to work with python 3 properly
snap now works
updated to use mirbase release 22
mpl tk fix
sphinx docs added
can run novel predictions in parallel
some fixes to precursor generation
removed bedtools dependency

------
0.4.0
------
Expand Down
8 changes: 8 additions & 0 deletions doc/source/cli.rst
Expand Up @@ -34,6 +34,8 @@ The advantage of configuration files is in avoiding long commands that have to b
species = hsa
pad5 = 3
pad3 = 5
verbose = 1
cpus = 1

[aligner]
default_params = -v 1 --best
Expand Down Expand Up @@ -110,6 +112,12 @@ Settings explained:
| pad3 | 5 | 5’ flanking bases |
| | | to add |
+---------------+---------------------------------+-------------------+
| verbose | 1 | print extra |
| | | information |
+---------------+---------------------------------+-------------------+
| cpus | 1 | number of threads |
| | | to use |
+---------------+---------------------------------+-------------------+
| sample_labels | samplefile.txt | csv file with |
| | | sample labels |
+---------------+---------------------------------+-------------------+
Expand Down
24 changes: 13 additions & 11 deletions doc/source/description.rst
Expand Up @@ -62,18 +62,14 @@ Linux

On most linux operating systems installations of Python should include the pip tool.
If not use your distributions package manager to install pip first. Then the simple
call below should install all dependencies. However if this fails see the linux section
below for commands to run for installing any pre-requisites that might not be on your
system.
::
pip install smallrnaseq
call below should install all dependencies.

If pip fails you can run the following commands first to fix likely missing packages.
These are mainly needed for HTSeq to install. Then run pip again.
You should first run the following commands for installing the pre-requisites that might not
be on your system already.

Ubuntu::

sudo apt install python-dev samtools bedtools liblzma-dev libbz2-dev zlib1g-dev liblzo2-dev python-scipy
sudo apt install python-dev samtools liblzma-dev libbz2-dev zlib1g-dev liblzo2-dev python-scipy
sudo pip install smallrnaseq
sudo apt install bowtie

Expand All @@ -84,6 +80,10 @@ Fedora::
sudo pip install smallrnaseq
sudo dnf install bowtie

Then finally run::

pip install smallrnaseq

Snap package
++++++++++++

Expand Down Expand Up @@ -139,10 +139,10 @@ will install the older version which should work.
Windows
-------

In theory this package will work on Windows but has not been tested. If you are a windows user there are several options available:
If you are a Windows user there are several options available:

1. simply use linux running inside a virtualbox instance. see http://www.makeuseof.com/tag/how-to-use-virtualbox/
2. install windows subsystem for linux (WSL_) and use the linux instructions above (not tested).
1. Simply use linux running inside a virtualbox instance. see http://www.makeuseof.com/tag/how-to-use-virtualbox/
2. Install Windows Subsystem for Linux (WSL_) and use the linux instructions above. This is confirmed to work on Windows 10.
3. Use conda and bioconda (see the OSX instructions below).

.. _WSL: https://docs.microsoft.com/en-gb/windows/wsl/install-win10
Expand All @@ -162,6 +162,8 @@ Required dependencies
* matplotlib
* seaborn (requires scipy)
* HTSeq
* bx-python
* pyfaidx
* scikit-learn

Installing R for differential expression
Expand Down
4 changes: 2 additions & 2 deletions smallrnaseq/aligners.py
Expand Up @@ -84,7 +84,7 @@ def build_subread_index(fastafile, path):
utils.move_files(files, path)
return

def bowtie_align(infile, ref, outfile=None, remaining=None, verbose=True):
def bowtie_align(infile, ref, outfile=None, remaining=None, cpus=2, verbose=True):
"""Map reads using bowtie"""

label = os.path.splitext(os.path.basename(infile))[0]
Expand All @@ -100,7 +100,7 @@ def bowtie_align(infile, ref, outfile=None, remaining=None, verbose=True):
params = BOWTIE_PARAMS
if remaining == None:
remaining = os.path.join(outpath, label+'_r.fa')
cmd = 'bowtie -f -p 2 -S %s --un %s %s %s > %s' %(params,remaining,ref,infile,outfile)
cmd = 'bowtie -f -p %s -S %s --un %s %s %s > %s' %(cpus,params,remaining,ref,infile,outfile)
if verbose == True:
print (cmd)
try:
Expand Down
5 changes: 3 additions & 2 deletions smallrnaseq/app.py
Expand Up @@ -166,7 +166,8 @@ def map_mirnas(self):
ref_name = self.ref_name
mat_name = 'mirbase-%s' %self.species
self.aligner_params[mat_name] = self.mirna_params

novel.VERBOSE = self.verbose

if self.check_index(ref_name) == False:
print ('no index for reference genome')
ref_name = ''
Expand Down Expand Up @@ -213,7 +214,7 @@ def map_mirnas(self):
new,cl = novel.find_mirnas(allreads, self.ref_fasta, species=self.species,
score_cutoff=float(self.score_cutoff),
read_cutoff=int(self.read_cutoff),
cpus=self.cpus, verbose=self.verbose)
cpus=self.cpus)
if self.strict == True:
new = new[new.mature_check=='ok']
print ('filtered %s' %len(new))
Expand Down
4 changes: 2 additions & 2 deletions smallrnaseq/base.py
Expand Up @@ -294,7 +294,7 @@ def deseq_normalize(df):

def map_rnas(files, indexes, outpath, collapse=True, adapters=None, aligner='bowtie',
norm_method='library', use_remaining=True, overwrite=False,
samplelabels=None, params={}, count_method='split', verbose=True):
samplelabels=None, params={}, count_method='split', cpus=2, verbose=True):
"""Map reads to one or more gene annotations, assumes adapters are removed.
Args:
Expand Down Expand Up @@ -351,7 +351,7 @@ def map_rnas(files, indexes, outpath, collapse=True, adapters=None, aligner='bow
rem = os.path.join(outpath, filename+'_r.fa')

if aligner == 'bowtie':
aligners.bowtie_align(query, idx, outfile=samfile,
aligners.bowtie_align(query, idx, outfile=samfile, cpus=cpus,
remaining=rem, verbose=verbose)
elif aligner == 'subread':
aligners.subread_align(query, idx, samfile)
Expand Down
Binary file added smallrnaseq/data/premirna_model.joblib
Binary file not shown.
2 changes: 1 addition & 1 deletion smallrnaseq/data/styles.css
Expand Up @@ -129,7 +129,7 @@ a:active { color: red; }
margin-right: 5px;
float: right;
height: 650px;
width: 20%;
width: 25%;
position: fixed;
overflow:hidden;
top: 30;
Expand Down

0 comments on commit 363b928

Please sign in to comment.