Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
:Description: This module will sort bam file by name
"""
'''
Created on Mar 18, 2015
Description: This module will sort bam file by name
@author: Ronak H Shah
'''
import os
import sys
import pysam
import logging
import coloredlogs
logger = logging.getLogger('iCallSV.sortbamByReadName')
coloredlogs.install(level='DEBUG')
def sortBam(inputBam, outputBamName, outputDir):
logger.info("sortbamByReadName: Trying to sort BAM file by Read Name")
if(os.path.isdir(outputDir)):
logger.info("sortbamByReadName: The output directory %s exists", outputDir)
outputFile = outputDir + "/" + outputBamName
else:
logger.info("sortbamByReadName: The output directory %s does not exists !!", outputDir)
sys.exit()
if(os.path.isfile(inputBam)):
try:
pysam.sort("-n", inputBam, outputFile)
except IndexError as err:
exception = "Index error({0}): {1}".format(err.errno, err.strerror)
logger.info("%s", exception)
::Output::
Filtered VCF files
'''
import os
import sys
import vcf
import re
import checkparameters as cp
import checkHotSpotList as chl
import checkBlackList as cbl
import logging
import coloredlogs
logger = logging.getLogger('iCallSV.FilterDellyCalls')
coloredlogs.install(level='DEBUG')
def run(
inputVcf,
outputDir,
controlId,
caseID,
hotspotFile,
blacklistFile,
svlength,
mapq,
mapqHotspot,
caseAltFreqHotspot,
caseTotalCountHotspot,
controlAltFreqHotspot,
caseAltFreq,
caseTotalCount,
global_function_cache[hash] = result
# print 'cache: + ' + str(hash) + '>>>'
else:
result = global_function_cache[hash]
# print 'use: - ' + str(hash) + '>>>'
return result
return wrapper
# -------------------------------------------------------------------------------------------------
# logging utilities
# -------------------------------------------------------------------------------------------------
# install colours in the logger
coloredlogs.install(fmt='%(levelname)s: %(message)s', level='WARN')
# set the logger level
def setLoggerLevel(level):
coloredlogs.install(fmt='%(levelname)s: %(message)s', level=level.upper())
# command line codes for colors
class color:
PURPLE = '\033[95m'
CYAN = '\033[96m'
DARKCYAN = '\033[36m'
BLUE = '\033[94m'
GREEN = '\033[92m'
YELLOW = '\033[93m'
RED = '\033[91m'
def main():
"""Parse command line and initialize PUDL DB."""
# Display logged output from the PUDL package:
logger = logging.getLogger(pudl.__name__)
log_format = '%(asctime)s [%(levelname)8s] %(name)s:%(lineno)s %(message)s'
coloredlogs.install(fmt=log_format, level='INFO', logger=logger)
args = parse_command_line(sys.argv)
with pathlib.Path(args.settings_file).open() as f:
script_settings = yaml.safe_load(f)
try:
pudl_in = script_settings["pudl_in"]
except KeyError:
pudl_in = pudl.workspace.setup.get_defaults()["pudl_in"]
try:
pudl_out = script_settings["pudl_out"]
except KeyError:
pudl_out = pudl.workspace.setup.get_defaults()["pudl_out"]
pudl_settings = pudl.workspace.setup.derive_paths(
pudl_in=pudl_in, pudl_out=pudl_out)
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import print_function
import logging
import coloredlogs
from tweebot.agents import UserAgentProvider
__author__ = "Vasyl Paliy"
__version__ = '2.3'
__license___ = "MIT"
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
coloredlogs.install(level='INFO', logger=logger)
coloredlogs.install(fmt='%(asctime)s | %(message)s')
ua_provider = UserAgentProvider()
def setup_logging(level):
try:
import coloredlogs
coloredlogs.install(level=level.upper())
except ImportError:
LOGGER = logging.getLogger()
handler = logging.StreamHandler()
handler.setLevel(level.upper())
formatter = logging.Formatter(('%(asctime)s - '
'%(name)s - '
'%(levelname)s - '
'%(message)s'))
handler.setFormatter(formatter)
LOGGER.addHandler(handler)
LOGGER.setLevel(level.upper())
for logger in LOGGERS_TO_DISABLE:
logging.getLogger(logger).disabled = True
def loglevel(ctx):
"""Set app cli log level"""
log_level = ctx.find_root().params["loglevel"]
log_format = None
coloredlogs.install(level=log_level, fmt=log_format)
LOG.info("Running scout version %s", __version__)
LOG.debug("Debug logging enabled.")
import sys
import coloredlogs
from pyvox.parser import VoxParser
from pyvox.writer import VoxWriter
coloredlogs.install(level='DEBUG')
m1 = VoxParser(sys.argv[1]).parse()
print(m1)
VoxWriter('test.vox', m1).write()
m2 = VoxParser('test.vox').parse()
print(m2)
assert m1.models == m2.models
file_parser = subparsers.add_parser(
"file",
help="Figure out what to do from the input file")
file_parser.add_argument(
"file",
nargs="+",
help="Post content - input file")
config = os.path.expanduser("~/.easyblogger")
if (os.path.exists(config)):
sysargv = ["@" + config] + sysargv
args = parser.parse_args(sysargv)
verbosity = logging.getLevelName(args.verbose)
# print(verbosity, logging.getLevelName(verbosity))
coloredlogs.install(verbosity)
if args.verbose != "critical":
logger.setLevel(logging.INFO)
logger.info("setting log level to: %s ", args.verbose)
logger.setLevel(verbosity)
logger.debug("Final args:")
logger.debug(sysargv)
return args
print(HEADER)
parser = argparse.ArgumentParser(description=\
"Capture all RabbitMQ messages being sent through a broker.")
parser.add_argument('url', type=str, help="rabbitmq_management URL")
parser.add_argument('--username', type=str, default="guest",\
help="rabbitmq_management username")
parser.add_argument('--password', type=str, default="guest",\
help="rabbitmq_management password")
parser.add_argument('-v', '--verbose', help="increase output verbosity",\
action='store_true')
args = parser.parse_args()
logger = verboselogs.VerboseLogger('cottontail')
logger.addHandler(logging.StreamHandler())
logger.setLevel(logging.VERBOSE)
coloredlogs.install(
fmt='%(asctime)s %(levelname)s %(message)s',
logger=logger,
level='debug' if args.verbose else 'verbose'
)
o = urlparse(args.url)
if o.port is None:
raise Exception("Invalid URL provided.")
rbmq = RabbitMQManagementClient(
o.hostname,
port=o.port,
username=args.username,
password=args.password,
ssl=(o.scheme == "https")
)