Hi everybody, I got stock in a problem with preparing my sequences for I-TASSER run, i tried many times again and again with different languages BASH,php, visualbasic and till now i didn't solve this problem, independent to way i chose for solution i got "empty files in folders" ! Suppose that we have an input file like :
>tr|Y8CHY3 MQEYISNRQEEMLKLIETLVNIDSGSGNKAGVDRIGSLLKREYEKIGFNIDVVH
>tr|G9MJA5 MNLDHYIEELKTLVNVDCGTRTVAGVETVAGIIETLWQREGWHTERVNLGDKV
and then we should put every sequences with related sequence identifier as folder names
for example
results/Y8CHY3
and in it , the file seq.txt
containing
>Y8CHY3
MQEYISNRQEEMLKLIETLVNIDSGSGNKAGVDRIGSLLKREYEKIGFNIDVVH
Please help me, any ideas that can help will be appreciated...
Sample bash script that doesn't work:
while read line do cd results; mkdir $line;
echo ">Sequence">$line/seq.fasta;
#echo ">$line">$line/seq.fasta; grep '$line' sequences.txt | awk {'print $2'}>>$line/seq.fasta;
#cd ..; done < seq_names.txt
Sample php script that doesn't work:
while (list ($id,$iden,$seqs) = mysql_fetch_row ($showcat))
{
echo $iden . " processing...";
mkdir($id, 0755);
$seqfile = $id . "/" . "seq.txt";
$myfile = fopen($seqfile, "w") or die("Unable to open file!");
$txt = "> " . $iden . "\n"; fwrite($seqfile, $txt);
$txt = $seqs . "\n";
fwrite($seqfile, $txt);
fclose($myfile);
}
Help me please, i spend five days with no answer and now on all of my hope is your kindness to look and solve this Thanks in advance
Thanks Ram for helpful and immediate answer, I've just tried this piece of code and encounter this error: awk: line 2: runaway string constant "/seq.txt; ...
what should i've do with this to work properly?!
Make sure you did not omit a double quote by accident. This should work on any machine with GNU binaries for the programs involved.