我决定使用Pandas进行一些数据分析,并使用使用 sqlite3 语法的组合sqldf库。问题是我收到了一个非 discript 错误。我认为这是我的 sql 语法,但没有什么让我眼前一亮。
错误:
Error on sql SELECT u.chromosome, u.transcript_affected, u.ensembl_gene_id, u.gene_name ,u.strand, s.transcript_affected, s.ensembl_gene_id, s.gene_name FROM utr_file u INNER JOIN ssm_file s ON u.chromosome= s.chromosome AND u.strand = s.chromosome_strand WHERE s.chromosome_start BETWEEN u.start AND u.end ORDER BY u.chromosome;
SQL 行(也在上面的错误中):
q = ''' SELECT u.chromosome, u.transcript_affected, u.ensembl_gene_id, u.gene_name ,u.strand, s.transcript_affected, s.ensembl_gene_id, s.gene_name FROM utr_file u INNER JOIN ssm_file s ON u.chromosome= s.chromosome AND u.strand = s.chromosome_strand WHERE s.chromosome_start BETWEEN u.start AND u.end ORDER BY u.chromosome;'''
qsubset= sqldf(q,globals())
目标: 我试图确定 ssm_file 中的突变(按位置)与 utr_file 中的突变匹配(在开始和结束之间)。我还需要先通过染色体和链进行匹配。
示例 utr 文件:
chromosome start end gene_name strand
0 chr1 67208778 67210768 NM_032291_utr3_24_0_chr1_67208779_f +
1 chr1 48998526 48999844 NM_032785_utr3_0_0_chr1_48998527_r -
2 chr1 16785385 16786584 NM_018090_utr3_7_0_chr1_16785386_f +
3 chr1 33585783 33585995 NM_052998_utr3_11_0_chr1_33585784_f +
4 chr1 16785385 16786584 NM_001145278_utr3_7_0_chr1_16785386_f +
示例 ssm_file:
chromosome chromosome_start chromosome_strand transcript_affected \
0 chr1 100951090 + ENSG00000079335
1 chr1 100951090 + ENSG00000079335
2 chr1 100951090 + ENSG00000079335
3 chr1 100951090 + ENSG00000079335
4 chr1 100951090 + ENSG00000079335
ensembl_gene_id gene_name
0 ENST00000544534 CDC14A
1 ENST00000542213 CDC14A
2 ENST00000370125 CDC14A
3 ENST00000361544 CDC14A
4 ENST00000336454 CDC14A