Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Breaking a fasta formatted file into multiple files containing each gene separately Post 302608187 by Ann Mc Cartney on Friday 16th of March 2012 11:10:44 AM
Old 03-16-2012
Breaking a fasta formatted file into multiple files containing each gene separately

Hey,

I've been trying to break a massive fasta formatted file into files containing each gene separately. Could anyone help me? I've tried to use the following code but i've recieved errors every time:
Code:
for i in *.rtf.out
do
awk '/^>/{f=++d".fasta"} {print > $i.out}' $i 
done


Last edited by Corona688; 03-16-2012 at 12:47 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Breaking one file into many files based on first column?

Hi, I have a file that looks like this (tab deliminited). MAT1 YKR2 3 MAT1 YMR1 2 MAT1 YFG2 2 MAT2 YLM4 4 MAT2 YHL2 1 BAR1 YKR2 3 BAR1 YFR1 4 BAR1 YMR1 1 What I want to do is break this file down into multiple files. So the result will look like this: File 1... (2 Replies)
Discussion started by: kylle345
2 Replies

2. Shell Programming and Scripting

Breaking the files as 10k recs. per file

Hi, I have a code as given below Set -A _Category="A\ B\ C" for _cat in ${_Category} do sed -e "s:<TABLE_NAME>:${_cat}:g" \ -e "s:<date>:${_dt}:g" \ ${_home}/skl/sq1.sql >> ${_dest}/del_${_dt}.sql fi ... (4 Replies)
Discussion started by: mr_manii
4 Replies

3. Shell Programming and Scripting

To extract date and time separately from the file name

Hi., My current script extracts only if the date and time are in 3rd and 4th pos. #!/bin/bash echo "Enter the file name to extract the timestamp" read fname IFILE=$fname F=$IFILE IFS="_." f=($F) echo "Date ${f} Time ${f}" How to generalize the script to extract the... (3 Replies)
Discussion started by: IND123
3 Replies

4. Shell Programming and Scripting

Breaking a column's value into multiple rows

Hello Friends, I am trying to implement the following using UNIX. I am getting a sequential file as input which would have two columns, "Name" and "Countries Visited". The "Countries Visisted" field will be multi-valued, each value separated by a space and also the number of values are not... (2 Replies)
Discussion started by: mehimadri
2 Replies

5. Shell Programming and Scripting

Output breaking when returning multiple values

I've been trying to write a command-line function to grab a website's MX records and their ip addresses. The code below works with domains that only have one MX record: function kmx { mx=`host -t MX $1 | awk '{ print $7 }'`; ip=`host $mx | sed '/IPv6/d;/handled/d' | awk '{ print $4 }'`; ... (8 Replies)
Discussion started by: Azrael
8 Replies

6. Shell Programming and Scripting

Count and search by sequence in multiple fasta file

Hello, I have 10 fasta files with sequenced reads information with read sizes from 15 - 35 . I have combined the reads and collapsed in to unique reads and filtered for sizes 18 - 26 bp long unique reads. Now i wanted to count each unique read appearance in all the fasta files and make a table... (5 Replies)
Discussion started by: empyrean
5 Replies

7. Shell Programming and Scripting

Breaking large file into small files

Dear all, I have huge txt file with the input files for some setup_code. However for running my setup_code, I require txt files with maximum of 1000 input files Please help me in suggesting way to break down this big txt file to small txt file of 1000 entries only. thanks and Greetings, Emily (12 Replies)
Discussion started by: emily
12 Replies

8. UNIX for Advanced & Expert Users

Map snps into a ref gene file

I have the following data set about the snps ID txt file POS ID 78599583 rs987435 33395779 rs345783 189807684 rs955894 33907909 rs6088791 75664046 rs11180435 218890658 rs17571465 127630276 rs17011450 90919465 rs6919430 and a gene... (7 Replies)
Discussion started by: marwah
7 Replies

9. Shell Programming and Scripting

Getting unique sequences from multiple fasta file

Hi, I have a fasta file with multiple sequences. How can i get only unique sequences from the file. For example my_file.fasta >seq1 TCTCAAAGAAAGCTGTGCTGCATACTGTACAAAACTTTGTCTGGAGAGATGGAGAATCTCATTGACTTTACAGGTGTGGACGGTCTTCAGAGATGGCTCAAGCTAACATTCCCTGACACACCTATAGGGAAAGAGCTAAC >seq2... (3 Replies)
Discussion started by: Ibk
3 Replies

10. UNIX for Beginners Questions & Answers

How to append two fasta files?

I have two fasta files as shown below, File:1 >Contig_1:90600-91187 AAGGCCATCAAGGACGTGGATGAGGTCGTCAAGGGCAAGGAACAGGAATTGATGACGGTC >Contig_98:35323-35886 GACGAAGCGCTCGCCAAGGCCGAAGAAGAAGGCCTGGATCTGGTCGAAATCCAGCCGCAG >Contig_24:26615-28387... (11 Replies)
Discussion started by: dineshkumarsrk
11 Replies
BP_MASK_BY_SEARCH(1p)					User Contributed Perl Documentation				     BP_MASK_BY_SEARCH(1p)

NAME
mask_by_search - mask sequence(s) based on its alignment results SYNOPSIS
mask_by_search.pl -f blast genomefile blastfile.bls > maskedgenome.fa DESCRIPTION
Mask sequence based on significant alignments of another sequence. You need to provide the report file and the entire sequence data which you want to mask. By default this will assume you have done a TBLASTN (or TFASTY) and try and mask the hit sequence assuming you've provided the sequence file for the hit database. If you would like to do the reverse and mask the query sequence specify the -t/--type query flag. This is going to read in the whole sequence file into memory so for large genomes this may fall over. I'm using DB_File to prevent keeping everything in memory, one solution is to split the genome into pieces (BEFORE you run the DB search though, you want to use the exact file you BLASTed with as input to this program). Below the double dash (--) options are of the form --format=fasta or --format fasta or you can just say -f fasta By -f/--format I mean either are acceptable options. The =s or =n or =c specify these arguments expect a 'string' Options: -f/--format=s Search report format (fasta,blast,axt,hmmer,etc) -sf/--sformat=s Sequence format (fasta,genbank,embl,swissprot) --hardmask (booelean) Hard mask the sequence with the maskchar [default is lowercase mask] --maskchar=c Character to mask with [default is N], change to 'X' for protein sequences -e/--evalue=n Evalue cutoff for HSPs and Hits, only mask sequence if alignment has specified evalue or better -o/--out/ --outfile=file Output file to save the masked sequence to. -t/--type=s Alignment seq type you want to mask, the 'hit' or the 'query' sequence. [default is 'hit'] --minlen=n Minimum length of an HSP for it to be used in masking [default 0] -h/--help See this help information AUTHOR - Jason Stajich Jason Stajich, jason-at-bioperl-dot-org. perl v5.14.2 2012-03-02 BP_MASK_BY_SEARCH(1p)
All times are GMT -4. The time now is 09:56 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy