HyPhy message board
http://www.hyphy.org/cgi-bin/hyphy_forums/YaBB.pl
Methodology Questions >> How to >> automate seqalignment.bf
http://www.hyphy.org/cgi-bin/hyphy_forums/YaBB.pl?num=1305683658

Message started by cftian on May 17th, 2011 at 6:53pm

Title: automate seqalignment.bf
Post by cftian on May 17th, 2011 at 6:53pm
  I am working on a batch file based on SeqAlignment.bf. It could run normally without showing any error messages, however I could only get the realignment files (translated sequences and .nuc) for the first .fasta file in my data set.  :( But the "log" window showed that all the .fasta files have been analysed. Could you help me with this script? :-?

  regards!

Changfu


Code (]prefix = "C:/HYPHY2.0/tmp/HYPHY2.0/data/KaKs/cluster";
samples = 15;

inputRedirect = {};
/* an associative array, with string entries, used to replace the standard input */

for (bitt=1; bitt<samples; bitt=bitt+1)
{
inputRedirect["01"):

="BLOSUM62"; /* Scoring Matrix */

inputRedirect["02"]="No penalty"; /* Do not penalize Prefix-Suffix Indels */

inputRedirect["03"]="Longest in file"; /* Use the longest sequence in the data file as the reference */

inputRedirect["04"]="No"; /* No reference coordinate sequence */

inputRedirect["05"]=prefix+" ("+bitt+").fasta"; /* data file path */

inputRedirect["06"]="No"; /* Skip sequences with unusurally poor allignment scores */

inputRedirect["07"]="No"; /* Only align in the provided direction - no reverse complement */

inputRedirect["08"]="Universal"; /* Choose genetic code - Genbank transl_table = 1 */

inputRedirect["09"]=prefix+bitt+"realignment";  /* save alignment files to */

ExecuteAFile (HYPHY_BASE_DIRECTORY + "TemplateBatchFiles"+
DIRECTORY_SEPARATOR+"SeqAlignment.bf", inputRedirect);

}

Title: Re: automate seqalignment.bf
Post by Sergei on May 18th, 2011 at 11:09am
Hi Changfu,

This is odd -- could you print the inputRedirect variable before and after the call to ExecuteAFile and paste the output of your script to the console?

Just add

[code]

fprintf (stdout, inputRedirect, "\n");

[/code]

before and after ExecuteAFile.

Sergei

Title: Re: automate seqalignment.bf
Post by cftian on May 18th, 2011 at 5:50pm
Dear Sergei,

      Thank you for your reply!
      Here is the script:
Code (]prefix = "C:/HYPHY2.0/tmp/HYPHY2.0/data/KaKs/cluster";
samples = 15;

inputRedirect = {};
/* an associative array, with string entries, used to replace the standard input */

for (bitt=1; bitt<samples; bitt=bitt+1)
{
inputRedirect["01"):

="BLOSUM62"; /* Scoring Matrix */

inputRedirect["02"]="No penalty"; /* Do not penalize Prefix-Suffix Indels */

inputRedirect["03"]="Longest in file"; /* Use the longest sequence in the data file as the reference */

inputRedirect["04"]="No"; /* No reference coordinate sequence */

inputRedirect["05"]=prefix+" ("+bitt+").fasta"; /* data file path */

inputRedirect["06"]="No"; /* Skip sequences with unusurally poor allignment scores */

inputRedirect["07"]="No"; /* Only align in the provided direction - no reverse complement */

inputRedirect["08"]="Universal"; /* Choose genetic code - Genbank transl_table = 1 */

inputRedirect["09"]=prefix+bitt+".realignment";  /* save alignment files to */

fprintf (stdout, inputRedirect, "\n");

ExecuteAFile (HYPHY_BASE_DIRECTORY + "TemplateBatchFiles"+
DIRECTORY_SEPARATOR+"SeqAlignment.bf", inputRedirect);

fprintf (stdout, inputRedirect, "\n");

}


and the output:

[code]
{"01":"BLOSUM62",
"02":"No penalty",
"03":"Longest in file",
"04":"No",
"05":"C:/HYPHY2.0/tmp/HYPHY2.0/data/KaKs/cluster (1).fasta",
"06":"No",
"07":"No",
"08":"Universal",
"09":"C:/HYPHY2.0/tmp/HYPHY2.0/data/KaKs/cluster1.realignment"}

Selected sequence GL002701 as reference.
Detecting reading frames for each sequence...

Found:
     26 sequences in reading frame 1
     0 sequences in reading frame 2
     0 sequences in reading frame 3

There were 0 sequences with apparent frameshift/sequencing errors

Performing pairwise alignment with reference sequences

Merging pairwise alignments into a MSA
{"01":"BLOSUM62",
"02":"No penalty",
"03":"Longest in file",
"04":"No",
"05":"C:/HYPHY2.0/tmp/HYPHY2.0/data/KaKs/cluster (1).fasta",
"06":"No",
"07":"No",
"08":"Universal",
"09":"C:/HYPHY2.0/tmp/HYPHY2.0/data/KaKs/cluster1.realignment"}
{"01":"BLOSUM62",
"02":"No penalty",
"03":"Longest in file",
"04":"No",
"05":"C:/HYPHY2.0/tmp/HYPHY2.0/data/KaKs/cluster (2).fasta",
"06":"No",
"07":"No",
"08":"Universal",
"09":"C:/HYPHY2.0/tmp/HYPHY2.0/data/KaKs/cluster2.realignment"}

Selected sequence GL000030 as reference.
Detecting reading frames for each sequence...

Found:
     26 sequences in reading frame 1
     0 sequences in reading frame 2
     0 sequences in reading frame 3

There were 0 sequences with apparent frameshift/sequencing errors

Performing pairwise alignment with reference sequences

Merging pairwise alignments into a MSA
{"01":"BLOSUM62",
"02":"No penalty",
"03":"Longest in file",
"04":"No",
"05":"C:/HYPHY2.0/tmp/HYPHY2.0/data/KaKs/cluster (2).fasta",
"06":"No",
"07":"No",
"08":"Universal",
"09":"C:/HYPHY2.0/tmp/HYPHY2.0/data/KaKs/cluster2.realignment"}
{"01":"BLOSUM62",
"02":"No penalty",
"03":"Longest in file",
"04":"No",
"05":"C:/HYPHY2.0/tmp/HYPHY2.0/data/KaKs/cluster (3).fasta",
"06":"No",
"07":"No",
"08":"Universal",
"09":"C:/HYPHY2.0/tmp/HYPHY2.0/data/KaKs/cluster3.realignment"}

Selected sequence GL006574 as reference.
Detecting reading frames for each sequence...

Found:
     26 sequences in reading frame 1
     0 sequences in reading frame 2
     0 sequences in reading frame 3

There were 0 sequences with apparent frameshift/sequencing errors

Performing pairwise alignment with reference sequences

Merging pairwise alignments into a MSA
{"01":"BLOSUM62",
"02":"No penalty",
"03":"Longest in file",
"04":"No",
"05":"C:/HYPHY2.0/tmp/HYPHY2.0/data/KaKs/cluster (3).fasta",
"06":"No",
"07":"No",
"08":"Universal",
"09":"C:/HYPHY2.0/tmp/HYPHY2.0/data/KaKs/cluster3.realignment"}
{"01":"BLOSUM62",
"02":"No penalty",
"03":"Longest in file",
"04":"No",
"05":"C:/HYPHY2.0/tmp/HYPHY2.0/data/KaKs/cluster (4).fasta",
"06":"No",
"07":"No",
"08":"Universal",
"09":"C:/HYPHY2.0/tmp/HYPHY2.0/data/KaKs/cluster4.realignment"}

Selected sequence GL006105 as reference.
Detecting reading frames for each sequence...

Found:
     26 sequences in reading frame 1
     0 sequences in reading frame 2
     0 sequences in reading frame 3

There were 0 sequences with apparent frameshift/sequencing errors

Performing pairwise alignment with reference sequences

Merging pairwise alignments into a MSA
... ...
... ...

[/code]

Finally I just got two files ("cluster1.realignment" and "cluster1.realignment.nuc") in "C:/HYPHY2.0/tmp/HYPHY2.0/data/KaKs/".

It is really odd. Several other batch files have been run successfully in the same circumstances.

We are working on more than 4000 alignments, and exploring analyses did show that "SeqAlignment.bf" could reduce the false positive information cuased by "uncorrected coarse" alignments. Therefore, to automate "SeqAlignment.bf" is very important to our project.

If you already have a similar executive file by chance, could you post it here? Then I could have a try on my PC.

Thank you!

Changfu  

Title: Re: automate seqalignment.bf
Post by Sergei on May 20th, 2011 at 11:06am
Hi Changfu,

This is very odd indeed. Can you replace the second frptintf statement with


Code (]
fprintf (stdout, fNameC, "\n");
[/code):

and paste the console output? Also, try changing forward slashes '/' with backslashes '\' in prefix and other paths, e.g.

[code]
prefix="C:\\HYPHY2.0\\tmp\\HYPHY2.0\\data\\KaKs\\cluster";


Sergei

Title: Re: automate seqalignment.bf
Post by cftian on May 21st, 2011 at 5:45am
Hi, Sergei,

    I am sorry for taking you so much time. Here is the new script
   
Code (]

prefix = "C:\HYPHY2.0\tmp\HYPHY2.0\data\KaKs\cluster";
samples = 15;

inputRedirect = {};
/* an associative array, with string entries, used to replace the standard input */

for (bitt=1; bitt<samples; bitt=bitt+1)
{
inputRedirect["01"):

="BLOSUM62"; /* Scoring Matrix */

inputRedirect["02"]="No penalty"; /* Do not penalize Prefix-Suffix Indels */

inputRedirect["03"]="Longest in file"; /* Use the longest sequence in the data file as the reference */

inputRedirect["04"]="No"; /* No reference coordinate sequence */

inputRedirect["05"]=prefix+" ("+bitt+").fasta"; /* data file path */

inputRedirect["06"]="No"; /* Skip sequences with unusurally poor allignment scores */

inputRedirect["07"]="No"; /* Only align in the provided direction - no reverse complement */

inputRedirect["08"]="Universal"; /* Choose genetic code - Genbank transl_table = 1 */

inputRedirect["09"]=prefix+bitt+".realignment";  /* save alignment files to */

fprintf (stdout, inputRedirect, "\n");

ExecuteAFile (HYPHY_BASE_DIRECTORY + "TemplateBatchFiles"+
DIRECTORY_SEPARATOR+"SeqAlignment.bf", inputRedirect);

fprintf (stdout, fNameC, "\n");

}



and the output

[code]
{"01":"BLOSUM62",
"02":"No penalty",
"03":"Longest in file",
"04":"No",
"05":"C:\\HYPHY2.0\tmp\\HYPHY2.0\\data\\KaKs\\cluster (1).fasta",
"06":"No",
"07":"No",
"08":"Universal",
"09":"C:\\HYPHY2.0\tmp\\HYPHY2.0\\data\\KaKs\\cluster1.realignment"}

Selected sequence GL002701 as reference.
Detecting reading frames for each sequence...

Found:
     26 sequences in reading frame 1
     0 sequences in reading frame 2
     0 sequences in reading frame 3

There were 0 sequences with apparent frameshift/sequencing errors

Performing pairwise alignment with reference sequences

Merging pairwise alignments into a MSA
C:\HYPHY2.0\tmp\HYPHY2.0\data\KaKs\cluster1.realignment.nuc
{"01":"BLOSUM62",
"02":"No penalty",
"03":"Longest in file",
"04":"No",
"05":"C:\\HYPHY2.0\tmp\\HYPHY2.0\\data\\KaKs\\cluster (2).fasta",
"06":"No",
"07":"No",
"08":"Universal",
"09":"C:\\HYPHY2.0\tmp\\HYPHY2.0\\data\\KaKs\\cluster2.realignment"}

Selected sequence GL000030 as reference.
Detecting reading frames for each sequence...

Found:
     26 sequences in reading frame 1
     0 sequences in reading frame 2
     0 sequences in reading frame 3

There were 0 sequences with apparent frameshift/sequencing errors

Performing pairwise alignment with reference sequences

Merging pairwise alignments into a MSA
C:\HYPHY2.0\tmp\HYPHY2.0\TemplateBatchFiles\Universal.nuc
{"01":"BLOSUM62",
"02":"No penalty",
"03":"Longest in file",
"04":"No",
"05":"C:\\HYPHY2.0\tmp\\HYPHY2.0\\data\\KaKs\\cluster (3).fasta",
"06":"No",
"07":"No",
"08":"Universal",
"09":"C:\\HYPHY2.0\tmp\\HYPHY2.0\\data\\KaKs\\cluster3.realignment"}

Selected sequence GL006574 as reference.
Detecting reading frames for each sequence...

Found:
     26 sequences in reading frame 1
     0 sequences in reading frame 2
     0 sequences in reading frame 3

There were 0 sequences with apparent frameshift/sequencing errors

Performing pairwise alignment with reference sequences

Merging pairwise alignments into a MSA
C:\HYPHY2.0\tmp\HYPHY2.0\TemplateBatchFiles\Universal.nuc
... ... ... ...
[/code]

I have checked the "C:\HYPHY2.0\tmp\HYPHY2.0\TemplateBatchFiles\Universal.nuc" and "Universal"(translated sequence in the same folder). They are exactly the realignment files produced from the last ".fasta" file in my list (14th in the above mentioned script). The path was changed after 1st round, and the file names became "Universal" for all the following output files. I have no idea how could this happen.

Looking forward to your message.

Regards.

Changfu

Title: Re: automate seqalignment.bf
Post by Sergei on May 23rd, 2011 at 10:54am
Hi Changfu,

Looks like a HyPhy bug -- let me see if I can fix it for you today. Thanks for alerting me.

Sergei

Title: Re: automate seqalignment.bf
Post by cftian on May 24th, 2011 at 6:23pm
Hi, Sergei,

Thank you! Looking forward to your good news!

Regards.

Changfu

Title: Re: automate seqalignment.bf
Post by Sergei on May 27th, 2011 at 10:18am
Hi Changfu,

Please replace the SeqAlignment.bf file inside HyPhy2.0/TemplateBatchFiles with the one I attach and the bug should go away.

Sergei
http://www.hyphy.org/cgi-bin/hyphy_forums/YaBB.pl?action=downloadfile;file=SeqAlignment.bf (1 KB | )

Title: Re: automate seqalignment.bf
Post by cftian on May 28th, 2011 at 6:41am
Hi, Sergei,

    Thank you very much. The new Seqalignment.bf works well!
      :D :D ;D ;D
    Best regards!

Changfu


HyPhy message board » Powered by YaBB 2.5.2!
YaBB Forum Software © 2000-2024. All Rights Reserved.