Skip to content

Commit

Permalink
select feature
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasrausch committed Jun 7, 2024
1 parent 21f96f2 commit f6b5c00
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/gtf.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ namespace dicey {
return 0;
}
std::string ft = *tokIter++;
if (ft == "exon") { // Select exons
if (ft == c.feature) { // Select exons
if (tokIter != tokens.end()) {
int32_t start = boost::lexical_cast<int32_t>(*tokIter++);
int32_t end = boost::lexical_cast<int32_t>(*tokIter++);
Expand All @@ -150,7 +150,7 @@ namespace dicey {
Tokenizer kvTokens(keyval, sepKeyVal);
Tokenizer::iterator kvTokensIt = kvTokens.begin();
std::string key = *kvTokensIt++;
if (key == "gene_id") { // Select gene_id
if (key == c.idname) { // Select gene_id
// Protein-coding exon?
bool includeExon = false;
for(Tokenizer::iterator arIter = attrTokens.begin(); arIter != attrTokens.end(); ++arIter) {
Expand Down
10 changes: 7 additions & 3 deletions src/padlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ namespace dicey
std::string ucscDB;
std::string anchor;
std::string spacerleft;
std::string spacerright;
std::string spacerright;
std::string feature;
std::string idname;
std::set<std::string> geneset;
std::vector<std::string> chrname;
std::map<std::string, int32_t> nchr;
Expand Down Expand Up @@ -264,15 +266,15 @@ namespace dicey
rcfile << meta.dump() << ',';
rcfile << "\"data\":{";
rcfile << "\"columns\": [";
rcfile << "\"Gene\", \"Symbol\", \"Code\", \"Position\", \"UCSC\", \"Strand\", \"ExonCoordinates\", \"ProbeSeq\", \"SpacerLeft\", \"AnchorSeq\", \"BarcodeSeq\", \"SpacerRight\", \"PadlockSeq\", \"Arm1TM\", \"Arm2TM\", \"BarcodeTM\", \"ProbeTM\", \"Arm1GC\", \"Arm2GC\", \"BarcodeGC\", \"ProbeGC\"";
rcfile << "\"Gene\", \"Symbol\", \"Code\", \"Position\", \"UCSC\", \"Strand\", \"FeatureCoordinates\", \"ProbeSeq\", \"SpacerLeft\", \"AnchorSeq\", \"BarcodeSeq\", \"SpacerRight\", \"PadlockSeq\", \"Arm1TM\", \"Arm2TM\", \"BarcodeTM\", \"ProbeTM\", \"Arm1GC\", \"Arm2GC\", \"BarcodeGC\", \"ProbeGC\"";
rcfile << "]," << std::endl;
rcfile << "\"rows\": [" << std::endl;
}

// Outfile
std::cout << '[' << boost::posix_time::to_simple_string(boost::posix_time::second_clock::local_time()) << "] " << "Compute padlocks" << std::endl;
std::ofstream ofile(c.outfile.string().c_str());
ofile << "Gene\tSymbol\tCode\tPosition\tUCSC\tStrand\tExonCoordinates\tProbeSeq\tSpacerLeft\tAnchorSeq\tBarcodeSeq\tSpacerRight\tPadlockSeq\tArm1TM\tArm2TM\tBarcodeTM\tProbeTM\tArm1GC\tArm2GC\tBarcodeGC\tProbeGC" << std::endl;
ofile << "Gene\tSymbol\tCode\tPosition\tUCSC\tStrand\tFeatureCoordinates\tProbeSeq\tSpacerLeft\tAnchorSeq\tBarcodeSeq\tSpacerRight\tPadlockSeq\tArm1TM\tArm2TM\tBarcodeTM\tProbeTM\tArm1GC\tArm2GC\tBarcodeGC\tProbeGC" << std::endl;
// Parse chromosomes
faidx_t* fai = fai_load(c.genome.string().c_str());
uint32_t targetlen = 2 * c.armlen;
Expand Down Expand Up @@ -536,6 +538,8 @@ namespace dicey
("barcodes,b", boost::program_options::value<boost::filesystem::path>(&c.barcodes), "FASTA barcode file")
("distance,d", boost::program_options::value<uint32_t>(&c.distance)->default_value(1), "neighborhood distance")
("armlen,m", boost::program_options::value<uint32_t>(&c.armlen)->default_value(20), "probe arm length")
("attribute,u", boost::program_options::value<std::string>(&c.idname)->default_value("gene_id"), "gtf/gff3 attribute")
("feature,f", boost::program_options::value<std::string>(&c.feature)->default_value("exon"), "gtf/gff3 feature")
("probe,p", "apply distance to entire probe, i.e., only one arm needs to be unique")
("overlapping,v", "allow overlapping probes")
;
Expand Down

0 comments on commit f6b5c00

Please sign in to comment.