[med-svn] [Git][med-team/mirtop][upstream] New upstream version 0.4.28

Alexandre Detiste (@detiste-guest) gitlab at salsa.debian.org
Sat Oct 12 13:49:45 BST 2024



Alexandre Detiste pushed to branch upstream at Debian Med / mirtop


Commits:
d6a23114 by Alexandre Detiste at 2024-10-12T14:35:37+02:00
New upstream version 0.4.28
- - - - -


17 changed files:

- + .github/workflows/ci-cd.yml
- + .github/workflows/python-package-conda.yml
- + .travis.yml
- HISTORY.md
- + environment.yml
- mirtop/bam/bam.py
- mirtop/gff/__init__.py
- mirtop/gff/convert.py
- mirtop/gff/stats.py
- mirtop/libs/parse.py
- mirtop/mirna/mintplates.py
- mirtop/mirna/realign.py
- scripts/import_gff3.py
- scripts/prepare.py
- setup.py
- test/test_automated_analysis.py
- test/test_functions.py


Changes:

=====================================
.github/workflows/ci-cd.yml
=====================================
@@ -0,0 +1,94 @@
+name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI
+
+on: push
+
+jobs:
+  build:
+    name: Build distribution 📦
+    runs-on: ubuntu-latest
+
+    steps:
+    - uses: actions/checkout at v4
+    - name: Set up Python
+      uses: actions/setup-python at v5
+      with:
+        python-version: "3.x"
+    - name: Install pypa/build
+      run: >-
+        python3 -m
+        pip install
+        build
+        --user
+    - name: Build a binary wheel and a source tarball
+      run: python3 -m build
+    - name: Store the distribution packages
+      uses: actions/upload-artifact at v4
+      with:
+        name: python-package-distributions
+        path: dist/
+
+  publish-to-pypi:
+    name: >-
+      Publish Python 🐍 distribution 📦 to PyPI
+    if: startsWith(github.ref, 'refs/tags/')  # only publish to PyPI on tag pushes
+    needs:
+    - build
+    runs-on: ubuntu-latest
+    environment:
+      name: pypi
+      url: https://pypi.org/p/mirtop  # Replace <package-name> with your PyPI project name
+    permissions:
+      id-token: write  # IMPORTANT: mandatory for trusted publishing
+
+    steps:
+    - name: Download all the dists
+      uses: actions/download-artifact at v4
+      with:
+        name: python-package-distributions
+        path: dist/
+    - name: Publish distribution 📦 to PyPI
+      uses: pypa/gh-action-pypi-publish at release/v1
+
+  github-release:
+    name: >-
+      Sign the Python 🐍 distribution 📦 with Sigstore
+      and upload them to GitHub Release
+    needs:
+    - publish-to-pypi
+    runs-on: ubuntu-latest
+
+    permissions:
+      contents: write  # IMPORTANT: mandatory for making GitHub Releases
+      id-token: write  # IMPORTANT: mandatory for sigstore
+
+    steps:
+    - name: Download all the dists
+      uses: actions/download-artifact at v4
+      with:
+        name: python-package-distributions
+        path: dist/
+    - name: Sign the dists with Sigstore
+      uses: sigstore/gh-action-sigstore-python at v2.1.1
+      with:
+        inputs: >-
+          ./dist/*.tar.gz
+          ./dist/*.whl
+    - name: Create GitHub Release
+      env:
+        GITHUB_TOKEN: ${{ github.token }}
+      run: >-
+        gh release create
+        '${{ github.ref_name }}'
+        --repo '${{ github.repository }}'
+        --notes ""
+    - name: Upload artifact signatures to GitHub Release
+      env:
+        GITHUB_TOKEN: ${{ github.token }}
+      # Upload to GitHub Release using the `gh` CLI.
+      # `dist/` contains the built packages, and the
+      # sigstore-produced signatures and certificates.
+      run: >-
+        gh release upload
+        '${{ github.ref_name }}' dist/**
+        --repo '${{ github.repository }}'
+


=====================================
.github/workflows/python-package-conda.yml
=====================================
@@ -0,0 +1,46 @@
+name: Python Package using Conda
+
+on:
+  push:
+    branches:
+    - main
+    - master
+    - dev
+    - release/*
+  pull_request:
+    branches:
+    - main
+    - master
+
+jobs:
+  build-linux:
+    runs-on: ubuntu-latest
+    strategy:
+      max-parallel: 5
+
+    steps:
+    - uses: actions/checkout at v4
+    - name: Set up Python 3.11
+      uses: actions/setup-python at v3
+      with:
+        python-version: '3.11'
+    - name: Add conda to system path
+      run: |
+        # $CONDA is an environment variable pointing to the root of the miniconda directory
+        echo $CONDA/bin >> $GITHUB_PATH
+    - name: Install dependencies
+      run: |
+        conda env update --file environment.yml --name base
+    - name: Lint with flake8
+      run: |
+        conda install flake8
+        # stop the build if there are Python syntax errors or undefined names
+        flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
+        # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
+        # flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
+        #flake8 . --count  --max-complexity=10 --max-line-length=127 --statistics
+    - name: Test with pytest
+      run: |
+        conda install pytest
+        python setup.py develop
+        pytest


=====================================
.travis.yml
=====================================
@@ -0,0 +1,37 @@
+sudo: required
+dist: trusty
+language: python
+python:
+    - "3.6"
+    - "2.7"
+notifications:
+  email:
+    recipients:
+    - lorena.pantano at gmail.com
+    on_failure: always
+before_install:
+- echo $TRAVIS_PYTHON_VERSION
+- miniconda="Miniconda3-latest-Linux-x86_64.sh"
+- if [[ $TRAVIS_PYTHON_VERSION == "2.7" ]] ; then miniconda="Miniconda2-latest-Linux-x86_64.sh"; fi
+- wget -O miniconda.sh http://repo.continuum.io/miniconda/${miniconda}
+- bash miniconda.sh -b -p ~/install
+install:
+- export PATH=~/install/bin/:$PATH
+- conda install --yes ncurses -c conda-forge
+- conda install --yes -c conda-forge -c bioconda bedtools samtools razers3 pip nose pysam pandas pyyaml pybedtools  biopython setuptools codecov -q
+script:
+- python setup.py develop
+- nosetests --with-coverage
+after_success:
+  - codecov
+deploy:
+  provider: pypi
+  user: lpantano
+  password:
+    secure: cxfwBMREy+KIQl7Y2EeT8fBChASr6F7GvZxkwe7xXhwPS5Ezw51IX5ktHz8s8O6psseSP6GFLOzfc6wUTY2KM9i5syFtQUc8dQ8B4GmPbZKb+r8hcu4Q3VQqyrkMgyOV6DZ3jZ/Dowqd0005c5tW872RB3ABjflEq1xOr3ddOAp1UmjswYoM+cHE6gurT3z7XYyWS8O6jBee27Pf/tZkrc5tQaN6uVyEvEbYgtkomJ46CsKhgXACqQJiW6CKbzc03VypjEs+oUDNu6DsXmTuTXRyDHH/CA9M0zmQc9EOfZuBauwJ7/PgAS7LVICTq9cvq5RZ4sGEdZ1I1FDTMupp4Hybt6kbEU+Pntfj0nWWYhRZkeWN96Gar7p2BEQ9y68zVvyoM3S3fshLCYF1gonI4Dvy2XXjy+zyQuOSiNbqKwR/GjeDZV/U/TVhIVakQ7yQllyv2Fio8pwE28qpgfIhaddRC+Cp2KBhFBbpwM8Mxx5PeayTIQnhD3zDUt8ZdP1djvH4q/S+qLp77l2znD9CwaELYEzXvVbocsyed4jsXbMtD1z092JViA9/YzZPnuQ0PR7Ccs1bsdvMI0gOyoIroTEP+aPkXKyrL5O7O3sF8UX0ES0vxOC9cJwpEPH39sRxYxjJ4K1NpaGWlHiZG0hihLP6QkeBDthMYNEb0Veqcwc=
+  skip_existing: true
+  on:
+    all_branches: true
+    condition: $TRAVIS_BRANCH =~ ^master|dev$
+    distributions: sdist bdist_wheel
+    repo: miRTop/mirtop


=====================================
HISTORY.md
=====================================
@@ -1,3 +1,16 @@
+0.4.28
+
+* fix random order in Variant field [#84](https://github.com/miRTop/mirtop/issues/83)
+
+0.4.27
+
+* fix possible duplication of lines [#80](https://github.com/miRTop/mirtop/issues/80)
+* accept prefix for gff output [#84](https://github.com/miRTop/mirtop/issues/84)
+
+0.4.26
+
+*  Support spaces and special characters in bam files
+
 0.4.25
 
 * [fix outliers samples](https://github.com/nf-core/smrnaseq/issues/137). When there is no identification of reference sequences or isomirs, the multiqc module will fails because it won't find the expected keys. Adding 0 when is the case.


=====================================
environment.yml
=====================================
@@ -0,0 +1,7 @@
+dependencies:
+  - python=3.11
+  - bioconda::pysam
+  - bioconda::pybedtools
+  - bioconda::samtools=1.21
+  - conda-forge::pandas
+  - conda-forge::biopython=1.83
\ No newline at end of file


=====================================
mirtop/bam/bam.py
=====================================
@@ -6,6 +6,7 @@ import os.path as op
 import os
 import pysam
 from collections import defaultdict
+from shlex import quote
 
 import pybedtools
 
@@ -321,7 +322,7 @@ def _sam_to_bam(bam_fn):
     if not bam_fn.endswith("bam"):
         bam_out = "%s.bam" % os.path.splitext(bam_fn)[0]
         cmd = "samtools view -Sbh {bam_fn} -o {bam_out}"
-        do.run(cmd.format(**locals()))
+        do.run(cmd.format(bam_fn=quote(bam_fn), bam_out=quote(bam_out)))
         return bam_out
     return bam_fn
 
@@ -330,7 +331,7 @@ def _bam_sort(bam_fn):
     bam_sort_by_n = op.splitext(bam_fn)[0] + "_sort.bam"
     if not file_exists(bam_sort_by_n):
         do.run(("samtools sort -n -o {bam_sort_by_n} {bam_fn}").format(
-            **locals()))
+            bam_sort_by_n=quote(bam_sort_by_n), bam_fn=quote(bam_fn)))
     return bam_sort_by_n
 
 


=====================================
mirtop/gff/__init__.py
=====================================
@@ -68,7 +68,7 @@ def reader(args):
     if args.low_memory:
         return None
     merged = merge.merge(out_dts, samples)
-    fn_merged_out = op.join(args.out, "mirtop.%s" % args.out_format)
+    fn_merged_out = op.join(args.out, "%s.%s" % (args.prefix, args.out_format))
     _write(merged, header.create(samples, database, header.make_tools([args.format])), fn_merged_out, args)
 
 


=====================================
mirtop/gff/convert.py
=====================================
@@ -3,6 +3,7 @@
 from __future__ import print_function
 
 import os.path as op
+import pandas as pd
 
 from mirtop.mirna import fasta, mapper
 from mirtop.mirna.realign import read_id
@@ -25,69 +26,69 @@ def convert_gff_counts(args):
             UID miRNA Variant Sample1 Sample2 ... Sample N
     """
     sep = "\t"
-    variant_header = sep.join(['iso_5p', 'iso_3p',
-                               'iso_add3p', 'iso_snp'])
+    variant_header = ['iso_5p', 'iso_3p',
+                      'iso_add3p', 'iso_snp']
     if args.add_extra:
         precursors = fasta.read_precursor(args.hairpin, args.sps)
         matures = mapper.read_gtf_to_precursor(args.gtf)
-        variant_header = sep.join([variant_header,
-                                   'iso_5p_nt', 'iso_3p_nt',
-                                   'iso_add3p_nt', 'iso_snp_nt'])
+        variant_header = variant_header + ['iso_5p_nt', 'iso_3p_nt', 'iso_add3p_nt', 'iso_snp_nt']
 
     logger.info("INFO Reading GFF file %s", args.gff)
     logger.info("INFO Writing TSV file to directory %s", args.out)
 
     gff_file = open(args.gff, 'r')
     out_file = op.join(args.out, "%s.tsv" % op.splitext(op.basename(args.gff))[0])
+    all_lines = []
     missing_parent = 0
     missing_mirna = 0
     unvalid_uid = 0
-    with open(out_file, 'w') as outh:
-
-        for samples_line in gff_file:
-            if samples_line.startswith("## COLDATA:"):
-                samples = sep.join(samples_line.strip().split("COLDATA:")[1].strip().split(","))
-                header = sep.join(['UID', 'Read', 'miRNA', 'Variant',
-                                   variant_header, samples])
-                print(header, file=outh)
-                break
-
-        for mirna_line in gff_file:
-            gff = feature(mirna_line)
-            attr = gff.attributes
-            UID = attr["UID"]
-            Read = attr["Read"]
-            mirna = attr["Name"]
-            parent = attr["Parent"]
-            variant = attr["Variant"]
-            try:
-                read_id(UID)
-            except KeyError:
-                unvalid_uid += 1
+    #with open(out_file, 'w') as outh:
+    
+    for samples_line in gff_file:
+        if samples_line.startswith("## COLDATA:"):
+            samples = [sep.join(samples_line.strip().split("COLDATA:")[1].strip().split(","))]
+            #header = sep.join(['UID', 'Read', 'miRNA', 'Variant',
+            #                   variant_header, samples])
+            #print(header, file=outh)
+            break
+    
+    for mirna_line in gff_file:
+        gff = feature(mirna_line)
+        attr = gff.attributes
+        UID = attr["UID"]
+        Read = attr["Read"]
+        mirna = attr["Name"]
+        parent = attr["Parent"]
+        variant = attr["Variant"]
+        try:
+            read_id(UID)
+        except KeyError:
+            unvalid_uid += 1
+            continue
+    
+        expression = [sep.join(attr["Expression"].strip().split(","))]
+        cols_variants = _expand(variant)
+        logger.debug("COUNTS::Read:%s" % Read)
+        logger.debug("COUNTS::EXTRA:%s" % variant)
+        if args.add_extra:
+            if parent not in precursors:
+                missing_parent += 1
                 continue
-
-            expression = sep.join(attr["Expression"].strip().split(","))
-            cols_variants = sep.join(_expand(variant))
-            logger.debug("COUNTS::Read:%s" % Read)
-            logger.debug("COUNTS::EXTRA:%s" % variant)
-            if args.add_extra:
-                if parent not in precursors:
-                    missing_parent += 1
-                    continue
-                if mirna not in matures[parent]:
-                    missing_mirna += 1
-                    continue
-                extra = variant_with_nt(mirna_line, precursors, matures)
-                if extra == "Invalid":
-                    continue
-                logger.debug("COUNTS::EXTRA:%s" % extra)
-                cols_variants = sep.join([cols_variants] + _expand(extra, True))
-            summary = sep.join([UID, Read,  mirna, variant,
-                                cols_variants, expression])
-            logger.debug(summary)
-            print(summary, file=outh)
-
-    gff_file.close()
+            if mirna not in matures[parent]:
+                missing_mirna += 1
+                continue
+            extra = variant_with_nt(mirna_line, precursors, matures)
+            if extra == "Invalid":
+                continue
+            logger.debug("COUNTS::EXTRA:%s" % extra)
+            cols_variants = cols_variants + _expand(extra, True)
+        summary = [UID, Read,  mirna, variant] + cols_variants + expression
+        logger.debug(summary)
+        all_lines.append(summary)
+    #import pdb; pdb.set_trace()   
+    df = pd.DataFrame(all_lines, columns = ['UID', 'Read', 'miRNA', 'Variant'] + variant_header + samples)
+    df = df.drop_duplicates()
+    df.to_csv(out_file, sep="\t", index=False)
     logger.info("Missing Parents in hairpin file: %s" % missing_parent)
     logger.info("Missing MiRNAs in GFF file: %s" % missing_mirna)
     logger.info("Non valid UID: %s" % unvalid_uid)


=====================================
mirtop/gff/stats.py
=====================================
@@ -107,13 +107,13 @@ def _add_missing(df):
     # ref_miRNA_mean
     category = "ref_miRNA_mean"
     if sum(df['category']==category) == 0:
-        df2 = {'category': category, 'sample': df['sample'].iat[0], 'counts': 0}
-        df = df.append(df2, ignore_index = True)
+        df2 = pd.DataFrame({'category': category, 'sample': df['sample'].iat[0], 'counts': 0}, index=[0])
+        df = pd.concat([df, df2], ignore_index = True)
     
     category = "isomiR_sum"
     if sum(df['category']==category) == 0:
-        df2 = {'category': category, 'sample': df['sample'].iat[0], 'counts': 0}
-        df = df.append(df2, ignore_index = True)
+        df2 =  pd.DataFrame({'category': category, 'sample': df['sample'].iat[0], 'counts': 0}, index=[0])
+        df = pd.concat([df, df2], ignore_index = True)
     
     return df
 


=====================================
mirtop/libs/parse.py
=====================================
@@ -82,6 +82,8 @@ def _add_subparser_gff(subparsers):
     parser.add_argument("files", nargs="*", help="Bam files.")
     parser.add_argument("-o", "--out", dest="out", required=1,
                         help="dir of output files")
+    parser.add_argument("--prefix", dest="prefix", required=0,
+                        default="mirtop", help="prefix for output file")
     parser.add_argument("--sps",
                         help="species")
     parser.add_argument("--keep-name", action="store_true",


=====================================
mirtop/mirna/mintplates.py
=====================================
@@ -509,7 +509,7 @@ def encode_sequence(sequence, prefix):
     """
     length = len(sequence)
     # Encode label
-    if prefix is '':
+    if prefix == '':
         final_result = [(str(length) + '-')]
     else:
         final_result = [prefix + "-" + str(length) + "-"]


=====================================
mirtop/mirna/realign.py
=====================================
@@ -94,7 +94,7 @@ class isomir:
             value.append("iso_3p:%s%s" % (direction, size))
         if not value:
             value = ["NA"]
-        return ",".join(list(set(value)))
+        return ",".join(sorted(list(set(value))))
 
     def format(self, sep="\t"):
         """Create tabular line from variant fields."""


=====================================
scripts/import_gff3.py
=====================================
@@ -11,7 +11,7 @@ def loadfile(filename,verbose=True):
         
     try:
         if verbose==True:
-            print 'Loading', filename
+            print('Loading', filename)
         # obtaning sample names and number from 3rd line in header
         num_header_lines=0
         with open(filename) as f:
@@ -26,12 +26,12 @@ def loadfile(filename,verbose=True):
                     num_header_lines+=1
         sample_number = len(sample_names)
         if verbose==True:
-            print '--------------------------------------'
-            print sample_number,' samples in the file'
-            print '--------------------------------------'
+            print('--------------------------------------')
+            print(sample_number,' samples in the file')
+            print('--------------------------------------')
             for elem in sample_names:
-                print elem
-            print '--------------------------------------'
+                print(elem)
+            print('--------------------------------------')
         
         
         
@@ -59,11 +59,11 @@ def loadfile(filename,verbose=True):
         num_attr = len(attr_names)                         #number of attributes
         #expression_colindex=attr_names.index ('Expression')  #position of the expression column in the attr column 
         if verbose==True:
-            print num_attr,' attributes in the file '
-            print '--------------------------------------'
+            print(num_attr,' attributes in the file ')
+            print('--------------------------------------')
             for attr in attr_names:
-                print attr
-            print '--------------------------------------'
+                print(attr)
+            print('--------------------------------------')
         
         # joining rows of attributes without the descriptor
         for row in range(atr_data.shape[0]):
@@ -113,7 +113,7 @@ def loadfile(filename,verbose=True):
                     data.at[row.Index,var]=np.nan    
         return data
     except:
-        print 'Error loading the file'
+        print('Error loading the file')
 
 
 """
@@ -137,7 +137,7 @@ def load_check_gff3(filename):
                     data_1=rowfile.split('\t')
                     break
         if coldata_found==False:
-            print 'No COLDATA, bad header'
+            print('No COLDATA, bad header')
             return False
         
         #Number of columns without breaking down attributes column 
@@ -155,33 +155,33 @@ def load_check_gff3(filename):
         for attr in list_attr:    
             if attr not in possible_attr:
                 Error=True
-                print attr,'is not a possible attribute'
+                print(attr,'is not a possible attribute')
                 break  
         if Error:
-            print 'File format error'            
+            print('File format error')
             return False      
         # If not format error, loading content
         try:
             dataframe=loadfile(filename,True)
         except:
-            print 'Error loading file'
+            print('Error loading file')
             return False
-        print 'Checking content'
+        print('Checking content')
         for i in range(dataframe.shape[0]):
             # Labels in type column
             if dataframe.loc[i, 'type'] not in ['ref_miRNA', 'isomiR']:
                 Error = True
-                print'line', i, 'pip install Markdownbad type error'
+                print('line', i, 'pip install Markdownbad type error')
     
             # start<end
             if dataframe.loc[i, 'start'] >= dataframe.loc[i, 'end']:
                 Error = True
-                print 'line', i, 'start >=end error'
+                print('line', i, 'start >=end error')
     
             # Strand + or -
             if dataframe.loc[i, 'strand'] not in ['+', '-']:
                 Error = True
-                print 'line', i, 'bad strand error'
+                print('line', i, 'bad strand error')
             # Variant checking
             possible_variant=['iso_5p','iso_3p','iso_add','iso_snp_seed','iso_snp_central_offset','iso_snp_central',
                   'iso_central_supp','iso_snp_central_supp','iso_snp']
@@ -191,36 +191,36 @@ def load_check_gff3(filename):
             if len(variant_i)==1 and variant_i[0]!='NA':
                 if variant_i[0].split(':')[0] not in possible_variant:
                     Error = True
-                    print 'Variant error', variant_i[0].split(':')[0], 'line', i
+                    print('Variant error', variant_i[0].split(':')[0], 'line', i)
             elif variant_i[0]!='NA':
                 for var in range(len(variant_i)):
                     if variant_i[var].split(':')[0] not in possible_variant:
                         Error = True
-                        print 'Variant error', variant_i[0].split(':')[0], 'line', i
+                        print('Variant error', variant_i[0].split(':')[0], 'line', i)
 
         #Checking expression data
         expression_cols=[col for col in dataframe.columns if 'Expression_' in col]         
         for col in expression_cols:
             for i in range(dataframe.shape[0]):
                 if not dataframe.loc[i,col].isdigit():
-                    print dataframe.loc[i,col].isdigit()
-                    print 'Expression count error line',i
+                    print(dataframe.loc[i,col].isdigit())
+                    print('Expression count error line',i)
                     Error= True
             dataframe[col]=dataframe[col].astype(int) #setting the datatype of counts
             dataframe[col]=dataframe[col].replace(0,np.nan) #Setting 0 reads to NaN
         if 'Filter' in dataframe.columns:         
             for i in range(dataframe.shape[0]):
                 if dataframe.loc[i, 'Filter']!='Pass':
-                    print 'Warning non-pass filter in line',i                   
+                    print('Warning non-pass filter in line',i)
         if Error:
-            print 'File format error'
+            print('File format error')
             return False
 
-        print '--------------------------------------'
-        print dataframe.dtypes
-        print '--------------------------------------'
-        print 'Format ok'
+        print('--------------------------------------')
+        print(dataframe.dtypes)
+        print('--------------------------------------')
+        print('Format ok')
         return dataframe
     except:
-        print 'Error checking the file'
+        print('Error checking the file')
         return False


=====================================
scripts/prepare.py
=====================================
@@ -62,7 +62,7 @@ if __name__ == "__main__":
     for mir in fa:
         if mir in bed:
             precursor = bed[mir][mir + "_pre"]
-            print precursor
+            print(precursor)
             mir5p = ""
             mir3p = ""
             for mature in bed[mir]:
@@ -82,7 +82,7 @@ if __name__ == "__main__":
                 if mature.find("3p") > 0:
                     mir3p = "[%s:%s-%s]" % (mature, start, end)
 
-            print >>OUT, ">%s (X) %s %s" % (mir, mir5p, mir3p)
-            print >>OUTP, ">%s\n%s" % (mir, fa[mir])
+            print(">%s (X) %s %s" % (mir, mir5p, mir3p), file=OUT)
+            print(">%s\n%s" % (mir, fa[mir]),file=OUTP)
 OUT.close()
 OUTP.close()


=====================================
setup.py
=====================================
@@ -3,8 +3,7 @@
 import os
 from setuptools import setup, find_packages
 
-version = '0.4.25'
-
+version = '0.4.28'
 url = 'http://github.com/mirtop/mirtop'
 
 


=====================================
test/test_automated_analysis.py
=====================================
@@ -10,8 +10,9 @@ import shutil
 import contextlib
 import functools
 
-from nose import SkipTest
-from nose.plugins.attrib import attr
+# from nose import SkipTest
+import pytest
+#from nose.plugins.attrib import attr
 
 
 @contextlib.contextmanager
@@ -39,7 +40,7 @@ def expected_failure(test):
         try:
             test(*args, **kwargs)
         except Exception:
-            raise SkipTest
+            raise pytest.skip
         else:
             raise AssertionError('Failure expected')
     return inner
@@ -66,7 +67,7 @@ class AutomatedAnalysisTest(unittest.TestCase):
         shutil.move(os.path.basename(dirname), dirname)
         os.remove(os.path.basename(url))
 
-    @attr(simulate=True)
+    ##@attr(simulate=True)
     def test_simulate(self):
         """Check simulated data"""
         mirna = "TGAGGTAGTAGGTTGTATAGTT"
@@ -102,10 +103,10 @@ class AutomatedAnalysisTest(unittest.TestCase):
                 n += 1
         print("rate %s/%s" % (correct, n))
 
-    @attr(complete=True)
-    @attr(annotate=True)
-    @attr(bam=True)
-    @attr(cmd=True)
+    ##@attr(complete=True)
+    ##@attr(annotate=True)
+    ##@attr(bam=True)
+    ##@attr(cmd=True)
     def test_srnaseq_annotation_bam(self):
         """Run miraligner analysis
         """
@@ -121,9 +122,9 @@ class AutomatedAnalysisTest(unittest.TestCase):
             print(" ".join(clcode))
             subprocess.check_call(clcode)
 
-    @attr(complete=True)
-    @attr(low_memory=True)
-    @attr(cmd=True)
+    ##@attr(complete=True)
+    ##@attr(low_memory=True)
+    ##@attr(cmd=True)
     def test_srnaseq_annotation_bam_chunk(self):
         """Run miraligner analysis
         """
@@ -139,9 +140,9 @@ class AutomatedAnalysisTest(unittest.TestCase):
             print(" ".join(clcode))
             subprocess.check_call(clcode)
 
-    @attr(cmd_bam_genomic=True)
-    @attr(complete=True)
-    @attr(cmd=True)
+    ##@attr(cmd_bam_genomic=True)
+    ##@attr(complete=True)
+    ##@attr(cmd=True)
     def test_srnaseq_annotation_genomic_bam(self):
         """Run genomic bam analysis
         """
@@ -157,9 +158,9 @@ class AutomatedAnalysisTest(unittest.TestCase):
             print(" ".join(clcode))
             subprocess.check_call(clcode)
 
-    @attr(cmd_bam_genomic_low_memory=True)
-    @attr(complete=True)
-    @attr(cmd=True)
+    ##@attr(cmd_bam_genomic_low_memory=True)
+    ##@attr(complete=True)
+    ##@attr(cmd=True)
     def test_srnaseq_annotation_genomic_bam_low_memory(self):
         """Run genomic bam analysis
         """
@@ -175,127 +176,127 @@ class AutomatedAnalysisTest(unittest.TestCase):
             print(" ".join(clcode))
             subprocess.check_call(clcode)
 
-    @attr(complete=True)
-    @attr(cmd_seqbuster=True)
-    @attr(cmd=True)
-    def test_srnaseq_annotation_seqbuster(self):
-        """Run miraligner analysis
-        """
-        with make_workdir():
-            clcode = ["mirtop",
-                      "gff",
-                      "--format", "seqbuster",
-                      "--sps", "hsa",
-                      "--hairpin", "../../data/examples/annotate/hairpin.fa",
-                      "--gtf", "../../data/examples/annotate/hsa.gff3",
-                      "-o", "test_out_mirs",
-                      "../../data/examples/seqbuster/reads.mirna"]
-            print("")
-            print(" ".join(clcode))
-            subprocess.check_call(clcode)
-
-    @attr(complete=True)
-    @attr(cmd_seqbuster_low_memory=True)
-    @attr(cmd=True)
-    def test_srnaseq_annotation_seqbuster_low_memory(self):
-        """Run miraligner analysis
-        """
-        with make_workdir():
-            clcode = ["mirtop",
-                      "gff", "--low-memory",
-                      "--format", "seqbuster",
-                      "--sps", "hsa",
-                      "--hairpin", "../../data/examples/annotate/hairpin.fa",
-                      "--gtf", "../../data/examples/annotate/hsa.gff3",
-                      "-o", "test_out_mirs",
-                      "../../data/examples/seqbuster/reads.mirna"]
-            print("")
-            print(" ".join(clcode))
-            subprocess.check_call(clcode)
-
-    @attr(complete=True)
-    @attr(cmd_isomirsea=True)
-    @attr(cmd=True)
-    def test_srnaseq_annotation_isomirsea(self):
-        """Run isomirsea analysis
-        """
-        with make_workdir():
-            clcode = ["mirtop",
-                      "gff",
-                      "--format", "isomirsea",
-                      "--sps", "hsa",
-                      "--hairpin", "../../data/examples/annotate/hairpin.fa",
-                      "--gtf", "../../data/examples/annotate/hsa.gff3",
-                      "-o", "test_out_mirs",
-                      "../../data/examples/isomir-sea/tagMir-all.gff",
-                      "-d", "-vd"]
-            print("")
-            print(" ".join(clcode))
-            subprocess.check_call(clcode)
-
-    @attr(complete=True)
-    @attr(cmd_srnabench=True)
-    @attr(cmd=True)
-    def test_srnaseq_annotation_srnabench(self):
-        """Run srnabench analysis
-        """
-        with make_workdir():
-            clcode = ["mirtop",
-                      "gff",
-                      "--format", "srnabench",
-                      "--sps", "hsa",
-                      "--hairpin", "../../data/examples/annotate/hairpin.fa",
-                      "--gtf", "../../data/examples/annotate/hsa.gff3",
-                      "-o", "test_out_mirs",
-                      "../../data/examples/srnabench/",
-                      "-d", "-vd"]
-            print("")
-            print(" ".join(clcode))
-            subprocess.check_call(clcode)
-
-    @attr(complete=True)
-    @attr(cmd_optimir=True)
-    @attr(cmd=True)
-    def test_srnaseq_annotation_optimir(self):
-        """Run optimir analysis
-        """
-        with make_workdir():
-            clcode = ["mirtop",
-                      "gff",
-                      "--format", "optimir",
-                      "--sps", "hsa",
-                      "--hairpin", "../../data/examples/annotate/hairpin.fa",
-                      "--gtf", "../../data/examples/annotate/hsa.gff3",
-                      "-o", "test_out_mirs",
-                      "../../data/examples/optimir/synthetic_100_full.gff3",
-                      "-d", "-vd"]
-            print("")
-            print(" ".join(clcode))
-            subprocess.check_call(clcode)
-
-    @attr(complete=True)
-    @attr(cmd_manatee=True)
-    @attr(cmd=True)
-    def test_srnaseq_annotation_manatee(self):
-        """Run Manatee analysis
-        """
-        with make_workdir():
-            clcode = ["mirtop",
-                      "gff",
-                      "--format", "manatee",
-                      "--sps", "hsa",
-                      "--hairpin", "../../data/examples/annotate/hairpin.fa",
-                      "--gtf", "../../data/examples/annotate/hsa.gff3",
-                      "-o", "test_out_mirs",
-                      "../../data/examples/manatee/simulated.sam",
-                      "-d", "-vd"]
-            print("")
-            print(" ".join(clcode))
-            subprocess.check_call(clcode)
-
-    @attr(complete=True)
-    @attr(cmd_stats=True)
-    @attr(cmd=True)
+    # ###@attr(complete=True)
+    # ###@attr(cmd_seqbuster=True)
+    # ####@attr(cmd=True)
+    # def test_srnaseq_annotation_seqbuster(self):
+    #     """Run miraligner analysis
+    #     """
+    #     with make_workdir():
+    #         clcode = ["mirtop",
+    #                   "gff",
+    #                   "--format", "seqbuster",
+    #                   "--sps", "hsa",
+    #                   "--hairpin", "../../data/examples/annotate/hairpin.fa",
+    #                   "--gtf", "../../data/examples/annotate/hsa.gff3",
+    #                   "-o", "test_out_mirs",
+    #                   "../../data/examples/seqbuster/reads.mirna"]
+    #         print("")
+    #         print(" ".join(clcode))
+    #         subprocess.check_call(clcode)
+
+    # ###@attr(complete=True)
+    # ###@attr(cmd_seqbuster_low_memory=True)
+    # ###@attr(cmd=True)
+    # def test_srnaseq_annotation_seqbuster_low_memory(self):
+    #     """Run miraligner analysis
+    #     """
+    #     with make_workdir():
+    #         clcode = ["mirtop",
+    #                   "gff", "--low-memory",
+    #                   "--format", "seqbuster",
+    #                   "--sps", "hsa",
+    #                   "--hairpin", "../../data/examples/annotate/hairpin.fa",
+    #                   "--gtf", "../../data/examples/annotate/hsa.gff3",
+    #                   "-o", "test_out_mirs",
+    #                   "../../data/examples/seqbuster/reads.mirna"]
+    #         print("")
+    #         print(" ".join(clcode))
+    #         subprocess.check_call(clcode)
+
+    # ##@attr(complete=True)
+    # ##@attr(cmd_isomirsea=True)
+    # ##@attr(cmd=True)
+    # def test_srnaseq_annotation_isomirsea(self):
+    #     """Run isomirsea analysis
+    #     """
+    #     with make_workdir():
+    #         clcode = ["mirtop",
+    #                   "gff",
+    #                   "--format", "isomirsea",
+    #                   "--sps", "hsa",
+    #                   "--hairpin", "../../data/examples/annotate/hairpin.fa",
+    #                   "--gtf", "../../data/examples/annotate/hsa.gff3",
+    #                   "-o", "test_out_mirs",
+    #                   "../../data/examples/isomir-sea/tagMir-all.gff",
+    #                   "-d", "-vd"]
+    #         print("")
+    #         print(" ".join(clcode))
+    #         subprocess.check_call(clcode)
+
+    # ##@attr(complete=True)
+    # ##@attr(cmd_srnabench=True)
+    # ##@attr(cmd=True)
+    # def test_srnaseq_annotation_srnabench(self):
+    #     """Run srnabench analysis
+    #     """
+    #     with make_workdir():
+    #         clcode = ["mirtop",
+    #                   "gff",
+    #                   "--format", "srnabench",
+    #                   "--sps", "hsa",
+    #                   "--hairpin", "../../data/examples/annotate/hairpin.fa",
+    #                   "--gtf", "../../data/examples/annotate/hsa.gff3",
+    #                   "-o", "test_out_mirs",
+    #                   "../../data/examples/srnabench/",
+    #                   "-d", "-vd"]
+    #         print("")
+    #         print(" ".join(clcode))
+    #         subprocess.check_call(clcode)
+
+    # ##@attr(complete=True)
+    # ##@attr(cmd_optimir=True)
+    # ##@attr(cmd=True)
+    # def test_srnaseq_annotation_optimir(self):
+    #     """Run optimir analysis
+    #     """
+    #     with make_workdir():
+    #         clcode = ["mirtop",
+    #                   "gff",
+    #                   "--format", "optimir",
+    #                   "--sps", "hsa",
+    #                   "--hairpin", "../../data/examples/annotate/hairpin.fa",
+    #                   "--gtf", "../../data/examples/annotate/hsa.gff3",
+    #                   "-o", "test_out_mirs",
+    #                   "../../data/examples/optimir/synthetic_100_full.gff3",
+    #                   "-d", "-vd"]
+    #         print("")
+    #         print(" ".join(clcode))
+    #         subprocess.check_call(clcode)
+
+    # ##@attr(complete=True)
+    # ##@attr(cmd_manatee=True)
+    # ##@attr(cmd=True)
+    # def test_srnaseq_annotation_manatee(self):
+    #     """Run Manatee analysis
+    #     """
+    #     with make_workdir():
+    #         clcode = ["mirtop",
+    #                   "gff",
+    #                   "--format", "manatee",
+    #                   "--sps", "hsa",
+    #                   "--hairpin", "../../data/examples/annotate/hairpin.fa",
+    #                   "--gtf", "../../data/examples/annotate/hsa.gff3",
+    #                   "-o", "test_out_mirs",
+    #                   "../../data/examples/manatee/simulated.sam",
+    #                   "-d", "-vd"]
+    #         print("")
+    #         print(" ".join(clcode))
+    #         subprocess.check_call(clcode)
+
+    ##@attr(complete=True)
+    ##@attr(cmd_stats=True)
+    ##@attr(cmd=True)
     def test_srnaseq_stats(self):
         """Run stats analysis
         """
@@ -312,9 +313,9 @@ class AutomatedAnalysisTest(unittest.TestCase):
             if sum(1 for line in open('test_out_mirs/mirtop_stats.txt')) == 1:
                 raise ValueError("File is empty, something is wrong with stats cmd.")
 
-    @attr(complete=True)
-    @attr(cmd_merge=True)
-    @attr(cmd=True)
+    ##@attr(complete=True)
+    ##@attr(cmd_merge=True)
+    ##@attr(cmd=True)
     def test_merge_bam(self):
         """
         Run collapse two samples
@@ -332,9 +333,9 @@ class AutomatedAnalysisTest(unittest.TestCase):
             print(" ".join(clcode))
             subprocess.check_call(clcode)
 
-    @attr(complete=True)
-    @attr(cmd_export_seqbuster=True)
-    @attr(cmd=True)
+    ##@attr(complete=True)
+    ##@attr(cmd_export_seqbuster=True)
+    ##@attr(cmd=True)
     def test_export_seqbuster(self):
         """
         Run SEQBUSTER export command
@@ -350,9 +351,9 @@ class AutomatedAnalysisTest(unittest.TestCase):
             print(" ".join(clcode))
             subprocess.check_call(clcode)
 
-    @attr(complete=True)
-    @attr(cmd_export_vcf=True)
-    @attr(cmd=True)
+    ##@attr(complete=True)
+    ##@attr(cmd_export_vcf=True)
+    ##@attr(cmd=True)
     def test_export_vcf(self):
         """
         Run VCF export command
@@ -370,9 +371,9 @@ class AutomatedAnalysisTest(unittest.TestCase):
             print(" ".join(clcode))
             subprocess.check_call(clcode)
 
-    @attr(complete=True)
-    @attr(cmd_export_fasta=True)
-    @attr(cmd=True)
+    ##@attr(complete=True)
+    ##@attr(cmd_export_fasta=True)
+    ##@attr(cmd=True)
     def test_export_fasta(self):
         """
         Run FASTA export command
@@ -390,9 +391,9 @@ class AutomatedAnalysisTest(unittest.TestCase):
             print(" ".join(clcode))
             subprocess.check_call(clcode)
 
-    @attr(complete=True)
-    @attr(cmd_count=True)
-    @attr(cmd=True)
+    ##@attr(complete=True)
+    ##@attr(cmd_count=True)
+    ##@attr(cmd=True)
     def test_count(self):
         """
         Run count command
@@ -408,49 +409,49 @@ class AutomatedAnalysisTest(unittest.TestCase):
             print(" ".join(clcode))
             subprocess.check_call(clcode)
 
-    @attr(complete=True)
-    @attr(cmd_spikeins=True)
-    @attr(cmd=True)
-    def test_spikeins_cmd(self):
-        """Run spikeins analysis
-        """
-        import platform
-        with make_workdir():
-            shutil.copy("../../data/examples/spikeins/spikeins.fa",
-                        "spikeins.fa")
-            clcode = ["mirtop",
-                      "spikein",
-                      "spikeins.fa",
-                      "-o",
-                      "test_out_spikeins"]
-            print("")
-            print(" ".join(clcode))
-            subprocess.check_call(clcode)
-
-            if platform.system() == "Linux":
-                clcode = ["razers3", "-dr", "0", "-i", "80", "-rr", "90",
-                          "-f", "-o", "spikeins.sam",
-                          "test_out_spikeins/spikeins_pre.fasta",
-                          "../../data/examples/spikeins/test-spikeins.fa"]
-                print(" ".join(clcode))
-                subprocess.check_call(clcode)
-            else:
-                shutil.copy("../../data/examples/spikeins/spikeins.sam",
-                            "spikeins.sam")
-            clcode = ["mirtop",
-                      "gff",
-                      "--add-extra",
-                      "--hairpin", "test_out_spikeins/spikeins_pre.fasta",
-                      "--gtf", "test_out_spikeins/spikeins_pre.gff",
-                      "-o", "test_out_mirs",
-                      "spikeins.sam"]
-            print("")
-            print(" ".join(clcode))
-            subprocess.check_call(clcode)
-
-    @attr(complete=True)
-    @attr(cmd_update=True)
-    @attr(cmd=True)
+    ##@attr(complete=True)
+    ##@attr(cmd_spikeins=True)
+    ##@attr(cmd=True)
+    # def test_spikeins_cmd(self):
+    #     """Run spikeins analysis
+    #     """
+    #     import platform
+    #     with make_workdir():
+    #         shutil.copy("../../data/examples/spikeins/spikeins.fa",
+    #                     "spikeins.fa")
+    #         clcode = ["mirtop",
+    #                   "spikein",
+    #                   "spikeins.fa",
+    #                   "-o",
+    #                   "test_out_spikeins"]
+    #         print("")
+    #         print(" ".join(clcode))
+    #         subprocess.check_call(clcode)
+
+    #         if platform.system() == "Linux":
+    #             clcode = ["razers3", "-dr", "0", "-i", "80", "-rr", "90",
+    #                       "-f", "-o", "spikeins.sam",
+    #                       "test_out_spikeins/spikeins_pre.fasta",
+    #                       "../../data/examples/spikeins/test-spikeins.fa"]
+    #             print(" ".join(clcode))
+    #             subprocess.check_call(clcode)
+    #         else:
+    #             shutil.copy("../../data/examples/spikeins/spikeins.sam",
+    #                         "spikeins.sam")
+    #         clcode = ["mirtop",
+    #                   "gff",
+    #                   "--add-extra",
+    #                   "--hairpin", "test_out_spikeins/spikeins_pre.fasta",
+    #                   "--gtf", "test_out_spikeins/spikeins_pre.gff",
+    #                   "-o", "test_out_mirs",
+    #                   "spikeins.sam"]
+    #         print("")
+    #         print(" ".join(clcode))
+    #         subprocess.check_call(clcode)
+
+    ##@attr(complete=True)
+    ##@attr(cmd_update=True)
+    ##@attr(cmd=True)
     def test_update_cmd(self):
         """Run update analysis
         """
@@ -463,9 +464,9 @@ class AutomatedAnalysisTest(unittest.TestCase):
             print(" ".join(clcode))
             subprocess.check_call(clcode)
 
-    @attr(complete=True)
-    @attr(cmd_validate=True)
-    @attr(cmd=True)
+    ##@attr(complete=True)
+    ##@attr(cmd_validate=True)
+    ##@attr(cmd=True)
     def test_validate_cmd(self):
         """Run update analysis
         """
@@ -478,9 +479,9 @@ class AutomatedAnalysisTest(unittest.TestCase):
             subprocess.check_call(clcode)
 
 
-    @attr(complete=True)
-    @attr(cmd_validate=True)
-    @attr(cmd=True)
+    ##@attr(complete=True)
+    ##@attr(cmd_validate=True)
+    ##@attr(cmd=True)
     def test_sql_create_1_cmd(self):
         """Run sql command to incorporate GFF to SQLite
         """
@@ -499,9 +500,9 @@ class AutomatedAnalysisTest(unittest.TestCase):
             subprocess.check_call(clcode)
 
 
-    @attr(complete=True)
-    @attr(cmd_validate=True)
-    @attr(cmd=True)
+    ##@attr(complete=True)
+    ##@attr(cmd_validate=True)
+    ##@attr(cmd=True)
     def test_sql_create_2_cmd(self):
         """Run sql command to incorporate GFF to SQLite
         """
@@ -517,9 +518,9 @@ class AutomatedAnalysisTest(unittest.TestCase):
             print(" ".join(clcode))
             subprocess.check_call(clcode)
 
-    @attr(complete=True)
-    @attr(cmd_validate=True)
-    @attr(cmd=True)
+    ##@attr(complete=True)
+    ##@attr(cmd_validate=True)
+    ##@attr(cmd=True)
     def test_sql_query_showTables_cmd(self):
         """Run sql command to query from a database to show tables using SQLite
         """
@@ -535,9 +536,9 @@ class AutomatedAnalysisTest(unittest.TestCase):
             print(" ".join(clcode))
             subprocess.check_call(clcode)
     
-    @attr(complete=True)
-    @attr(cmd_validate=True)
-    @attr(cmd=True)
+    ##@attr(complete=True)
+    ##@attr(cmd_validate=True)
+    ##@attr(cmd=True)
     def test_sql_query_showSchema_cmd(self):
         """Run sql command to query from a database to show schema using SQLite
         """
@@ -555,9 +556,9 @@ class AutomatedAnalysisTest(unittest.TestCase):
             print(" ".join(clcode))
             subprocess.check_call(clcode)
     
-    @attr(complete=True)
-    @attr(cmd_validate=True)
-    @attr(cmd=True)
+    ##@attr(complete=True)
+    ##@attr(cmd_validate=True)
+    ##@attr(cmd=True)
     def test_sql_query_showColumns_cmd(self):
         """Run sql command to query from a database to show columns using SQLite
         """
@@ -573,9 +574,9 @@ class AutomatedAnalysisTest(unittest.TestCase):
             print(" ".join(clcode))
             subprocess.check_call(clcode)
     
-    @attr(complete=True)
-    @attr(cmd_validate=True)
-    @attr(cmd=True)
+    ##@attr(complete=True)
+    ##@attr(cmd_validate=True)
+    ##@attr(cmd=True)
     def test_sql_query_descSummary_cmd(self):
         """Run sql command to query from a database to display the header of the GFF using SQLite
         """
@@ -591,9 +592,9 @@ class AutomatedAnalysisTest(unittest.TestCase):
             print(" ".join(clcode))
             subprocess.check_call(clcode)
     
-    @attr(complete=True)
-    @attr(cmd_validate=True)
-    @attr(cmd=True)
+    ##@attr(complete=True)
+    ##@attr(cmd_validate=True)
+    ##@attr(cmd=True)
     def test_sql_query_statIsomirs_cmd(self):
         """Run sql command to query from a database to summarize isomirs per miRNA 
         """
@@ -611,9 +612,9 @@ class AutomatedAnalysisTest(unittest.TestCase):
             print(" ".join(clcode))
             subprocess.check_call(clcode)
     
-    @attr(complete=True)
-    @attr(cmd_validate=True)
-    @attr(cmd=True)
+    ##@attr(complete=True)
+    ##@attr(cmd_validate=True)
+    ##@attr(cmd=True)
     def test_sql_query_statIsomirsFile_cmd(self):
         """Run sql command to query from a database to summarize isomirs per miRNA reading from afile
         """
@@ -631,9 +632,9 @@ class AutomatedAnalysisTest(unittest.TestCase):
             print(" ".join(clcode))
             subprocess.check_call(clcode)
     
-    @attr(complete=True)
-    @attr(cmd_validate=True)
-    @attr(cmd=True)
+    ##@attr(complete=True)
+    ##@attr(cmd_validate=True)
+    ##@attr(cmd=True)
     def test_sql_query_SelectLimit_cmd(self):
         """Run sql command to query from database using limit option
         """
@@ -651,9 +652,9 @@ class AutomatedAnalysisTest(unittest.TestCase):
             print(" ".join(clcode))
             subprocess.check_call(clcode)
     
-    @attr(complete=True)
-    @attr(cmd_validate=True)
-    @attr(cmd=True)
+    ##@attr(complete=True)
+    ##@attr(cmd_validate=True)
+    ##@attr(cmd=True)
     def test_sql_query_SelectColumns_cmd(self):
         """Run sql command to query from database using limit option
         """
@@ -673,9 +674,9 @@ class AutomatedAnalysisTest(unittest.TestCase):
             print(" ".join(clcode))
             subprocess.check_call(clcode)
     
-    @attr(complete=True)
-    @attr(cmd_validate=True)
-    @attr(cmd=True)
+    ##@attr(complete=True)
+    ##@attr(cmd_validate=True)
+    ##@attr(cmd=True)
     def test_sql_query_SelectMirna_cmd(self):
         """Run sql command to query from database for specific miRNAs 
         """
@@ -697,9 +698,9 @@ class AutomatedAnalysisTest(unittest.TestCase):
             print(" ".join(clcode))
             subprocess.check_call(clcode)
     
-    @attr(complete=True)
-    @attr(cmd_validate=True)
-    @attr(cmd=True)
+    ##@attr(complete=True)
+    ##@attr(cmd_validate=True)
+    ##@attr(cmd=True)
     def test_sql_query_SelectiVariant_cmd(self):
         """Run sql command to query from database for specific variant types  
         """
@@ -719,9 +720,9 @@ class AutomatedAnalysisTest(unittest.TestCase):
             print(" ".join(clcode))
             subprocess.check_call(clcode)
     
-    @attr(complete=True)
-    @attr(cmd_validate=True)
-    @attr(cmd=True)
+    ##@attr(complete=True)
+    ##@attr(cmd_validate=True)
+    ##@attr(cmd=True)
     def test_sql_query_SelectFilter_cmd(self):
         """Run sql command to query from database using filters 
         """
@@ -743,9 +744,9 @@ class AutomatedAnalysisTest(unittest.TestCase):
             print(" ".join(clcode))
             subprocess.check_call(clcode)
     
-    @attr(complete=True)
-    @attr(cmd_validate=True)
-    @attr(cmd=True)
+    ##@attr(complete=True)
+    ##@attr(cmd_validate=True)
+    ##@attr(cmd=True)
     def test_sql_query_SelectCount_cmd(self):
         """Run sql command to query from database to fetch counts of the return values  
         """
@@ -763,9 +764,9 @@ class AutomatedAnalysisTest(unittest.TestCase):
             print(" ".join(clcode))
             subprocess.check_call(clcode)
     
-    @attr(complete=True)
-    @attr(cmd_validate=True)
-    @attr(cmd=True)
+    ##@attr(complete=True)
+    ##@attr(cmd_validate=True)
+    ##@attr(cmd=True)
     def test_sql_query_SelectTextOut_cmd(self):
         """Run sql command to query from database and return the output to a text file  
         """


=====================================
test/test_functions.py
=====================================
@@ -10,7 +10,7 @@ import argparse
 import contextlib
 import shutil
 
-from nose.plugins.attrib import attr
+#from nose.plugins.attrib import attr
 
 
 @contextlib.contextmanager
@@ -64,7 +64,7 @@ def annotate(fn, read_file, load=False, create=True, keep_name=False,
 class FunctionsTest(unittest.TestCase):
     """Setup a full automated analysis and run the pipeline.
     """
-    @attr(database=True)
+    #@pytest.mark.database
     def test_database(self):
         from mirtop.mirna import mapper
         args = argparse.Namespace()
@@ -75,7 +75,7 @@ class FunctionsTest(unittest.TestCase):
         if db != "miRBasev21":
             raise ValueError("%s not eq to miRBasev21" % db)
 
-    @attr(read_hairpin=True)
+    #@pytest.mark.read_hairpin
     def test_read_hairpin(self):
         from mirtop.mirna import mapper, fasta
         from mirtop.libs import logger
@@ -96,7 +96,7 @@ class FunctionsTest(unittest.TestCase):
         # read data/aligments/let7-perfect.bam
         return True
 
-    @attr(read_hairpin_mirgenedb=True)
+    ##@attr(read_hairpin_mirgenedb=True)
     def test_read_hairpin_mirgenedb(self):
         from mirtop.mirna import mapper
         from mirtop.libs import logger
@@ -105,7 +105,7 @@ class FunctionsTest(unittest.TestCase):
             "data/db/mirgenedb/hsa.gff")
         print(map_mir)
 
-    @attr(read_mir2chr=True)
+    ##@attr(read_mir2chr=True)
     def test_read_mir2chr(self):
         from mirtop.mirna import mapper
         from mirtop.libs import logger
@@ -114,7 +114,7 @@ class FunctionsTest(unittest.TestCase):
         print(map_mir)
         # print(mapper.read_gtf_chr2mirna2("data/examples/annotate/hsa.gff3"))
 
-    @attr(read_mir2genomic=True)
+    ##@attr(read_mir2genomic=True)
     def test_read_mir2genomic(self):
         from mirtop.mirna import mapper
         from mirtop.libs import logger
@@ -122,7 +122,7 @@ class FunctionsTest(unittest.TestCase):
         map_mir = mapper.read_gtf_to_mirna("data/examples/annotate/hsa.gff3")
         print(map_mir)
 
-    @attr(read_line=True)
+    ##@attr(read_line=True)
     def test_read_line(self):
         """Read GFF/GTF line"""
         from mirtop.gff.body import read_gff_line
@@ -130,7 +130,7 @@ class FunctionsTest(unittest.TestCase):
             for line in inh:
                 print(read_gff_line(line))
 
-    @attr(code=True)
+    ##@attr(code=True)
     def test_code(self):
         """testing code correction function"""
         from mirtop.mirna.realign import make_id, read_id
@@ -153,7 +153,7 @@ class FunctionsTest(unittest.TestCase):
         # if read_id("asD(-"):
         #     raise ValueError("This should be False, Not valid code.")
 
-    @attr(code_convert=True)
+    ##@attr(code_convert=True)
     def test_code_convert(self):
         """testing code correction function"""
         from mirtop.mirna.realign import make_id
@@ -164,7 +164,7 @@ class FunctionsTest(unittest.TestCase):
         if not make_id(read_uid_10("@#%$@2")) == "iso-13-B1NYDX":
             raise ValueError("Update ID is not working.")
 
-    @attr(cigar=True)
+    ##@attr(cigar=True)
     def test_cigar(self):
         """testing cigar correction function"""
         cigar = [[0, 14], [1, 1], [0, 5]]
@@ -188,7 +188,7 @@ class FunctionsTest(unittest.TestCase):
             raise ValueError("3MA3M not equal AAATCCC but %s" %
                              cigar2snp("3MA3M", "AAATCCC"))
 
-    @attr(sequence=True)
+    ##@attr(sequence=True)
     def test_is_sequence(self):
         """testing if string is valid sequence"""
         from mirtop.mirna.realign import is_sequence
@@ -197,7 +197,7 @@ class FunctionsTest(unittest.TestCase):
         if is_sequence("AC2TGC"):
             raise ValueError("AC2TGC should return false.")
 
-    @attr(locala=True)
+    ##@attr(locala=True)
     def test_locala(self):
         """testing pairwise alignment"""
         from mirtop.mirna.realign import align
@@ -209,7 +209,7 @@ class FunctionsTest(unittest.TestCase):
         print(align("TGANTAGTNGNTTGTATNGTT", "TGAGTATAGGCCTTGTATAGTT")[0])
         print(align("NCANAGTCCAAGNTCATN", "TCATAGTCCAAGGTCATG")[0])
 
-    @attr(reverse=True)
+    ##@attr(reverse=True)
     def test_reverse(self):
         """Test reverse complement function"""
         from mirtop.mirna.realign import reverse_complement
@@ -218,7 +218,7 @@ class FunctionsTest(unittest.TestCase):
             raise ValueError("ATGC complement is not: %s" %
                              reverse_complement("ATGC"))
 
-    @attr(class_gff=True)
+    ##@attr(class_gff=True)
     def test_class(self):
         """Test class to read GFF line"""
         from mirtop.gff.classgff import feature
@@ -231,7 +231,7 @@ class FunctionsTest(unittest.TestCase):
         print(gff.columns)
         print(gff.attributes)
 
-    @attr(merge=True)
+    ##@attr(merge=True)
     def test_merge(self):
         """Test merge functions"""
         from mirtop.gff import merge
@@ -250,7 +250,7 @@ class FunctionsTest(unittest.TestCase):
         if expression != "1,2":
             raise ValueError("This is wrong: %s" % expression)
 
-    @attr(align_mature=True)
+    ##@attr(align_mature=True)
     def test_variant(self):
         """testing get mature sequence"""
         from mirtop.mirna import fasta, mapper
@@ -315,10 +315,10 @@ class FunctionsTest(unittest.TestCase):
             raise ValueError("Wrong alignment for test 8 %s" % res)
         
 
-    @attr(alignment=True)
+    ##@attr(alignment=True)
     def test_alignment(self):
         """testing alignments function"""
-        from mirtop.bam import bam
+        from mirtop import bam
         from mirtop.gff.classgff import feature
         fns = {"let7-last1D.sam": {56:"iso_add3p:1,iso_snv"},
                "let7-1D.sam": {5:"iso_snv,iso_3p:-5"},
@@ -328,13 +328,13 @@ class FunctionsTest(unittest.TestCase):
                "let7-triming.sam": {5:"iso_3p:+2",4:"iso_5p:-1",6:"iso_5p:+1,iso_3p:-3"}}
         #import pdb; pdb.set_trace()
         for fn in fns:
-            gff = annotate("data/aligments/%s" % fn, bam.read_bam)
+            gff = annotate("data/aligments/%s" % fn, bam.bam.read_bam)
             for pos in gff['hsa-let-7a-1']:
                 f = feature(gff['hsa-let-7a-1'][pos][0][4])
                 if not set(f.attributes['Variant'].split(",")) == set(fns[fn][pos].split(",")):
                     raise ValueError("Error in %s" % fn)
    
-    @attr(alignment_genomic=True)
+    ##@attr(alignment_genomic=True)
     def test_alignment_genomic(self):
         """testing alignments function"""
         from mirtop.bam import bam
@@ -351,7 +351,7 @@ class FunctionsTest(unittest.TestCase):
                                bam.read_bam,
                                gtf="data/db/mirbase/hsa.gff3", genomic=True))
 
-    @attr(keep_name=True)
+    ##@attr(keep_name=True)
     def test_keep_name(self):
         from mirtop.bam import bam
         line = annotate("data/aligments/let7-perfect.sam",
@@ -361,7 +361,7 @@ class FunctionsTest(unittest.TestCase):
         if line["hsa-let-7a-1"][5][0][4].find("seq_perfect_x2") < 0:
             raise ValueError("Keep name failed: %s" % line)
 
-    @attr(seqbuster=True)
+    ##@attr(seqbuster=True)
     def test_seqbuster(self):
         """testing reading seqbuster files function"""
         from mirtop.libs import logger
@@ -375,7 +375,7 @@ class FunctionsTest(unittest.TestCase):
         print("\nno frequency\n")
         annotate("data/examples/seqbuster/seqbuster_nofreq.mirna", seqbuster.read_file)
 
-    @attr(srnabench=True)
+    ##@attr(srnabench=True)
     def test_srnabench(self):
         """testing reading srnabench files function"""
         from mirtop.libs import logger
@@ -384,7 +384,7 @@ class FunctionsTest(unittest.TestCase):
         from mirtop.importer import srnabench
         annotate("data/examples/srnabench", srnabench.read_file, create=False)
 
-    @attr(optimir=True)
+    ##@attr(optimir=True)
     def test_optimir(self):
         """testing reading optimir files function"""
         from mirtop.libs import logger
@@ -393,7 +393,7 @@ class FunctionsTest(unittest.TestCase):
         from mirtop.importer import optimir
         annotate("data/examples/optimir/synthetic_100_full.gff3", optimir.read_file, create=False)
 
-    @attr(prost=True)
+    ##@attr(prost=True)
     def test_prost(self):
         """testing reading prost files function"""
         from mirtop.libs import logger
@@ -408,7 +408,7 @@ class FunctionsTest(unittest.TestCase):
             fn, precursors, "miRBasev21", "data/examples/annotate/hsa.gff3")
         annotate("data/example/prost/prost.example.txt", reads, True)
 
-    @attr(gff=True)
+    ##@attr(gff=True)
     def test_gff(self):
         """testing GFF function"""
         from mirtop.libs import logger
@@ -419,7 +419,7 @@ class FunctionsTest(unittest.TestCase):
         annotate(bam_fn, bam.read_bam)
         return True
 
-    @attr(collapse=True)
+    ##@attr(collapse=True)
     def test_collapse(self):
         """testing GFF function"""
         from mirtop.libs import logger
@@ -430,7 +430,7 @@ class FunctionsTest(unittest.TestCase):
         annotate(bam_fn, bam.read_bam)
         return True
 
-    @attr(counts=True)
+    ##@attr(counts=True)
     def test_counts(self):
         """testing convert_gff_counts in convert.py function"""
         from mirtop.libs import logger
@@ -452,7 +452,7 @@ class FunctionsTest(unittest.TestCase):
 
         return True
 
-    @attr(stats=True)
+    ##@attr(stats=True)
     def test_stats(self):
         """testing stats function"""
         from mirtop.gff import stats
@@ -461,7 +461,7 @@ class FunctionsTest(unittest.TestCase):
         stats._dump_log(df, version, None)
         print(df)
 
-    @attr(variant=True)
+    ##@attr(variant=True)
     def test_string_variant(self):
         """testing parsing string variants"""
         from mirtop.gff import body
@@ -477,7 +477,7 @@ class FunctionsTest(unittest.TestCase):
         if (truthv > list(gff.values())) - (list(gff.values()) > truthv):
             raise ValueError("Not found expected Values.")
 
-    @attr(validate=True)
+    ##@attr(validate=True)
     def test_validator(self):
         """test validator functions"""
         from mirtop.gff.validator import _check_file
@@ -493,7 +493,7 @@ class FunctionsTest(unittest.TestCase):
             raise ValueError("Validator did catch an unexpected error in correct_file.gff.") 
 
 
-    @attr(spikeins=True)
+    ###@attr(spikeins=True)
     def test_spikeins(self):
         """Test spikeins reading and annotation"""
         from mirtop.libs import spikeins
@@ -519,19 +519,19 @@ class FunctionsTest(unittest.TestCase):
         fasta_precursor = fasta.read_precursor(file_fasta, None)
         print(fasta_precursor)
 
-    @attr(export_fasta=True)
+    #@attr(export_fasta=True)
     def test_export_fasta(self):
         from mirtop.exporter.fasta import _process
         print("\n")
         _process("data/examples/gff/2samples.gff", None)
 
-    @attr(update=True)
+    #@attr(update=True)
     def test_update(self):
         from mirtop.gff.update import update_file
         print("\n")
         update_file("data/examples/versions/version1.0.gff", None)
 
-    @attr(sql=True)
+    #@attr(sql=True)
     def test_sql(self):
         """testing mirtop_sql in sql.py function"""
         from mirtop.libs import logger
@@ -548,13 +548,13 @@ class FunctionsTest(unittest.TestCase):
         os.remove(os.path.join(args.out, "SQL_sample.db"))
         return True
 
-    @attr(issue64=True)
+    #@attr(issue64=True)
     def test_issue64(self):
         from mirtop.bam.filter import tune
         subs, add, cigar = tune("TATCACAGTGGCTGTTCTTTTTT", "CCCCCTATCACAGTGGCTGTTCTTTTTT", 5, None)
         if add:
             raise ValueError("Bad annotation in for seqs with 6T/As at the end")
-    @attr(error69=True)
+    #@attr(error69=True)
     def test_error69(self):
         from mirtop.bam.filter import tune
         v = tune("CTTATCAGATTGTATTGTAATT", 



View it on GitLab: https://salsa.debian.org/med-team/mirtop/-/commit/d6a23114a9123de153412f783e1f2759934609df

-- 
View it on GitLab: https://salsa.debian.org/med-team/mirtop/-/commit/d6a23114a9123de153412f783e1f2759934609df
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20241012/a5f1c9c9/attachment-0001.htm>


More information about the debian-med-commit mailing list