Iterative mapping


In [2]:
r_enz = 'HindIII'

In [4]:
from pytadbit.mapping.full_mapper import full_mapping

In [5]:
full_mapping('media/storage/db/reference_genome/Homo_sapiens/hg38/hg38.gem' ,
             reads=2, clean=True, r_enz=r_enz,
             frag_map=False,
             out_map_dir='results/{0}/01_mapping/map{0}_r1' .format(r_enz), 
             fastq_path='/media/storage/FASTQs/K562_{0}_1.fastq'.format(r_enz), 
             windows=(1, 25), (1, 30), (1, 35), (1, 40), (1, 45), (1, 50), (1, 75), (25, 75))


  File "<ipython-input-5-2609f3888829>", line 6
    windows=(1, 25), (1, 30), (1, 35), (1, 40), (1, 45), (1, 50), (1, 75), (25, 75)))
                                                                                    ^
SyntaxError: invalid syntax

In [6]:
full_mapping('media/storage/db/reference_genome/Homo_sapiens/hg38/hg38.gem' ,
             reads=2, clean=True, r_enz=r_enz,
             frag_map=False,
             out_map_dir='results/{0}/01_mapping/map{0}_r2' .format(r_enz), 
             fastq_path='/media/storage/FASTQs/K562_{0}_2.fastq'.format(r_enz), 
             windows=(1, 25), (1, 30), (1, 35), (1, 40), (1, 45), (1, 50), (1, 75), (25, 75))


  File "<ipython-input-6-0a55ac57b8d0>", line 6
    windows=(1, 25), (1, 30), (1, 35), (1, 40), (1, 45), (1, 50), (1, 75), (25, 75)))
                                                                                    ^
SyntaxError: invalid syntax

In [8]:
! mkdir -p results/

In [14]:
! mkdir -p results/HindIII/01_mapping

In [10]:
! mkdir -p results/MboI/01_mapping

In [18]:
! ls results/HindIII/


01_mapping

In [12]:
full_mapping('media/storage/db/reference_genome/Homo_sapiens/hg38/hg38.gem' ,
             nthreads=2, clean=True, r_enz=r_enz,
             frag_map=True,
             out_map_dir='results/{0}/01_mapping/map{0}_r1' .format(r_enz), 
             fastq_path='/media/storage/FASTQs/K562_{0}_1.fastq'.format(r_enz))


  File "<ipython-input-12-2b5514c21a41>", line 6
    windows=(1, 25), (1, 30), (1, 35), (1, 40), (1, 45), (1, 50), (1, 75), (25, 75))
SyntaxError: non-keyword arg after keyword arg

In [27]:
ls results/HindIII/01_mapping/mapHindIII_r1/


The history saving thread hit an unexpected error (OperationalError('database is locked',)).History will not be written to the database.

In [21]:
full_mapping('media/storage/db/reference_genome/Homo_sapiens/hg38/hg38.gem' ,
             nthreads=2, clean=True, r_enz=r_enz,
             frag_map=True,
             out_map_dir='results/{0}/01_mapping/map{0}_r1' .format(r_enz), 
             fastq_path='/media/storage/FASTQs/K562_{0}_1.fastq'.format(r_enz))


/home/student/.miniconda2/lib/python2.7/site-packages/pytadbit/mapping/full_mapper.py:390: UserWarning: WARNING: only 146 Gb left on tmp_dir: /home/student/tmp

  warn('WARNING: only %d Gb left on tmp_dir: %s\n' % (fspace, temp_dir))
Preparing FASTQ file
  - conversion to MAP format
Mapping reads in window 1-end...
TO GEM /home/student/tmp/K562_HindIII_1_yOdMC5
/usr/local/bin/gem-mapper -I /home/student/Notebooks/Beata/media/storage/db/reference_genome/Homo_sapiens/hg38/hg38.gem -q offset-33 -m 0.04 -s 0 --allow-incomplete-strata 0.00 --granularity 10000 --max-decoded-matches 1 --min-decoded-strata 0 --min-insert-size 0 --max-insert-size 0 --min-matched-bases 0.8 --gem-quality-threshold 26 --max-big-indel-length 15 --mismatch-alphabet ACGT -E 0.30 --max-extendable-matches 20 --max-extensions-per-match 1 -e 0.04 -T 2 -i /home/student/tmp/K562_HindIII_1_yOdMC5 -o /home/student/tmp/K562_HindIII_1_yOdMC5_full_1-end
Parsing result...
---------------------------------------------------------------------------
IOError                                   Traceback (most recent call last)
<ipython-input-21-f499fe4d7e56> in <module>()
      3              frag_map=True,
      4              out_map_dir='results/{0}/01_mapping/map{0}_r1' .format(r_enz),
----> 5              fastq_path='/media/storage/FASTQs/K562_{0}_1.fastq'.format(r_enz))

/home/student/.miniconda2/lib/python2.7/site-packages/pytadbit/mapping/full_mapper.pyc in full_mapping(gem_index_path, fastq_path, out_map_dir, r_enz, frag_map, min_seq_len, windows, add_site, clean, get_nread, **kwargs)
    442                         os.path.join(out_map_dir,
    443                                      base_name + '_full_%s-%s%s.map' % (
--> 444                                          beg, end, suffix)))
    445             # clean
    446             if clean:

/home/student/.miniconda2/lib/python2.7/site-packages/pytadbit/mapping/full_mapper.pyc in _gem_filter(fnam, unmap_out, map_out)
    216        - not feasible with gt.filter
    217     """
--> 218     fhandler = magic_open(fnam) if isinstance(fnam, str) else fnam
    219     unmap_out = open(unmap_out, 'w')
    220     map_out   = open(map_out  , 'w')

/home/student/.miniconda2/lib/python2.7/site-packages/pytadbit/utils/file_handling.pyc in magic_open(filename, verbose, cpus)
     27     """
     28     if isinstance(filename, str) or isinstance(filename, unicode):
---> 29         fhandler = file(filename, 'rb')
     30         inputpath = True
     31         if tarfile.is_tarfile(filename):

IOError: [Errno 2] No such file or directory: '/home/student/tmp/K562_HindIII_1_yOdMC5_full_1-end.map'

In [ ]:
full_mapping('media/storage/db/reference_genome/Homo_sapiens/hg38/hg38.gem' ,
             nthreads=2, clean=True, r_enz=r_enz,
             frag_map=True,
             out_map_dir='results/{0}/01_mapping/map{0}_r2' .format(r_enz), 
             fastq_path='/media/storage/FASTQs/K562_{0}_2.fastq'.format(r_enz))

In [28]:
ls


00_fast_QC.ipynb  01_mapping.ipynb  learning_python.ipynb  results/

In [29]:
! head results/HindIII/01__mapping/mapHindIII_r2/K562_HindIII_2_full_1-end.map


head: cannot open ‘results/HindIII/01__mapping/mapHindIII_r2/K562_HindIII_2_full_1-end.map’ for reading: No such file or directory

In [ ]: