title: Removing columns from a txt file
body: <p>I'm a beginner in Python and I'm a bit stuck on a trivial problem. I would like to remove some columns and strings from a text file. It is tab separated.
  The first file is called A.txt</p>
  
  <pre><code>chr1_1792868_SNP    Bcin01g04980    NON_SYNONYMOUS  NON_SYNONYMOUS[T](gene:Bcin01g04980|transcript:Bcin01g04980.1|P-&gt;S:225) C   T   C/C C/C C/C C/C C/C C/T 234 233 232 219 233 221 234 233 232 219 233 23  0   0   0   0   0   198
  </code></pre>
  
  <p>And the output file (let's call it B.txt) should be like :</p>
  
  <pre><code>1   1792868 Bcin01g04980    C   T   C/C C/C C/C C/C C/C C/T 234 233 232 219 233 221 234 233 232 219 233 23  0   0   0   0   0   198
  </code></pre>
  
  <p>So it would be to perform different operations:</p>
  
  <ul>
  <li>Remove the "chr" and "_" strings of the first column</li>
  <li>Split the 1 after "chr" and the number after in 2 different columns</li>
  <li>Remove all the columns 3 and 4 </li>
  </ul>
  
  <p>I tried so far to do :</p>
  
  <pre><code>with  open ('A.txt', 'r') as mutmut_mutants:
          dble_mut = csv.reader(mutmut_mutants, delimiter='\t')
          with open('B.txt', 'w+') as mutants_coo:
              mut_coo= csv.writer(mutants_coo)
              for i in dble_mut:
                  del i[2]
                  del i[3]
                  mut_coov.writerow( i )
  </code></pre>
  
  <p>But, big surprise, it's not working. And I'm not splitting the first string in 2 columns. Anyone has an idea on how to proceed?</p>
  
  <p>Thanks a lot!</p>