Question: analyze and compare PValues in 2 csv file by python
gravatar for ali.hakimzadeh
19 months ago by
ali.hakimzadeh10 wrote:

Hi all,

I am doing an RNA-seq analysis. I have two CSV files, and I want to get a set of data of my genes during P Values to know which genes in each CSV file are up regulated. EdgeR achieves the tables in differential gene expression in R studio, and the script is written down. I use the codes for both tables that I have for gene counts achieved by ht-seq. At frist i want to know which genes are common among two tables and then use a python script to build a set or table to tell me which genes in each table are up regulated and which are not from the mutual ones that i find. The P value that i consider is < 5% . How can I do it by python? Also there is a point that i have to mention that the genes orders(first column) in the tables are not the same and they are different!


group <- factor(c(rep("pro-vaccine",30),rep("pre_vaccine",20)))
y<-DGEList(counts = x, group=group)
lrt<-glmLRT(fit,coef = 2)
deg <-topTags(lrt, n = Inf , p= 0.05)$table
up <-deg[deg$logFC > 0,]
down <-deg[deg$logFC < 0,]
write.csv(up, file="up.csv")
write.csv(down, file="down.csv")

Here is also my tables shapes in R studio:


Thanks in advance

rna-seq csv python • 669 views
ADD COMMENTlink modified 18 months ago by Biostar ♦♦ 20 • written 19 months ago by ali.hakimzadeh10

Why do you need to use python? If you're reading files into R, why not use R to compare columns of a data.frame to achieve what you need?

ADD REPLYlink written 19 months ago by _r_am32k

the problem is i am not a R programmer and i am not into that! i just use this package because i am stimulating an article process! that is also why i want to compare two tables which is mine and them!

ADD REPLYlink written 19 months ago by ali.hakimzadeh10

In that case, I'd recommend you read up on pandas and use that to compare/manipulate your datasets.

Also, in this case, the R code you supplied has nothing to do with the exercise, as you merely need to understand how to work with tabular data/CSV files in python.

ADD REPLYlink modified 19 months ago • written 19 months ago by _r_am32k

i saw the suggestions are toward pandas but i couldn't adopt what i want in the exercise by pandas but as it seems the only solution is to do it! the code is just to show what i use to create for my tables! that is it!

ADD REPLYlink written 19 months ago by ali.hakimzadeh10

Yes, you're going to have to learn one technology or the other.

A side note: Use the ! mark judiciously. It can make sentences appear quite prickly when used improperly or overused.

ADD REPLYlink written 19 months ago by _r_am32k

thanks anyway. i didn't mean anything by "!". pardon me if you i irritate you by that.

ADD REPLYlink written 19 months ago by ali.hakimzadeh10

No problem, it's just quirks with language usage.

ADD REPLYlink written 19 months ago by _r_am32k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1217 users visited in the last hour