3

Does anyone know how to get rid of '\r'?

I have to run 89 files in the supercomputer, I have done so far the two next scripts

The first one is .sh to run it on shell

$ID=$(sed "${PBS_ARRAYID}q;d" ID_index.txt)
$echo "Processing $ID"
$python $PBS_O_WORKDIR/script.py $ID

where the ID_index text implies the index from 1 to 89 datafiles

Then I have the next script in python

#!/usr/bin/python

import pandas as pd
import numpy as np
import sys

ID_1 = sys.argv[1]
vcf_info = sample_id + '.snp.INFO'


ID_1 = sys.argv[1]
ID_1_info = ID_1 + 'sample_cases.lgen'
ID_2 = sys.argv[2]
ID_2_info = ID_2 + 'sample_controls.lgen'

# Reading files

df_1 = pd.read_table(ID_1_info, delim_whitespace=True , header=None)
df_2 = pd.read_table(ID_2_info, delim_whitespace=True , header=None)

.
.
.

Because the output link to read the datafiles returns a space, this is the error:

df_1 = pd.read_table(ID_1_info, delim_whitespace=True , header=None) File "pandas/io/parsers.py", line 685, in parser_f return _read(filepath_or_buffer, kwds) File "pandas/io/parsers.py", line 457, in _read parser = TextFileReader(fp_or_buf, **kwds) File "pandas/io/parsers.py", line 895, . . . pandas._libs.parsers.TextReader._setup_parser_source FileNotFoundError: [Errno 2] File b'1\r_sample_cases.lgen' does not exist: b'1\r_sample_cases.lgen'

The original name of the data to read is 1_sample_cases.lgen

How can I remove '\r' or at least replace them that the result looks like the name of the data file? I did read a lot of answers about this, but none helped.

Hopefully someone can help me. Thank you,

Ale.

Ale Lope
  • 33
  • 3

0 Answers0