Re: Help with queries. - Mailing list pgsql-sql

From Oliveiros d'Azevedo Cristina
Subject Re: Help with queries.
Date
Msg-id 13622609C3E64F38B9187B90F12F3049@marktestcr.marktest.pt
Whole thread Raw
In response to Help with queries.  (Adrian Johnson <oriolebaltimore@gmail.com>)
Responses Re: Help with queries.  (Adrian Johnson <oriolebaltimore@gmail.com>)
List pgsql-sql
Howdy, Adrian,
Please see my questions below

> snps table
>
> id   |   sample_id | chromosome | from  | to |
> ----------------------------------------------------------------
> 1         1                chr1             10       11
> 2          1              chr1               14       15
> 3          2              chr1               14       15
> 4         2               chr1                9         10
> 5         3              chr1                14        15
> 6          3             chr14              35        36
> 7          3             chr14              39        40
> 8          2             chr14              39        40
> 9          2             chr14              43        44
> 10        1             chr14              43        44
>
>
> gene table:
>
> id |   chromosome | from | to  | genename
> 1         chr1            4       20    SRC
> 2         chr1           25      45    SRC
> 3         chr1           80      100   CSK
> 4         chr1          120     140   CSK
>
> My aim is to for a gene in gene table (SRC that has two ranges 4-20 and 
> 25-45),
> I want to map all coordinates in snps table.

Please advice me,
What do you call coordinates to, exactly? Sorry, my genetics knowledge is 
very poor.
You call the from and to fields coordinates?
Do they have the same meaning as the from and to fields from table snps ?
What does it mean to map all coordinates in table snps?
Do you wanna know which  entries from snps map in the SRC gene?
Coordinates are the segment where the gene/sample fit in the chromosome? Is 
my understanding correct ?

> Then I want to get those entries where sample 1 and sample 2 have in
> common and sample 1 and sampl3 in common.
>

Could you give an example of your desired output, for the data you have ?

>
> I do not know how to get these entries. Could any one help me please.
>
> thank you.
>
> adrian
>

Best,
Oliver

> -- 
> Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql 



pgsql-sql by date:

Previous
From: Adrian Johnson
Date:
Subject: Help with queries.
Next
From: Joshua Gooding
Date:
Subject: available RPM package for 8.4.4?