Command line input

Hello,
Can we calculate the consensus sequence from the command line(Linux system) with no display?.

Thanks and Regards
Kajal

Hi Kajal - we don't have a convenient command line switch to do this, but it is possible using a groovy script. Save the following to a file:

// export a consensus sequence

def alf = Jalview.getAlignFrames();
for (ala in alf)
{
  // ala is an jalview.gui.AlignFrame object
  jalview.datamodel.SequenceI seq = ala.viewport.getConsensusSeq();

  print new jalview.io.FastaFile().print(((jalview.datamodel.SequenceI) [ seq ]),false)+"\n";

}

Assuming you are using the conda package then you can execute the script via:

jalview -headless -groovy exportconsensus.groovy -open myalignment.fa

Jim.

PS. Apologies for the scruffy coding ! I'm sure someone can improve on the script's syntax :slight_smile:
PPS. If you are processing lots of alignments it may be worth launching a single Jalview instance as a server and sending it commands. You could also run Jalview from a Jupyter notebook with beaker-x.
PPS. Issue lodged here: https://issues.jalview.org/browse/JAL-3547

···

On 03/03/2020 05:11, kajal pande wrote:

Hello,
Can we calculate the consensus sequence from the command line(Linux system) with no display?.

Thanks and Regards
Kajal

_______________________________________________
Jalview-discuss mailing list
Jalview-discuss@jalview.org
http://www.compbio.dundee.ac.uk/mailman/listinfo/jalview-discuss

Hello again, Kajal - I've added the groovy script to Jalview's script directory, so it will be published in the next Jalview release.

You can download it directly via the commit linked to this issue:
https://issues.jalview.org/browse/JAL-3547
https://source.jalview.org/crucible/browse/jalview/examples/groovy/exportconsensus.groovy?r=89baab96128b7c469bae27a4ae7a0c870292f507

Jim.

···

On 03/03/2020 08:31, Jim Procter wrote:

Hi Kajal - we don't have a convenient command line switch to do this, but it is possible using a groovy script. Save the following to a file:

// export a consensus sequence

def alf = Jalview.getAlignFrames();
for (ala in alf)
{
// ala is an jalview.gui.AlignFrame object
jalview.datamodel.SequenceI seq = ala.viewport.getConsensusSeq();

print new jalview.io.FastaFile().print(((jalview.datamodel.SequenceI) [ seq ]),false)+"\n";

}

Assuming you are using the conda package then you can execute the script via:

jalview -headless -groovy exportconsensus.groovy -open myalignment.fa

Jim.

PS. Apologies for the scruffy coding ! I'm sure someone can improve on the script's syntax :slight_smile:
PPS. If you are processing lots of alignments it may be worth launching a single Jalview instance as a server and sending it commands. You could also run Jalview from a Jupyter notebook with beaker-x.
PPS. Issue lodged here: https://issues.jalview.org/browse/JAL-3547

On 03/03/2020 05:11, kajal pande wrote:

Hello,
Can we calculate the consensus sequence from the command line(Linux system) with no display?.

Thanks and Regards
Kajal

_______________________________________________
Jalview-discuss mailing list
Jalview-discuss@jalview.org
http://www.compbio.dundee.ac.uk/mailman/listinfo/jalview-discuss