I am not able to let R read my file
0
0
Entering edit mode
3.7 years ago

I proceed to import this alignment file to save it into a variable in R

x <- read.alignment("humanSeqAligned.fasta", "fasta")

and I get this error:

Error in read.alignment("humanSeqAligned.fasta",  : 
  File humanSeqAligned.fasta is not readable
Execution halted

Can anyone tell me what I am doing wrong?

R fasta • 3.4k views
ADD COMMENT
0
Entering edit mode

It looks like you might have two different quotation mark types in your command ( versus "). Try manually typing the command into your terminal instead of copy-pasting it from somewhere if you did so.

ADD REPLY
0
Entering edit mode

Python code above is not writing an aligned file. Why are you trying to read it as an alignment?

ADD REPLY
0
Entering edit mode

Sorry i did an alignment on my terminal already.

ADD REPLY
0
Entering edit mode

Then please remove the python code in original question. It is not related to issue you are experiencing.

ADD REPLY
0
Entering edit mode

Okay fixed the question and fix what rpolicastro suggested to do. Now I have updated the question with what R is telling me.

ADD REPLY
0
Entering edit mode

Is the file in the same working directory as R? You can check the R working directory with getwd(), and list the files with list.files().

ADD REPLY
0
Entering edit mode

Are you able to view the file with less/cat? Is it in the current working directory?

ADD REPLY
0
Entering edit mode

Yes I able to run less -S humanSeqAlign.Fasta in the working directory and im able to see all of the ids and base pairs in this file. Which makes me confused on why is not being read through R.

ADD REPLY
0
Entering edit mode

Is your file in one of the following alignment formats?

Read a file in mase, clustal, phylip, fasta or msf format

Can you show us head -5 yourfile?

ADD REPLY
0
Entering edit mode

Is in a fasta format. Is a long file but when I run head -5.

>NC_001643.1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------GTTTATGTAGCTTACCCCCTCAAAGCAATACACTGAAAATGTTTCGACGGGTTTACATCACCCCATAAACAAACAGGTTTGGTCCTAGCCTTTCTATTAGCTCTTAGTAAGATTACACATGCAAGCATCCCCG-CCCCGTGAG-TCACCCTCTAAATCGCCATGATCAAAAGGAACAAGTATCAAGCACGCAGCAATGCAGCTCAAAACGCTTAGCCTAGCCACACCCCCACGGGAGACAGCAGTGATAAACCTTTAGCAATAAACGAAAGTTTAACTAAGCCATACTAACCTCAGGGTTGGTCAATTTCGTGCTAGCCACCGCGGTCATACGATTAACCCAAGTCAATAGAAACCGGCGTAAAGAGTGTTTTAGATCACC-----CCCCCATAAAGCTAAAATTCACCTGAGTTGTAAAAAACTCCAGCTGATACAAAATAAACTACGAAAGTGGCTTTAACACATCTGAATACACAATAGCTAAGACCCAAACTGGGATTAGATACCCCACTATGCTTAGCCCTAAACTTCAACAGTTAAATTAACAAAACTGCTCGCCAGAACACTACGAGCCACAGCTTAAAACTCAAAGGACCTGGCGGTGCTTCATATCCCTCTAGAGGAGCCTGTTCTGTAATCGATAAACCCCGATCAACCTCACCGCCTCTTGCTCAGCCTATATACCGCCATCTTCAGCAAACCCTGATGAAGGTTACAAAGTAAGCACAAGTACCCACGTAAAGACGTTAGGTCAAGGTGTAGCCTATGAGGTGGCAAGAAATGGGCTACATTTTCTACCCCAGAAAATTACGATAACCCTTATGAAACCTAAGGGTCAAAGGTGGATTTAGCAGTAAACTAAGAGTAGAGTGCTTAGTTGAACAGGGCCCTGAAGCGCGTACACACCGCCCGTCACCCTCCTCAAGTATACTTCAAAGGATACTTAACTTAAACCCCCTACGTATTTATATAGAGGAGATAAGTCGTAACATGGTAAGTGTACTGGAAAGTGCACTTGGACGAACCAGAGTGTAGCTTAACATAAAGCACCCAACTTACACTTAGGAGATTTCAACTCAACTTGACCACTCTGAGCCAAACCTAGCCCCAAACCCCCTCCACCCTACTACCAAACAACCTTAACCAAACCATTTACCCAAATAAAGTATAGGCGATAGAAATTGTAAACCGGCGCAATAGACATAGTACCGCAAGGGAAAGATGAAAAATTATACCCAAGCATAATACAGCAAGGACTAACCCCTGTACCTTTTGCATAATGAATTAACTAGAAATAACTTTGCAAAGAGAACCAAAGCTAAGACCCCCGAAACCAGACGAGCTACCTAAGAACAGCTAAAAGAGCACACCCGTCTATGTAGCAAAATAGTGGGAAGATTTATAGGTAGAGGCGACAAACCTACCGAGCCTGGTGATAGCTGGTTGTCCAAGATAGAATCTTAGTTCAACTTTAAATTTACCTACAGAACCCTCTAAATCCCCTTGTAAACTTAACTGTTAGTCCAAAGAGGAACAGCTCTTTAGACACTAGGAAAAAACCTTGTAAAGAGAGTAAAAAATTTAACACCCATAGTAGGCCTAAAAGCAGCCACCAATTAAGAAAGCGTTCAAGCTCAACACCCACAACCT-TAAAGATCCCAAACATACAACCGAACTCCTTACACCCAATTGGACCAATCTATTACCCCATAGAAGAACTAATGTTAGTATAAGTAACATGAAAACATTCTCCTCCGCATAAGCCTACATCAGACCAAAATATTAAACTGACAATTAACAGCCTAATATCTACAATCAACCAACAAGCCATTATTACCCCCGCTGTTAACCCAACACAGGCATGCCCACAAGGAAAGGTTAAAAAAAGTAAAAGGAACTCGGCAAATCTTACCCCGCCTGTTTACCAAAAACATCACCTCTAGCATTACCAGTATTAGAGGCACCGCCTGCCCGGTGACATATGTTTAACGGCCGCGGTACCCTAACCGTGCAAAGGTAGCATAATCACTTGTTCCTTAAATAGGGACTTGTATGAATGGCTCCACGAGGGTTTAGCTGTCTCTTACTTTCAACCAGTGAAATTGACCTACCCGTGAAGAGGCGGGCATAACATAACAAGACGAGAAGACCCTATGGAGCTTTAATTCATTAATGCAAACAATACTTAACAAACCTACAGGTCCTAAACTATTAAACCTGCATTAAAAATTTCGGTTGGGGCGACCTCGGAGCACAACCCAACCTCCGAGCAATACATGCTAAGACCTCACCAGTCAAAGCGAATTACTACATCCAATTGATCCAATGACTTGACCAACGGAACAAGTTACCCTAGGGATAACAGCGCAATCCTATTCCAGAGTCCATATCAACAATAGGGTTTACGACCTCGATGTTGGATCAGGACATCCCGATGGTGCAGCCGCTATTAAAGGTTCGTTTGTTCAACGATTAAAGTCCTACGTGATCTGAGTTCAGACCGGAGTAATCCAGGTCGGTTTCTATCTGT-TCTAAATTTCTCCCTGTACGAAAGGACAAGAGAAATGAGGCCTACTTCACAAAGCGCCTTCCCCAATAAATGATATTATCTCAATTTAGCGCCATGCCAACACCCACTCAAGAACAGAGTTT-GTTAAGATGGCAGAGCCCGGTAATTGCATAAAACTTAAAACTTTACAATCAGAGGTTCAATTCCTCTTCTTGACAACACACCCATGACCAACCTCCTACTCCTCATTGTACCCATCCTAATCGCAATAGCATTCCTAATGCTAACCGAACGAAAAATTCTAGGCTACATACAACTACGCAAAGGTCCCAACATTGTAGGTCCTTACGGGCTATTACAGCCCTTCGCTGACGCCATAAAACTCTTCACTAAAGAACCCTTAAAACCCTCCACTTCAACCATTACCCTCTACATCACCGCCCCAACCCTAGCCCTCACCATTGCCCTCTTACTATGAACCCCCCTCCCCATACCCAACCCCCTAGTCAATCTTAACTTAGGCCTCCTATTTATTCTAGCCACCTCCAGCCTAGCCGTTTACTCAATCCTCTGATCAGGGTGAGCATCAAACTCGAACTACGCCTTAATCGGTGCACTACGAGCAGTAGCCCAAACAATCTC
ADD REPLY
0
Entering edit mode

aligned fasta format is not the same as plain fasta format. Just making sure. example of an aligned fasta file below

>APE_PIG 
MRVLWVALVVTLLAGCRTEDEPGPPPE.VHVWWEESKWQGSQP.WEQALGRFWDYLRWVQ
SLSDQVQEELLSTKVTQELTELIEESMKEVKAYREELEAQLGPVTQETQARLSKELQAAQ
ARVGADMEDVRNRLVLYRSEVHNMLGQTTEELRSRLASHLRNVRKRLVRDTEDLQKRLAV
YQAGLREGAERSVSALRERLGPLVEQGRLRAATLSTRAGQPLRERAEAWGQKLRGRLEEM
GSRTRDRLDEMRDELEEVRTKVEEQGSQLRLQAEAFQARLKGWFEPLVEDMRRQWAGLVE
RMQSAVSISSSTSA..PSDNQ
>APE_MOUSE 
MKALWAVLLVTLLTGCLA........EGEPEVTDQLEWQSNQP.WEQALNRFWDYLRWVQ
TLSDQVQEELQSSQVTQELTALMEDTMTEVKAYKKELEEQLGPVAEETRARLGKEVQAAQ
ARLGADMEDLRNRLGQYRNEVHTMLGQSTEEIRARLSTHLRKMRKRLMRDAEDLQKRLAV
YKAGAREGAERGVSAIRERLGPLVEQGRQRTANLGAGAAQPLRDRAQAFGDRIRGRLEEV
GNQARDRLEEVREHMEEVRSKMEEQTQQIRLQAEIFQARLKGWFEPIVEDMHRQWANLME
KIQASVATNPII.TPVAQENQ
ADD REPLY
0
Entering edit mode

Is a long file so I can't post the full output.

ADD REPLY
0
Entering edit mode

Here is a better look at some of what was called

ADD REPLY
0
Entering edit mode

As long as all sequences are same length and leading and trailing positions are indicated by tildes (~) and gap positions are indicated by periods (.) you should have the correct format.

ADD REPLY
0
Entering edit mode

Yeah I checked to see if they were all the same length and if there's any suspicious characters, but I couldn't find any.

ADD REPLY
0
Entering edit mode

I accidentally spammed this post which caused it to be removed and for you to be suspended. I approved the post and reinstated you. Sorry!

ADD REPLY
0
Entering edit mode

As mentioned by rpolicastro , make sure the file is present in the R work directory.

ADD REPLY

Login before adding your answer.

Traffic: 1184 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6