taking sequences of a list of miRNAs
2
3
Entering edit mode
6.2 years ago
fi1d18 ★ 4.1k

hi,

I have a long list of different miRNAs like below

hsa-miR-7641
bta-miR-2904
hhi-miR-7641
hsa-miR-4454
bta-miR-2478
efu-let-7c
mmu-miR-6240
hsa-miR-7704


is there any way to avoid searching one by one in mirbase and copy pasting their mature sequences and taking their sequences at the same time?

miRNA mirbase sequence gene • 3.0k views
6
Entering edit mode
6.2 years ago

"Fasta format sequences of all miRNA hairpins" & "Fasta format sequences of all mature miRNA sequences"

When you have those files, a simple grep -f <youridentifiers.txt> <mirbase.fasta> would do the trick

2
Entering edit mode

thank you,

grep -f <youridentifiers.txt> <mirbase.fasta> > result.txt

1
Entering edit mode

You need to redirect the output to a file, e.g. grep -f youridentifiers.txt mirbase.fasta > mysequences.fasta. Without that redirection, grep just writes to stdout, which is the terminal.

You write "As a txt file", what exactly do you have in mind as output? With standard linux tools (grep, sed, cut, awk) you can probably do all processing you would like.

1
Entering edit mode

Oh good, I see you already found out how to get it in a file ;)

1
Entering edit mode

yes exceptionally sometimes grey cells in my brain work :)

1
Entering edit mode

sorry I inspect the result file that contained all of mature miRNAs while my identifiers.txt contained about 80 miRNAs

:(

then what to do?

1
Entering edit mode

Is there by chance a newline (empty line) at the bottom of your identifiers.txt file? Additionally, might be better to go for grep -w -f identifiers.txt mirbase.fasta to only get full 'word' matches and not partial 'pattern' matches.

1
Entering edit mode

thank youuuuuu

exactly the problem was some empty lines at the end of my id file

1
Entering edit mode

Yeah, and then everything matches to the newlines :p (I have this problem about 95% of the times that I do something like this)

1
Entering edit mode

I tried these codes all give me whole of fasta file

grep -A1 -w -f id.txt seqFile.fasta > output.fasta

grep -Fwf miRNA.txt -A 1 mature.fasta | grep -v '^--$' > out.fasta grep -Fwf < ( sort -u miRNA.txt ) -A 1 mature.fasta | grep -v '^--$'

1
Entering edit mode

Could you try grep -A 1 -Fwf <(tr -d '\n' miRNA.txt) mature.fasta > result.fasta? I see you do grep -v at the end to remove newlines, but you should remove newlines from the identifier file (although I have my doubt whether ^--\$ would work).

1
Entering edit mode

thank you

grep -A 1 -Fwf <(tr -d '\n' miRNA.txt) mature.fasta > result.fasta

told missing name for redirect

1
Entering edit mode

sorry,

supposing a file containing

dataset: 1

target: EAL01688

length: 507

miRNA : hsa-miR-26b-3p

length: 22

mfe: -18.2 kcal/mol

p-value: 1.000000e+00

position 190

target 5' A UACCU AAA A A 3'

       AGUC      UGGA   GGGC AGG

UCGG      ACCU   CUUG UCC


miRNA 3' C UUCAUU 5'

dataset: 1

target: EAL01691

length: 2484

miRNA : hsa-miR-26b-3p

length: 22

mfe: -23.2 kcal/mol

p-value: 1.000000e+00

position 913

target 5' G CA GGA AAAGA U 3'

       GAGCU  GAG   AAUGGA     GAAUAG

CUCGG  UUC   UUACCU     CUUGUC


miRNA 3' A C 5

how to extract only unique target for example EAL01688

1
Entering edit mode

Which output do you want? I'm not sure I understand.

1
Entering edit mode

thank you

actually I was searching for targets of my miRNAs by rnahybrid as I presented some parts of the results above. now I want to extract only target from this output specially unique target. for example if EAL01691 repeated some times I only need that once.

1
Entering edit mode

If I understand it correctly, something like this would work: grep "target:" yourinput.txt | sed 's/"target: //' | sort -u

1
Entering edit mode
6.2 years ago
Farbod ★ 3.3k

Hi ,

You can use faSomeRecords to extract multiple fasta records

Usage:

faSomeRecords   mature.fasta   your-list-file  result.fa


in the grep -f/-F be careful of space and blank lines. you can check them with Notepad++ in windows.

Take care.

1
Entering edit mode

Or just, using nano or gedit or whatever text editor under linux you prefer.

0
Entering edit mode

Hi,

Some times some spaces (specially when converting a fasta file to tabular format and line breaks are not in the right place) are not visible in gedit and nano and most linux text editors.

1
Entering edit mode

There are options to display them, much like in Notepad++ or TextWrangler. Even cat has an option (-A) to do that.

1
Entering edit mode

did you like my posts Farbod?!!!! your 2.3K score is because today I liked whatever written by you :)

2
Entering edit mode

That is not cool.

Whole idea is to use "upvotes" judiciously so you can acknowledge posts that are offering significant help that either solve or go towards solving your problem. Since all communication on Biostars stays public, if every exchange is "upvoted" then that defeats the purpose of the voting system.

1
Entering edit mode

ok I am sorry for that

1
Entering edit mode

This is a misuse of the site - you are helping no one with this.

Please remove the votes cast for no reason - use them only to help other people identify the content that is valuable.

1
Entering edit mode

In addition all of your posts (Angel) are being automatically upvoted by

jivarajivaraj

Who is also from Iran. That's why you have 2K votes when in fact you don't help other people.

I am very sympathetic for people that live in countries where there is a ... let's say "lack of democracy" but please do understand you are helping no one - and you are not serving any cause by gaming the system and pointlessly voting each other up.

0
Entering edit mode

I'd like to also tag in Farbod for this same purpose.

There is reciprocity between comments and replies between these two users - I can understand that on mutually helpful posts, but not on every single post.

0
Entering edit mode

Dear @Ram, @Istevan and other nice people in Biostars; of course I do not feel any necessity to answer but as you "tagged me in" I must say that there is no "reciprocity" between me and any other people in here unless their response or answer is valuable (from scientific point or even teaching us some kind of correct appreciation or offering some helpful scripts).

In addition, I do not know how to automatically upvote some one else profile for 1K in a minute!

The scores in this (and any other) websites are not important for me (of course solving the people problems and my problems is valuable for me).

Dear @Angel, please do not act somehow that have negative feedback for my personality as a friend and do not take any action that the others call people of your country "poor in culture of using online voting system due to lack of democracy" !

1
Entering edit mode

I'm not sure under which comment my reaction is the most appropriate, but it's mainly targeted to Farbod and Angel.

Don't misunderstand the reactions above, we value every contribution to this website and are happy to have you here so frequently. But since all of us are volunteers, and votes are the only type of "recognition" that people can get for the time and effort that is spend here, it's a rather important system. And just like with any other thing, if you don't spend these votes "wisely", they lose their value. It's understandable that you want to upvote people who have been helpful to you in the past, but just do that for posts in which they actually are helpful. That way, other people in the community can also see which posts have a higher value than others.

"If every post is upvoted - no post is"

0
Entering edit mode

believe I did not that to disturb any one, I was only joking with farbod. I am sorry for doing like a childish act while I am too busy but I spent about an hour to joke might be that is why I did not learn data analysis after two years :( :( :( actually Iranian people is not all alike me :( :( they are good and affectionate people but exceptionally I usually do unreasonable things.

0
Entering edit mode

Ok, we'll fix this in the upcoming days - in a way it is the site's responsibility to catch that - though I must say it makes coding a lot more complicated as every action needs to be validated.

5
Entering edit mode

This was a case of educating the users about proper use of the voting system. @Angel has hopefully learned a lesson and we can now get back to helping people.

0
Entering edit mode

You should not have to do this, Istvan. There are rules and etiquettes, and our fear that we'd become SO is tying our hands from any kind of disciplining.

I've been silently monitoring their activity over the past few weeks and not intervening, and now you can see the thing Goutham Atla and I were fearing would happen.

But yes, there are a few holes we could plug - the trophy on answering own questions - it could be made less frequent (once in six months or so).

0
Entering edit mode

you know Ram, actually poor Farbod did not know anything about my ridiculous action and jivarajivaraj user is my previous profile I created two years ago when I was starting to learn data analysis. I did not know my action would irritate admins. now what is suffering me is whether biostars in future continue to help me as already by this illogical manner :( :( :(

actually I am not going to make intervention here, you, Devon, Goutham, genomax2 , WouterDeCoster and many others saved me many times from puzzling questions. for example newly @Persistent LABS solved my problem and last year @Antonio R. Franco helped me to run DEseq2 what even I can't do that myself now. today I was roaming in biostars, suddenly I thought what happen if my scores go higher like a moderator then I did so and I also made a joke with Farbod posts but he did not know anything.

now please excuse me and treat me as already and I promise be a good user might be have progress in my learning.

0
Entering edit mode

Apologies accepted (from my side). This accident will not influence me helping you in the future, don't worry. Let's move on.

0
Entering edit mode

1
Entering edit mode

Sorry about the "lack of democracy" quip. I was in a hurry - all I wanted to say that I believe your government does not treat people equally - and that has the tendency to have people look out for one another more and help each other however they feel is necessary.

All positive sentiments - not trying to be judgmental or anything - one of the problems with the internet is the lack of metacommunication - it is easy to state something in writing that sounds very different than intended.

0
Entering edit mode

not at all @Istvan Albert. I am so happy being a member of this wonderful forum :) :) :)

0
Entering edit mode

Your culture is not being targeted, not is your being active on the site. We are raising a valid point on your misuse of the voting system. We welcome everyone and are happy to have you as part of the community, until you start abusing the system. It demeans the amount of effort Istvan and the mods put into this.

0
Entering edit mode

Dear Ram, if you are with me,

I did not "misuse" or "abusing" your system.

The scores here is not important for me (not at all).

I have repeat it several times here but it seems that I was not so clear, So for the last time: I did not try to maximize mine or others scores! (I have upvoted "genomax2" or "Wouterdecouster" or "Denis" many times more than "Angel" - haven't you realized that in your silently monitoring our activity over the past few weeks)

And maybe I am not so expert in the field of bioinformatic, as it was not my field of interest in university, but I have learned in my life that it is not a good manner to anathematize all the people of a country and speaking about the democracy situation in their country !

1
Entering edit mode

I think we all made our point and can reach a mutual understanding of the voting system. We should avoid making this personal or discuss about the role of cultural elements in this. Perhaps it's time to end this discussion and move on to more pleasant bioinformatics.

0
Entering edit mode

I agree, but I protest on the lack of Incredibles references!

0
Entering edit mode

Oh good, someone got the reference. But it will be hard to have more references. (And the movie wasn't exactly that memorable - my sincere (ahum) apologies if I hurt your feelings with that statement.)

0
Entering edit mode

No one's targeting your country, Farbod - I don't understand where you get that from. Who spoke of your nationality or ethnicity?

And I reported what I observed - threads between Angel and yourself with no content but one upvote each. As a mod, it is my job to monitor and check for odd usage.

0
Entering edit mode

I think it is fine if people respond to each other preferentially. Or to seek out each other if they wish so and contribute that way.

There is nothing wrong with that - this is a social site after all. As long as posts are on topic everyone is welcome to make use of it the way want to.

The only issue with misusing the voting system - it undermines its value.

1
Entering edit mode

That was my point, Istvan - reciprocity in voting. "I upvote your post, you upvote my reply" kind of quid pro quo. There is nothing wrong in seeking out people preferentially.

0
Entering edit mode

Dear Angel Hi,

I really appreciate your kindness and generosity (to tell you the truth, it was somehow bizarre for me),

but I use Biostar website as a place to learn and enjoying one can find in solving other person problems, so as maybe you have realized, my SCORES was not so high as it was not one of my goals, gaining them. If you remember, I have suggest to run your miRNA data analysis on my server and be sure that it was not for maximizing my online scores and just for helping one of my compatriot.

I really do not want to be rude specially with a Fereshteh from Iran, but . . .