#!/usr/bin/env python # coding: utf-8 # # In[1]: get_ipython().system('date') # In[2]: get_ipython().run_cell_magic('bash', '', 'system_profiler SPSoftwareDataType\n') # In[128]: cd /Volumes/nightingales/O_lurida/20160203_mbdseq/ # ### Concatenate entire set of FASTQ files for each individual # ##### The commands below use a for loop to: # 1. process each FASTQ corresponding to an individual (zr1394_n_*) # 2. concatenate each file (cat \$file) to the designated output file (\${file/_s*_R1/}) # # The output file is named using bash parameter expansion. It takes the file name ($file) and replaces the designated matching text (_s*_R1) with whatever follows the last slash - in this case, it's replaced with an empty string (i.e. deleted). # In[129]: get_ipython().run_cell_magic('bash', '', '\nfor file in zr1394_1_*; do\n cat $file >> ${file/_s*_R1/}\ndone\n') # In[130]: get_ipython().run_cell_magic('bash', '', '\nfor file in zr1394_2_*; do\n cat $file >> ${file/_s*_R1/}\ndone\n') # In[131]: get_ipython().run_cell_magic('bash', '', '\nfor file in zr1394_3_*; do\n cat $file >> ${file/_s*_R1/}\ndone\n') # In[132]: get_ipython().run_cell_magic('bash', '', '\nfor file in zr1394_4_*; do\n cat $file >> ${file/_s*_R1/}\ndone\n') # In[133]: get_ipython().run_cell_magic('bash', '', '\nfor file in zr1394_5_*; do\n cat $file >> ${file/_s*_R1/}\ndone\n') # In[134]: get_ipython().run_cell_magic('bash', '', '\nfor file in zr1394_6_*; do\n cat $file >> ${file/_s*_R1/}\ndone\n') # In[135]: get_ipython().run_cell_magic('bash', '', '\nfor file in zr1394_7_*; do\n cat $file >> ${file/_s*_R1/}\ndone\n') # In[136]: get_ipython().run_cell_magic('bash', '', '\nfor file in zr1394_8_*; do\n cat $file >> ${file/_s*_R1/}\ndone\n') # In[137]: get_ipython().run_cell_magic('bash', '', '\nfor file in zr1394_9_*; do\n cat $file >> ${file/_s*_R1/}\ndone\n') # In[138]: get_ipython().run_cell_magic('bash', '', '\nfor file in zr1394_10_*; do\n cat $file >> ${file/_s*_R1/}\ndone\n') # In[139]: get_ipython().run_cell_magic('bash', '', '\nfor file in zr1394_11_*; do\n cat $file >> ${file/_s*_R1/}\ndone\n') # In[140]: get_ipython().run_cell_magic('bash', '', '\nfor file in zr1394_12_*; do\n cat $file >> ${file/_s*_R1/}\ndone\n') # In[141]: get_ipython().run_cell_magic('bash', '', '\nfor file in zr1394_13_*; do\n cat $file >> ${file/_s*_R1/}\ndone\n') # In[142]: get_ipython().run_cell_magic('bash', '', '\nfor file in zr1394_14_*; do\n cat $file >> ${file/_s*_R1/}\ndone\n') # In[143]: get_ipython().run_cell_magic('bash', '', '\nfor file in zr1394_15_*; do\n cat $file >> ${file/_s*_R1/}\ndone\n') # In[144]: get_ipython().run_cell_magic('bash', '', '\nfor file in zr1394_16_*; do\n cat $file >> ${file/_s*_R1/}\ndone\n') # In[145]: get_ipython().run_cell_magic('bash', '', '\nfor file in zr1394_17_*; do\n cat $file >> ${file/_s*_R1/}\ndone\n') # In[146]: get_ipython().run_cell_magic('bash', '', '\nfor file in zr1394_18_*; do\n cat $file >> ${file/_s*_R1/}\ndone\n') # In[147]: get_ipython().run_cell_magic('bash', '', '\nls -lh zr1394_{1..18}.fastq.gz\n') # ### Concatenate sets of s4, s5, & s6 of FASTQ files for each individual # ##### The commands below use a for loop to: # 1. process the s4, s5, & s6 FASTQ corresponding to an individual (zr1394_1_s{4..6}*) # 2. concatenate each file (cat \$file) to the designated output file (\${file/_s*_R1/_s456}) # # The output file is named using bash parameter expansion. It takes the file name ($file) and replaces the designated matching text (_s*_R1) with whatever follows the last slash - in this case, it's replaced with "_s456". # In[148]: get_ipython().run_cell_magic('bash', '', '\nfor file in zr1394_1_s{4..6}*; do\n cat $file >> ${file/_s*_R1/_s456}\ndone\n') # In[149]: get_ipython().run_cell_magic('bash', '', '\nfor file in zr1394_2_s{4..6}*; do\n cat $file >> ${file/_s*_R1/_s456}\ndone\n') # In[150]: get_ipython().run_cell_magic('bash', '', '\nfor file in zr1394_3_s{4..6}*; do\n cat $file >> ${file/_s*_R1/_s456}\ndone\n') # In[151]: get_ipython().run_cell_magic('bash', '', '\nfor file in zr1394_4_s{4..6}*; do\n cat $file >> ${file/_s*_R1/_s456}\ndone\n') # In[152]: get_ipython().run_cell_magic('bash', '', '\nfor file in zr1394_5_s{4..6}*; do\n cat $file >> ${file/_s*_R1/_s456}\ndone\n') # In[153]: get_ipython().run_cell_magic('bash', '', '\nfor file in zr1394_6_s{4..6}*; do\n cat $file >> ${file/_s*_R1/_s456}\ndone\n') # In[154]: get_ipython().run_cell_magic('bash', '', '\nfor file in zr1394_7_s{4..6}*; do\n cat $file >> ${file/_s*_R1/_s456}\ndone\n') # In[155]: get_ipython().run_cell_magic('bash', '', '\nfor file in zr1394_8_s{4..6}*; do\n cat $file >> ${file/_s*_R1/_s456}\ndone\n') # In[156]: get_ipython().run_cell_magic('bash', '', '\nfor file in zr1394_9_s{4..6}*; do\n cat $file >> ${file/_s*_R1/_s456}\ndone\n') # In[157]: get_ipython().run_cell_magic('bash', '', '\nfor file in zr1394_10_s{4..6}*; do\n cat $file >> ${file/_s*_R1/_s456}\ndone\n') # In[158]: get_ipython().run_cell_magic('bash', '', '\nfor file in zr1394_11_s{4..6}*; do\n cat $file >> ${file/_s*_R1/_s456}\ndone\n') # In[159]: get_ipython().run_cell_magic('bash', '', '\nfor file in zr1394_12_s{4..6}*; do\n cat $file >> ${file/_s*_R1/_s456}\ndone\n') # In[160]: get_ipython().run_cell_magic('bash', '', '\nfor file in zr1394_13_s{4..6}*; do\n cat $file >> ${file/_s*_R1/_s456}\ndone\n') # In[161]: get_ipython().run_cell_magic('bash', '', '\nfor file in zr1394_14_s{4..6}*; do\n cat $file >> ${file/_s*_R1/_s456}\ndone\n') # In[162]: get_ipython().run_cell_magic('bash', '', '\nfor file in zr1394_15_s{4..6}*; do\n cat $file >> ${file/_s*_R1/_s456}\ndone\n') # In[163]: get_ipython().run_cell_magic('bash', '', '\nfor file in zr1394_16_s{4..6}*; do\n cat $file >> ${file/_s*_R1/_s456}\ndone\n') # In[164]: get_ipython().run_cell_magic('bash', '', '\nfor file in zr1394_17_s{4..6}*; do\n cat $file >> ${file/_s*_R1/_s456}\ndone\n') # In[165]: get_ipython().run_cell_magic('bash', '', '\nfor file in zr1394_18_s{4..6}*; do\n cat $file >> ${file/_s*_R1/_s456}\ndone\n') # In[166]: ls -lh zr1394_*_s456.fastq.gz | sort