z0on / GO_MWU

Rank-based Gene Ontology analysis of gene expression data
37 stars 17 forks source link

unrecognized division: Error in file(file, "rt") : cannot open the connection #19

Closed marwa38 closed 1 year ago

marwa38 commented 1 year ago

Hi could you please advise why I might be getting this error? I copied the .csv in both code_notes and MicrobiomeMS folders. Thanks in advance

# Edit these to match your data file names: 
input="new_magenta_kme_GOMWU.csv" 
#two columns of comma-separated values: gene id, continuous measure of significance. To perform standard GO enrichment analysis based on Fisher's exact test, use binary measure (0 or 1, i.e., either sgnificant or not).
goAnnotations="annos.tab" 
#two-column, tab-delimited, one line per gene, multiple GO terms separated by semicolon. If you have multiple lines per gene, use nrify_GOtable.pl prior to running this script.
goDatabase="go.obo" 
#download from http://www.geneontology.org/GO.downloads.ontology.shtml
goDivision="BP" 
#either MF, or BP, or CC

source("code_notes/MicrobiomeMS/gomwu.functions.R")

perlPath="/home/r01mt19/Documents/NP_papers/network_intergrative/NP_intesParts/code_notes/gomwu_a.pl"

gomwuStats(input, goDatabase, goAnnotations, goDivision,
    perlPath=perlPath, # replace with full path to perl executable if it is not in your system's PATH already
    largest=0.1,  # a GO category will not be considered if it contains more than this fraction of the total number of genes
    smallest=5,   # a GO category should contain at least this many genes to be considered
    clusterCutHeight=0.25, # threshold for merging similar (gene-sharing) terms. 
    #   Alternative="g" # by default the MWU test is two-tailed; specify "g" or "l" of you want to test for "greater" or "less" instead. 
    Module=TRUE,Alternative="g" # un-remark this if you are analyzing a SIGNED WGCNA module (values: 0 for not in module genes, kME for in-module genes). In the call to gomwuPlot below, specify absValue=0.001 (count number of "good genes" that fall into the module)
    # Module=TRUE # un-remark this if you are analyzing an UNSIGNED WGCNA module 
)

./gomwu_a.pl go.obo annos.tab new_magenta_kme_GOMWU.csv BP largest=0.1 smallest=5 cutHeight=0.25

Run parameters:

  largest GO category as fraction of all genes (largest)  : 0.1
smallest GO category as # of genes (smallest)  : 5
clustering threshold (clusterCutHeight) : 0.25

unrecognized division: new_magenta_kme_GOMWU.csv
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
  In file(file, "rt") :
getwd()
/home/r01mt19/Documents/NP_papers/network_intergrative/NP_intesParts/
marwa38 commented 1 year ago
          Hmm. This does look strange. Are you Windows? If yes, do you have perl? If not, install it and specify the path to it as perlPath argument in the call to gomwuStats. 

If you are a Mac or Linux with build-in perl, let me know, I'll try to think of something else...

_Originally posted by @z0on in https://github.com/z0on/GO_MWU/issues/2#issuecomment-392934621_

What about using the terminal in Ubuntu? (i have perl installed already)

marwa38 commented 1 year ago
          Hello - sorry about the delayed response, I am traveling -  looks like the package is missing some of its files. Everything, including package files and your input files, should be in the same directory, and that directory must be the working directory in R. I feel this is what is causing problems?

Misha

On Mar 14, 2022, at 10:48 AM, UsernameUrie @.***> wrote:

Hello,

I used these scripts on my own data several times, but since I got a new computer, I don't seem to be able to run it successfully. I tried with the data from heat.csv, without ANY modification once I saw it did not work with mine but the issu stays the same : error in file(file, “rt”) : cannot open the connection I assume the following message : cannot open file 'dissim0_MF_amil_defog_iso2go.tab': No such file or directory is just a consequence from the connection issu. I checked my Perl path, but I don't think it's the issue as Perl is installed in my C: drive and all the data is in my working directory (I checked). I tried to re-install all files to restart with clean files but it did not help.

Could you help me with this issue ?

Here's the code but as it is yours I'm not sure it's useful:

Edit these to match your data file names:

input="heats.csv" # two columns of comma-separated values: gene id, continuous measure of significance. To perform standard GO enrichment analysis based on Fisher's exact test, use binary measure (0 or 1, i.e., either sgnificant or not). goAnnotations="amil_defog_iso2go.tab" # two-column, tab-delimited, one line per gene, multiple GO terms separated by semicolon. If you have multiple lines per gene, use nrify_GOtable.pl prior to running this script. goDatabase="go.obo" # download from http://www.geneontology.org/GO.downloads.ontology.shtml goDivision="MF" # either MF, or BP, or CC source("gomwu.functions.R")

gomwuStats(input, goDatabase, goAnnotations, goDivision, perlPath="perl", # replace with full path to perl executable if it is not in your system's PATH already largest=0.1, # a GO category will not be considered if it contains more than this fraction of the total number of genes smallest=5, # a GO category should contain at least this many genes to be considered clusterCutHeight=0.25, # threshold for merging similar (gene-sharing) terms. See README for details.

Alternative="g" # by default the MWU test is two-tailed; specify "g" or "l" of you want to test for "greater" or "less" instead.

Module=TRUE,Alternative="g" # un-remark this if you are analyzing a SIGNED WGCNA module (values: 0 for not in module genes, kME for in-module genes). In the call to gomwuPlot below, specify absValue=0.001 (count number of "good genes" that fall into the module)

Module=TRUE # un-remark this if you are analyzing an UNSIGNED WGCNA module

) — Reply to this email directly, view it on GitHub https://github.com/z0on/GO_MWU/issues/10, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZUHGHZTFR7E2JFZGPS4T3U74DOFANCNFSM5QU7EHLQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you are subscribed to this thread.

_Originally posted by @z0on in https://github.com/z0on/GO_MWU/issues/10#issuecomment-1182872106_

quick note that I added the .pl file in the working directory along with all my files but not on the system PATH - please check codes for details. Thanks again

z0on commented 1 year ago

Hi Marwa - Looks like it cannot find your input file. Try putting your input files (measure of interest and annotations) into the same directory as all the GO_MWU scripts, functions, and go.obo, setwd to this directory, and run it from there. Cheers Misha

On Wed, Jul 19, 2023 at 12:34 PM Marwa @.***> wrote:

Hi could you please advise why I might be getting this error? I copied the .csv in both code_notes and MicrobiomeMS folders. Thanks in advance

Edit these to match your data file names:

input="new_magenta_kme_GOMWU.csv"

two columns of comma-separated values: gene id, continuous measure of significance. To perform standard GO enrichment analysis based on Fisher's exact test, use binary measure (0 or 1, i.e., either sgnificant or not).

goAnnotations="annos.tab"

two-column, tab-delimited, one line per gene, multiple GO terms separated by semicolon. If you have multiple lines per gene, use nrify_GOtable.pl prior to running this script.

goDatabase="go.obo"

download from http://www.geneontology.org/GO.downloads.ontology.shtml

goDivision="BP"

either MF, or BP, or CC

source("code_notes/MicrobiomeMS/gomwu.functions.R")

perlPath="/home/r01mt19/Documents/NP_papers/network_intergrative/NP_intesParts/code_notes/gomwu_a.pl"

gomwuStats(input, goDatabase, goAnnotations, goDivision, perlPath=perlPath, # replace with full path to perl executable if it is not in your system's PATH already largest=0.1, # a GO category will not be considered if it contains more than this fraction of the total number of genes smallest=5, # a GO category should contain at least this many genes to be considered clusterCutHeight=0.25, # threshold for merging similar (gene-sharing) terms.

Alternative="g" # by default the MWU test is two-tailed; specify "g" or "l" of you want to test for "greater" or "less" instead.

Module=TRUE,Alternative="g" # un-remark this if you are analyzing a SIGNED WGCNA module (values: 0 for not in module genes, kME for in-module genes). In the call to gomwuPlot below, specify absValue=0.001 (count number of "good genes" that fall into the module)

Module=TRUE # un-remark this if you are analyzing an UNSIGNED WGCNA module

)

./gomwu_a.pl go.obo annos.tab new_magenta_kme_GOMWU.csv BP largest=0.1 smallest=5 cutHeight=0.25

Run parameters:

largest GO category as fraction of all genes (largest) : 0.1 smallest GO category as # of genes (smallest) : 5 clustering threshold (clusterCutHeight) : 0.25

unrecognized division: new_magenta_kme_GOMWU.csv Error in file(file, "rt") : cannot open the connection In addition: Warning message: In file(file, "rt") :

— Reply to this email directly, view it on GitHub https://github.com/z0on/GO_MWU/issues/19, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZUHGFOCLWUARFBXIHU45LXRALDRANCNFSM6AAAAAA2QIGTOU . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- cheers Misha matzlab.weebly.com

marwa38 commented 1 year ago

working fine thanks Misha 💯