Question: How to remove special characters from text files?
0
gravatar for nivya.james2016
4 months ago by
nivya.james20160 wrote:

Hi all

I have an miRNA text file (having ~2000 miRNA information) like the following

>hsa-miR-576-3p MIMAT0004796
AAGAUGUGGAAAAAUUGGAAUC
>hsa-miR-140-5p MIMAT0000431
CAGUGGUUUUACCCUAUGGUAG

i want it to become

>hsa-miR-576-3p
 AAGAUGUGGAAAAAUUGGAAUC
>hsa-miR-140-5p
CAGUGGUUUUACCCUAUGGUAG

without the MIMAT000XX

Could anyone help me to do this? My OS is Ubuntu 14.04

Thank You in advance.

mirnafiles textfiles ubuntu • 206 views
ADD COMMENTlink modified 4 months ago by finswimmer11k • written 4 months ago by nivya.james20160
1

Try sed ,

sed -e 's/MIMAT.*//' input.file > output.file
ADD REPLYlink written 4 months ago by k.kathirvel93190

Thank You So Much kathirvel. I was able to do it.

ADD REPLYlink written 4 months ago by nivya.james20160

After this when i was running miRDeep2.pl, i got this error

mkdir mirdeep_runs/run_13_12_2018_t_16_20_32
#testing input files
#testing input files
started: 16:20:33
sanity_check_mature_ref.pl /home/shanthi/Desktop/Nivya/miRBase/mature_human_miRNA1.fa
Error: problem with /home/shanthi/Desktop/Nivya/miRBase/mature_human_miRNA1.fa
Error in line 5.309: The sequence
contains characters others than [acgtunACGTUN]
Please check your file for the following issues:
I.  Sequences are allowed only to comprise characters [ACGTNacgtn].
II. Identifiers are not allowed to have withespaces.

Do you have any idea how to rectify this?

ADD REPLYlink written 4 months ago by nivya.james20160

Don't ask unrelated/new questions in existing threads. Consider opening a new thread, if you are not able to find a previous answer by searching.

ADD REPLYlink modified 4 months ago • written 4 months ago by genomax65k
1
gravatar for finswimmer
4 months ago by
finswimmer11k
Germany
finswimmer11k wrote:

Assuming there is a whitespace before the part that you want to remove, you can do this:

$ cut -d " " -f1 input.fa > output.fa

cut selects the columns given with -f parameter. With -d " " we define a whitespace as a delimiter between two columns.

fin swimmer

ADD COMMENTlink written 4 months ago by finswimmer11k

Thank you so much finswimmer.

ADD REPLYlink written 4 months ago by nivya.james20160

If an answer was helpful, you should upvote it; if the answer resolved your question, you should mark it as accepted. You can accept more than one if they work.
Upvote|Bookmark|Accept

Please do the same for your previous posts as well.

ADD REPLYlink written 4 months ago by genomax65k

I shall do it. Thank You.

ADD REPLYlink written 4 months ago by nivya.james20160
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2310 users visited in the last hour