Skip to content
Snippets Groups Projects
Commit 27cb9af0 authored by Graham McVicker's avatar Graham McVicker
Browse files

not used as far as I can tell

parent f45a2f36
No related branches found
No related tags found
No related merge requests found
#!/usr/local/ensembl/bin/perl -w
# Output a transcript (or raw contig) and its supporting evidence
# (or similarity features) in Fasta format, to stdout.
# Can also output more than one such alignment. With raw contigs,
# output may be limited to all hits with a given logic name.
#
# usage: aligner [--user <username>] [--pass <password>] [--dbname <dbname>] \
# [--host <host>] --transcript <id> [<id>...]
#
# aligner [--user <username>] [--pass <password>] [--dbname <dbname>] \
# [--host <host>] --contig [--logic_name <logicname>] <id> [<id>...]
#
# Stable IDs and/or internal dbIDs may be used for transcripts.
# It isn't possible to mix contigs and transcripts in the
# same command.
#
# For example:
#
# transcript stable ID, default database details, supporting evidence:
# aligner --transcript ENST00000279043 > ENST00000279043.fa
#
# transcript internal ID, default database details:
# aligner --transcript --evidence 12213 > 12213.fa
#
# raw contig, nondefault database details, all hits:
# aligner --contig --host ecs1h --dbname homo_sapiens_core_4_28 \
# --user ensro AL356104.6.1.96693 > AL356104.6.1.96693.fa
#
# raw contig, default database details, human_mrna hits only:
# aligner --logic_name human_mrna --contig AP001464.1.1.115915 > out.fa
use constant DEFAULT_USER => 'anonymous';
use constant DEFAULT_DBNAME => 'current';
use constant DEFAULT_HOST => 'kaka.sanger.ac.uk';
use strict;
use Getopt::Long;
use Bio::EnsEMBL::DBSQL::DBAdaptor;
use Bio::EnsEMBL::EvidenceAlignment;
sub usage_die {
die "usage: aligner [--user <username>] [--pass <password>] [--dbname <dbname>] \\\n [--host <host>] --transcript [--evidence] <id> [<id>...]\n aligner [--user <username>] [--pass <password>] [--dbname <dbname>] \\\n [--host <host>] --contig [--logic_name <logicname>] <id> [<id>...]\n";
}
# main program
my ($using_transcripts, $using_contigs, $user, $pass, $dbname, $host,
$logic_name, $evidence);
GetOptions("transcript" => \$using_transcripts,
"contig" => \$using_contigs,
"user=s" => \$user,
"pass=s" => \$pass,
"dbname=s" => \$dbname,
"host=s" => \$host,
"logic_name=s" => \$logic_name,
"evidence" => \$evidence
) or usage_die();
usage_die()
if ( ( $using_transcripts and $using_contigs)
|| (!$using_transcripts and !$using_contigs)
|| ( $using_transcripts and $logic_name) );
$user = DEFAULT_USER if (!$user);
$dbname = DEFAULT_DBNAME if (!$dbname);
$host = DEFAULT_HOST if (!$host);
my $db = new Bio::EnsEMBL::DBSQL::DBAdaptor(-user => $user,
-pass => $pass,
-dbname => $dbname,
-host => $host
);
my $ea = Bio::EnsEMBL::EvidenceAlignment->new(-DBADAPTOR => $db);
if ($evidence) {
$ea->use_supporting_evidence(1);
}
foreach my $id (@ARGV) {
if ($using_transcripts) {
$ea->transcriptid($id);
} else {
$ea->contigname($id);
}
my @evidence_seq_arr;
eval {
if ($logic_name) {
@evidence_seq_arr = $ea->fetch_alignment($logic_name);
} else {
@evidence_seq_arr = $ea->fetch_alignment;
}
};
if ($@) {
die "error: can't fetch alignment for $id: $@\n";
}
foreach my $evidence_obj (@evidence_seq_arr) {
print ">", $evidence_obj->accession_number , "\n"
or die "write error for $id";
print $evidence_obj->seq , "\n\n"
or die "write error for $id";
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment