Answers.Body: <p>The error message is telling you:</p>
  <blockquote>
  <p>&quot;We run script located in folder /root/myfolder . Please, specify ABSOLUTE paths, relative paths do not work for every machine. If everything crashes, please, check the correctness of this path first.&quot;</p>
  </blockquote>
  <p>So it sounds like you simply need to use absolute instead of relative paths. Something like this:</p>
  <pre><code>Rscript /home/yourUser/ClinCNV/clinCNV.R \
      --normal /home/yourUser/myfolder/myfile.cov \
      --out /home/yourUser/myfolder/ \
      --bed /home/yourUser/myfolder/myfileGCannotated.bed \
      --folderWithScript /home/yourUser/ClinCNV/
  </code></pre>
  <p>Also, don't run things as root unless absolutely necessary. if anything goes wrong or if any of your scripts or tools has a bug, you could end up breaking your machine if you run as root.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-01-02T15:41:59.457Z
Answers.LastActivityDate: 2023-01-02T15:41:59.457Z
Answers.UserDisplayName: terdon
Body: <p>I have some problems with ClinCNV(<a href="https://github.com/imgag/ClinCNV" rel="nofollow noreferrer">https://github.com/imgag/ClinCNV</a>):</p>
  <p>I made a BED file from a BAM, then i made a GC count with ngs-bits (link: <a href="https://github.com/imgag/ngs-bits" rel="nofollow noreferrer">https://github.com/imgag/ngs-bits</a> )
  The main idea of redacting a BED file is making GC content, but i think i need to remove all other columns. Here an example:</p>
  <p>My BED:</p>
  <pre><code>chr1    10041   10086   NB501410:34:H23TGAFXY:1:11102:23474:15441/1     0       +       0.4889 
  </code></pre>
  <p>In description says:</p>
  <pre><code>chr1    12171   12245   0.4595 
  </code></pre>
  <p>I tried to run script with my BED file and there is an issue:</p>
  <pre><code> Rscript ClinCNV/clinCNV.R --normal myfolder/myfile.cov --out myfolder/ --bed myfolder/myfileGCannotated.bed --folderWithScript ClinCNV/
  </code></pre>
  <p>and there is an output:</p>
  <pre><code>&quot;We run script located in folder /root/myfolder . Please, specify ABSOLUTE paths, relative paths do not work for every machine. If everything crashes, please, check the correctness of this path first.&quot;
  
  
  [1] &quot;START cluster allocation.&quot;
  
  [1] &quot;Cluster allocated.&quot;
  
  [1] &quot;END cluster allocation.&quot;
  
  [1] &quot;We are started with reading the coverage files and bed files 2023-01-02 13:49:43&quot;
  
  Error in fread(fileName, header = F, stringsAsFactors = F, sep = &quot;\t&quot;) :
    File 'myfolder/myfileGCannotated.bed' does not exist or is non-readable. getwd()=='/root/ClinCNV'
  Calls: ReadFileFast -&gt; as.data.frame -&gt; fread
  Execution halted
  </code></pre>
  <p>Now I started the script with absolute paths and it works but I have a new problem:</p>
  <pre><code>Error in setnames(localDf &lt;- as.data.frame(fread(fileName, skip = 1, header = F,  :
    Can't assign 4 names to a 7 column data.table
  Calls: ReadFileFast -&gt; setnames
  Execution halted
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-01-02T12:23:25.977Z
Comments.Text: Did you try using absolute paths instead of relative ones as the error message says? Something like `Rscript /home/yourUser/ClinCNV/clinCNV.R --normal /home/yourUser/myfolder/myfile.cov --out /home/yourUser/myfolder/ --bed /home/yourUser/myfolder/myfileGCannotated.bed --folderWithScript /home/yourUser/ClinCNV/`?
Comments.UserDisplayName: terdon
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-01-02T12:23:51.297Z
Comments.Text: Also, are you running this as root? Why?
Comments.UserDisplayName: terdon
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-01-02T12:47:10.267Z
Comments.Text: I tried with absolute paths and it works, but i have a new problem, check the question pls
Comments.UserDisplayName: Илья Бетяев
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-01-02T13:00:39.030Z
Comments.Text: `Can't assign 4 names to a 7 column data.table` looks like you need to specify a four column `bed` file
Comments.UserDisplayName: Steve
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-01-02T15:40:20.993Z
Comments.Text: Please don't do that. If the original issue has been solved, then please ask a new question about any further issues.  I will post an answer with the absolute paths.
Comments.UserDisplayName: terdon
Tags: <ngs><bash><bed><coverage>
Title: Problems with BED format for ClinCNV
ThreadText: # Problems with BED format for ClinCNV
  
  (Asked by: username_0 on 2023-01-02)
  
  I have some problems with ClinCNV(<https://github.com/imgag/ClinCNV>):
  
  I made a BED file from a BAM, then i made a GC count with ngs-bits (link: <https://github.com/imgag/ngs-bits> )
  The main idea of redacting a BED file is making GC content, but i think i need to remove all other columns. Here an example:
  
  My BED:
  
  ```
  chr1    10041   10086   NB501410:34:H23TGAFXY:1:11102:23474:15441/1     0       +       0.4889 
  
  ```
  
  In description says:
  
  ```
  chr1    12171   12245   0.4595 
  
  ```
  
  I tried to run script with my BED file and there is an issue:
  
  ```
   Rscript ClinCNV/clinCNV.R --normal myfolder/myfile.cov --out myfolder/ --bed myfolder/myfileGCannotated.bed --folderWithScript ClinCNV/
  
  ```
  
  and there is an output:
  
  ```
  "We run script located in folder /root/myfolder . Please, specify ABSOLUTE paths, relative paths do not work for every machine. If everything crashes, please, check the correctness of this path first."
  
  [1] "START cluster allocation."
  
  [1] "Cluster allocated."
  
  [1] "END cluster allocation."
  
  [1] "We are started with reading the coverage files and bed files 2023-01-02 13:49:43"
  
  Error in fread(fileName, header = F, stringsAsFactors = F, sep = "\t") :
    File 'myfolder/myfileGCannotated.bed' does not exist or is non-readable. getwd()=='/root/ClinCNV'
  Calls: ReadFileFast -> as.data.frame -> fread
  Execution halted
  
  ```
  
  Now I started the script with absolute paths and it works but I have a new problem:
  
  ```
  Error in setnames(localDf <- as.data.frame(fread(fileName, skip = 1, header = F,  :
    Can't assign 4 names to a 7 column data.table
  Calls: ReadFileFast -> setnames
  Execution halted
  
  ```
  
  **Tags:** ngs, bash, bed, coverage
  
  > **Comments:**
  > **username_1**: Did you try using absolute paths instead of relative ones as the error message says? Something like `Rscript /home/yourUser/ClinCNV/clinCNV.R --normal /home/yourUser/myfolder/myfile.cov --out /home/yourUser/myfolder/ --bed /home/yourUser/myfolder/myfileGCannotated.bed --folderWithScript /home/yourUser/ClinCNV/`?  
  > **username_1**: Also, are you running this as root? Why?  
  > **username_0**: I tried with absolute paths and it works, but i have a new problem, check the question pls  
  > **username_2**: `Can't assign 4 names to a 7 column data.table` looks like you need to specify a four column `bed` file  
  > **username_1**: Please don't do that. If the original issue has been solved, then please ask a new question about any further issues.  I will post an answer with the absolute paths.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-01-02. Score: 1 | Accepted answer
  
  The error message is telling you:
  
  > "We run script located in folder /root/myfolder . Please, specify ABSOLUTE paths, relative paths do not work for every machine. If everything crashes, please, check the correctness of this path first."
  
  So it sounds like you simply need to use absolute instead of relative paths. Something like this:
  
  ```
  Rscript /home/yourUser/ClinCNV/clinCNV.R \
      --normal /home/yourUser/myfolder/myfile.cov \
      --out /home/yourUser/myfolder/ \
      --bed /home/yourUser/myfolder/myfileGCannotated.bed \
      --folderWithScript /home/yourUser/ClinCNV/
  
  ```
  
  Also, don't run things as root unless absolutely necessary. if anything goes wrong or if any of your scripts or tools has a bug, you could end up breaking your machine if you run as root.
  
  
  ---
  
  