Skip to content
Open
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
8 changes: 1 addition & 7 deletions mirtop/exporter/vcf.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
from __future__ import print_function

import datetime
import sys
import os.path as op

import six

from mirtop.mirna.fasta import read_precursor
from mirtop.mirna.mapper import read_gtf_to_precursor, read_gtf_to_mirna
from mirtop.gff.body import read_gff_line
Expand Down Expand Up @@ -133,14 +129,12 @@ def create_vcf(mirgff3, precursor, gtf, vcffile, database):
"""
#Check if the input files exist:
try:
gff3_file = open(mirgff3, "r", encoding="utf-8") if six.PY3 else open(mirgff3, "r")
gff3_file = open(mirgff3, "r", encoding="utf-8")
except IOError:
print ("Can't read the file", end=mirgff3)
sys.exit()
with gff3_file:
data = gff3_file.read()
if six.PY2:
data = data.decode("utf-8-sig").encode("utf-8")

gff3_data = data.split("\n")
vcf_file = open(vcffile, "w")
Expand Down
8 changes: 3 additions & 5 deletions mirtop/libs/do.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import subprocess
import logging

import six


logger = logging.getLogger("run")

Expand All @@ -16,7 +14,7 @@ def run(cmd, data=None, checks=None, region=None, log_error=True,
"""Run the provided command, logging details and checking for errors.
"""
try:
logger.debug(" ".join(str(x) for x in cmd) if not isinstance(cmd, six.string_types) else cmd)
logger.debug(" ".join(str(x) for x in cmd) if not isinstance(cmd, str) else cmd)
_do_run(cmd, checks, log_stdout)
except:
if log_error:
Expand Down Expand Up @@ -44,7 +42,7 @@ def _normalize_cmd_args(cmd):
Piped commands set pipefail and require use of bash to help with debugging
intermediate errors.
"""
if isinstance(cmd, six.string_types):
if isinstance(cmd, str):
# check for standard or anonymous named pipes
if cmd.find(" | ") > 0 or cmd.find(">(") or cmd.find("<("):
return "set -o pipefail; " + cmd, True, find_bash()
Expand Down Expand Up @@ -74,7 +72,7 @@ def _do_run(cmd, checks, log_stdout=False):
for line in s.stdout:
debug_stdout.append(line)
if exitcode is not None and exitcode != 0:
error_msg = " ".join(cmd) if not isinstance(cmd, six.string_types) else cmd
error_msg = " ".join(cmd) if not isinstance(cmd, str) else cmd
error_msg += "\n"
error_msg += "".join(debug_stdout)
s.communicate()
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ pybedtools
pandas
biopython
pyyaml
pybedtools
six
pytest
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ def write_version_py():
long_description_content_type="text/markdown",
classifiers=[
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 2.7',
"Programming Language :: Python :: 3",
'Topic :: Scientific/Engineering :: Bio-Informatics'
],
Expand Down
Loading