removing elements from a list of genes
<p>I have a list like this:</p>

<pre><code>['&gt;ENST00000262144 cds:known chromosome:GRCh37:16:74907468:75019046:-1 gene:ENSG00000103091 gene_biotype:protein_coding transcript_biotype:protein_coding', 
 '&gt;ENST00000446813 cds:known chromosome:GRCh37:7:72349936:72419009:1 gene:ENSG00000196313 gene_biotype:protein_coding transcript_biotype:protein_coding']
</code></pre>

<p>I want to make a new list with the same dimension and order but in the new list I will keep only gene id. the results would be like this:</p>

<pre><code>['ENSG00000103091', 'ENSG00000196313']
</code></pre>

<p>I am using python. do you guys know how to do that? thanks</p>

<pre><code>For each string in the list:
    Split the string on spaces (Python **split** command)
    Find the element starting with "gene:"
    Keep the rest of the string (grab the slice [5:] of that element)
</code></pre>

<p>Do you have enough basic Python knowledge to take it from there?  If not, I suggest that you consult the <a href="https://docs.python.org/release/2.5.2/lib/string-methods.html" rel="nofollow">string method documentation</a>.</p>

python