multiple fasta conversion using java
1
0
Entering edit mode
5.8 years ago
signaturemdx ▴ 10

Hi, I ( a biologist and a newcomer to informatics) need help. Really trying hard to learn biopython, but that's another story.

In my folder I have a downloaded java script and a lot of fasta-to-text converted files. Fasta had to be manually converted to text files individually , but no complaint there.

I run java script in a way;

   java -jar ABC.local.jar xaa.txt Out.txt

"java -jar ABC.local.jar" is the command I am supposed to write(copy$paste) in the terminal.

xaa.txt is the input text file converted from fasta.

Out.txt (I name it) is the result file of xaa.txt that was processed through java -jar ABC.local.jar.

It runs beautifully, and I check every 10 minutes and surely get the results I want.

There is a quite number of input file (xaa.txt, xab.txt, xac.txt......), all generating corresponding xaa.txt Out.txt, xab.txt Out.txt, xac.txt Out.txt...result files by the afore-mentioned script.

I assume there would be a way for this process (javascript run) to repeat by itself until all the input files are processed, but it is beyond me.

Or is there? May I ask someone to suggest one?

I know critiques, such as "why haven't you tried at all? etc". I am just not at that stage. Thanks

sequence • 1.3k views
ADD COMMENT
1
Entering edit mode

a lot of fasta-to-text converted files

Fasta format files are plain text. So what is fasta-to-text? Multi-fasta (multiple seq in one file) to one sequence per file fasta?

ADD REPLY
1
Entering edit mode

On a bit of a tangent: take the plunge into BioPython sooner rather than later would be my advice ;)

Java is not the most widely used language in bioinformatics really.

There's a lot of boilerplate BioPython code out there these days that should require very little tweaking but just enough for you to learn.

ADD REPLY
0
Entering edit mode

Thanks for the tip !

ADD REPLY
0
Entering edit mode

java != java "script"

ADD REPLY
4
Entering edit mode
5.8 years ago

use a bash loop that will call this java program for each file

something like

ls *.txt | while read F; do  java -jar ABC.local.jar "${F}" "${F}.out" ; done
ADD COMMENT
1
Entering edit mode

It's working nicely !! Thanks

ADD REPLY
0
Entering edit mode

This shows you how to run the script against all *.txt files in that directory. But be careful. We don't exactly know what you java file is doing. If it uses the same output file names each time it will just overwrite results so you will end up with one set of output files for the last input.

ADD REPLY
0
Entering edit mode

All OP's fasta files seem to start with xa (from the description in OP). To be safe, it may be better for OP to restrict the code either with x or xa (some thing like ls x*.txt or ls xa*.txt)

ADD REPLY

Login before adding your answer.

Traffic: 2646 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