Filename without extension terminology - filenames

What is the technical term used for a filename without the extension ?
For exemple in the following file path:
"C:\Folder\foo.txt"
What is the terminology used for "foo" ?
Thanks

Lots of citations to Wikipedia, but one term on that page that seems to be unambiguous is stem. Stem seems better than base name/basename because, in Unix, the basename command simply removes the folder path and keeps the extension.
I suspect that most will not think of stem as including the folder path, but if you want to be sure, you can say base name stem or stem of the base name. It shouldn't be necessary, though. There is a lot of confirmatory information here.

It is just called a "file" if referring to its base name according to wikipedia.
https://en.wikipedia.org/wiki/Filename

Extensionless is what I typically use and hear used.

A 'file', or 'blank file' maybe.
Also the part before the dot is called a 'basename', 'base name', 'filename', or a 'file name'.

Related

Find MMT Unicode abbreviations for given symbol (e.g. given ☞, find "juri")

The usual IDEs/editors for MMT (e.g. IntelliJ + MMT plugin or jEdit) feature an autocompletion feature for certain useful Unicode characters. For instance, I can type jle and immediately get suggested jleftrightarrow that, upon autocompletion, is replaced by ↔.
Is there a way to find out the reverse association? E.g. I have the symbol ☞ at hand and would like to know the autocompletion abbreviation starting with j — if it exists. For that hand, I would get juri.
The MMT OnlineTools I developed allow this: https://comfreek.github.io/mmteditor.
See screenshot below: if you already have a string full of Unicode symbols that you don't know how to type, just paste it under "how do I type X?". And if you are looking for a specific abbreviation — by Unicode character or by (parts of its) name — use the "abbreviation search" feature.
Internally, my tools pulls from (a copy of) the same resource file that Dennis linked in his answer.
As far as I know, there currently isn't a good way to look up or search for the ASCII abbreviations, except to go straight for the source — which at least has the advantage that it's guaranteed to be up-to-date.
The IDE plugins all have access to an mmt.jar and load their abbreviations from a specific resource file embedded therein. You can find it here on GitHub: https://github.com/UniFormal/MMT/blob/master/src/mmt-api/resources/unicode/unicode-latex-map.
In the long term, we should consider extending that file with a third "field" that gives a short description, and e.g. have a text field in IntelliJ to search for a specific abbreviation.

Snakemake: Pull sample-specific information from config sheet

In my workflow, I have a sample sheet that contains all the samples that are supposed to be analysed + the path where to find input files + the reference genome that is supposed to be used. All of this is sample-specific.
In my config file, I have a list of reference genomes and for each of them a list of paths of files depending on the tool.
In the rule that performs the alignment of each sample, I need to load some of those files but in a sample-specific way because the reference genome might not be the same for all samples.
Here is how I tried to solve this:
params: reference=lambda wildcards: table_samples['reference'][wildcards.sample],
chrom_sizes=config[reference]['chrom_sizes']
However, when I try to run it like this, I get an error (directly when running Snakemake) saying that reference in the line of chrom_sizes=... is not defined.
Does anybody have an idea of a workaround?
EDIT: Some more information because I guess it's not really clear what I meant. Here is the relevant part of my config file.
hg19:
bwa: 'path/to/hg19/bwa/reference'
samtools: 'path/to/hg19/samtools/reference'
chrom_sizes: '...'
mm9:
bwa: 'path/to/mm9/bwa/reference'
samtools: 'path/to/mm9/samtools/reference'
chrom_sizes: '...'
And here is an example of the sample sheet.
name path reference
sample1 path/to/sample1 mm9
So, in the line reference=lambda wildcards: table_samples['reference'][wildcards.sample] I load the respective reference to be used for the current sample. Then, in chrom_sizes=config[reference]['chrom_sizes'] I need to use reference as a variable to get chrom_sizes for the correct reference genome.
I hope this makes it a bit more clear.
This is probably a ugly solution but should work.
params:
reference = table_samples['reference']['{sample}']
chrom_sizes = config[table_samples['reference']['{sample}']]['chrom_sizes']
You were defining a variable under params and attempted to pass its value within params itself; I'm not sure Snakemake can do that.
You forgot to put quotes around the reference key. Like you write it, Python interprets it as a variable.
chrom_sizes=config['reference']['chrom_sizes']
Alright, taking the information from your comments I was able to make it work. I just had to modify them a little.
As I added to my original post, I actually needed reference to be a variable in order to pull the information for every sample individually.
As #JeeYem suggested, I tried to do the following:
chrom_sizes = config[table_samples['reference']['{sample}']]['chrom_sizes']
However, it seems not to be possible to use {sample} in this context. Instead, I changed it like this:
chrom_sizes = lambda wildcards: config[table_samples['reference'][wildcards.sample]]['chrom_sizes']
For now, it works! Thanks for everyone for the contribution!

nio2: detect '..' and suchlike elements

I wish to use a string handed to me as a parameter as an element of a pathname. I do not wish to be troubled with 'Little Bobby Tables'. That is, I don't want '..' to be acceptable. I want this to work with an arbitrary NIO2 FileSystem, so just looking for the string .. isn't good enough. I can make some checks, such as !path.isAbsolute(), and path.getNameCount() == 1 to filter out other problem cases, but can I do anything other than pass it to resolve and look for the wrong name count to tell if it has the semantics of ..?
toRealPath()
Is mostly the answer. The method on a path after resolved gives you
the real path after resolving parent (e.g. "..") and links.
You can then use root.startsWith( path ) to quickly check that it is in your subtree.
But: Works only for existing files.

Possible to apache mod_autoindex and mod_dir to return directory listing via AJAX?

This probably sounds silly, after all I could generate the file listing via PHP, right?
But I am becoming more and more fascinated with what all can be accomplished with just Apache and JQuery alone. I've been reading documentation and it seems like things are SO VERY close, but I am obviously missing a few things.
First, can I set a directory listing to a "path" or file name,
overwriting the default, "index.html"? In particular, I am trying to
configure any request ending in "ndx.mnu" to return the directory
listing:
"DirectoryIndex ndx.mnu"
...does not accomplish that. Anyideas?
Second, does anyone know of a way to impose a numerical sort similar
to the way in which VersionSort works for files? Right now:
"foo-1, foo-2"
sorts correctly but what if I want to force:
"foo-1, bar-2"
to be order returned?
Trying to make something with as few moving parts as possible. Any pointers to read up would be appreciated.
Well for the second part, you want to sort by the number rather than the letters correct? You should be able to read the string backwards and sort from end to beginning. Using strrev() to reverse it, you can write a sorting algorithm to do that.
Or if all the file use the '-#' notation then $num = explode('-', $string); and sort by $num[1] (which should be the number on the end) though if some file names contain multiple '-' you could use regular expressions.

Is there any way I can define a variable in LaTeX?

In LaTeX, how can I define a string variable whose content is used instead of the variable in the compiled PDF?
Let's say I'm writing a tech doc on a software and I want to define the package name in the preamble or somewhere so that if its name changes, I don't have to replace it in a lot of places but only in one place.
add the following to you preamble:
\newcommand{\newCommandName}{text to insert}
Then you can just use \newCommandName{} in the text
For more info on \newcommand, see e.g. wikibooks
Example:
\documentclass{article}
\newcommand\x{30}
\begin{document}
\x
\end{document}
Output:
30
Use \def command:
\def \variable {Something that's better to use as a variable}
Be aware that \def overrides preexisting macros without any warnings and therefore can cause various subtle errors. To overcome this either use namespaced variables like my_var or fall back to \newcommand, \renewcommand commands instead.
For variables describing distances, you would use \newlength (and manipulate the values with \setlength, \addlength, \settoheight, \settolength and \settodepth).
Similarly you have access to \newcounter for things like section and figure numbers which should increment throughout the document. I've used this one in the past to provide code samples that were numbered separatly of other figures...
Also of note is \makebox which allows you to store a bit of laid-out document for later re-use (and for use with \settolength...).
If you want to use \newcommand, you can also include \usepackage{xspace} and define command by \newcommand{\newCommandName}{text to insert\xspace}.
This can allow you to just use \newCommandName rather than \newCommandName{}.
For more detail, http://www.math.tamu.edu/~harold.boas/courses/math696/why-macros.html
I think you probably want to use a token list for this purpose:
to set up the token list
\newtoks\packagename
to assign the name:
\packagename={New Name for the package}
to put the name into your output:
\the\packagename.