Hi my sequence is like tis, i want to remove new line character s between two fasta seq and also want to remove new line character within the sequence.
i have used tr -d '\n' <file name<="" p="">
but the file is not geting modified and saved, also there is no line break between the seq.
>gi|339714733|gb|JK209933.1|JK209933 RIRL_009841 Ralstonia solanacearum challenged root cDNA library of peanut (Arachis hypogaea) Arachis hypogaea cDNA clone ocprra0_0120_C01.ab1, mRNA sequence
GGGGAAGCAGAGGACGGCCATTGAGCAGCCAAACCACCAGCAGCGACAGCGATGGTCCTCAAGACGGAAC
TTTGCCGCTTTAGTGGCGCGAAGATCTACCCTGGGAAGGGCATCAGATTCGTTCGTGGTGATTCTCAGGT
CTTTCTGTTTTCAAACTCGAAATGCAAAAGGTATTTCCACAATCGTTTGAAGCCATCAAAGCTCACATGG
ACTGCCATGTATAGGAAGCAACACAAAAAGGACATTGCTCAAGAAGCTGTGAAGAAGAAGCGTCGTGCTA
CCAAGAAGCCATACTCTAGGTCAATTGTTGGTGCTACCTTGGAAGTTATCCAGAAGAGAAGAACCGAGAA
GCCTGAAGTTAGAGATGCAGCAAGGGAAGCTGCTCTTCGTGAAATTAAAGAGAGGATCAAGAAGACAAAA
GATGAGAAAAAGGCTATGAAGGCAGAGGTATCGGCTAAGCAACAAAAGGCACAGGGCAAAGGCCATGTTA
CAAAGGTTGCTGCACCGAAAGGTCCCAAACTTGGTGGAGGAGGTGGCAAA
>gi|339714732|gb|JK209932.1|JK209932 RIRL_009840 Ralstonia solanacearum challenged root cDNA library of peanut (Arachis hypogaea) Arachis hypogaea cDNA clone ocprra0_0120_B12.ab1, mRNA sequence
GGGGGACCAAGGAGTTCAACTGNGAGTGTGAGTCGTAGCAAAAAAAAAAAAAATTTAAAAAACAAATTTT
AAAAATAAATGCATACGGCGTAACGAAAGTAACTTAACAAAAAAAAAGGTAAGACGTCTTTTTTTTTTTA
AAAAGAGACTCCATTACCGGCCAGCTAGGAACACTGTTGTTTTGACTTAGTGCAATGACCAGTGCTTCTT
TTTTTTTTTTTTTTTTAAAAAAAAAAGAAAGAGTAGTTGAGCTAATGAACATTTTTGTTGAGACCCGAAA
GATGGTGAACTATTCTCGGACATGGTGAAGTCAGGTGAAAACTTGATGGAAGCTTGCGTTGTGAGGAACT
GACGTGCAAATCGTTGCCTCCTGAACTGAGTATAGGGGCGAAAGACTAATCGAACCATCGAGTAGCTGGT
TCTCTCCGAAGTTTCCCTCAGGATAGCTCGAGTCTATTTTTATAGAGTANCATGG
3 answers
linearize http://stackoverflow.com/documentation/bioinformatics/4194/ and then "tr '\t' '\n'"
You have another choice if using Windows. You can install Notepad++ which is a fantastic program with many different uses
One of them is to search and replace ascii codes, (it can use regular expressions)
You can tell the program to use Extended mode and then replace /n/n (which is a double lane carriage ) by a single /n and then your file will be fixed very easily
I am not a Macintosh guy, but I am sure that you can find similar programs
quick perl cross-platform one-liner:
perl -pe 's/[\r\n]//g; s/^(>.+)/$n$1\n/; $n="\n"' test.fasta
it first removes any carriage return present (platform independent), and then it includes line breaks after all and before all-but-first sequence names.
Log in to answer this question.
you could check this post for the second part of your question multiline fasta to one line fasta. for the fisrt part I find a way with sed StackOverflow sed '/^\s*$/d' file.