Question: Fastq header modification
0
gravatar for Guillaume
9 months ago by
Guillaume0
France, Toulouse, ENVT
Guillaume0 wrote:

Hi everyone,

I hope this question has not been posted before, even if I looked for an answer in the forum I didn't find anything that fits my problem.

I need to modify the header of my fastq files (generated by MinION) in order to fit with the new storage of the fast5 files.

For example, the name is :

@ba66450b /root/**barcode09/15/**file.fast5

And I need :

@ba66450b /root/file.fast5

And the number can be 15 but also 20,21,25, etc..

Thanks in advance if you can help me !

G

next-gen sequence • 454 views
ADD COMMENTlink modified 9 months ago by RamRS19k • written 9 months ago by Guillaume0

Please use the formatting bar (especially the code option) to present your post better. I've done it for you this time. Formatting bar

ADD REPLYlink written 9 months ago by RamRS19k

OK thank you, I'll do that next time.

ADD REPLYlink written 9 months ago by Guillaume0

Is sed an option? If the number is the only variable, you can write a regex around it.

ADD REPLYlink written 9 months ago by RamRS19k

How about following sed command?

   sed -e 's/\*\*barcode09\/[0-9]*\///g'
ADD REPLYlink modified 9 months ago • written 9 months ago by Sej Modha3.9k

Or perl:

perl -pe 's/\*\*barcode\d+\/\d+\/\*\*//' < file_in > file_out
ADD REPLYlink written 9 months ago by JC7.1k
2

The reason I asked "Is sed OK" and did not give sed/perl code was so OP could work on writing their own code.

ADD REPLYlink written 9 months ago by RamRS19k
1

Give up on that dream @Ram :) Not going to happen.

ADD REPLYlink written 9 months ago by genomax59k
1

I care more about people providing ready-to-use code than people asking for such code. The latter depend on the former, and the former encourage the latter. Askers will always exist, providers need to create scarcity so askers turn to themselves.

ADD REPLYlink written 9 months ago by RamRS19k

Many of us are guilty of handing out free drinks erm solutions. I agree that it would be nice that askers can learn, but often the formulation of their question already indicates they have no idea on how to solve their issue.

ADD REPLYlink written 9 months ago by WouterDeCoster35k

Hence, the pointers. Use tool X, with options y and z, focusing on solving the challenge around concept c. Use sed to substitute a regex focusing on the number part of the identifier.

ADD REPLYlink written 9 months ago by RamRS19k

I wonder is pepsi OK?

ADD REPLYlink written 9 months ago by WouterDeCoster35k

I prefer Thums Up

ADD REPLYlink written 9 months ago by RamRS19k

perl -pe 's/**barcode\d+\/\d+\/**//' < file_in > file_out

Nice, this one is working. Thanks

ADD REPLYlink modified 9 months ago • written 9 months ago by Guillaume0

The reason I asked "Is sed OK" and did not give sed code was so OP could work on writing their own code.

ADD REPLYlink written 9 months ago by RamRS19k

I totally understand you want askers to be able to write their own code. However for people like me that don't have strong bioinformatics skills it's hard to understand the code, except if you give us details enough to explain the line. You will tell me "follow bioinformatics courses", yes you're right, I should do that.

Thanks a lot for your kind help

ADD REPLYlink written 9 months ago by Guillaume0
1

I understand that people might be just starting out, but one has to start _somewhere_. You could google for the code and adapt that code - that way, you'll learn both Google search as well as code tweaking. By copy pasting code here, how would you know what each part of the code does?

One can either claim to be a beginner and stay there with the code others provide, or they can work their way towards not being a beginner any more.

ADD REPLYlink written 9 months ago by RamRS19k
1

But not everyone has the same ambitions - to become a real biofinformagician.

ADD REPLYlink written 9 months ago by WouterDeCoster35k

+1 for Bioinformagicians :)

ADD REPLYlink modified 9 months ago • written 9 months ago by Sej Modha3.9k

Fair point. OP seems like they're willing to learn, so I'm doing the socratic method spiel.

ADD REPLYlink written 9 months ago by RamRS19k
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: 1548 users visited in the last hour