[Baypiggies] Fwd: manipulating lists question

Mark Voorhies mvoorhie at yahoo.com
Thu Dec 5 18:16:50 CET 2013


On 12/05/2013 02:11 AM, Vikram K wrote:
> i am having some difficulty in applying this to my actual problem although
> i love the dictionary method. Imagine the following three lists are the
> first, second and third elements of a larger list:
>
>>>> comp[6]
> ['6558', 'NM_001046.2', 'SLC12A2', '6037226', '2', 'chr5', '127502453',
> '127502454', 'het-ref', 'snp', 'A', 'T', 'A', '185', '113', '184', '112',
> 'VQHIGH', 'VQHIGH', '', '', '', '', '259974', '9', '6', '6', '15',
> '6558:NM_001046.2:SLC12A2:CDS:MISSENSE',
> '6558:NM_001046.2:SLC12A2:CDS:NO-CHANGE', 'PFAM:PF01490:Aa_trans', '', '',
> '', '0.99', '2', '0.99', '0.998', '1.01', '1.000', '0.5', '0.46', '0.5',
> '1', '18', '18', '19', 'ref-identical;onlyA', 'snp', '0.072', '-1',
> 'SQHIGH']
<snip>

This looks like the result of a SQL query on a database of SNPs.
If so, you can ask the database to solve your de-duplication problem
for you.  E.g., with a MySQL query like:

SELECT id, GROUP_CONCAT(DISTINCT accession), GROUP_CONCAT(DISTINCT name), etc
FROM ...
WHERE ...
GROUP BY id;

You can almost always get a more useful result by including more context in your query.

--Mark


More information about the Baypiggies mailing list