2 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/afbff82a32e9/
changeset: afbff82a32e9
user: dannon
date: 2012-08-13 18:59:17
summary: Fix convert_newlines and sep2tabs to return '0' lines in the event of an empty file, instead of blowing up.
affected #: 1 file
diff -r bb76489b554107f534df7e0f829e60308fea719a -r afbff82a32e98e9261b52c5415377c0ee5ecee1d lib/galaxy/datatypes/sniff.py
--- a/lib/galaxy/datatypes/sniff.py
+++ b/lib/galaxy/datatypes/sniff.py
@@ -91,15 +91,16 @@
"""
fd, temp_name = tempfile.mkstemp()
fp = os.fdopen( fd, "wt" )
- for i, line in enumerate( file( fname, "U" ) ):
+ i = 0
+ for i, line in enumerate( file( fname, "U" ), 1 ):
fp.write( "%s\n" % line.rstrip( "\r\n" ) )
fp.close()
if in_place:
shutil.move( temp_name, fname )
# Return number of lines in file.
- return ( i + 1, None )
+ return ( i, None )
else:
- return ( i + 1, temp_name )
+ return ( i, temp_name )
def sep2tabs( fname, in_place=True, patt="\\s+" ):
"""
@@ -115,7 +116,8 @@
regexp = re.compile( patt )
fd, temp_name = tempfile.mkstemp()
fp = os.fdopen( fd, "wt" )
- for i, line in enumerate( file( fname ) ):
+ i = 0
+ for i, line in enumerate( file( fname ), 1):
line = line.rstrip( '\r\n' )
elems = regexp.split( line )
fp.write( "%s\n" % '\t'.join( elems ) )
@@ -123,9 +125,9 @@
if in_place:
shutil.move( temp_name, fname )
# Return number of lines in file.
- return ( i + 1, None )
+ return ( i, None )
else:
- return ( i + 1, temp_name )
+ return ( i, temp_name )
def convert_newlines_sep2tabs( fname, in_place=True, patt="\\s+" ):
"""
https://bitbucket.org/galaxy/galaxy-central/changeset/fbefa0369895/
changeset: fbefa0369895
user: dannon
date: 2012-08-13 19:00:09
summary: Whitespace cleanup.
affected #: 1 file
diff -r afbff82a32e98e9261b52c5415377c0ee5ecee1d -r fbefa03698959fc15d06d74ad9a2cf24f6001e63 lib/galaxy/datatypes/sniff.py
--- a/lib/galaxy/datatypes/sniff.py
+++ b/lib/galaxy/datatypes/sniff.py
@@ -8,7 +8,7 @@
from galaxy.datatypes.binary import unsniffable_binary_formats
log = logging.getLogger(__name__)
-
+
def get_test_fname(fname):
"""Returns test data filename"""
path, name = os.path.split(__file__)
@@ -79,7 +79,7 @@
def convert_newlines( fname, in_place=True ):
"""
- Converts in place a file from universal line endings
+ Converts in place a file from universal line endings
to Posix line endings.
>>> fname = get_test_fname('temp.txt')
@@ -159,7 +159,7 @@
def get_headers( fname, sep, count=60, is_multi_byte=False ):
"""
Returns a list with the first 'count' lines split by 'sep'
-
+
>>> fname = get_test_fname('complete.bed')
>>> get_headers(fname,'\\t')
[['chr7', '127475281', '127491632', 'NM_000230', '0', '+', '127486022', '127488767', '0', '3', '29,172,3225,', '0,10713,13126,'], ['chr7', '127486011', '127488900', 'D49487', '0', '+', '127486022', '127488767', '0', '2', '155,490,', '0,2399']]
@@ -175,12 +175,12 @@
if idx == count:
break
return headers
-
+
def is_column_based( fname, sep='\t', skip=0, is_multi_byte=False ):
"""
- Checks whether the file is column based with respect to a separator
+ Checks whether the file is column based with respect to a separator
(defaults to tab separator).
-
+
>>> fname = get_test_fname('test.gff')
>>> is_column_based(fname)
True
@@ -288,7 +288,7 @@
"""
Some classes may not have a sniff function, which is ok. In fact, the
Tabular and Text classes are 2 examples of classes that should never have
- a sniff function. Since these classes are default classes, they contain
+ a sniff function. Since these classes are default classes, they contain
few rules to filter out data of other formats, so they should be called
from this function after all other datatypes in sniff_order have not been
successfully discovered.
@@ -333,7 +333,7 @@
is_compressed = check_compressed_function( filename )
if is_compressed:
break #found compression type
- if is_compressed:
+ if is_compressed:
if ext in AUTO_DETECT_EXTENSIONS:
check_exts = COMPRESSION_DATATYPES[ compressed_type ]
elif ext in COMPRESSED_EXTENSIONS:
@@ -347,7 +347,7 @@
keep_compressed = True
is_valid = True
break
-
+
if not is_compressed:
is_valid = True
elif not keep_compressed:
@@ -373,13 +373,13 @@
def handle_uploaded_dataset_file( filename, datatypes_registry, ext = 'auto', is_multi_byte = False ):
is_valid, ext = handle_compressed_file( filename, datatypes_registry, ext = ext )
-
+
if not is_valid:
raise InappropriateDatasetContentError, 'The compressed uploaded file contains inappropriate content.'
-
+
if ext in AUTO_DETECT_EXTENSIONS:
ext = guess_ext( filename, sniff_order = datatypes_registry.sniff_order, is_multi_byte=is_multi_byte )
-
+
if check_binary( filename ):
if ext not in unsniffable_binary_formats and not datatypes_registry.get_datatype_by_extension( ext ).sniff( filename ):
raise InappropriateDatasetContentError, 'The binary uploaded file contains inappropriate content.'
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
2 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/05c643a133ec/
changeset: 05c643a133ec
user: fubar
date: 2012-08-11 01:36:29
summary: Unicode/raw for re.sub string in rgFastQC.py
affected #: 1 file
diff -r 0a800e817e84abba99331e784f622dd3ce54e900 -r 05c643a133ec9421c252647fb1eedc96f2940da5 tools/rgenetics/rgFastQC.py
--- a/tools/rgenetics/rgFastQC.py
+++ b/tools/rgenetics/rgFastQC.py
@@ -56,7 +56,7 @@
cl.append('-c %s' % self.opts.contaminants)
# patch suggested by bwlang https://bitbucket.org/galaxy/galaxy-central/pull-request/30
# use a symlink in a temporary directory so that the FastQC report reflects the history input file name
- fastqinfilename = re.sub('[^a-zA-Z0-9_\-\.]', '_', os.path.basename(self.opts.inputfilename))
+ fastqinfilename = re.sub(ru'[^a-zA-Z0-9_\-\.]', '_', os.path.basename(self.opts.inputfilename))
link_name = os.path.join(self.opts.outputdir, fastqinfilename)
os.symlink(self.opts.input, link_name)
cl.append(link_name)
https://bitbucket.org/galaxy/galaxy-central/changeset/bb76489b5541/
changeset: bb76489b5541
user: fubar
date: 2012-08-11 01:42:48
summary: Added unicode and raw flags to the re.sub string - not tested with unicode name yet..
affected #: 1 file
diff -r 05c643a133ec9421c252647fb1eedc96f2940da5 -r bb76489b554107f534df7e0f829e60308fea719a tools/rgenetics/rgFastQC.py
--- a/tools/rgenetics/rgFastQC.py
+++ b/tools/rgenetics/rgFastQC.py
@@ -56,7 +56,7 @@
cl.append('-c %s' % self.opts.contaminants)
# patch suggested by bwlang https://bitbucket.org/galaxy/galaxy-central/pull-request/30
# use a symlink in a temporary directory so that the FastQC report reflects the history input file name
- fastqinfilename = re.sub(ru'[^a-zA-Z0-9_\-\.]', '_', os.path.basename(self.opts.inputfilename))
+ fastqinfilename = re.sub(ur'[^a-zA-Z0-9_\-\.]', '_', os.path.basename(self.opts.inputfilename))
link_name = os.path.join(self.opts.outputdir, fastqinfilename)
os.symlink(self.opts.input, link_name)
cl.append(link_name)
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
2 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/b612d9dcca9f/
changeset: b612d9dcca9f
user: jmchilton
date: 2012-08-10 00:25:35
summary: Implement a mechanism to secure access to lwr. If enabled on the
server, a private token must be passed along with all
interactions. This token may be specified as part of the job runner
url as such:
wintool = lwr://https://token@host:8913/
This token will not protect the client against a rouge server that has
exploited say a DNS spoofing vulnerability. It is only meant as a
mechanism for the lwr to ensure the client is authorized. This feature
should be used in conjunction with SSL to prevent a "man-in-middle"
from intercepting this token.
affected #: 1 file
diff -r 3b5db939aebe61addd6f0b8d0c14267cf16c4144 -r b612d9dcca9fd75f7dc9592cd64e385d3300e0bb lib/galaxy/jobs/runners/lwr.py
--- a/lib/galaxy/jobs/runners/lwr.py
+++ b/lib/galaxy/jobs/runners/lwr.py
@@ -112,16 +112,30 @@
class Client(object):
"""
"""
- def __init__(self, remote_host, job_id):
+ """
+ """
+ def __init__(self, remote_host, job_id, private_key=None):
if not remote_host.endswith("/"):
remote_host = remote_host + "/"
+ ## If we don't have an explicit private_key defined, check for
+ ## one embedded in the URL. A URL of the form
+ ## https://moo@cow:8913 will try to contact https://cow:8913
+ ## with a private key of moo
+ private_key_format = "https?://(.*)@.*/?"
+ private_key_match= re.match(private_key_format, remote_host)
+ if not private_key and private_key_match:
+ private_key = private_key_match.group(1)
+ remote_host = remote_host.replace("%s@" % private_key, '', 1)
self.remote_host = remote_host
self.job_id = job_id
+ self.private_key = private_key
def url_open(self, request, data):
return urllib2.urlopen(request, data)
def __build_url(self, command, args):
+ if self.private_key:
+ args["private_key"] = self.private_key
data = urllib.urlencode(args)
url = self.remote_host + command + "?" + data
return url
https://bitbucket.org/galaxy/galaxy-central/changeset/b24c67866f49/
changeset: b24c67866f49
user: natefoo
date: 2012-08-10 20:35:44
summary: Merged in jmchilton/galaxy-central-lwr-enhancement-1 (pull request #57)
affected #: 1 file
diff -r 4b0d6a9ecef858e507df4fa04fd8d8c37d542958 -r b24c67866f4942fddf50be60aa66b39f34643a55 lib/galaxy/jobs/runners/lwr.py
--- a/lib/galaxy/jobs/runners/lwr.py
+++ b/lib/galaxy/jobs/runners/lwr.py
@@ -112,16 +112,30 @@
class Client(object):
"""
"""
- def __init__(self, remote_host, job_id):
+ """
+ """
+ def __init__(self, remote_host, job_id, private_key=None):
if not remote_host.endswith("/"):
remote_host = remote_host + "/"
+ ## If we don't have an explicit private_key defined, check for
+ ## one embedded in the URL. A URL of the form
+ ## https://moo@cow:8913 will try to contact https://cow:8913
+ ## with a private key of moo
+ private_key_format = "https?://(.*)@.*/?"
+ private_key_match= re.match(private_key_format, remote_host)
+ if not private_key and private_key_match:
+ private_key = private_key_match.group(1)
+ remote_host = remote_host.replace("%s@" % private_key, '', 1)
self.remote_host = remote_host
self.job_id = job_id
+ self.private_key = private_key
def url_open(self, request, data):
return urllib2.urlopen(request, data)
def __build_url(self, command, args):
+ if self.private_key:
+ args["private_key"] = self.private_key
data = urllib.urlencode(args)
url = self.remote_host + command + "?" + data
return url
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/35c524274296/
changeset: 35c524274296
user: jgoecks
date: 2012-08-10 18:26:43
summary: Explicitly specify encodings for tool help templates to avoid unicode/ascii confusion.
affected #: 1 file
diff -r 7ac62afbcdf2b983e002b79e52753f9cf142db60 -r 35c524274296c33320190a017bc316b57cb4f759 lib/galaxy/tools/__init__.py
--- a/lib/galaxy/tools/__init__.py
+++ b/lib/galaxy/tools/__init__.py
@@ -1083,7 +1083,9 @@
help_pages = self.help.findall( "page" )
help_header = self.help.text
try:
- self.help = Template( util.rst_to_html(self.help.text) )
+ self.help = Template( util.rst_to_html(self.help.text), input_encoding='utf-8',
+ output_encoding='utf-8', default_filters=[ 'decode.utf8' ],
+ encoding_errors='replace' )
except:
log.exception( "error in help for tool %s" % self.name )
# Multiple help page case
@@ -1093,7 +1095,10 @@
help_footer = help_footer + help_page.tail
# Each page has to rendered all-together because of backreferences allowed by rst
try:
- self.help_by_page = [ Template( util.rst_to_html( help_header + x + help_footer ) )
+ self.help_by_page = [ Template( util.rst_to_html( help_header + x + help_footer,
+ input_encoding='utf-8', output_encoding='utf-8',
+ default_filters=[ 'decode.utf8' ],
+ encoding_errors='replace' ) )
for x in self.help_by_page ]
except:
log.exception( "error in multi-page help for tool %s" % self.name )
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/7ac62afbcdf2/
changeset: 7ac62afbcdf2
user: jgoecks
date: 2012-08-10 15:58:59
summary: Make from_work_dir attribute work when outputs_to_working_directory is True.
affected #: 1 file
diff -r 18462a6cbf46566307eaa4fd33c8891b5979d699 -r 7ac62afbcdf2b983e002b79e52753f9cf142db60 lib/galaxy/jobs/runners/__init__.py
--- a/lib/galaxy/jobs/runners/__init__.py
+++ b/lib/galaxy/jobs/runners/__init__.py
@@ -40,7 +40,18 @@
if job_wrapper.dependency_shell_commands:
commands = "; ".join( job_wrapper.dependency_shell_commands + [ commands ] )
- # Append commands to copy job outputs based on from_work_dir attribute.
+ # -- Append commands to copy job outputs based on from_work_dir attribute. --
+
+ # Set up dict of dataset id --> output path; output path can be real or
+ # false depending on outputs_to_working_directory
+ output_paths = {}
+ for dataset_path in job_wrapper.get_output_fnames():
+ path = dataset_path.real_path
+ if self.app.config.outputs_to_working_directory:
+ path = dataset_path.false_path
+ output_paths[ dataset_path.dataset_id ] = path
+
+ # Walk job's output associations to find and use from_work_dir attributes.
job = job_wrapper.get_job()
job_tool = self.app.toolbox.tools_by_id.get( job.tool_id, None )
for dataset_assoc in job.output_datasets + job.output_library_datasets:
@@ -53,12 +64,13 @@
# Copy from working dir to HDA.
# TODO: move instead of copy to save time?
source_file = os.path.join( os.path.abspath( job_wrapper.working_directory ), hda_tool_output.from_work_dir )
+ destination = output_paths[ dataset.dataset_id ]
if in_directory( source_file, job_wrapper.working_directory ):
try:
- commands += "; cp %s %s" % ( source_file, dataset.file_name )
- log.debug( "Copying %s to %s as directed by from_work_dir" % ( source_file, dataset.file_name ) )
+ commands += "; cp %s %s" % ( source_file, destination )
+ log.debug( "Copying %s to %s as directed by from_work_dir" % ( source_file, destination ) )
except ( IOError, OSError ):
- log.debug( "Could not copy %s to %s as directed by from_work_dir" % ( source_file, dataset.file_name ) )
+ log.debug( "Could not copy %s to %s as directed by from_work_dir" % ( source_file, destination ) )
else:
# Security violation.
log.exception( "from_work_dir specified a location not in the working directory: %s, %s" % ( source_file, job_wrapper.working_directory ) )
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/18462a6cbf46/
changeset: 18462a6cbf46
user: fubar
date: 2012-08-10 12:53:00
summary: Added sanitisation of the only user controllable parameter and removed use of shell in subprocess.popen to
improve security and reduce breakage risk from ugly filenames pointed out by A Nonymous in
https://bitbucket.org/galaxy/galaxy-central/issue/793/rgenetics-rgfastqcpy-…
affected #: 2 files
diff -r c6e1ef62c40b6c212210356fa59222b60645070b -r 18462a6cbf46566307eaa4fd33c8891b5979d699 tools/rgenetics/rgFastQC.py
--- a/tools/rgenetics/rgFastQC.py
+++ b/tools/rgenetics/rgFastQC.py
@@ -13,8 +13,13 @@
"""
-
-import os,sys,subprocess,optparse,shutil,tempfile
+import re
+import os
+import sys
+import subprocess
+import optparse
+import shutil
+import tempfile
from rgutils import getFileString
class FastQC():
@@ -38,25 +43,26 @@
"""
serr = ''
- dummy,tlog = tempfile.mkstemp(prefix='rgFastQClog')
+ dummy,tlog = tempfile.mkstemp(prefix='rgFastQC',suffix=".log",dir=self.opts.outputdir)
sout = open(tlog, 'w')
fastq = os.path.basename(self.opts.input)
- cl = [self.opts.executable,'-o %s' % self.opts.outputdir]
+ cl = [self.opts.executable,'--outdir=%s' % self.opts.outputdir]
if self.opts.informat in ['sam','bam']:
cl.append('-f %s' % self.opts.informat)
if self.opts.contaminants <> None :
cl.append('-c %s' % self.opts.contaminants)
# patch suggested by bwlang https://bitbucket.org/galaxy/galaxy-central/pull-request/30
# use a symlink in a temporary directory so that the FastQC report reflects the history input file name
- fastqinfilename = os.path.basename(self.opts.inputfilename).replace(' ','_')
+ fastqinfilename = re.sub('[^a-zA-Z0-9_]+', '', os.path.basename(self.opts.inputfilename))
link_name = os.path.join(self.opts.outputdir, fastqinfilename)
os.symlink(self.opts.input, link_name)
cl.append(link_name)
- p = subprocess.Popen(' '.join(cl), shell=True, stderr=sout, stdout=sout, cwd=self.opts.outputdir)
+ sout.write('# FastQC cl = %s\n' % ' '.join(cl))
+ sout.flush()
+ p = subprocess.Popen(cl, shell=False, stderr=sout, stdout=sout, cwd=self.opts.outputdir)
retval = p.wait()
sout.close()
runlog = open(tlog,'r').readlines()
- os.unlink(tlog)
os.unlink(link_name)
flist = os.listdir(self.opts.outputdir) # fastqc plays games with its output directory name. eesh
odpath = None
diff -r c6e1ef62c40b6c212210356fa59222b60645070b -r 18462a6cbf46566307eaa4fd33c8891b5979d699 tools/rgenetics/rgFastQC.xml
--- a/tools/rgenetics/rgFastQC.xml
+++ b/tools/rgenetics/rgFastQC.xml
@@ -1,5 +1,5 @@
-<tool name="Fastqc: Fastqc QC" id="fastqc" version="0.5">
- <description>using FastQC from Babraham</description>
+<tool name="FastQC:Read QC" id="fastqc" version="0.51">
+ <description>reports using FastQC</description><command interpreter="python">
rgFastQC.py -i "$input_file" -d "$html_file.files_path" -o "$html_file" -n "$out_prefix" -f "$input_file.ext" -j "$input_file.name" -e "${GALAXY_DATA_INDEX_DIR}/shared/jars/FastQC/fastqc"
#if $contaminants.dataset and str($contaminants) > ''
@@ -21,7 +21,7 @@
help="tab delimited file with 2 columns: name and sequence. For example: Illumina Small RNA RT Primer CAAGCAGAAGACGGCATACGA"/></inputs><outputs>
- <data format="html" name="html_file" label="${out_prefix}_${on_string}.html" />
+ <data format="html" name="html_file" label="${out_prefix}_${input_file.name}.html" /></outputs><tests><test>
@@ -51,15 +51,18 @@
- Export of results to an HTML based permanent report
- Offline operation to allow automated generation of reports without running the interactive application
-**FastQC documentation**
-This is a Galaxy interface to the external package FastQC_.
-Specific documentation on FastQC can be found on that site.
+-----
+
+
+.. class:: infomark
+
+**FastQC**
+
+This is a Galaxy wrapper. It merely exposes the external package FastQC_ which is documented at FastQC_
+Kindly acknowledge it as well as this tool if you use it.
FastQC incorporates the Picard-tools_ libraries for sam/bam processing.
- .. _FastQC: http://www.bioinformatics.bbsrc.ac.uk/projects/fastqc/
- .. _Picard-tools: http://picard.sourceforge.net/index.shtml
-
The contaminants file parameter was borrowed from the independently developed
fastqcwrapper contributed to the Galaxy Community Tool Shed by J. Johnson.
@@ -69,7 +72,10 @@
**Inputs and outputs**
-This wrapper will accept any fastq file as well as sam or bam as the primary file to check.
+FastQC_ is the best place to look for documentation - it's very good.
+A summary follows below for those in a tearing hurry.
+
+This wrapper will accept a Galaxy fastq, sam or bam as the input read file to check.
It will also take an optional file containing a list of contaminants information, in the form of
a tab-delimited file with 2 columns, name and sequence.
@@ -88,6 +94,8 @@
- Kmer Content
All except Basic Statistics and Overrepresented sequences are plots.
+ .. _FastQC: http://www.bioinformatics.bbsrc.ac.uk/projects/fastqc/
+ .. _Picard-tools: http://picard.sourceforge.net/index.shtml
</help></tool>
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.