For loop command specifying stored name of a file (from bash to python script)Loop through tab delineated...
Is there a push, in the United States, to use gender-neutral language and gender pronouns (when they are given)?
Legality of creating a SE replica using SE's content
Using Terminal` (ASCII plots) in Wolfram 12
What is the name for a fluid transition between two tones? When did it first appear?
Is it possible to actually run Sidney Coleman's "Diehard" experiment?
How much do sea levels rise due to thermal expansion?
Exists infinitely many as a numerical-quantifier
Is it now possible to undetectably cross the Arctic Ocean on ski/kayak?
What does the British parliament hope to achieve by requesting a third Brexit extension?
3-prong to 4-prong conversion - EXTRA MISLABELLED WIRES - Dryer cable upgrade and installation
Why does Chinuch confuse Parashat Nitzavim and Vayelech?
Electrophilic substitution of benzene with conc. HNO₃ and HNO₂
"A tin of biscuits" vs "A biscuit tin"
How to say dandruff in Esperanto?
Marxist and post modernism contradiction
What is the fastest algorithm for finding the natural logarithm of a big number?
Why does b+=(4,) work and b = b + (4,) doesn't work when b is a list?
Rule of thumb: how far before changing my chain to prevent cassette wear
Sampling a uniform distribution of fixed size strings containing no forbidden substrings
I got this nail stuck in my tire, should I plug or replace?
Extra battery in the gap of an HDD
How can a company compel a W2 employee to sign a non-compete agreement?
7 mentions of night in Gospel of John
What do you call a document which has no content?
For loop command specifying stored name of a file (from bash to python script)
Loop through tab delineated file in bash scriptfor loop when matching both front and back of file nameBash script to echo the first positional of each line into file with name of the secondFilename expansion for expect script within bashScript doesn't wait for subprocesses from a loopCalling a file with variable file name in bash scriptTraverse through subfolders using bash scriptBash command that iterates throught folder and runs python script
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{
margin-bottom:0;
}
I have been using the following bash command to process files (using another python script ~/$HOME/quality_filter.py). The files come in pairs i.e. R1 ans R2 files
eg.
MK2_S34_L001_R1_001.fastq, MK2_S34_L001_R2_001.fastq,
MK3_S87_L001_R1_001.fastq, MK3_S87_L001_R2_001.fastq
Where M2 and M3 are the sample names, the _S34_ and _S87_, are different for each sample and _R1_ and _R2_ are R1 and R2 respectively.
for FNAME in $IN_DIR/*_S*_L001_R1_001.fastq
do
FILE=${FNAME##*/}
SAMPLE=${FILE%*_S*_L001_R1_001.fastq}
mkdir $OUT_DIR/${SAMPLE}/
COMMAND="python ~/$HOME/quality_filter.py -1 $IN_DIR/${SAMPLE}_S*_L001_R1_001.fastq -2 $IN_DIR/${SAMPLE}_S*_L001_R2_001.fastq -q 26"
echo $COMMAND >> $OUT_DIR/${SAMPLE}/QualityFiltering.sh
cd $OUT_DIR/${SAMPLE}/
sh $OUT_DIR/${SAMPLE}/QualityFiltering.sh
done
The output: for each of the samples a folder is created and in it a script named QualityFiltering.sh
eg.
/M2/QualityFiltering.sh
/M3/QualityFiltering.sh
How can I write the same in python 3. Thanks
bash python3
add a comment
|
I have been using the following bash command to process files (using another python script ~/$HOME/quality_filter.py). The files come in pairs i.e. R1 ans R2 files
eg.
MK2_S34_L001_R1_001.fastq, MK2_S34_L001_R2_001.fastq,
MK3_S87_L001_R1_001.fastq, MK3_S87_L001_R2_001.fastq
Where M2 and M3 are the sample names, the _S34_ and _S87_, are different for each sample and _R1_ and _R2_ are R1 and R2 respectively.
for FNAME in $IN_DIR/*_S*_L001_R1_001.fastq
do
FILE=${FNAME##*/}
SAMPLE=${FILE%*_S*_L001_R1_001.fastq}
mkdir $OUT_DIR/${SAMPLE}/
COMMAND="python ~/$HOME/quality_filter.py -1 $IN_DIR/${SAMPLE}_S*_L001_R1_001.fastq -2 $IN_DIR/${SAMPLE}_S*_L001_R2_001.fastq -q 26"
echo $COMMAND >> $OUT_DIR/${SAMPLE}/QualityFiltering.sh
cd $OUT_DIR/${SAMPLE}/
sh $OUT_DIR/${SAMPLE}/QualityFiltering.sh
done
The output: for each of the samples a folder is created and in it a script named QualityFiltering.sh
eg.
/M2/QualityFiltering.sh
/M3/QualityFiltering.sh
How can I write the same in python 3. Thanks
bash python3
add a comment
|
I have been using the following bash command to process files (using another python script ~/$HOME/quality_filter.py). The files come in pairs i.e. R1 ans R2 files
eg.
MK2_S34_L001_R1_001.fastq, MK2_S34_L001_R2_001.fastq,
MK3_S87_L001_R1_001.fastq, MK3_S87_L001_R2_001.fastq
Where M2 and M3 are the sample names, the _S34_ and _S87_, are different for each sample and _R1_ and _R2_ are R1 and R2 respectively.
for FNAME in $IN_DIR/*_S*_L001_R1_001.fastq
do
FILE=${FNAME##*/}
SAMPLE=${FILE%*_S*_L001_R1_001.fastq}
mkdir $OUT_DIR/${SAMPLE}/
COMMAND="python ~/$HOME/quality_filter.py -1 $IN_DIR/${SAMPLE}_S*_L001_R1_001.fastq -2 $IN_DIR/${SAMPLE}_S*_L001_R2_001.fastq -q 26"
echo $COMMAND >> $OUT_DIR/${SAMPLE}/QualityFiltering.sh
cd $OUT_DIR/${SAMPLE}/
sh $OUT_DIR/${SAMPLE}/QualityFiltering.sh
done
The output: for each of the samples a folder is created and in it a script named QualityFiltering.sh
eg.
/M2/QualityFiltering.sh
/M3/QualityFiltering.sh
How can I write the same in python 3. Thanks
bash python3
I have been using the following bash command to process files (using another python script ~/$HOME/quality_filter.py). The files come in pairs i.e. R1 ans R2 files
eg.
MK2_S34_L001_R1_001.fastq, MK2_S34_L001_R2_001.fastq,
MK3_S87_L001_R1_001.fastq, MK3_S87_L001_R2_001.fastq
Where M2 and M3 are the sample names, the _S34_ and _S87_, are different for each sample and _R1_ and _R2_ are R1 and R2 respectively.
for FNAME in $IN_DIR/*_S*_L001_R1_001.fastq
do
FILE=${FNAME##*/}
SAMPLE=${FILE%*_S*_L001_R1_001.fastq}
mkdir $OUT_DIR/${SAMPLE}/
COMMAND="python ~/$HOME/quality_filter.py -1 $IN_DIR/${SAMPLE}_S*_L001_R1_001.fastq -2 $IN_DIR/${SAMPLE}_S*_L001_R2_001.fastq -q 26"
echo $COMMAND >> $OUT_DIR/${SAMPLE}/QualityFiltering.sh
cd $OUT_DIR/${SAMPLE}/
sh $OUT_DIR/${SAMPLE}/QualityFiltering.sh
done
The output: for each of the samples a folder is created and in it a script named QualityFiltering.sh
eg.
/M2/QualityFiltering.sh
/M3/QualityFiltering.sh
How can I write the same in python 3. Thanks
bash python3
bash python3
edited 12 mins ago
alex kiarie
asked 53 mins ago
alex kiariealex kiarie
305 bronze badges
305 bronze badges
add a comment
|
add a comment
|
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f545456%2ffor-loop-command-specifying-stored-name-of-a-file-from-bash-to-python-script%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f545456%2ffor-loop-command-specifying-stored-name-of-a-file-from-bash-to-python-script%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown