Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
necrolyte2 committed Mar 25, 2016
2 parents bfab090 + cad3d7b commit 7bd4553
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 61,689 deletions.
8 changes: 6 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
.. image:: https://zenodo.org/badge/doi/10.5281/zenodo.46716.svg
:target: http://dx.doi.org/10.5281/zenodo.46716

.. image:: https://badge.waffle.io/VDBWRAIR/ngs_mapper.png?label=ready&title=Ready
:target: https://waffle.io/VDBWRAIR/ngs_mapper
:alt: 'Stories in Ready'
:target: https://waffle.io/VDBWRAIR/ngs_mapper
:alt: 'Stories in Ready'

.. image:: https://readthedocs.org/projects/ngs_mapper/badge/?version=latest
:target: http://ngs_mapper.readthedocs.org/en/latest/
:alt: Documentation Status
Expand Down
2 changes: 1 addition & 1 deletion ngs_mapper/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def platform_for_read( filepath ):
fh, ext = file_handle(filepath)
# fix sanger abi extension issue
if ext == 'ab1':
ext = 'abi'
return 'Sanger'
try:
# First record in readfile
try:
Expand Down
14 changes: 10 additions & 4 deletions ngs_mapper/file_formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
from glob import glob
import gzip
from Bio import SeqIO
from . import log

logger = log.setup_logger(__name__, log.get_config())

{
'sff' : 'sff',
Expand All @@ -18,25 +21,28 @@ def convert_sff(dir):
sff_paths = find_ext('sff')(dir)
outnames = map(swap_ext('fastq'), sff_paths)
def wrapped_conv(a, b):
print "Converting %s to fastq into %s" % (a, b)
logger.info('Converting {0} to {1}'.format(a, b))
n = 0
try:
n=sffs_to_fastq([a], b, trim=True)
except AssertionError as e:
pass
print "%s reads converted" % n
logger.info("{0} reads converted".format(n))
return n
return sum(map(wrapped_conv, sff_paths, outnames))

def convert_ab1(dir):
for abi in find_ext('gz')(dir):
SeqIO.convert(abi, 'abi', swap_ext('fastq')(abi), 'fastq')
for abi in find_ext('ab1')(dir):
dest = swap_ext('fastq')(abi)
logger.info('Converting {0} to {1}'.format(abi, dest))
SeqIO.convert(abi, 'abi', dest, 'fastq')

def convert_gzips(dir):
for gz in find_ext('gz')(dir):
dest = drop_ext(gz)
with gzip.open( gz, 'rb' ) as input:
with open(dest, 'w') as output:
logger.info('Unpacking {0} to {1}'.format(gz, dest))
output.write(input.read())

def convert_formats(dir):
Expand Down
61,680 changes: 0 additions & 61,680 deletions ngs_mapper/tests/fixtures/functional/780/780_S12_L001_R1_001_2014_04_16.fastq

This file was deleted.

Binary file not shown.
Binary file not shown.
2 changes: 0 additions & 2 deletions ngs_mapper/tests/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,8 @@ def test_identifies_sanger_reads(self, mseqio):
mock.Mock(id='aZ_09-', seq='ATGC')
]
for record in records:
mseqio.parse.return_value = iter([record])
r = data.platform_for_read('/path/to/read.ab1')
self.assertEqual('Sanger', r)
self.assertEqual('abi', mseqio.parse.call_args[0][1])

def test_identifies_miseq_reads(self, mseqio):
#@<instrument>:<run number>:<flowcell ID>:<lane>:<tile>:<x-pos>:<y-pos> <read>:<is filtered>:<control number>:<index sequence>
Expand Down

0 comments on commit 7bd4553

Please sign in to comment.