Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error of read.table when spaces are present in columns, (" (1 of many)" mention cases) #1

Open
sebriq opened this issue Sep 7, 2018 · 0 comments

Comments

@sebriq
Copy link

sebriq commented Sep 7, 2018

Error of read.table in server.R; due to the presence of spaces in upstream_gene_symbol and as_gene_symbol columns; where and when " (1 of many)" mention is added.

procedure to find the error's cause.

Rscript app.R -c ~/Bureau/projets/RegenLink/2018/DiffContigsInfos.tsv -s ~/Bureau/projets/RegenLink/2018/sample_conditions_full.tsv

Listening on http://0.0.0.0:8080
Warning: Error in scan: la ligne 125 n'avait pas 57 éléments
55: scan
54: read.table
53: loadContigsfile [/home/seb/Bureau/projets/RegenLink/2018/dekupl-viewer/src/server.R#11]
52: server [/home/seb/Bureau/projets/RegenLink/2018/dekupl-viewer/src/server.R#22]
Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec, :
la ligne 125 n'avait pas 57 éléments

cat ~/Bureau/projets/RegenLink/2018/DiffContigsInfos.tsv | sed -e 's/(//' | sed -e 's/)//' > DiffContigTest.tsv # remove first double parenthesis

Warning: Error in scan: la ligne 125 n'avait pas 57 éléments
55: scan
54: read.table
53: loadContigsfile [/home/seb/Bureau/projets/RegenLink/2018/dekupl-viewer/src/server.R#11]
52: server [/home/seb/Bureau/projets/RegenLink/2018/dekupl-viewer/src/server.R#22]
Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec, :
la ligne 125 n'avait pas 57 éléments

-> Not due to the parenthesis itself

cat ~/Bureau/projets/RegenLink/2018/DiffContigsInfos.tsv | sed -e 's/ (1 of many)/_(1_of_many)/' > DiffContigTest.tsv # remove all spaces

~/Bureau/projets/RegenLink/2018/dekupl-viewer/src$ Rscript app.R -c ./DiffContigTest.tsv -s ~/Bureau/projets/RegenLink/2018/sample_conditions_full.tsv

Warning: Error in scan: la ligne 2543 n'avait pas 57 éléments
55: scan
54: read.table
53: loadContigsfile [/home/seb/Bureau/projets/RegenLink/2018/dekupl-viewer/src/server.R#11]
52: server [/home/seb/Bureau/projets/RegenLink/2018/dekupl-viewer/src/server.R#22]
Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec, :
la ligne 2543 n'avait pas 57 éléments

-> report the error to line 2543 containing the next " (1 of many)" mention.

-> so the error seems to be due to read.table which doesn't like the spaces in a tsv without quotes.

The simpler solution is to add "sep = "\t"" to the read.table function.
This correction seems to work in my case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant