Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^4: Command or Perl script for changing headers of multiple FASTA files in a specific order listed in a txt file

by Anonymous Monk
on Sep 12, 2017 at 12:08 UTC ( #1199192=note: print w/replies, xml ) Need Help??


in reply to Re^3: Command or Perl script for changing headers of multiple FASTA files in a specific order listed in a txt file
in thread Command or Perl script for changing headers of multiple FASTA files in a specific order listed in a txt file

The mapping of names in Headers.txt and the FASTA files can work.

Chimpanzee_AMY2B_CDS.fasta MP.C_AMY2B Human_AMY2B_CDS.fasta FP.H_AMY2B
Following solution worked for my problem.

create a folder called test (in the same folder where fasta files are located) and run the command:

$ mkdir test

execute:

 for i in $(seq 1 $(ls *.fasta |wc -l)); do sed -n "$i"p headers.txt| sed 's/^/>/'> test/$(ls *.fasta| sed -n "$i"p); cat $(ls *.fasta| sed -n "$i"p)| sed '1d' >>test/$(ls *.fasta| sed -n "$i"p); done

Cheers.. :)

  • Comment on Re^4: Command or Perl script for changing headers of multiple FASTA files in a specific order listed in a txt file
  • Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1199192]
help
Chatterbox?
talexb is happy to be on this site.

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (13)
As of 2018-07-19 14:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (408 votes). Check out past polls.

    Notices?